public void button1_Click1(object sender, EventArgs e) { Class_SystemStyle.SystemStyle_Enter(1, 1, 1, this); }
private void button3_Click(object sender, EventArgs e) { Class_SystemStyle.SystemStyle_Enter(3, 3, 1, this); }
public static void Main_GetCommandArgs(Form_Main frm) { frm.Hide(); Point loc = frm.Location; string FullCommandArgs = ""; try { if (frm.CommandArgs.Length > 0) { switch (frm.CommandArgs[0].ToString().Substring(0, 2).Replace("-", "").Replace("/", "").Replace(@"\", "").Replace(" ", "").ToUpper()) { case "M": //用于进入主界面 frm.Show(); if (frm.CommandArgs[0].Substring(3, frm.CommandArgs[0].Length - 3).Length != 8) { string SETPONE = frm.CommandArgs[0].Substring(3, frm.CommandArgs[0].Length - 3); int first = MyFunctions.StreamAndTextOperate.ConvertData.StringsToInt(SETPONE.Substring(0, 2), 1); int second = MyFunctions.StreamAndTextOperate.ConvertData.StringsToInt(SETPONE.Substring(3, 2), 1); //MessageBox.Show(first.ToString() + "\r\n" + second.ToString()); Class_FormMain.Main_Enter(first, second, frm); } else { for (int h = 1; h <= frm.CommandArgs.Length; h = h + 1) { FullCommandArgs = FullCommandArgs + " " + frm.CommandArgs[h - 1].ToString(); } string res = MyFunctions.Dialogs.MessageDialog("启动参数错误", "无法识别指定的启动参数", MyFunctions.Dialogs.MessageDialogIcon.Error, "无效的启动参数:\r\n" + FullCommandArgs, "b1", true, true, "查看帮助", "确定"); if (res == "B1") { MyFunctions.Dialogs.HelpDialog("系统齿轮命令行选项", SystemGear.Properties.Resources.CommandArgs); } } break; case "F": //用于进入各个功能 frm.Hide(); frm.JShow = "SYSVIE"; //MessageBox.Show(frm.CommandArgs.Length.ToString()); if (frm.CommandArgs.Length == 4) { string firstindex = frm.CommandArgs[1].ToString().Replace("-", "").Replace("/", "").Replace(@"\", ""); int secondindex = MyFunctions.StreamAndTextOperate.ConvertData.StringsToInt(frm.CommandArgs[2].ToString().Replace("-", "").Replace("/", "").Replace(@"\", ""), 1); int thridindex = MyFunctions.StreamAndTextOperate.ConvertData.StringsToInt(frm.CommandArgs[3].ToString().Replace("-", "").Replace("/", "").Replace(@"\", ""), 1); //MessageBox.Show(firstindex.ToString()); //MessageBox.Show(secondindex.ToString()); //MessageBox.Show(thridindex.ToString()); if (firstindex.ToUpper() == "SYSVIE") { Form_SystemStyle sty = new Form_SystemStyle(); sty.Location = loc; Class_SystemStyle.SystemStyle_Enter(1, secondindex, thridindex, sty); sty.Show(); } } else { frm.Show(); for (int h = 1; h <= frm.CommandArgs.Length; h = h + 1) { FullCommandArgs = FullCommandArgs + " " + frm.CommandArgs[h - 1].ToString(); } string res = MyFunctions.Dialogs.MessageDialog("启动参数错误", "无法识别指定的启动参数", MyFunctions.Dialogs.MessageDialogIcon.Error, "无效的启动参数:\r\n" + FullCommandArgs, "b1", true, true, "查看帮助", "确定"); if (res == "B1") { MyFunctions.Dialogs.HelpDialog("系统齿轮命令行选项", SystemGear.Properties.Resources.CommandArgs); } } break; case "L": //用于加载SGCF文件 frm.Show(); string sgcf = frm.CommandArgs[0].Substring(3, frm.CommandArgs[0].Length - 3); if (System.IO.File.Exists(sgcf) == true) { string writefile = MyFunctions.ApplicationAndEnvironmentInformation.ApplicationSettings.GetApplicationSetting_TempPath(Application.StartupPath + @"\Temp") + @"\LoadSGCF.sgcf"; MyFunctions.FileSystemOperate.FileSystemOperate_DeleteFile(writefile); string filetype = MyFunctions.StreamAndTextOperate.ConfigFileOperate.SGCFFileOperate_GetValue("SystemGear", "FileType", "Config", false, sgcf); string ver = MyFunctions.StreamAndTextOperate.ConfigFileOperate.SGCFFileOperate_GetValue("SystemGear", "Version", "Config", false, sgcf); if (filetype.ToUpper() != "CONFIG" && filetype.ToUpper() != "") { if (ver.ToUpper() == Application.ProductVersion) { string res = MyFunctions.Dialogs.MessageDialog("是否应用?", "是否将指定的配置文件应用到系统齿轮?", MyFunctions.Dialogs.MessageDialogIcon.Question, "", "b1", true, true, "继续", "取消"); //SGFunction.ConfigFileOperate.SGCFFileOperate_WriteValue("Info", "FileName", sgcf, "Config", false, writefile); //SGFunction.ConfigFileOperate.SGCFFileOperate_WriteValue("Info", "FileType", filetype, "Config", false, writefile); if (res == "B1") { switch (filetype.ToUpper()) { case "GUIDICON": string CFG_GUID = Application.StartupPath + @"\Config\MainProgram.sgcf"; SGFunction.ConfigFileOperate.SGCFFileOperate_WriteValue("SystemStyle", "GUIDConfigFile", sgcf, "Config", false, CFG_GUID); MyFunctions.ProgramAndLinksOperate.ShellPrograms(Application.ExecutablePath, "/F /SYSVIE /02 /01", false, false, true, false, false); Application.Exit(); break; case "RIGHTMENUGROUP": string CFG_GUID1 = Application.StartupPath + @"\Config\MainProgram.sgcf"; SGFunction.ConfigFileOperate.SGCFFileOperate_WriteValue("SystemStyle", "RightMenuGroupConfigFile", sgcf, "Config", false, CFG_GUID1); MyFunctions.ProgramAndLinksOperate.ShellPrograms(Application.ExecutablePath, "/F /SYSVIE /04 /01", false, false, true, false, false); Application.Exit(); break; default: MyFunctions.Dialogs.MessageDialog("无法加载指定的文件", "无法加载指定的配置文件.因为该文件的标识信息与目前系统齿轮所支持的配置文件不符", MyFunctions.Dialogs.MessageDialogIcon.Error, "", "b2", false, true, "继续", "确定"); break; } } } else { MyFunctions.Dialogs.MessageDialog("无法加载指定的文件", "无法加载指定的配置文件.因为该文件的版本与当前的系统齿轮的版本不一致", MyFunctions.Dialogs.MessageDialogIcon.Error, @"无法加载""" + sgcf + @""" 因为该文件的版本与当前的系统齿轮的版本不一致." + "\r\n" + "该文件的版本 :" + ver + "\r\n" + "系统齿轮的版本 :" + Application.ProductVersion, "b2", false, true, "", "确定"); } } else { MyFunctions.Dialogs.MessageDialog("无法加载指定的文件", "无法识别您所指定的文件的必要信息.并且无法加载系统齿轮的配置文件", MyFunctions.Dialogs.MessageDialogIcon.Error, @"无法加载""" + sgcf + @""" 因为无法识别指定的信息.无法加载标识为""Config""的配置文件", "b2", false, true, "", "确定"); //MyFunctions.Dialogs.MessageDialog("无法加载指定的文件", "无法识别您所指定的文件的必要信息.并且无法加载系统齿轮的配置文件", "error", @"无法加载""" + sgcf + @""" 因为无法识别指定的信息.无法加载标识为""Config""的配置文件", "b2", false, true, "", "确定", frm); } } else { MyFunctions.Dialogs.MessageDialog("无法加载指定的文件", "无法识别您所指定的文件的必要信息.因为指定文件不存在", MyFunctions.Dialogs.MessageDialogIcon.Error, @"找不到文件""" + sgcf + @"""", "b2", false, true, "", "确定"); //MyFunctions.Dialogs.MessageDialog("无法加载指定的文件", "无法加载指定的文件.因为指定的文件不存在", "error", @"找不到文件""" + sgcf + @"""", "b2", false, true, "是", "确定", frm); } break; case "B": //用于返回 frm.Show(); break; case "D": //用于清理临时文件 break; case "C": //剪切板功能 frm.Show(); if (frm.CommandArgs.Length == 2) { if (frm.CommandArgs[1].Length >= 8) { string folder = frm.CommandArgs[1].Substring(8, frm.CommandArgs[1].Length - 8); Class_SystemStyle.SystemStyle_SaveJQBObjectInCommandLineWithOOBEFile(folder, frm); System.Environment.Exit(0); } else { MyFunctions.Dialogs.MessageDialog("无法继续", "参数错误", MyFunctions.Dialogs.MessageDialogIcon.Error, "", "b2", false, true, "是", "确定"); } } else { MyFunctions.Dialogs.MessageDialog("无法继续", "没有指定一个参数", MyFunctions.Dialogs.MessageDialogIcon.Error, "", "b2", false, true, "是", "确定"); } break; case "I": //用于安装时 MyFunctions.FileSystemOperate.FileSystemOperate_CreateNewFolder(Environment.GetFolderPath(Environment.SpecialFolder.Programs) + @"\奥威森网络\系统齿轮"); MyFunctions.ProgramAndLinksOperate.CreateLink(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\系统齿轮.LNK", Application.ExecutablePath, "", "强大、简单、方便的系统优化软件", Application.ExecutablePath + ",0", null); MyFunctions.ProgramAndLinksOperate.CreateLink(Environment.GetFolderPath(Environment.SpecialFolder.Programs) + @"\奥威森网络\系统齿轮\系统齿轮.LNK", Application.ExecutablePath, "", "强大、简单、方便的系统优化软件", Application.ExecutablePath + ",0", null); MyFunctions.ExtraNames.RegistryExtraName("ALL"); //// string clipfile = Application.StartupPath + @"\Config\ClipboardAutoAnswer.sgcf"; SGFunction.ConfigFileOperate.SGCFFileOperate_WriteValue("AutoAnswer", "TEXT", "F", "Config", false, clipfile); SGFunction.ConfigFileOperate.SGCFFileOperate_WriteValue("AutoAnswer", "IMAGE", "F", "Config", false, clipfile); SGFunction.ConfigFileOperate.SGCFFileOperate_WriteValue("AutoAnswer", "FILES", "F", "Config", false, clipfile); SGFunction.ConfigFileOperate.SGCFFileOperate_WriteValue("IMAGE", "Folder", "U", "Config", false, clipfile); SGFunction.ConfigFileOperate.SGCFFileOperate_WriteValue("IMAGE", "Type", "PNG", "Config", false, clipfile); SGFunction.ConfigFileOperate.SGCFFileOperate_WriteValue("IMAGE", "Size_W", "", "Config", false, clipfile); SGFunction.ConfigFileOperate.SGCFFileOperate_WriteValue("IMAGE", "Size_H", "", "Config", false, clipfile); SGFunction.ConfigFileOperate.SGCFFileOperate_WriteValue("TEXT", "Folder", "U", "Config", false, clipfile); SGFunction.ConfigFileOperate.SGCFFileOperate_WriteValue("TEXT", "Type", "TXT", "Config", false, clipfile); SGFunction.ConfigFileOperate.SGCFFileOperate_WriteValue("FILES", "Folder", "U", "Config", false, clipfile); //// string[] FOLDERS = new string[6]; FOLDERS[0] = "Backup"; FOLDERS[1] = "Config"; FOLDERS[2] = "Images"; FOLDERS[3] = "Packages"; FOLDERS[4] = "Programs"; FOLDERS[5] = "Temp"; for (int h = 1; h <= FOLDERS.Length; h++) { if (System.IO.Directory.Exists(Application.StartupPath + @"\" + FOLDERS[h - 1]) == false) { MyFunctions.FileSystemOperate.FileSystemOperate_CreateNewFolder(Application.StartupPath + @"\" + FOLDERS[h - 1]); } } SGFunction.ConfigFileOperate.SGCFFileOperate_WriteValue("SystemStyle", "GUIDConfigFile", @"%AppPath%\Config\DefaultGUIDIconConfigFile.sgcf", "Config", false, Application.StartupPath + @"\Config\MainProgram.sgcf"); SGFunction.ConfigFileOperate.SGCFFileOperate_WriteValue("SystemStyle", "RightMenuGroupConfigFile", @"%AppPath%\Config\DefaultRightMenuGroup.sgcf", "Config", false, Application.StartupPath + @"\Config\MainProgram.sgcf"); MyFunctions.FileSystemOperate.FileSystemOperate_DeleteFile(Application.StartupPath + @"\Config\DefaultGUIDIconConfigFile.sgcf"); MyFunctions.FileSystemOperate.FileSystemOperate_DeleteFile(Application.StartupPath + @"\Config\DefaultRightMenuGroup.sgcf"); Class_SystemStyle.SystemStyle_CreateDefaultGUIDIconConfigFile(); Class_SystemStyle.SystemStyle_CreateDefaultRightMenuConfigFile(); SGFunction.ConfigFileOperate.SGCFFileOperate_WriteValue("MainInfo", "ImagesCount", "0", "Config", false, Application.StartupPath + @"\Config\LogonUIImages.sgcf"); SGFunction.ConfigFileOperate.SGCFFileOperate_WriteValue("Info", "Count", "0", "Config", false, Application.StartupPath + @"\Config\Pings.sgcf"); MyFunctions.FileSystemOperate.FileSystemOperate_DeleteFile(Application.StartupPath + @"\Config\SystemIcons.sgcf"); if (frm.CommandArgs.Length == 2) { string show = frm.CommandArgs[1].Substring(1, 1).ToUpper(); if (show == "F") { Application.Exit(); } else { frm.Show(); } } else { if (frm.CommandArgs.Length == 1) { } else { for (int h = 1; h <= frm.CommandArgs.Length; h = h + 1) { FullCommandArgs = FullCommandArgs + " " + frm.CommandArgs[h - 1].ToString(); } string res = MyFunctions.Dialogs.MessageDialog("启动参数错误", "无法识别指定的启动参数", MyFunctions.Dialogs.MessageDialogIcon.Error, "无效的启动参数:\r\n" + FullCommandArgs, "b1", true, true, "查看帮助", "确定"); if (res == "B1") { MyFunctions.Dialogs.HelpDialog("系统齿轮命令行选项", SystemGear.Properties.Resources.CommandArgs); } } } break; case "H": frm.Show(); MyFunctions.Dialogs.HelpDialog("系统齿轮命令行选项", SystemGear.Properties.Resources.CommandArgs); break; case "?": frm.Show(); MyFunctions.Dialogs.HelpDialog("系统齿轮命令行选项", SystemGear.Properties.Resources.CommandArgs); break; case "P": //LOAD PACKAGE frm.Show(); string package = frm.CommandArgs[0].Substring(3, frm.CommandArgs[0].Length - 3); if (System.IO.File.Exists(package) == true) { MyFunctions.PackageOperate.SGPAK_ExtactPackage(package, "", true); MyFunctions.Dialogs.MessageDialog("已成功解压压缩包文件", "已成功解压压缩包文件", MyFunctions.Dialogs.MessageDialogIcon.Information, @"已成功解压压缩包文件""" + package + @"""", "b2", false, true, "是", "确定"); } else { MyFunctions.Dialogs.MessageDialog("无法解压指定的压缩包", "无法解压指定的压缩包.因为指定的文件不存在", MyFunctions.Dialogs.MessageDialogIcon.Error, @"找不到文件""" + package + @"""", "b2", false, true, "是", "确定"); } break; default: for (int h = 1; h <= frm.CommandArgs.Length; h = h + 1) { FullCommandArgs = FullCommandArgs + " " + frm.CommandArgs[h - 1].ToString(); } string res1 = MyFunctions.Dialogs.MessageDialog("启动参数错误", "无法识别指定的启动参数", MyFunctions.Dialogs.MessageDialogIcon.Error, "无效的启动参数:\r\n" + FullCommandArgs, "b1", true, true, "查看帮助", "确定"); if (res1 == "B1") { MyFunctions.Dialogs.HelpDialog("系统齿轮命令行选项", SystemGear.Properties.Resources.CommandArgs); } frm.Show(); break; } } else { frm.Show(); } } catch { frm.Show(); for (int h = 1; h <= frm.CommandArgs.Length; h = h + 1) { FullCommandArgs = FullCommandArgs + " " + frm.CommandArgs[h - 1].ToString(); } string res2 = MyFunctions.Dialogs.MessageDialog("启动参数错误", "无法识别指定的启动参数", MyFunctions.Dialogs.MessageDialogIcon.Error, "无效的启动参数:\r\n" + FullCommandArgs, "b1", true, true, "查看帮助", "确定"); if (res2 == "B1") { MyFunctions.Dialogs.HelpDialog("系统齿轮命令行选项", SystemGear.Properties.Resources.CommandArgs); } } }