本文整理汇总了C#中ConfigManager类的典型用法代码示例。如果您正苦于以下问题:C# ConfigManager类的具体用法?C# ConfigManager怎么用?C# ConfigManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConfigManager类属于命名空间,在下文中一共展示了ConfigManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: xEmulateForm
public xEmulateForm(string[] args)
{
InitializeComponent();
Singleton<InfoTextManager>.Instance.Init(ref infoText);
Singleton<InputManager>.Instance.Init();
Singleton<DxInputManager>.Instance.Init(this);
Singleton<XimDyn>.Instance.Init();
m_commandParser = CommandParser.Instance;
m_ximulator = new Ximulator(this);
m_configManager = ConfigManager.Instance;
m_varManager = VarManager.Instance;
if (args.Length == 0 || !m_configManager.LoadConfig(args[0]))
{
m_configManager.LoadDefaultConfig();
}
this.cbGame.Items.AddRange(GamesManager.GameNames);
if(System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
this.version.Text = "Version: "+System.Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString();
this.drawSticksCenter = new Vector2(this.mouseDisplayRect.Location.X + this.mouseDisplayRect.Size.Width / 2,
this.mouseDisplayRect.Location.Y + this.mouseDisplayRect.Size.Height / 2);
drawSticksSize = this.mouseDisplayRect.Size.Height;
SyncUI();
SetTooltips();
commandBox.Focus();
}
示例2: ConfigImplementationSelectorItem
public ConfigImplementationSelectorItem( ConfigManager configManager, PluginCluster pluginCluster )
: base(configManager)
{
_cluster = pluginCluster;
SelectItem = new VMCommand( OnSelectItem, CanSelectItem );
OpenEditor = new VMCommand( StartPluginEditor, () => CanOpenEditor );
}
示例3: GetInstance
public static ConfigManager GetInstance()
{
if (instance == null) {
instance = (ConfigManager) FindObjectOfType(typeof(ConfigManager));
}
return instance;
}
示例4: SetUp
public void SetUp()
{
_configManager = ConfigManager.GetInstance();
if (_configManager.GetConfigFile(XmlConfigFile) == null)
_configManager.Load(XmlConfigFile);
}
示例5: GuestAndHostEnvTests
public void GuestAndHostEnvTests()
{
Stream configStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(
"RemoteInstallUnitTests.TestConfigs.MinimumCopy.config");
string configFileName = Path.GetTempFileName();
using (StreamReader everythingReader = new StreamReader(configStream))
{
File.WriteAllText(configFileName, everythingReader.ReadToEnd());
}
ConfigManager configManager = new ConfigManager(configFileName, new NameValueCollection());
Assert.AreEqual(1, configManager.Configuration.CopyFiles.Count);
/*
<copyfiles destpath="windows\${hostenv.PROCESSOR_ARCHITECTURE}\${env.PROCESSOR_ARCHITECTURE}\systemfiles">
<copyfile file="${guestenv.ProgramFiles(x86)}\system.ini" />
</copyfiles>
*/
CopyFileConfig copyFileConfig = configManager.Configuration.CopyFiles[0];
Console.WriteLine("{0}: {1} => {2}", copyFileConfig.Name, copyFileConfig.File, copyFileConfig.DestinationPath);
string pa = Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE");
Assert.AreEqual(string.Format("system dot ini ({0})", pa), copyFileConfig.Name);
Assert.AreEqual(@"${guestenv.ProgramFiles(x86)}\system.ini", copyFileConfig.File);
Assert.AreEqual(string.Format(@"windows\{0}\{1}\systemfiles",
"${hostenv.PROCESSOR_ARCHITECTURE}", pa), copyFileConfig.DestinationPath);
File.Delete(configFileName);
}
示例6: Start
// Use this for initialization
void Start()
{
cm = GetComponent<ConfigManager> ();//Gets the ConfigManager
//float Duration = (float)Double.Parse(cm.Load ("Duration"));//Stores the lifespan of the puffer cloud
float Duration = 1.0f;
Lifetime = Time.time + Duration;//Sets the delete timer to the future
}
示例7: TestInstanceClassWithoutKey
public void TestInstanceClassWithoutKey()
{
InstanceConfig config = new InstanceConfig();
ConfigManager configManager = new ConfigManager();
configManager.Register(config);
configManager.RegisterProvider(new ConfigurationProviderAppConfig());
configManager.Update();
Assert.AreEqual("xx1", config.Test1);
Assert.AreEqual(99, config.SubObject1.TestInt1);
Assert.IsNotNull(config.IntValues);
Assert.IsNotNull(config.StringValues);
Assert.AreEqual("x", config.StringValues["ValX"]);
Assert.AreEqual("y", config.StringValues["ValY"]);
Assert.AreEqual("z", config.StringValues["ValZ"]);
Assert.AreEqual(3, config.StringValues.Count);
Assert.AreEqual(1, config.IntValues["Val1"]);
Assert.AreEqual(2, config.IntValues["Val2"]);
Assert.AreEqual(3, config.IntValues["Val3"]);
Assert.AreEqual(3, config.IntValues.Count);
}
示例8: UserCredentialsForm
public UserCredentialsForm(ConfigManager manager)
{
this._manager = manager;
InitializeComponent();
textBox_Password.PasswordChar = '*';
comboBox_Department.SelectedIndex = 0;
}
示例9: TestComplexSave
public void TestComplexSave()
{
var baseConfig = CreateTestConfig("configbase.xml");
var userConfig = new Configuration()
{
FilePath = Path.Combine(Path.GetDirectoryName(baseConfig.FilePath), "config.xml"),
Parent = "configbase.xml"
};
baseConfig.ChildConfigurations.Add(userConfig);
userConfig.Parameters.Add(new Parameter()
{
Name = "TestParam",
Value = "uservalue",
ValueComesFromConfiguration = userConfig
});
ConfigManager.SaveConfig(baseConfig);
ConfigManager.SaveConfig(userConfig);
var man = new ConfigManager(userConfig.FilePath);
man.Load();
var param = man.Config.Parameters.FirstOrDefault(p => p.Name == "TestParam");
param.Value = "testnewvalue";
man.Save();
man.Load();
param = man.Config.Parameters.FirstOrDefault(p => p.Name == "TestParam");
Assert.IsTrue(param.Value == "testnewvalue");
}
示例10: setupTab
// Use this for initialization
public void setupTab(ConfigManager config, List<ConfigManager.Child> list)
{
cM = config;
cam = Camera.main;
clusterStart = 0;
playerStart= 0;
selectedCluster ="";
selectedPlayer ="";
demographics = list;
clusterScroll.scrollValue = 0;
playerScroll.scrollValue = 0;
completed = new Dictionary<string, bool>();
foreach(ConfigManager.Child c in demographics){
bool complete =false;
if(c.lastCompleted>=6) complete = true;
completed.Add(c.Cluster+c.ID, complete);
}
updateLists();
}
示例11: ApplicationSettings
void ApplicationSettings(ConfigManager config)
{
config.appName = EditorGUILayout.TextField("App Name", config.appName);
EditorGUILayout.LabelField("Nome do App exibido nas PopUps nativas", EditorStyles.whiteMiniLabel);
config.appId = EditorGUILayout.IntField("App ID", config.appId);
EditorGUILayout.LabelField("ID do App na database", EditorStyles.whiteMiniLabel);
config.appVersion = EditorGUILayout.FloatField("App Version", config.appVersion);
EditorGUILayout.LabelField("Versão do App (float)", EditorStyles.whiteMiniLabel);
config.appProtocol = EditorGUILayout.TextField("App Protocol", config.appProtocol).Replace(":", "").Replace("/", "");
EditorGUILayout.LabelField("Protocolo do App (ex: utgbase://)", EditorStyles.whiteMiniLabel);
EditorGUILayout.Space();
config.headerObject = (GameObject) EditorGUILayout.ObjectField("Header", config.headerObject, typeof(GameObject));
EditorGUILayout.LabelField("Objeto Header", EditorStyles.whiteMiniLabel);
EditorGUILayout.Space();
config.loading = (GameObject) EditorGUILayout.ObjectField("Loading Dialog", config.loading, typeof(GameObject));
config.messageOk = (GameObject) EditorGUILayout.ObjectField("Message Ok Dialog", config.messageOk, typeof(GameObject));
config.messageOkCancel = (GameObject) EditorGUILayout.ObjectField("Message Ok Cancel Dialog", config.messageOkCancel, typeof(GameObject));
config.inviteAllScroll = (UIScrollList) EditorGUILayout.ObjectField("Invite 'all' ScrollList ", config.inviteAllScroll, typeof(UIScrollList));
config.invitePlayingScroll = (UIScrollList) EditorGUILayout.ObjectField("Invite 'playing' ScrollList", config.invitePlayingScroll, typeof(UIScrollList));
EditorGUILayout.LabelField("Janelas padrao", EditorStyles.whiteMiniLabel);
config.appInitialCoins = EditorGUILayout.IntField("Initial Coins Number", config.appInitialCoins);
}
示例12: Start
// Use this for initialization
void Start()
{
cm = GameObject.Find ("Configuration").GetComponent <ConfigManager>();// GetComponent<ConfigManager> ();
pm = GameObject.Find("Player").GetComponent<PlayerManager>();
pufferSlider.maxValue = (float)Double.Parse(cm.Load ("MaxPufferCharge"));;
breathSlider.maxValue = (float)Double.Parse(cm.Load ("MaxBreath"));
}
示例13: AtFolder_ReturnsSelf
private void AtFolder_ReturnsSelf()
{
var configManager = new ConfigManager()
.WithLocalMachineScope();
Assert.IsType<ConfigManager>(
configManager.AtFolder("2ED1FA2A-62B3-46E4-BB02-24008FA4373A"));
}
示例14: Main
static void Main(string[] args)
{
//App name, this is what the folder will be called in Appdata\Local\<appNameSpace>
string appNamespace = "Json2Config.Net";
//Creates the config folder & config.json
ConfigManager burgerCfg = new ConfigManager(appNamespace, "burgerCfg");
ConfigManager securityCfg = new ConfigManager(appNamespace, "securityCfg");
//Get the objects ready
Store myStore = new Store();
myStore.Name = "Bobs Burgers";
Product product1 = new Product() { Name = "Cheese Burgers", Price = 7.99 };
Product product2 = new Product() { Name = "Pizza", Price = 12.49 };
myStore.Products.Add(product1);
myStore.Products.Add(product2);
//Save the objects!
burgerCfg.SaveConfig(myStore);
Company myCompany = new Company();
myCompany.CompanyId = 1;
myCompany.CompanyName = "Jacks Security Folk";
Client client1 = new Client() { ClientId = 1, Name = "Bobs Burgers", WebsiteUrl = "BobsBurgers.biz" };
myCompany.Clients.Add(client1);
securityCfg.SaveConfig(myCompany);
}
示例15: AddSettings
public static void AddSettings(ConfigManager config, string key, string value, ServerSettings.Type type)
{
if (key.IsEmpty()) return;
int duplicated = -1;
ConfigManager.CachedServerSettings newSetting = new ConfigManager.CachedServerSettings();
newSetting.key = key;
newSetting.setting = new ServerSettings.Serializable(value, type);
for(int i = 0; i < config.serverSettings.Length; i++)
{
ConfigManager.CachedServerSettings setting = config.serverSettings[i];
if (setting.key == key)
{
duplicated = i;
break;
}
}
if (!(duplicated >= 0))
{
Array.Resize(ref config.serverSettings, config.serverSettings.Length + 1);
config.serverSettings[config.serverSettings.Length - 1] = newSetting;
Array.Sort(config.serverSettings,
delegate(ConfigManager.CachedServerSettings a, ConfigManager.CachedServerSettings b)
{ return a.key.CompareTo(b.key); }
);
return;
}
config.serverSettings[duplicated] = newSetting;
}