using HotelPms.Share.Data;
|
using HotelPms.Share.IO;
|
using System.Reflection;
|
using System.Text;
|
|
namespace HotelPms.WinForm.Common.Util
|
{
|
public static class EnvironmentSetting
|
{
|
private static Setting? m_Default;
|
|
public static Setting Default
|
{
|
get
|
{
|
if (m_Default == null) {
|
//var aa = Config.Instance.Get(Config.SettingKey.HostName);
|
|
m_Default = new Setting
|
{
|
DataBase = new DBConnectItem(Config.Instance.Get(Config.SettingKey.HostName),
|
Config.Instance.Get(Config.SettingKey.DBName),
|
Config.Instance.Get(Config.SettingKey.UserID),
|
Config.Instance.Get(Config.SettingKey.Password)),
|
};
|
OperationLog.Instance.WriteLog(Config.Instance.ToString());
|
}
|
return m_Default;
|
}
|
}
|
|
#region ★★★★★ Function ★★★★★
|
|
/// <summary>
|
/// 初期化
|
/// </summary>
|
/// <returns></returns>
|
public static bool Init()
|
{
|
try
|
{
|
return true;
|
}
|
catch(Exception ex)
|
{
|
OperationLog.Instance.WriteLog($"{MethodInfo.GetCurrentMethod()}:{ex.Message}");
|
return false;
|
}
|
}
|
|
public static string GetResourceString(string name)
|
{
|
using (Stream st = Assembly.GetExecutingAssembly().GetManifestResourceStream(name))
|
{
|
using (StreamReader sr = new StreamReader(st, Encoding.UTF8))
|
{
|
string info = sr.ReadToEnd();
|
return info;
|
}
|
}
|
}
|
|
#endregion
|
|
}
|
}
|