本文整理汇总了C#中Settings.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Settings.ToString方法的具体用法?C# Settings.ToString怎么用?C# Settings.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Settings
的用法示例。
在下文中一共展示了Settings.ToString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDefaultValue
public static string GetDefaultValue(Settings setting)
{
SettingsInfo settingInfo;
if (_settingsMap.TryGetValue(setting, out settingInfo)) {
return settingInfo.defaultValue;
} else {
Logger.Error(TAG, String.Format("Unable to get name for setting \"{0}\"", setting.ToString()));
return null;
}
}
示例2: Setup
public void Setup()
{
Transport = new JenkinsTransportExtension();
var settings = new Settings()
{
Project = String.Empty,
Username = String.Empty,
Password = String.Empty,
Server = "https://builds.apache.org/"
};
Transport.Settings = settings.ToString();
Transport.Configuration = new BuildServer(settings.Server);
}
示例3: TestSerialization
public void TestSerialization()
{
var settings = new Settings()
{
Project = "Test Project",
Server = "Test Server",
Username = "Tester",
Password = "TestPassword"
};
var serializedString = settings.ToString().Replace(Environment.NewLine, String.Empty);
StringAssert.Matches(serializedString, new Regex("<JenkinsServerManagerSettings.*?>.*?</JenkinsServerManagerSettings>"));
StringAssert.Matches(serializedString, new Regex("<Server.*?>" + settings.Server + "</Server>"));
StringAssert.Matches(serializedString, new Regex("<Project.*?>" + settings.Project + "</Project>"));
StringAssert.Matches(serializedString, new Regex("<AuthorizationInformation.*?>" + settings.AuthorizationInformation + "</AuthorizationInformation>"));
StringAssert.DoesNotMatch(serializedString, new Regex("<Username.*?>" + settings.Username + "</Username>"));
StringAssert.DoesNotMatch(serializedString, new Regex("<Password.*?>" + settings.Password + "</Password>"));
}
示例4: Build
void Build(string filePath) {
if (File.Exists(filePath)) {
string name = filePath.FromLast('/').UpToFirst('.');
string content = File.ReadAllText(filePath);
Settings settings = new Settings(content);
//Debug.Log(settings.ToString());
StreamWriter sr = File.CreateText(targetPath + name + ".cs");
sr.Write(settings.ToString());
sr.Close();
Debug.Log("wrote file " + name + ".cs");
}
}
示例5: CreateTestTarget
private JenkinsTransportExtension CreateTestTarget(TestMocks mocks)
{
var Transport = new JenkinsTransportExtension();
var settings = new Settings()
{
Project = String.Empty,
Username = String.Empty,
Password = String.Empty,
Server = "https://builds.apache.org/"
};
Transport.JenkinsServerManagerFactory = mocks.JenkinsServerManagerFactory;
Transport.WebRequestFactory = mocks.WebRequestFactory;
Transport.JenkinsApiFactory = mocks.JenkinsApiFactory;
Transport.ConfigurationFormFactory = mocks.ConfigurationFormFactory;
Transport.DialogService = mocks.DialogService;
Transport.Settings = settings.ToString();
Transport.Configuration = new BuildServer(settings.Server);
return Transport;
}
示例6: Settings_setter_should_update_settings
public void Settings_setter_should_update_settings()
{
TestMocks mocks = new TestMocks();
var target = CreateTestTarget(mocks);
var settings = new Settings()
{
Project = "SomeProjectName",
Username = "SomeUserName",
Password = "SomePassword",
Server = "https://some.testserver.com/"
};
// Act
target.Settings = settings.ToString();
// Assert
target.Settings.Should().Be(settings.ToString());
}
示例7: CheckIfSettingExists
private bool CheckIfSettingExists(Settings settings)
{
return (_environment.Settings.Any(s => s.Name == settings.ToString()));
}
示例8: SetSettingsValue
public void SetSettingsValue(Settings setting, bool isValid, string value)
{
string propertyName = setting.ToString().Split('_')[1];
var property = this.GetType().GetProperty(propertyName);
if (property.PropertyType.Equals(typeof(ListViewModel)))
{
if (value == null)
{
value = "10";
}
var listViewModel = property.GetValue(this, null) as ListViewModel;
listViewModel.SelectedValue = value;
}
else
{
if (value == null)
{
value = "Yes";
}
var toggleSwitchViewModel = property.GetValue(this, null) as SimpleToggleSwitchViewModel;
toggleSwitchViewModel.IsValid = isValid;
toggleSwitchViewModel.IsChecked = value.Equals("Yes");
}
}
示例9: GetSettingsValue
public string GetSettingsValue(Settings setting)
{
string propertyName = setting.ToString().Split('_')[1];
var property = this.GetType().GetProperty(propertyName);
if (property.PropertyType.Equals(typeof(ListViewModel)))
{
var listViewModel = property.GetValue(this, null) as ListViewModel;
return listViewModel.SelectedValue;
}
else
{
var toggleSwitchViewModel = property.GetValue(this, null) as SimpleToggleSwitchViewModel;
return toggleSwitchViewModel.IsChecked ? "Yes" : "No";
}
}