|
|
|
|
using KGIS.Framework.Utils;
|
|
|
|
|
using Kingo.PluginServiceInterface;
|
|
|
|
|
using Kingo.PluginServiceInterface.Model;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Security.Principal;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Xml.Linq;
|
|
|
|
|
|
|
|
|
|
namespace KGIS_DLTB
|
|
|
|
|
{
|
|
|
|
|
class Program
|
|
|
|
|
{
|
|
|
|
|
[STAThread]
|
|
|
|
|
static void Main(string[] args)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (IsAdministrator())
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("True");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("False");
|
|
|
|
|
}
|
|
|
|
|
if (!KGIS.Framework.AE.AELicense.AoInit())
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//args = new string[] { "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iZ2IyMzEyIj8+PElER1BhcmFtZXRlciB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3RhbmNlIiB4bWxuczp4c2Q9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hIj48U3RyUHJvakluZm8+RDpc5rWL6K+VXOW5tOW6puWPmOabtOW7uuW6k1zogofkuJzluIIoMjMxMjgyKVzlt6XnqIvnm67lvZVc6IKH5LicMTIxMy0xXOiCh+S4nDEyMTMtMS5LQkc8L1N0clByb2pJbmZvPjxFeGVETFRCPnRydWU8L0V4ZURMVEI+PEV4ZUdEREI+ZmFsc2U8L0V4ZUdEREI+PEV4ZUNKRENRPmZhbHNlPC9FeGVDSkR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now.ToString());
|
|
|
|
|
//Console.WriteLine(GetTime(s_dt));
|
|
|
|
|
//Console.ReadKey();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(ex.Message);
|
|
|
|
|
Console.ReadKey();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public static bool IsAdministrator()
|
|
|
|
|
{
|
|
|
|
|
WindowsIdentity current = WindowsIdentity.GetCurrent();
|
|
|
|
|
WindowsPrincipal windowsPrincipal = new WindowsPrincipal(current);
|
|
|
|
|
return windowsPrincipal.IsInRole(WindowsBuiltInRole.Administrator);
|
|
|
|
|
}
|
|
|
|
|
static void Exe(string pParm)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
DateTime s_dt = DateTime.Now;
|
|
|
|
|
//string strParm = args[0];
|
|
|
|
|
byte[] base64ToByte = Convert.FromBase64String(pParm);
|
|
|
|
|
string strParm = Encoding.UTF8.GetString(base64ToByte);
|
|
|
|
|
IDGParameter gPParamClass = SerializeAPI.DeserializeToObject<IDGParameter>(strParm);
|
|
|
|
|
if (gPParamClass == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(gPParamClass.StrProjInfo) && File.Exists(gPParamClass.StrProjInfo))
|
|
|
|
|
{
|
|
|
|
|
gPParamClass.PrjInfo = ProjectInfo.OpenProject(gPParamClass.StrProjInfo);
|
|
|
|
|
if (gPParamClass.PrjInfo == null)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Err:获取工程信息失败!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Dictionary<string, decimal> _kcxsDic = new Dictionary<string, decimal>();//《字符串-数字》字典集合
|
|
|
|
|
string strPath = SysAppPath.GetBGGDLXConfigPath();//获取配置文件路径
|
|
|
|
|
XDocument xDoc = XDocument.Load(strPath);
|
|
|
|
|
foreach (XElement xElement in xDoc.Descendants("Item"))
|
|
|
|
|
{
|
|
|
|
|
string gdlx = xElement.Attributes("GDLX").Single().Value;
|
|
|
|
|
string gdpdjb = xElement.Attributes("GDPDJB").Single().Value;
|
|
|
|
|
string strKcdlxs = xElement.Attributes("KCDLXS").Single().Value;
|
|
|
|
|
decimal kcdlxs = Convert.ToDecimal(xElement.Attributes("KCDLXS").Single().Value == "" ? "0" : xElement.Attributes("KCDLXS").Single().Value);
|
|
|
|
|
string key = string.Format("{0}-{1}", gdlx, gdpdjb);
|
|
|
|
|
_kcxsDic.Add(key, kcdlxs);
|
|
|
|
|
}
|
|
|
|
|
gPParamClass.KCXSDic = _kcxsDic;
|
|
|
|
|
if (gPParamClass.PrjInfo.ListZLXXInfo == null)
|
|
|
|
|
gPParamClass.PrjInfo.ListZLXXInfo = new System.Collections.ObjectModel.ObservableCollection<Kingo.PluginServiceInterface.ZLXXInfo>();
|
|
|
|
|
if (gPParamClass.ExeDLTB)
|
|
|
|
|
{
|
|
|
|
|
DLTB_IDGHelper helper = new DLTB_IDGHelper();
|
|
|
|
|
Console.WriteLine("Msg:正在执行地类图斑数据提取");
|
|
|
|
|
helper.Execute(gPParamClass);
|
|
|
|
|
}
|
|
|
|
|
Console.Clear();
|
|
|
|
|
Console.WriteLine("执行完成,耗时:" + GetTime(s_dt) + "秒");
|
|
|
|
|
Console.ReadKey();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public static string GetTime(DateTime timeA)
|
|
|
|
|
{
|
|
|
|
|
//timeA 表示需要计算
|
|
|
|
|
DateTime timeB = DateTime.Now; //获取当前时间
|
|
|
|
|
TimeSpan ts = timeB - timeA; //计算时间差
|
|
|
|
|
string time = ts.TotalSeconds.ToString(); //将时间差转换为秒
|
|
|
|
|
return time;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|