本文整理汇总了C#中Configuration.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Configuration.ToString方法的具体用法?C# Configuration.ToString怎么用?C# Configuration.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configuration
的用法示例。
在下文中一共展示了Configuration.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResetPhysicalContentDirectoryAndConfigureStore
public static string ResetPhysicalContentDirectoryAndConfigureStore(Configuration.Store store)
{
var poolRecycled = false;
var rrFolder = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName + "\\RequestReduce.SampleWeb\\RRContent";
if (Directory.Exists(rrFolder))
{
RecyclePool();
poolRecycled = true;
try
{
RecyclePool();
Directory.Delete(rrFolder, true);
}
catch (IOException)
{
Thread.Sleep(100);
Directory.Delete(rrFolder, true);
}
while (Directory.Exists(rrFolder))
Thread.Sleep(0);
}
XDocument doc = null;
using (var stream = File.OpenText(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName +
"\\RequestReduce.SampleWeb\\web.config"))
{
doc = XDocument.Load(stream);
}
var cs = doc.Element("configuration").Element("RequestReduce").Attribute("contentStore");
if (cs == null || cs.Value.ToLower() != store.ToString().ToLower())
{
doc.Element("configuration").Element("RequestReduce").SetAttributeValue("contentStore", store.ToString());
if (!poolRecycled)
RecyclePool();
doc.Save(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName +
"\\RequestReduce.SampleWeb\\web.config");
}
return rrFolder;
}
示例2: DoBootstrap
/// <summary>
/// Steps to configure the windows instances
/// 1. Wait for the network connectivity become active
/// 2. Setup ACPI/remote desktop allowance
/// 3. Format uninitialize drives
/// 4. Change admin's password
/// 5. Change hostname (and reboot)
/// 6. Join AD
/// </summary>
/// <param name="configFileLocation"></param>
public virtual void DoBootstrap(string configFileLocation)
{
try
{
string installLocation = (string)EucaUtil.GetRegistryValue(Registry.LocalMachine, EucaRegistryPath, "InstallLocation");
EucaLogger.LogLocation = string.Format("{0}\\eucalog.txt", installLocation);
_configLocation = configFileLocation;
EucaLogger.Info(string.Format("Eucalyptus Systems Inc. Windows Service ver 1.0.0.2, 3/4/2014"));
EucaLogger.Info(string.Format("EucaServiceLibrary with config= {0}!", configFileLocation));
EucaLogger.Info(string.Format("OS: {0}, SP: {1}, 64bit?:{2}", OSEnvironment.OS_Name, OSEnvironment.OS_ServicePack, OSEnvironment.Is64bit));
try
{
_eucaConfig = ConfigurationParser.Parse(configFileLocation);
#if EUCA_DEBUG
EucaLogger.Debug(_eucaConfig.ToString());
#endif
}
catch (Exception e)
{
EucaLogger.Exception("Failed to parse configuration; admin's password and AD setting will not be changed", e);
}
try
{
RecordInstanceLaunch(_eucaConfig);
}
catch (Exception e)
{
EucaLogger.Exception("Could not record and check the instance's launch status", e);
}
DoBootstrapThreaded(); // will return immediately
EucaLogger.Info("Windows service started");
/// service will return now
}catch (Exception e)
{
EucaLogger.Exception("Bootstrapping failed", e);
}
}
示例3: ShallowToStringShouldIncludeTheNameAndValueOfTheConfiguration
public void ShallowToStringShouldIncludeTheNameAndValueOfTheConfiguration()
{
var configuration = new Configuration("connection", "localhost");
Assert.AreEqual(
"{MACSkeptic.ExpLorer.Configuration: {connection: localhost}}", configuration.ToString(true));
}
示例4: FrmCmdLine
public FrmCmdLine(Configuration.Configuration config)
{
InitializeComponent();
textBox1.Text = config.ToString(true);
}
示例5: getSimilarConfig
private static Tuple<Configuration, Configuration> getSimilarConfig(Configuration config)
{
Configuration similarConfig = null;
List<Configuration> similarOnes = new List<Configuration>();
int nbCount = config.BinaryOptions.Count;
if (config.BinaryOptions.Keys.Contains(varModel.Root))
nbCount--;
bool found = false;
foreach (var configInGS in GlobalState.allMeasurements.getSimilarConfigs(config))
{
if (config.Equals(configInGS))
{
similarConfig = configInGS;
found = true;
break;
}
else if (takeSimilarConfig)
{
var conf = findSimilarConfigBinary(config, configInGS, nbCount);
if (conf != null)
similarOnes.Add(conf);
}
}
if (!found)
{
if (takeSimilarConfig && similarOnes.Count > 0)
similarConfig = findSimilarConfigNumeric(config, similarOnes);
else
{
if (similarOnes.Count == 0)
logError.logLine("Required config: " + config.ToString() + " " + config.printConfigurationForMeasurement());
// logError.log("Did not find a measured value for the configuration: " + config.ToString());
}
}
return Tuple.Create<Configuration, Configuration>(config, similarConfig);
}