Browse Source

Merge remote-tracking branch 'origin/master' into ZhangXueYang

ZhangXueYang
zhangxueyang 3 years ago
parent
commit
c25d90f2ff
3 changed files with 55 additions and 26 deletions
  1. 4
    3
      Common/system/RegistryHelper.cs
  2. 39
    12
      XHZB.Desktop/App.cs
  3. 12
    11
      XHZB.Desktop/LoginWindow.xaml.cs

+ 4
- 3
Common/system/RegistryHelper.cs View File

@@ -131,6 +131,7 @@ namespace Common.system
131 131
         /// <param name="subKey">注册表项名称</param>  
132 132
         public virtual void CreateSubKey(string subKey)
133 133
         {
134
+
134 135
             ///判断注册表项名称是否为空,如果为空,返回false  
135 136
             if (subKey == string.Empty || subKey == null)
136 137
             {
@@ -620,7 +621,7 @@ namespace Common.system
620 621
             ///判断是否设置键值属性  
621 622
             if (_regeditkey == string.Empty || _regeditkey == null)
622 623
             {
623
-                return false;
624
+                _regeditkey = "";
624 625
             }
625 626
 
626 627
             ///判断注册表项是否存在,如果不存在,则直接创建  
@@ -670,7 +671,7 @@ namespace Common.system
670 671
             ///判断键值是否存在  
671 672
             if (name == string.Empty || name == null)
672 673
             {
673
-                return false;
674
+                name = "";
674 675
             }
675 676
 
676 677
             ///判断注册表项是否存在,如果不存在,则直接创建  
@@ -720,7 +721,7 @@ namespace Common.system
720 721
             ///判断键值是否存在  
721 722
             if (name == string.Empty || name == null)
722 723
             {
723
-                return false;
724
+                name = "";
724 725
             }
725 726
 
726 727
             ///判断注册表项是否存在,如果不存在,则直接创建  

+ 39
- 12
XHZB.Desktop/App.cs View File

@@ -35,6 +35,10 @@ namespace XHZB.Desktop
35 35
         /// </summary>
36 36
         public static string AESPassWordStr = null;
37 37
         /// <summary>
38
+        /// 课堂节次
39
+        /// </summary>
40
+        public static string ClassroomAdd = null;
41
+        /// <summary>
38 42
         /// 接口地址
39 43
         /// </summary>
40 44
         public static string apiUrl = isDebug ? "http://schoolapitest.xhkjedu.com" : FileToolsCommon.GetConfigValue("APIRequestAddress");
@@ -269,15 +273,39 @@ namespace XHZB.Desktop
269 273
             StopSameProcess();
270 274
             Killffmpeg();
271 275
             UnZipFFmpeg();
276
+            //注册
277
+            WriteRegistry();
272 278
             try
273 279
             {
274
-                if (args != null&&args.Length>0)
280
+                if (args != null && args.Length > 0)
275 281
                 {
276
-                    AESAccountStr = args[0];
277
-                    AESPassWordStr = args[1];
282
+                    string Str = args[0];
283
+                    List<string> StrArg = new List<string>(Str.Substring(0, Str.Length - 1).Replace("xhzb://", "").Split('&'));
284
+                    //AESAccountStr = args[0];
285
+                    //AESPassWordStr = args[1];
286
+                    LogHelper.WriteInfoLog(Str);
287
+                    foreach (string str in StrArg)
288
+                    {
289
+                        if (str.Contains("account"))
290
+                        {
291
+                            AESAccountStr = str.Substring(str.LastIndexOf("=") + 1);
292
+                            //string Account= AESHelper.AESDecrypt(AESAccountStr);
293
+                            LogHelper.WriteInfoLog("账号=" + AESAccountStr);
294
+
295
+                        }
296
+                        if (str.Contains("password"))
297
+                        {
298
+                            AESPassWordStr = str.Substring(str.LastIndexOf("=") + 1);
299
+                            //string PassWord = AESHelper.AESDecrypt(AESPassWordStr);
300
+                            LogHelper.WriteInfoLog("密码=" + AESPassWordStr);
301
+                        }
302
+                        if (str.Contains("rid"))
303
+                        {
304
+                            ClassroomAdd = str.Substring(str.LastIndexOf("=") + 1);
305
+                            LogHelper.WriteInfoLog("课堂=" + ClassroomAdd);
306
+                        }
307
+                    }
278 308
                     ////解密
279
-                    //string Account= AESHelper.AESDecrypt(AESAccountStr);
280
-                    //string PassWord = AESHelper.AESDecrypt(AESPassWordStr);
281 309
                 }
282 310
             }
283 311
             catch (Exception ex)
@@ -637,19 +665,19 @@ namespace XHZB.Desktop
637 665
 
638 666
         public static void WriteRegistry()
639 667
         {
640
-            if(IsSubKeyExist())
668
+            if (IsSubKeyExist())
641 669
             {
642 670
                 //存在时对比位置
643 671
                 string regStr = ReadRegeditKey();
644 672
                 string pathStr = FileToolsCommon.GetFileAbsolutePath("/星火直播.exe").Replace("/","\\\\");
645 673
                 if(regStr!= pathStr)
646 674
                 {
647
-
675
+                    CreateRegeditKey();
648 676
                 }
649 677
             }
650 678
             else
651 679
             {
652
-
680
+                CreateRegeditKey();
653 681
             }
654 682
         }
655 683
         /// <summary>
@@ -679,18 +707,17 @@ namespace XHZB.Desktop
679 707
         {
680 708
             reg.CreateSubKey();
681 709
             string pathStr = FileToolsCommon.GetFileAbsolutePath("/星火直播.exe").Replace("/", "\\\\");
682
-            reg.WriteRegeditKey("@","星火直播");
710
+            reg.WriteRegeditKey("星火直播");
683 711
             reg.WriteRegeditKey("URL Protocol", pathStr);
684 712
 
685
-
686 713
             RegistryHelper reg1 = new RegistryHelper("XHZB\\DefaultIcon\\", RegDomain.ClassesRoot);
687 714
             reg1.CreateSubKey();
688
-            reg1.WriteRegeditKey("@", pathStr+",1");
715
+            reg1.WriteRegeditKey(pathStr +",1");
689 716
             //reg1.CreateSubKey("XHZB\\DefaultIcon\\");
690 717
 
691 718
             RegistryHelper reg2 = new RegistryHelper("XHZB\\shell\\open\\command\\", RegDomain.ClassesRoot);
692 719
             reg2.CreateSubKey();
693
-            reg2.WriteRegeditKey("@", "\""+pathStr + "\"\"%1\"");
720
+            reg2.WriteRegeditKey("\"" +pathStr + "\"\"%1\"");
694 721
             //reg.CreateSubKey("XHZB\\shell\\open\\command\\");
695 722
 
696 723
             //[HKEY_CLASSES_ROOT\XHZB]

+ 12
- 11
XHZB.Desktop/LoginWindow.xaml.cs View File

@@ -70,17 +70,6 @@ namespace XHZB.Desktop
70 70
         public LoginWindow()
71 71
         {
72 72
             InitializeComponent();
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 73
             if (!APP.CheckScreenCapturerRecorder())
85 74
             {
86 75
                 MessageWindow.Show("首次运行需安装环境,请在确定后依次点击“English-OK-Next>-Next>Install”完成安装!");
@@ -111,6 +100,18 @@ namespace XHZB.Desktop
111 100
             {
112 101
                 APP.fileStorageAddress = System.IO.File.ReadAllText(APP.dataPath + "fileStorageAddress.txt", Encoding.Default);
113 102
             }
103
+            //APP.AESAccountStr = "9001";
104
+            //APP.AESPassWordStr = "123456";
105
+            //免登录
106
+            if (!string.IsNullOrWhiteSpace(APP.AESAccountStr) && !string.IsNullOrWhiteSpace(APP.AESPassWordStr))
107
+            {
108
+                Dispatcher.Invoke(new Action(() =>
109
+                {
110
+                    txbAccountNumber.Text = APP.AESAccountStr;
111
+                    pobPassword.Password = APP.AESPassWordStr;
112
+                    btnLogin_Click(null, null);
113
+                }));
114
+            }
114 115
         }
115 116
         //#region 登陆页面验证本地激活码 1.验证成功 可登陆。 2.验证失败 弹出激活窗口。   关闭激活窗口,点击登陆时继续 弹出激活窗口
116 117
         ///// <summary>

Loading…
Cancel
Save