|
@@ -20,8 +20,6 @@ namespace OTSSysMgrApp
|
|
|
//获取XML 路径
|
|
|
static string xmlFilePath = string.Empty;// System.Configuration.ConfigurationManager.ConnectionStrings["XMLFilePath"].ConnectionString;
|
|
|
//日志路径
|
|
|
- static string LogPath = string.Empty;//System.Configuration.ConfigurationManager.ConnectionStrings["LogPath"].ConnectionString;
|
|
|
- static string LogAppPath = string.Empty;//System.Configuration.ConfigurationManager.ConnectionStrings["LogAppPath"].ConnectionString;
|
|
|
static string XMLFileName = string.Empty;//System.Configuration.ConfigurationManager.ConnectionStrings["XMLFileName"].ConnectionString;
|
|
|
static string DLLXMLFileName = string.Empty;//System.Configuration.ConfigurationManager.ConnectionStrings["DLLXMLFileName"].ConnectionString;
|
|
|
//设置日志路径
|
|
@@ -31,7 +29,6 @@ namespace OTSSysMgrApp
|
|
|
OTSSysMgrTools.Language lan;
|
|
|
//国际化存储信息
|
|
|
Hashtable table;
|
|
|
- //static string message1, message2, message3, message4 ,message5 , message6 ,message7 , message8, message9, message10;
|
|
|
#endregion
|
|
|
|
|
|
#region 构造函数
|
|
@@ -41,9 +38,6 @@ namespace OTSSysMgrApp
|
|
|
{
|
|
|
//获取XML 路径
|
|
|
xmlFilePath = System.Configuration.ConfigurationManager.ConnectionStrings["XMLFilePath"].ConnectionString;
|
|
|
- //日志路径
|
|
|
- LogPath = System.Configuration.ConfigurationManager.ConnectionStrings["LogPath"].ConnectionString;
|
|
|
- LogAppPath = System.Configuration.ConfigurationManager.ConnectionStrings["LogAppPath"].ConnectionString;
|
|
|
XMLFileName = System.Configuration.ConfigurationManager.ConnectionStrings["XMLFileName"].ConnectionString;
|
|
|
DLLXMLFileName = System.Configuration.ConfigurationManager.ConnectionStrings["DLLXMLFileName"].ConnectionString;
|
|
|
|
|
@@ -143,20 +137,7 @@ namespace OTSSysMgrApp
|
|
|
|
|
|
try
|
|
|
{
|
|
|
- //判断是否注册与日期是否有效
|
|
|
- //if (!IsValidLicense(ref message))
|
|
|
- //{
|
|
|
- // tabHardwareSet.Parent = null;
|
|
|
- //}
|
|
|
- //else
|
|
|
- //{
|
|
|
- //获取已存在的注册信息
|
|
|
- //tbLComupterName.Text = GetLicenseInfo("ComupterName");
|
|
|
- //tbLHardwareID.Text = GetLicenseInfo("HardwareID");
|
|
|
- //tbOTSProduct.Text = GetLicenseInfo("OTSProduct");
|
|
|
- //tbPassType.Text = GetLicenseInfo("PassType");
|
|
|
- //tbExpireDate.Text = Convert.ToDateTime(GetLicenseInfo("ExpireDate")).ToString("yyyy-MM-dd");
|
|
|
- //显示硬件Tab菜单
|
|
|
+
|
|
|
tabHardwareSet.Parent = tabControl1;
|
|
|
//}
|
|
|
}
|
|
@@ -204,25 +185,7 @@ namespace OTSSysMgrApp
|
|
|
SaveSetting(Name, Value);
|
|
|
}
|
|
|
}
|
|
|
- //遍历tabHardwareSet标签中所有的ComboBox控件
|
|
|
- //foreach (Control control in this.tabLicenseSet.Controls)
|
|
|
- //{
|
|
|
- // //判断类型名称
|
|
|
- // if (control is ComboBox)
|
|
|
- // {
|
|
|
- // //获取节点名称与节点参数值
|
|
|
- // Name = (control as ComboBox).Name.Substring(2);
|
|
|
- // Value = (control as ComboBox).Text;
|
|
|
- // SaveSetting(Name, Value);
|
|
|
- // }
|
|
|
- // if (control is TextBox)
|
|
|
- // {
|
|
|
- // //获取节点名称与节点参数值
|
|
|
- // Name = (control as TextBox).Name.Substring(2);
|
|
|
- // Value = (control as TextBox).Text;
|
|
|
- // SaveSetting(Name, Value);
|
|
|
- // }
|
|
|
- //}
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -565,168 +528,10 @@ namespace OTSSysMgrApp
|
|
|
}
|
|
|
|
|
|
|
|
|
- #region 判断当前License信息是否正确
|
|
|
- //public static bool IsValidLicense(ref string MessageInfo)
|
|
|
- //{
|
|
|
- // if (fun == null)
|
|
|
- // {
|
|
|
- // fun = new COTSLicMgrClr();
|
|
|
- // }
|
|
|
- // if (otsInfoClr == null)
|
|
|
- // {
|
|
|
- // otsInfoClr = new COTSLicenseInfoClr();
|
|
|
- // }
|
|
|
- // //if (cfunClass == null)
|
|
|
- // //{
|
|
|
- // // cfunClass = new NSLogFunExport.CFunExportClass();
|
|
|
- // //}
|
|
|
- // //实例化C++对象 从选择文件对话框中 选择Lsk文件
|
|
|
- // //1.检查通行证是否合法
|
|
|
- // //计算机名称
|
|
|
- // string ComupterName = GetLicenseInfo("ComupterName");
|
|
|
- // //硬件ID
|
|
|
- // string HardwareID = GetLicenseInfo("HardwareID");
|
|
|
- // //OTS产品
|
|
|
- // int OTSProduct = Convert.ToInt32(GetLicenseInfo("OTSProduct") == "OTSIncA" ? 0 : 1);
|
|
|
- // //通行证类型
|
|
|
- // int PassType = Convert.ToInt32(GetLicenseInfo("PassType") == "Online" ? 0 : 1);
|
|
|
- // //有效期
|
|
|
- // DateTime ExpireDate = Convert.ToDateTime(GetLicenseInfo("ExpireDate")!=""? GetLicenseInfo("ExpireDate"):DateTime.Now.ToString());
|
|
|
- // //判断查询参数
|
|
|
- // otsInfoClr.SetComputerNickName(ComupterName);
|
|
|
- // otsInfoClr.SetMachineId(HardwareID);
|
|
|
- // otsInfoClr.SetPackId(OTSProduct);
|
|
|
- // otsInfoClr.SetLicType(PassType);
|
|
|
- // otsInfoClr.SetExpireDate(ExpireDate);
|
|
|
- // int nResult = 0;
|
|
|
- // bool bResult = fun.IsValidLicense(OTSProduct, otsInfoClr, ref nResult, true, true);
|
|
|
- // if (bResult)
|
|
|
- // {
|
|
|
- // //2.将通行证写入指定的路径
|
|
|
- // bool CreateResult = fun.CreateLicenseFile(otsInfoClr);
|
|
|
- // if (CreateResult)
|
|
|
- // {
|
|
|
- // return true;
|
|
|
- // }
|
|
|
- // return false;
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
-
|
|
|
- // MessageInfo = message1;
|
|
|
- // switch (nResult)
|
|
|
- // {
|
|
|
- // case 0:
|
|
|
- // MessageInfo += message2;
|
|
|
- // break;
|
|
|
- // case 1:
|
|
|
- // MessageInfo += message3;
|
|
|
- // break;
|
|
|
- // case 2:
|
|
|
- // MessageInfo += message4;
|
|
|
- // break;
|
|
|
- // case 3:
|
|
|
- // MessageInfo += message5;
|
|
|
- // break;
|
|
|
- // case 4:
|
|
|
- // MessageInfo += message6;
|
|
|
- // break;
|
|
|
- // case 5:
|
|
|
- // MessageInfo += message7;
|
|
|
- // break;
|
|
|
- // case 6:
|
|
|
- // MessageInfo += message8;
|
|
|
- // break;
|
|
|
- // }
|
|
|
- // return false;
|
|
|
- // }
|
|
|
- //}
|
|
|
- #endregion
|
|
|
+
|
|
|
|
|
|
- #region 获取License参数
|
|
|
- /// <summary>
|
|
|
- /// 获取并显示 Licanse参数
|
|
|
- /// </summary>
|
|
|
- //public void OpenLicenseDialog()
|
|
|
- //{
|
|
|
- // try
|
|
|
- // {
|
|
|
- // fun = new OTSINTERFACE.COTSLicMgrClr();
|
|
|
- // string str = fun.GetMachineId();
|
|
|
- // //获取电脑ID
|
|
|
- // string MachineId = fun.GetMachineId();
|
|
|
- // //实例化C++对象
|
|
|
- // otsInfoClr = new OTSINTERFACE.COTSLicenseInfoClr();
|
|
|
- // //设置电脑ID
|
|
|
- // otsInfoClr.SetMachineId(MachineId);
|
|
|
- // bool a_bAdd = false;
|
|
|
- // bool a_bRequest = true;
|
|
|
- // //弹出通行证窗体
|
|
|
- // bool result = fun.ShowEditDialogExport(otsInfoClr, a_bAdd, a_bRequest);
|
|
|
- // if (result)
|
|
|
- // {
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // catch (Exception)
|
|
|
- // {
|
|
|
-
|
|
|
- // }
|
|
|
- // finally
|
|
|
- // {
|
|
|
- // fun.FreePointer();
|
|
|
- // otsInfoClr.FreePointer();
|
|
|
- // }
|
|
|
- //}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 获取电脑名称
|
|
|
- /// </summary>
|
|
|
- public string GetComupterName()
|
|
|
- {
|
|
|
- return "";
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 获取硬件ID
|
|
|
- /// </summary>
|
|
|
- public string GetHardwareID()
|
|
|
- {
|
|
|
- return "";
|
|
|
- }
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 项目
|
|
|
- /// </summary>
|
|
|
- public string GetOTSProduct()
|
|
|
- {
|
|
|
- //OTSIncA=0
|
|
|
- //OtsPartA=1
|
|
|
- return "";
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 通行证种类
|
|
|
- /// </summary>
|
|
|
- public string GetPassType()
|
|
|
- {
|
|
|
- //Online = 0,
|
|
|
- //Offline = 1,
|
|
|
- return "";
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 时间
|
|
|
- /// </summary>
|
|
|
- public string GetExpireDate()
|
|
|
- {
|
|
|
- return "";
|
|
|
- }
|
|
|
- /// <summary>
|
|
|
- /// 显示通行证信息
|
|
|
- /// </summary>
|
|
|
- public void ShowLicenseInfo()
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
- #endregion
|
|
|
|
|
|
private void OTSSystemManagerForms_FormClosing(object sender, FormClosingEventArgs e)
|
|
|
{
|
|
@@ -820,68 +625,8 @@ namespace OTSSysMgrApp
|
|
|
SaveSelectVersionInfo();
|
|
|
}
|
|
|
}
|
|
|
- /// <summary>
|
|
|
- /// 判断是否注册与日期是否有效
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- public static bool ExistsLicenseInfo(ref string message)
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- //计算机名称
|
|
|
- string tbLComupterName = GetLicenseInfo("ComupterName");
|
|
|
- //硬件ID
|
|
|
- string tbLHardwareID = GetLicenseInfo("HardwareID");
|
|
|
- //OTS产品
|
|
|
- string tbOTSProduct = GetLicenseInfo("OTSProduct");
|
|
|
- //通行证类型
|
|
|
- string tbPassType = GetLicenseInfo("PassType");
|
|
|
- //有效期
|
|
|
- string tbExpireDate = GetLicenseInfo("ExpireDate");
|
|
|
-
|
|
|
- if (string.IsNullOrEmpty(tbLComupterName) || string.IsNullOrEmpty(tbLHardwareID) || string.IsNullOrEmpty(tbOTSProduct) || string.IsNullOrEmpty(tbPassType) || string.IsNullOrEmpty(tbExpireDate))
|
|
|
- {
|
|
|
-
|
|
|
- //message = message9;
|
|
|
- return false;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- string ExpireDate = Convert.ToDateTime(tbExpireDate).ToString("yyyy-MM-dd 23:59:59");
|
|
|
- DateTime dtExpireDate = Convert.ToDateTime(ExpireDate);
|
|
|
- DateTime dtCurrent = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
|
|
- if (dtCurrent > dtExpireDate)
|
|
|
- {
|
|
|
- ////message = message10;
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- log.Error("OTSSystemManagerForms_ExistsLicenseInfo:" + ex.ToString() + "");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- log.Error("OTSSystemManagerForms_ExistsLicenseInfo:" + ex.ToString() + "");
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
- public static string GetLicenseInfo(string NodeName)
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- return XMLOperationClass.GetXMLInformations(NodeName);
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
- log.Error("OTSSystemManagerForms_GetLicenseInfo:" + ex.ToString() + "");
|
|
|
- return "";
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
private void btnRemove_Click(object sender, EventArgs e)
|
|
|
{
|
|
@@ -895,37 +640,12 @@ namespace OTSSysMgrApp
|
|
|
SaveSetting("OTSProduct", "");
|
|
|
SaveSetting("PassType", "");
|
|
|
SaveSetting("ExpireDate", "");
|
|
|
- //清空文本框信息
|
|
|
- //tbLComupterName.Text = string.Empty;
|
|
|
- //tbLHardwareID.Text = string.Empty;
|
|
|
- //tbOTSProduct.Text = string.Empty;
|
|
|
- //tbPassType.Text = string.Empty;
|
|
|
- //tbExpireDate.Text = string.Empty;
|
|
|
- //显示硬件Tab菜单
|
|
|
+
|
|
|
tabHardwareSet.Parent = null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //private void cbbLanguage_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
- //{
|
|
|
- // //获取combobox的值
|
|
|
- // string Global = cbbLanguage.SelectedItem.ToString();
|
|
|
- // Global = Global.Trim();
|
|
|
-
|
|
|
- // if (Global.IndexOf("-") == 0)
|
|
|
- // {
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
-
|
|
|
- // Global = Global.Substring(Global.IndexOf("[") + 1, 2);
|
|
|
- // }
|
|
|
-
|
|
|
- // WriteDefaultLanguage(Global);
|
|
|
- // //国际化
|
|
|
- // OTSSysMgrTools.Language lan1 = new OTSSysMgrTools.Language(this);
|
|
|
- //}
|
|
|
+
|
|
|
|
|
|
//修改默认语言
|
|
|
public static void WriteDefaultLanguage(string lang)
|