Browse Source

zhao:增加环境配置,增加注册表帮助类

ZhangXueYang
耀 3 years ago
parent
commit
65bf2fb35a

+ 1411
- 0
Common/system/RegistryHelper.cs
File diff suppressed because it is too large
View File


+ 77
- 2
XHZB.Desktop/App.cs View File

@@ -252,7 +252,7 @@ namespace XHZB.Desktop
252 252
             UnZipFFmpeg();
253 253
             try
254 254
             {
255
-                if (args != null&&args.Length>1)
255
+                if (args != null&&args.Length>0)
256 256
                 {
257 257
                     AESAccountStr = args[0];
258 258
                     AESPassWordStr = args[1];
@@ -264,7 +264,6 @@ namespace XHZB.Desktop
264 264
             catch (Exception ex)
265 265
             {
266 266
                 LogHelper.WriteErrLog("参数接收失败:" + ex.Message, ex);
267
-                throw;
268 267
             }
269 268
             try
270 269
             {
@@ -610,5 +609,81 @@ namespace XHZB.Desktop
610 609
             return filepath;
611 610
         }
612 611
         #endregion
612
+
613
+        #region 写入注册表
614
+        /// <summary>
615
+        /// 注册表
616
+        /// </summary>
617
+        public static RegistryHelper reg = new RegistryHelper("XHZB\\", RegDomain.ClassesRoot);
618
+
619
+        public static void WriteRegistry()
620
+        {
621
+            if(IsSubKeyExist())
622
+            {
623
+                //存在时对比位置
624
+                string regStr = ReadRegeditKey();
625
+                string pathStr = FileToolsCommon.GetFileAbsolutePath("/星火直播.exe").Replace("/","\\\\");
626
+                if(regStr!= pathStr)
627
+                {
628
+
629
+                }
630
+            }
631
+            else
632
+            {
633
+
634
+            }
635
+        }
636
+        /// <summary>
637
+        /// 判断注册表是否存在
638
+        /// </summary>
639
+        public static bool IsSubKeyExist()
640
+        {
641
+            return reg.IsSubKeyExist();
642
+        }
643
+        /// <summary>
644
+        /// 读取注册表键值
645
+        /// </summary>
646
+        /// <returns></returns>
647
+        public static string ReadRegeditKey()
648
+        {
649
+            if(reg.IsRegeditKeyExist("URL Protocol"))
650
+            {
651
+                return reg.ReadRegeditKey("URL Protocol").ToString();
652
+            }
653
+            else
654
+            {
655
+                return "";
656
+            }
657
+        }
658
+
659
+        public static void CreateRegeditKey()
660
+        {
661
+            reg.CreateSubKey();
662
+            string pathStr = FileToolsCommon.GetFileAbsolutePath("/星火直播.exe").Replace("/", "\\\\");
663
+            reg.WriteRegeditKey("@","星火直播");
664
+            reg.WriteRegeditKey("URL Protocol", pathStr);
665
+
666
+
667
+            RegistryHelper reg1 = new RegistryHelper("XHZB\\DefaultIcon\\", RegDomain.ClassesRoot);
668
+            reg1.CreateSubKey();
669
+            reg1.WriteRegeditKey("@", pathStr+",1");
670
+            //reg1.CreateSubKey("XHZB\\DefaultIcon\\");
671
+
672
+            RegistryHelper reg2 = new RegistryHelper("XHZB\\shell\\open\\command\\", RegDomain.ClassesRoot);
673
+            reg2.CreateSubKey();
674
+            reg2.WriteRegeditKey("@", "\""+pathStr + "\"\"%1\"");
675
+            //reg.CreateSubKey("XHZB\\shell\\open\\command\\");
676
+
677
+            //[HKEY_CLASSES_ROOT\XHZB]
678
+            //"URL Protocol" = "E:\\项目\\星火直播\\XHZB\\XHZB.Desktop\\bin\\Debug\\星火直播.exe"
679
+            //@= "XHZBProtocol"
680
+            //[HKEY_CLASSES_ROOT\XHZB\DefaultIcon]
681
+            //@= "E:\\项目\\星火直播\\XHZB\\XHZB.Desktop\\bin\\Debug\\星火直播.exe,1"
682
+            //[HKEY_CLASSES_ROOT\XHZB\shell]
683
+            //[HKEY_CLASSES_ROOT\XHZB\shell\open]
684
+            //[HKEY_CLASSES_ROOT\XHZB\shell\open\command]
685
+            //@= "\"E:\\项目\\星火直播\\XHZB\\XHZB.Desktop\\bin\\Debug\\星火直播.exe\"\"%1\""
686
+        }
687
+        #endregion
613 688
     }
614 689
 }

+ 16
- 0
XHZB.Desktop/LoginWindow.xaml.cs View File

@@ -71,6 +71,22 @@ namespace XHZB.Desktop
71 71
         {
72 72
             InitializeComponent();
73 73
 
74
+            //try
75
+            //{
76
+            //    MessageWindow.Show("值1:" + APP.AESAccountStr);
77
+            //    MessageWindow.Show("值2:" + APP.AESPassWordStr);
78
+            //}
79
+            //catch (Exception ex)
80
+            //{
81
+
82
+            //}
83
+
84
+            if (!APP.CheckScreenCapturerRecorder())
85
+            {
86
+                MessageWindow.Show("首次运行需安装环境,请在确定后依次点击“English-OK-Next>-Next>Install”完成安装!");
87
+                APP.InstallScreenCapturerRecorder();
88
+            }
89
+
74 90
             WindowStartupLocation = WindowStartupLocation.CenterScreen;
75 91
 
76 92
             string typestr = APP.isDebug ? "测试版" : "正式版";

+ 3
- 3
XHZB.Desktop/Properties/AssemblyInfo.cs View File

@@ -7,11 +7,11 @@ using System.Windows;
7 7
 // 有关程序集的一般信息由以下
8 8
 // 控制。更改这些特性值可修改
9 9
 // 与程序集关联的信息。
10
-[assembly: AssemblyTitle("XHZB.Desktop")]
10
+[assembly: AssemblyTitle("星火直播")]
11 11
 [assembly: AssemblyDescription("")]
12 12
 [assembly: AssemblyConfiguration("")]
13
-[assembly: AssemblyCompany("")]
14
-[assembly: AssemblyProduct("XHZB.Desktop")]
13
+[assembly: AssemblyCompany("河南星火燎原软件科技有限公司")]
14
+[assembly: AssemblyProduct("星火直播")]
15 15
 [assembly: AssemblyCopyright("Copyright ©  2021")]
16 16
 [assembly: AssemblyTrademark("")]
17 17
 [assembly: AssemblyCulture("")]

+ 0
- 7
XHZB.Desktop/ToolbarWindow.xaml.cs View File

@@ -49,13 +49,6 @@ namespace XHZB.Desktop
49 49
         public ToolbarWindow()
50 50
         {
51 51
             InitializeComponent();
52
-
53
-            if (!APP.CheckScreenCapturerRecorder())
54
-            {
55
-                MessageWindow.Show("首次运行需安装环境,请在确定后依次点击“English-OK-Next>-Next>Install”完成安装!");
56
-                APP.InstallScreenCapturerRecorder();
57
-            }
58
-
59 52
             txbName.Text = APP.LoginUser.username;
60 53
 
61 54
             heiban_btn.Click += Heiban_btn_Click;

Loading…
Cancel
Save