public void Show(CommonBase ViewModel) { SettingsWindow myWin = new SettingsWindow(); myWin.DataContext = ViewModel; myWin.Owner = Application.Current.MainWindow; myWin.ShowDialog(); }
public bool RemoveMain1() { string windowsPath = CommonBase.GetWindowsPath(); string text = windowsPath + "\\PlmConfig.dop"; CommonBase.DeleteFileNoException(text); return(true); }
public void Show(CommonBase ViewModel) { ImportWindow myWin = new ImportWindow(); myWin.DataContext = ViewModel; ((ImportViewModel)ViewModel).ClosingRequest += (sender, e) => myWin.Close(); myWin.Owner = Application.Current.MainWindow; myWin.ShowDialog(); }
public string GetProeCommonFilesLocationPathX64() { string subitem = "Software\\Wow6432Node\\PTC\\Creo Parametric"; string text = CommonBase.GetRegistMachineKeyValue(subitem, "CommonFilesLocation", false, true); if (!string.IsNullOrEmpty(text)) { text += "\\"; } return(text); }
public bool SetupMain1() { string str = string.Format("{0}\\{1}\\", this.SourceDefaultDir, this.DirName); string windowsPath = CommonBase.GetWindowsPath(); CommonBase.CopyFile(str + "PlmConfig.dop", windowsPath + "\\PlmConfig.dop"); AccessControl.DirectoryInfoAccessControl(windowsPath + @"\temp\plmpdf"); return(true); }
public bool SaveOrUpdate(IList <Sys_BankInfo> list) { Hashtable MyHs = new Hashtable();//以事务方式 foreach (Sys_BankInfo obj in list) { if (obj.Id == 0) //需要插入的 { Sys_BankInfoDAL.Insert(obj, MyHs); } else { //需要更新的 Sys_BankInfo objUpdate = obj; Sys_BankInfoDAL.Update(obj, MyHs); } } return(CommonBase.RunHashtable(MyHs)); }
public string GetProeSetupPath() { string subitem = "Software\\PTC\\"; string text = CommonBase.GetRegistUserKeyValue(subitem, "proemsg", false, false); try { text = text.Replace("\"", ""); if (text != string.Empty) { text = text.Substring(0, text.ToUpper().IndexOf("BIN\\PROE.EXE") - 1); } } catch { text = ""; } if (string.IsNullOrEmpty(text)) { subitem = "Software\\PTC\\Pro/ENGINEER"; text = CommonBase.GetRegistMachineKeyValue(subitem, "InstallDir", false, true); } if (string.IsNullOrEmpty(text)) { subitem = "Software\\PTC\\Creo Parametric"; text = CommonBase.GetRegistMachineKeyValue(subitem, "InstallDir", false, true); if (!string.IsNullOrEmpty(text)) { text += "\\"; } } if (string.IsNullOrEmpty(text)) { subitem = "Software\\Wow6432Node\\PTC\\Creo Parametric"; text = CommonBase.GetRegistMachineKeyValue(subitem, "InstallDir", false, true); if (!string.IsNullOrEmpty(text)) { text += "\\"; } } return(text); }
public static bool SaveOrUpdate(List <Sys_Language> list) { bool result = false; Hashtable MyHs = new Hashtable(); foreach (Sys_Language obj in list) { if (obj.Id == 0) //需要插入的 { Sys_LanguageDAL.Insert(obj, MyHs); } else { //需要更新的 Sys_LanguageDAL.Update(obj, MyHs); } } result = CommonBase.RunHashtable(MyHs); return(result); }
/// <summary> /// 需要处理权限的文件 /// </summary> /// <returns></returns> private IEnumerable <string> DealFiles() { string system32path = CommonBase.GetSystemPath().TrimEnd('\\', '/'); string system64path = CommonBase.GetSystem64Path().TrimEnd('\\', '/'); string allusers = CommonBase.GetAllUsersDocumentPath().TrimEnd('\\', '/'); yield return(Path.Combine(system32path, "LoginSetting.ini")); yield return(Path.Combine(system32path, "proegm.txt")); yield return(Path.Combine(system32path, "Login.html")); yield return(Path.Combine(system64path, "LoginSetting.ini")); yield return(Path.Combine(allusers, "LoginSetting.ini")); yield return(Path.Combine(system32path, "proeCheckFile.txt")); yield return(Path.Combine(system64path, "proeCheckFile.txt")); }
private void GetSoftOpen(ArrayList ExeName, bool IsRemove) { if (ExeName != null && ExeName.Count > 0) { for (int i = 0; i < ExeName.Count; i++) { string text = ExeName[i].ToString(); bool flag = CommonBase.CheckProcessStart(text); if (flag) { if (IsRemove) { this.CheckString.Append(text + plm.kingdee.com.MutiLanguageConvert.LoadKDString("正在运行,请先关闭再进行卸载。\r\n")); } else { this.CheckString.Append(text + plm.kingdee.com.MutiLanguageConvert.LoadKDString("正在运行,请先关闭再进行安装。\r\n")); } } } } }
/// <summary> /// 打开图纸的处理 /// </summary> /// <param name="CreoCommonPath"></param> /// <param name="pf"></param> private void OpenAssistentDeal(string CreoCommonPath, Platform pf) { var xtopPath = FileAndDirectoryManager.SearchFile(CreoCommonPath, new string[] { "i486_nt\\obj", "x86e_win64\\obj" }, "pro_comm_msg.exe").FirstOrDefault(); //添加环境变量 Environment.SetEnvironmentVariable("PRO_COMM_MSG_EXE", xtopPath, EnvironmentVariableTarget.Machine); //将OpenAssistent.exe 拷到system32 string OpenAssistentName = "openAssistent.exe"; string OpenAssistentName64 = "openAssistent64.exe"; string str = string.Format("{0}\\{1}\\", this.SourceDefaultDir, this.DirName); if (pf == Platform.X64) { CommonBase.CopyFile(str + OpenAssistentName64, "C:\\Windows\\System32\\" + OpenAssistentName); } else if (pf == Platform.X86) { CommonBase.CopyFile(str + OpenAssistentName, "C:\\Windows\\System32\\" + OpenAssistentName); CommonBase.CopyFile(str + OpenAssistentName, "C:\\Windows\\syswow64\\" + OpenAssistentName); } }
private void WriteDateFile() { string proeSetupPath = this.GetProeSetupPath(); if (Directory.Exists(proeSetupPath + "\\text")) { string protkPath = proeSetupPath + "\\text\\protk.dat"; this.WriteProtkFile(protkPath); } string text = CommonBase.GetMyDocumentPath() + "\\protk.dat"; if (Directory.Exists(text)) { string protkPath = text + "\\protk.dat"; this.WriteProtkFile(protkPath); } string proeCommonFilesLocationPath = this.GetProeCommonFilesLocationPath(); if (Directory.Exists(proeCommonFilesLocationPath + "\\text")) { string protkPath = proeCommonFilesLocationPath + "\\text\\protk.dat"; this.WriteProtkFile(protkPath); } string proeCommonFilesLocationPathX = this.GetProeCommonFilesLocationPathX64(); if (Directory.Exists(proeCommonFilesLocationPathX + "\\text")) { string protkPath = proeCommonFilesLocationPathX + "\\text\\protk.dat"; this.WriteProtkFile(protkPath); } string allUsersDocumentPath = CommonBase.GetAllUsersDocumentPath(); if (Directory.Exists(allUsersDocumentPath)) { string protkPath = allUsersDocumentPath + "\\protk.dat"; this.WriteProtkFile(protkPath); } }
private void DeleteFile() { string str = string.Format("{0}\\{1}\\", this.UserDefaultDir, this.DirName); CommonBase.DeleteFileNoException(str + CREOPACKAGE); string systemPath = CommonBase.GetSystemPath(); CommonBase.DeleteFileNoException(systemPath + "Login.exe"); string tagfile = this.GetProeSetupPath() + "\\text\\protk.dat"; CommonBase.DeleteFileNoException(tagfile); string tagfile2 = CommonBase.GetMyDocumentPath() + "\\protk.dat"; CommonBase.DeleteFileNoException(tagfile2); string tagfile3 = this.GetProeCommonFilesLocationPath() + "\\text\\protk.dat"; CommonBase.DeleteFileNoException(tagfile3); string tagfile4 = CommonBase.GetAllUsersDocumentPath() + "\\protk.dat"; CommonBase.DeleteFileNoException(tagfile4); string tagfile5 = this.GetProeCommonFilesLocationPathX64() + "\\text\\protk.dat"; CommonBase.DeleteFileNoException(tagfile5); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { _viewModel = (CommonBase)this.DataContext; }
private void CopyMenuFile() { //string systemLanguageID = plm.kingdee.com.MutiLanguageConvert.GetSystemLanguageID(); string systemLanguageID = "chn"; string str = string.Format("{0}\\{1}\\", this.SourceDefaultDir, this.DirName); string str2 = string.Format("{0}\\{1}\\", this.UserDefaultDir, this.DirName); string proeSetupPath = this.GetProeSetupPath(); if (!Directory.Exists(str2 + "Text\\chinese_cn\\")) { Directory.CreateDirectory(str2 + "Text\\chinese_cn\\"); } if (!Directory.Exists(str2 + "Text\\chinese_tw\\")) { Directory.CreateDirectory(str2 + "Text\\chinese_tw\\"); } if (!Directory.Exists(str2 + "Text\\usascii\\")) { Directory.CreateDirectory(str2 + "Text\\usascii\\"); } if (!Directory.Exists(proeSetupPath + "Text\\chinese_cn\\")) { Directory.CreateDirectory(proeSetupPath + "Text\\chinese_cn\\"); } if (!Directory.Exists(proeSetupPath + "Text\\chinese_tw\\")) { Directory.CreateDirectory(proeSetupPath + "Text\\chinese_tw\\"); } if (!Directory.Exists(proeSetupPath + "Text\\usascii\\")) { Directory.CreateDirectory(proeSetupPath + "Text\\usascii\\"); } CommonBase.CopyFile(str + "Text\\chinese_cn\\Message.txt", str2 + "Text\\usascii\\Message.txt"); CommonBase.CopyFile(str + "Text\\chinese_cn\\Message.txt", str2 + "Text\\chinese_cn\\Message.txt"); CommonBase.CopyFile(str + "Text\\chinese_cn\\Message.txt", str2 + "Text\\chinese_tw\\Message.txt"); CommonBase.CopyFile(str + "Text\\chinese_cn\\Message.txt", proeSetupPath + "\\Text\\usascii\\Message.txt"); CommonBase.CopyFile(str + "Text\\chinese_cn\\Message.txt", proeSetupPath + "\\Text\\chinese_cn\\Message.txt"); CommonBase.CopyFile(str + "Text\\chinese_cn\\Message.txt", proeSetupPath + "\\Text\\chinese_tw\\Message.txt"); //if (systemLanguageID == "cht") //{ // CommonBase.CopyFile(str + "Text\\chinese_tw\\FMessage.txt", str2 + "Text\\usascii\\Message.txt"); // CommonBase.CopyFile(str + "Text\\chinese_tw\\FMessage.txt", str2 + "Text\\chinese_cn\\Message.txt"); // CommonBase.CopyFile(str + "Text\\chinese_tw\\FMessage.txt", str2 + "Text\\chinese_tw\\Message.txt"); // CommonBase.CopyFile(str + "Text\\chinese_tw\\FMessage.txt", proeSetupPath + "\\Text\\usascii\\Message.txt"); // CommonBase.CopyFile(str + "Text\\chinese_tw\\FMessage.txt", proeSetupPath + "\\Text\\chinese_cn\\Message.txt"); // CommonBase.CopyFile(str + "Text\\chinese_tw\\FMessage.txt", proeSetupPath + "\\Text\\chinese_tw\\Message.txt"); //} //else //{ // if (systemLanguageID == "eng") // { // CommonBase.CopyFile(str + "Text\\usascii\\EMessage.txt", str2 + "Text\\usascii\\Message.txt"); // CommonBase.CopyFile(str + "Text\\usascii\\EMessage.txt", str2 + "Text\\chinese_cn\\Message.txt"); // CommonBase.CopyFile(str + "Text\\usascii\\EMessage.txt", str2 + "Text\\chinese_tw\\Message.txt"); // CommonBase.CopyFile(str + "Text\\usascii\\EMessage.txt", proeSetupPath + "\\Text\\usascii\\Message.txt"); // CommonBase.CopyFile(str + "Text\\usascii\\EMessage.txt", proeSetupPath + "\\Text\\chinese_cn\\Message.txt"); // CommonBase.CopyFile(str + "Text\\usascii\\EMessage.txt", proeSetupPath + "\\Text\\chinese_tw\\Message.txt"); // } // else // { // CommonBase.CopyFile(str + "Text\\chinese_cn\\Message.txt", str2 + "Text\\usascii\\Message.txt"); // CommonBase.CopyFile(str + "Text\\chinese_cn\\Message.txt", str2 + "Text\\chinese_cn\\Message.txt"); // CommonBase.CopyFile(str + "Text\\chinese_cn\\Message.txt", str2 + "Text\\chinese_tw\\Message.txt"); // CommonBase.CopyFile(str + "Text\\chinese_cn\\Message.txt", proeSetupPath + "\\Text\\usascii\\Message.txt"); // CommonBase.CopyFile(str + "Text\\chinese_cn\\Message.txt", proeSetupPath + "\\Text\\chinese_cn\\Message.txt"); // CommonBase.CopyFile(str + "Text\\chinese_cn\\Message.txt", proeSetupPath + "\\Text\\chinese_tw\\Message.txt"); // } //} }
private void CopyFile() { string str = string.Format("{0}\\{1}\\", this.SourceDefaultDir, this.DirName); string text = string.Format("{0}\\{1}\\", this.UserDefaultDir, this.DirName); string str2 = string.Format("{0}\\{1}\\", this.SourceDefaultDir, "Common\\"); string systemPath = CommonBase.GetSystemPath(); if (!Directory.Exists(text)) { Directory.CreateDirectory(text); } var CreoCommonPath = GetProeCommonFilesLocationPath(); //找到 "..\Creo 2.0\\Common Files\\M020" 目录 if (string.IsNullOrEmpty(CreoCommonPath)) { CreoCommonPath = GetProeCommonFilesLocationPathX64(); } var xtopPath = FileAndDirectoryManager.SearchFile(CreoCommonPath, new string[] { "i486_nt\\obj", "x86e_win64\\obj" }, "xtop.exe").FirstOrDefault(); if (string.IsNullOrEmpty(xtopPath)) { throw new Exception("未找到 xtop.exe 路径。不支持绿色版,请确认正确安装!"); } var pf = OSHelp.GetExcutePlatform(xtopPath); if (pf == Platform.X64) { CommonBase.CopyFile(str + CREOPACKAGE64, text + CREOPACKAGE); } else if (pf == Platform.X86) { CommonBase.CopyFile(str + CREOPACKAGE, text + CREOPACKAGE); } else { throw new Exception("未发现当前creo所处平台"); } OpenAssistentDeal(CreoCommonPath, pf); if (!File.Exists("c:\\WINDOWS\\IntegrationLogin.exe")) { CommonBase.CopyFile(str2 + "IntegrationLogin.exe", "c:\\WINDOWS\\IntegrationLogin.exe"); } if (!File.Exists("c:\\WINDOWS\\IntegrationLogin.exe.config")) { CommonBase.CopyFile(str2 + "IntegrationLogin.exe.config", "c:\\WINDOWS\\IntegrationLogin.exe.config"); } try { string windowsPath = CommonBase.GetWindowsPath(); CommonBase.DeleteFile(windowsPath + "\\PlmConfig.dop");//先将之前有的删除掉 } catch { } //忽略错误 //给文件、文件夹设置权限 //system32\LoginSetting.ini //system32\proegm.txt //system32\Login.Html //%ALLUSERSPROFILE%\PLM\LoginSetting.ini //c:\windows\temp\plmpdf foreach (var item in DealFiles()) { AccessControl.FileInfoAccessControl(item); } this.CopyMenuFile(); }