Browse Source

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

ZhangXueYang
zhangxueyang 4 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
         /// <param name="subKey">注册表项名称</param>  
131
         /// <param name="subKey">注册表项名称</param>  
132
         public virtual void CreateSubKey(string subKey)
132
         public virtual void CreateSubKey(string subKey)
133
         {
133
         {
134
+
134
             ///判断注册表项名称是否为空,如果为空,返回false  
135
             ///判断注册表项名称是否为空,如果为空,返回false  
135
             if (subKey == string.Empty || subKey == null)
136
             if (subKey == string.Empty || subKey == null)
136
             {
137
             {
620
             ///判断是否设置键值属性  
621
             ///判断是否设置键值属性  
621
             if (_regeditkey == string.Empty || _regeditkey == null)
622
             if (_regeditkey == string.Empty || _regeditkey == null)
622
             {
623
             {
623
-                return false;
624
+                _regeditkey = "";
624
             }
625
             }
625
 
626
 
626
             ///判断注册表项是否存在,如果不存在,则直接创建  
627
             ///判断注册表项是否存在,如果不存在,则直接创建  
670
             ///判断键值是否存在  
671
             ///判断键值是否存在  
671
             if (name == string.Empty || name == null)
672
             if (name == string.Empty || name == null)
672
             {
673
             {
673
-                return false;
674
+                name = "";
674
             }
675
             }
675
 
676
 
676
             ///判断注册表项是否存在,如果不存在,则直接创建  
677
             ///判断注册表项是否存在,如果不存在,则直接创建  
720
             ///判断键值是否存在  
721
             ///判断键值是否存在  
721
             if (name == string.Empty || name == null)
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
         /// </summary>
35
         /// </summary>
36
         public static string AESPassWordStr = null;
36
         public static string AESPassWordStr = null;
37
         /// <summary>
37
         /// <summary>
38
+        /// 课堂节次
39
+        /// </summary>
40
+        public static string ClassroomAdd = null;
41
+        /// <summary>
38
         /// 接口地址
42
         /// 接口地址
39
         /// </summary>
43
         /// </summary>
40
         public static string apiUrl = isDebug ? "http://schoolapitest.xhkjedu.com" : FileToolsCommon.GetConfigValue("APIRequestAddress");
44
         public static string apiUrl = isDebug ? "http://schoolapitest.xhkjedu.com" : FileToolsCommon.GetConfigValue("APIRequestAddress");
269
             StopSameProcess();
273
             StopSameProcess();
270
             Killffmpeg();
274
             Killffmpeg();
271
             UnZipFFmpeg();
275
             UnZipFFmpeg();
276
+            //注册
277
+            WriteRegistry();
272
             try
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
             catch (Exception ex)
311
             catch (Exception ex)
637
 
665
 
638
         public static void WriteRegistry()
666
         public static void WriteRegistry()
639
         {
667
         {
640
-            if(IsSubKeyExist())
668
+            if (IsSubKeyExist())
641
             {
669
             {
642
                 //存在时对比位置
670
                 //存在时对比位置
643
                 string regStr = ReadRegeditKey();
671
                 string regStr = ReadRegeditKey();
644
                 string pathStr = FileToolsCommon.GetFileAbsolutePath("/星火直播.exe").Replace("/","\\\\");
672
                 string pathStr = FileToolsCommon.GetFileAbsolutePath("/星火直播.exe").Replace("/","\\\\");
645
                 if(regStr!= pathStr)
673
                 if(regStr!= pathStr)
646
                 {
674
                 {
647
-
675
+                    CreateRegeditKey();
648
                 }
676
                 }
649
             }
677
             }
650
             else
678
             else
651
             {
679
             {
652
-
680
+                CreateRegeditKey();
653
             }
681
             }
654
         }
682
         }
655
         /// <summary>
683
         /// <summary>
679
         {
707
         {
680
             reg.CreateSubKey();
708
             reg.CreateSubKey();
681
             string pathStr = FileToolsCommon.GetFileAbsolutePath("/星火直播.exe").Replace("/", "\\\\");
709
             string pathStr = FileToolsCommon.GetFileAbsolutePath("/星火直播.exe").Replace("/", "\\\\");
682
-            reg.WriteRegeditKey("@","星火直播");
710
+            reg.WriteRegeditKey("星火直播");
683
             reg.WriteRegeditKey("URL Protocol", pathStr);
711
             reg.WriteRegeditKey("URL Protocol", pathStr);
684
 
712
 
685
-
686
             RegistryHelper reg1 = new RegistryHelper("XHZB\\DefaultIcon\\", RegDomain.ClassesRoot);
713
             RegistryHelper reg1 = new RegistryHelper("XHZB\\DefaultIcon\\", RegDomain.ClassesRoot);
687
             reg1.CreateSubKey();
714
             reg1.CreateSubKey();
688
-            reg1.WriteRegeditKey("@", pathStr+",1");
715
+            reg1.WriteRegeditKey(pathStr +",1");
689
             //reg1.CreateSubKey("XHZB\\DefaultIcon\\");
716
             //reg1.CreateSubKey("XHZB\\DefaultIcon\\");
690
 
717
 
691
             RegistryHelper reg2 = new RegistryHelper("XHZB\\shell\\open\\command\\", RegDomain.ClassesRoot);
718
             RegistryHelper reg2 = new RegistryHelper("XHZB\\shell\\open\\command\\", RegDomain.ClassesRoot);
692
             reg2.CreateSubKey();
719
             reg2.CreateSubKey();
693
-            reg2.WriteRegeditKey("@", "\""+pathStr + "\"\"%1\"");
720
+            reg2.WriteRegeditKey("\"" +pathStr + "\"\"%1\"");
694
             //reg.CreateSubKey("XHZB\\shell\\open\\command\\");
721
             //reg.CreateSubKey("XHZB\\shell\\open\\command\\");
695
 
722
 
696
             //[HKEY_CLASSES_ROOT\XHZB]
723
             //[HKEY_CLASSES_ROOT\XHZB]

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

70
         public LoginWindow()
70
         public LoginWindow()
71
         {
71
         {
72
             InitializeComponent();
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
             if (!APP.CheckScreenCapturerRecorder())
73
             if (!APP.CheckScreenCapturerRecorder())
85
             {
74
             {
86
                 MessageWindow.Show("首次运行需安装环境,请在确定后依次点击“English-OK-Next>-Next>Install”完成安装!");
75
                 MessageWindow.Show("首次运行需安装环境,请在确定后依次点击“English-OK-Next>-Next>Install”完成安装!");
111
             {
100
             {
112
                 APP.fileStorageAddress = System.IO.File.ReadAllText(APP.dataPath + "fileStorageAddress.txt", Encoding.Default);
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
         //#region 登陆页面验证本地激活码 1.验证成功 可登陆。 2.验证失败 弹出激活窗口。   关闭激活窗口,点击登陆时继续 弹出激活窗口
116
         //#region 登陆页面验证本地激活码 1.验证成功 可登陆。 2.验证失败 弹出激活窗口。   关闭激活窗口,点击登陆时继续 弹出激活窗口
116
         ///// <summary>
117
         ///// <summary>

Loading…
Cancel
Save