配置文件 路径
This commit is contained in:
parent
7ebfe8c272
commit
50c4e64b5b
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="SDKAppID" value="1400472092"/>
|
||||
<add key="SDKAppKEY" value="75907eef24093acc1d2cc20ed1eb95c50cd6728c8f5e0d98b17c5180824eee78"/>
|
||||
<add key="LIVEAppID" value="1302772646"/>
|
||||
<add key="LIVEBizid" value="110962"/>
|
||||
<add key="RoomId" value ="654657754"/>
|
||||
<add key="WSUrl" value ="wss://web.cqjgjyw.cn/websocket"/>
|
||||
<add key="ParamTip" value ="Startup Parameter Null"/>
|
||||
</appSettings>
|
||||
</configuration>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"sDKAppID": "1400472092",
|
||||
"sDKAppKEY": "75907eef24093acc1d2cc20ed1eb95c50cd6728c8f5e0d98b17c5180824eee78",
|
||||
"lIVEAppID": "1302772646",
|
||||
"lIVEBizid": "110962",
|
||||
"wSUrl": "wss://web.cqjgjyw.cn/websocket",
|
||||
"paramTip": "Startup Parameter Null"
|
||||
}
|
||||
|
|
@ -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<T>(string key)
|
||||
{
|
||||
return config[key].ToObject<T>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="App.config">
|
||||
<None Update="App.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="logo.ico">
|
||||
|
|
@ -60,4 +60,5 @@
|
|||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="set Platform=Win64
SETLOCAL ENABLEDELAYEDEXPANSION
if $(PlatformName)==x86 ( 
set Platform=Win32
)
copy /Y "$(ProjectDir)TRTC_SDK\!Platform!\lib\*.*" "$(ProjectDir)$(OutDir)"
ENDLOCAL" />
|
||||
</Target>
|
||||
<ProjectExtensions><VisualStudio><UserProperties app_1json__JsonSchema="https://beaujs.com/schema.json" /></VisualStudio></ProjectExtensions>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -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<uint>("sDKAppID"); } }
|
||||
static string SDKAppKEY { get { return App.GetConfig<string>("sDKAppKEY"); } }
|
||||
static uint LIVEAppID { get { return App.GetConfig<uint>("lIVEAppID"); } }
|
||||
static uint LIVEBizid { get { return App.GetConfig<uint>("lIVEBizid"); } }
|
||||
static string WSUrl { get { return App.GetConfig<string>("wSUrl"); } }
|
||||
|
||||
/// <summary>
|
||||
/// TRTC实例
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
//设备
|
||||
|
|
|
|||
|
|
@ -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<string>("paramTip"); } }
|
||||
public Login()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
|
|
|||
Loading…
Reference in New Issue