|
|
|
|
using KGIS.Framework.Core.Services;
|
|
|
|
|
using KGIS.Framework.Utils;
|
|
|
|
|
using Kingo.Core.Authorize;
|
|
|
|
|
using Kingo.PluginServiceInterface;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using UIShell.OSGi;
|
|
|
|
|
|
|
|
|
|
namespace Kingo.Plugin.DataCheck
|
|
|
|
|
{
|
|
|
|
|
public class Activator : IBundleActivator
|
|
|
|
|
{
|
|
|
|
|
//IDataCheckHelper dataCheckInterf = null;
|
|
|
|
|
public void Start(IBundleContext context)
|
|
|
|
|
{
|
|
|
|
|
#if DEBUG
|
|
|
|
|
#else
|
|
|
|
|
ValidityVerification(context);
|
|
|
|
|
#endif
|
|
|
|
|
//dataCheckInterf = new DLTBBGDataCheck();
|
|
|
|
|
//context.AddService<IDataCheckInterface>(dataCheckInterf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Stop(IBundleContext context)
|
|
|
|
|
{
|
|
|
|
|
//if (dataCheckInterf != null)
|
|
|
|
|
// context.RemoveService<IDataCheckInterface>(dataCheckInterf);
|
|
|
|
|
}
|
|
|
|
|
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));
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug(ex);
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private string GetVersion(string fileName)
|
|
|
|
|
{
|
|
|
|
|
FileVersionInfo file1 = System.Diagnostics.FileVersionInfo.GetVersionInfo(fileName);
|
|
|
|
|
return String.Format("{0}{1}{2}", file1.ProductMajorPart, file1.ProductMinorPart, file1.ProductBuildPart);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|