Commit 472a3e7d by wangonghui

CBAURL添加配置文件

parent 70c206ae
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="url" value="http://sportsdata.misports.cn/beitai/api/"/>
<add key="vizIpMain" value=""/>
<add key="vizIpBack" value=""/>
<add key="leagueId" value="401"/>
</appSettings>
</configuration>
\ No newline at end of file
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Configuration;
using System.IO.Packaging; using System.IO.Packaging;
using System.Linq; using System.Linq;
using System.Security.Policy; using System.Security.Policy;
...@@ -19,7 +20,9 @@ namespace VIZ.TVP.CBA.Module.Common ...@@ -19,7 +20,9 @@ namespace VIZ.TVP.CBA.Module.Common
{ {
//AppConfigUtil.GetAppConfig("url") //AppConfigUtil.GetAppConfig("url")
//AppConfigUtil.GetAppConfig("leagueId") //AppConfigUtil.GetAppConfig("leagueId")
private static string httpStr = "http://sportsdata.misports.cn/beitai/api/";
public static AppSettingsSection sd = ConfigManage.InitLogConfig().AppSettings;
private static string httpStr = sd.Settings["url"].Value.ToString();
private static string leagueid ="401" ; private static string leagueid ="401" ;
private static string customer = "migu"; private static string customer = "migu";
private static string key = "migu"; private static string key = "migu";
......
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.CBA.Module
{
public static class ConfigManage
{
#region 1.获取当前类库的文件配置
public static Configuration InitLogConfig()
{
string baesePath = AppDomain.CurrentDomain.BaseDirectory;
string fullName = Path.GetFileName(Assembly.GetCallingAssembly().Location);
string path = string.Format(@"{0}CBA.Module.config", baesePath);
//AppDomain.CurrentDomain.BaseDirectory
if (File.Exists(path) == false)
{
{
string msg = string.Format("{0}路径下的文件未找到 ", path);
throw new FileNotFoundException(msg);
}
}
try
{
ExeConfigurationFileMap configFile = new ExeConfigurationFileMap();
configFile.ExeConfigFilename = path;
Configuration config= ConfigurationManager.OpenMappedExeConfiguration(configFile, ConfigurationUserLevel.None);
return config;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
#endregion
}
}
}
...@@ -114,6 +114,7 @@ ...@@ -114,6 +114,7 @@
<Compile Include="Common\JsonHelper.cs" /> <Compile Include="Common\JsonHelper.cs" />
<Compile Include="Common\JsonModel.cs" /> <Compile Include="Common\JsonModel.cs" />
<Compile Include="Common\Utils.cs" /> <Compile Include="Common\Utils.cs" />
<Compile Include="ConfigHelper\ConfigManage.cs" />
<Compile Include="DayMatch\DayMatchPlugin.cs" /> <Compile Include="DayMatch\DayMatchPlugin.cs" />
<Compile Include="DayMatch\Model\Dayschedules.cs" /> <Compile Include="DayMatch\Model\Dayschedules.cs" />
<Compile Include="Main\ViewModel\MainViewModel.cs" /> <Compile Include="Main\ViewModel\MainViewModel.cs" />
...@@ -195,6 +196,9 @@ ...@@ -195,6 +196,9 @@
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
<None Include="CBA.Module.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<appSettings> <appSettings>
<add key="url" value="http://sportsdata.misports.cn/beitai/api/"/> <add key="vizIpBack1" value=""/>
<add key="vizIpMain" value=""/>
<add key="vizIpBack" value=""/>
<add key="leagueId" value="401"/>
</appSettings> </appSettings>
</configuration> </configuration>
\ No newline at end of file
...@@ -111,7 +111,9 @@ ...@@ -111,7 +111,9 @@
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
<None Include="App.config" /> <None Include="App.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment