本文整理汇总了C#中ConfigFile.Get方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigFile.Get方法的具体用法?C# ConfigFile.Get怎么用?C# ConfigFile.Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigFile
的用法示例。
在下文中一共展示了ConfigFile.Get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadFromConfig
public void ReadFromConfig(ConfigFile config)
{
this.name = config.Get("Emulation.DeviceName", this.name.ToString());
string str1 = config.Get("Emulation.OSCategory", this.os.ToString());
string str2 = config.Get("Emulation.InputCategory", this.input.ToString());
string str3 = config.Get("Emulation.ScreenCategory", this.screen.ToString());
string str4 = config.Get("Emulation.ScreenDensityCategory", this.screenDensity.ToString());
Log.ConfigFile.Print("Reading Emulated Device: " + this.name + " from " + config.GetPath());
try
{
this.os = (OSCategory) Enum.Parse(typeof (OSCategory), str1);
this.input = (InputCategory) Enum.Parse(typeof (InputCategory), str2);
this.screen = (ScreenCategory) Enum.Parse(typeof (ScreenCategory), str3);
this.screenDensity = (ScreenDensityCategory) Enum.Parse(typeof (ScreenDensityCategory), str4);
}
catch (ArgumentException ex)
{
string format = "Could not parse {0} in {1} as a valid device!";
object[] objArray = new object[2];
int index1 = 0;
string str5 = this.name;
objArray[index1] = (object) str5;
int index2 = 1;
string path = config.GetPath();
objArray[index2] = (object) path;
// Blizzard.Log.Warning(format, objArray);
}
}
示例2: SqliteDbProvider
public SqliteDbProvider(ConfigFile configFile)
{
_connectionString = string.Format("Data Source={0};Version=3", configFile.Get(DbConstants.KEY_FILE_NAME));
_clientExec = configFile.Get(DbConstants.KEY_CLIENT_EXEC);
_dbFileName = configFile.Get(DbConstants.KEY_FILE_NAME);
}
示例3: Create
public static IDbProvider Create(ConfigFile configFile)
{
configFile.Load();
string dbType = configFile.Get(DbConstants.KEY_DB_TYPE);
log.Info("Creating provider for" + dbType);
switch (dbType)
{
case DbConstants.DB_TYPE_MYSQL:
return new MySqlDbProvider(configFile);
case DbConstants.DB_TYPE_SQLITE:
return new SqliteDbProvider(configFile);
default:
throw new Exception(string.Format("Don't know Data Provider type {0}", dbType));
}
}
示例4: EmulateMobileDevice
private static bool EmulateMobileDevice()
{
ConfigFile config = new ConfigFile();
if (!config.FullLoad(Vars.GetClientConfigPath()))
{
Debug.LogWarning("Failed to read DeviceEmulation from client.config");
return false;
}
DevicePreset devicePreset = new DevicePreset();
devicePreset.ReadFromConfig(config);
if (devicePreset.name == "No Emulation" || !config.Get("Emulation.emulateOnDevice", false))
return false;
PlatformSettings.s_os = devicePreset.os;
PlatformSettings.s_input = devicePreset.input;
PlatformSettings.s_screen = devicePreset.screen;
PlatformSettings.s_screenDensity = devicePreset.screenDensity;
Log.DeviceEmulation.Print("Emulating an " + devicePreset.name);
return true;
}
示例5: MySqlDbProvider
public MySqlDbProvider(ConfigFile configFile)
{
if (configFile == null)
{
_connectionString = string.Empty;
return;
}
if (!string.IsNullOrEmpty(configFile.Get(DbConstants.KEY_PWD)))
{
_connectionString = string.Format("SERVER={0};PORT={1};DATABASE={2};UID={3};PWD={4}",
configFile.Get(DbConstants.KEY_HOST),
configFile.Get(DbConstants.KEY_PORT),
configFile.Get(DbConstants.KEY_DATABASE),
configFile.Get(DbConstants.KEY_UID),
configFile.Get(DbConstants.KEY_PWD));
}
else
{
_connectionString = string.Format("SERVER={0};PORT={1};DATABASE={2};UID={3}",
configFile.Get(DbConstants.KEY_HOST),
configFile.Get(DbConstants.KEY_PORT),
configFile.Get(DbConstants.KEY_DATABASE),
configFile.Get(DbConstants.KEY_UID));
}
_uid = configFile.Get(DbConstants.KEY_UID);
_pwd = configFile.Get(DbConstants.KEY_PWD);
_database = configFile.Get(DbConstants.KEY_DATABASE);
_host = configFile.Get(DbConstants.KEY_HOST);
_clientExec = configFile.Get(DbConstants.KEY_CLIENT_EXEC);
_port = configFile.Get(DbConstants.KEY_PORT);
}