年度变更建库软件5.0版本
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.7 KiB

using KGIS.Framework.Core.Services;
using KGIS.Framework.Utils;
using Kingo.Plugin.DataLoad.Service;
using Kingo.PluginServiceInterface;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using UIShell.OSGi;
namespace Kingo.Plugin.DataLoad
{
public class Activator : IBundleActivator
{
IProofManager ProofMgr = null;
public void Start(IBundleContext context)
{
#if DEBUG
ProofMgr = new ProofManager();
context.AddService<IProofManager>(ProofMgr);
#else
ValidityVerification(context);
#endif
}
public void Stop(IBundleContext context)
{
if (ProofMgr != null)
context.RemoveService<IProofManager>(ProofMgr);
}
private void ValidityVerification(IBundleContext context)
{
try
{
Attribute guid_attr = Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(GuidAttribute));
string guid = ((GuidAttribute)guid_attr).Value;
var type = ConfigurationManager.AppSettings.Get("LicenseType");
//if (!RunIDService2.Instance.Models.Contains(guid))
//{
// throw new Exception(string.Format("【{0}】插件未授权,加载失败", context.Bundle.Name));
//}
ProofMgr = new ProofManager();
context.AddService<IProofManager>(ProofMgr);
}
catch (Exception ex)
{
LogAPI.Debug(ex);
throw ex;
}
}
}
}