diff --git a/ClientDemo/App.xaml.cs b/ClientDemo/App.xaml.cs index 5fd2fa4..6d9fedb 100644 --- a/ClientDemo/App.xaml.cs +++ b/ClientDemo/App.xaml.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Configuration; using System.Data; using System.Linq; using System.Threading.Tasks; diff --git a/JianGongYun/App.config b/JianGongYun/App.config deleted file mode 100644 index 63e1132..0000000 --- a/JianGongYun/App.config +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/JianGongYun/App.json b/JianGongYun/App.json new file mode 100644 index 0000000..ce548cc --- /dev/null +++ b/JianGongYun/App.json @@ -0,0 +1,8 @@ +{ + "sDKAppID": "1400472092", + "sDKAppKEY": "75907eef24093acc1d2cc20ed1eb95c50cd6728c8f5e0d98b17c5180824eee78", + "lIVEAppID": "1302772646", + "lIVEBizid": "110962", + "wSUrl": "wss://web.cqjgjyw.cn/websocket", + "paramTip": "Startup Parameter Null" +} \ No newline at end of file diff --git a/JianGongYun/App.xaml.cs b/JianGongYun/App.xaml.cs index cf97065..5fad5d3 100644 --- a/JianGongYun/App.xaml.cs +++ b/JianGongYun/App.xaml.cs @@ -1,6 +1,6 @@ -using System; +using Newtonsoft.Json.Linq; +using System; using System.Collections.Generic; -using System.Configuration; using System.Data; using System.Linq; using System.Threading.Tasks; @@ -28,5 +28,11 @@ namespace JianGongYun return bitmapImage; } } + private static JObject config = JObject.Parse(System.IO.File.ReadAllText(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App.json"))); + + public static T GetConfig(string key) + { + return config[key].ToObject(); + } } } diff --git a/JianGongYun/JianGongYun.csproj b/JianGongYun/JianGongYun.csproj index 4cace9b..9333d6d 100644 --- a/JianGongYun/JianGongYun.csproj +++ b/JianGongYun/JianGongYun.csproj @@ -29,7 +29,7 @@ - + Always @@ -60,4 +60,5 @@ + diff --git a/JianGongYun/TRTC/LiveClassroom.cs b/JianGongYun/TRTC/LiveClassroom.cs index dbfbf3a..38be140 100644 --- a/JianGongYun/TRTC/LiveClassroom.cs +++ b/JianGongYun/TRTC/LiveClassroom.cs @@ -20,7 +20,6 @@ using System.Drawing; using System.Diagnostics; using System.Runtime.InteropServices; using AduSkin.Controls.Metro; -using System.Configuration; using Websocket.Client; using System.Windows.Threading; using Newtonsoft.Json.Linq; @@ -36,11 +35,11 @@ namespace JianGongYun.TRTC //const string SDKAppKEY = "6ee2586282eb8ab5bff3f917b44500c4ffd9bbd3d820258b1fa8cdd470cfd1ee"; //const uint LIVEAppID = 1252883401; //const uint LIVEBizid = 126866; - static uint SDKAppID { get { return uint.Parse(ConfigurationManager.AppSettings[nameof(SDKAppID)]); } } - static string SDKAppKEY { get { return ConfigurationManager.AppSettings[nameof(SDKAppKEY)]; } } - static uint LIVEAppID { get { return uint.Parse(ConfigurationManager.AppSettings[nameof(LIVEAppID)]); } } - static uint LIVEBizid { get { return uint.Parse(ConfigurationManager.AppSettings[nameof(LIVEBizid)]); } } - static string WSUrl { get { return ConfigurationManager.AppSettings[nameof(WSUrl)]; } } + static uint SDKAppID { get { return App.GetConfig("sDKAppID"); } } + static string SDKAppKEY { get { return App.GetConfig("sDKAppKEY"); } } + static uint LIVEAppID { get { return App.GetConfig("lIVEAppID"); } } + static uint LIVEBizid { get { return App.GetConfig("lIVEBizid"); } } + static string WSUrl { get { return App.GetConfig("wSUrl"); } } /// /// TRTC实例 diff --git a/JianGongYun/TRTC/ViewModels/SettingWindowViewModel.cs b/JianGongYun/TRTC/ViewModels/SettingWindowViewModel.cs index 914b988..b772393 100644 --- a/JianGongYun/TRTC/ViewModels/SettingWindowViewModel.cs +++ b/JianGongYun/TRTC/ViewModels/SettingWindowViewModel.cs @@ -195,7 +195,7 @@ namespace JianGongYun.TRTC.ViewModels { get { - if (AudioSource == "2"||AudioSource=="3") + if (AudioSource == "2" || AudioSource == "3") { _ShowSytemGatherSlider = Visibility.Visible; } @@ -916,7 +916,7 @@ namespace JianGongYun.TRTC.ViewModels #region 配置持久化 //配置文件路径 - private string sPath = ".\\TRTCConfig.ini"; + private string sPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TRTCConfig.ini"); //根节点 private const string INI_ROOT_KEY = "TRTCLOCALCONFIG"; //设备 diff --git a/JianGongYun/Views/Login.xaml.cs b/JianGongYun/Views/Login.xaml.cs index 6f910fb..03addf0 100644 --- a/JianGongYun/Views/Login.xaml.cs +++ b/JianGongYun/Views/Login.xaml.cs @@ -3,7 +3,6 @@ using AduSkin.Controls.Metro; using JianGongYun.TRTC; using System; using System.Collections.Generic; -using System.Configuration; using System.Text; using System.Windows; using System.Windows.Controls; @@ -28,7 +27,7 @@ namespace JianGongYun.Views const string TEACHER_ID = "--teacherid"; const string TEACHER_NAME = "--teachername"; const string END_TIME = "endtime"; - static string ParamTip { get { return ConfigurationManager.AppSettings[nameof(ParamTip)]; } } + static string ParamTip { get { return App.GetConfig("paramTip"); } } public Login() { InitializeComponent();