GIT: perform LF normalization

This commit is contained in:
Gary Sharp
2013-02-28 17:15:46 +11:00
parent 989f08a24d
commit 7d9be5620d
729 changed files with 300734 additions and 300712 deletions
+36 -36
View File
@@ -1,36 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Disco.Data.Configuration
{
public abstract class ConfigurationBase
{
private ConfigurationContext _context;
public ConfigurationContext Context
{
get
{
return _context;
}
}
public abstract string Scope { get; }
public ConfigurationBase(ConfigurationContext Context)
{
this._context = Context;
}
protected void SetValue<ValueType>(string Key, ValueType Value)
{
this.Context.SetConfigurationValue(this.Scope, Key, Value);
}
protected ValueType GetValue<ValueType>(string Key, ValueType Default)
{
return this.Context.GetConfigurationValue(this.Scope, Key, Default);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Disco.Data.Configuration
{
public abstract class ConfigurationBase
{
private ConfigurationContext _context;
public ConfigurationContext Context
{
get
{
return _context;
}
}
public abstract string Scope { get; }
public ConfigurationBase(ConfigurationContext Context)
{
this._context = Context;
}
protected void SetValue<ValueType>(string Key, ValueType Value)
{
this.Context.SetConfigurationValue(this.Scope, Key, Value);
}
protected ValueType GetValue<ValueType>(string Key, ValueType Default)
{
return this.Context.GetConfigurationValue(this.Scope, Key, Default);
}
}
}
@@ -1,41 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Disco.Data.Configuration.Modules
{
public class BootstrapperConfiguration : ConfigurationBase
{
public BootstrapperConfiguration(ConfigurationContext Context) : base(Context) { }
public override string Scope
{
get { return "Bootstrapper"; }
}
public string MacSshUsername
{
get
{
return this.GetValue("MacSshUsername", "root");
}
set
{
this.SetValue("MacSshUsername", value);
}
}
public string MacSshPassword
{
get
{
return ConfigurationContext.DeobsfucateValue(this.GetValue("MacSshPassword", string.Empty));
}
set
{
this.SetValue("MacSshPassword", ConfigurationContext.ObsfucateValue(value));
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Disco.Data.Configuration.Modules
{
public class BootstrapperConfiguration : ConfigurationBase
{
public BootstrapperConfiguration(ConfigurationContext Context) : base(Context) { }
public override string Scope
{
get { return "Bootstrapper"; }
}
public string MacSshUsername
{
get
{
return this.GetValue("MacSshUsername", "root");
}
set
{
this.SetValue("MacSshUsername", value);
}
}
public string MacSshPassword
{
get
{
return ConfigurationContext.DeobsfucateValue(this.GetValue("MacSshPassword", string.Empty));
}
set
{
this.SetValue("MacSshPassword", ConfigurationContext.ObsfucateValue(value));
}
}
}
}
@@ -1,86 +1,86 @@
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
//
//
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Disco.Models.Repository;
//namespace Disco.Data.Configuration.Modules
//{
// public class DeviceProfileConfiguration : ConfigurationBase
// {
// private DeviceProfilesConfiguration deviceProfilesConfig;
// private DeviceProfile deviceProfile;
// public DeviceProfileConfiguration(ConfigurationContext Context, DeviceProfile DeviceProfile)
// : base(Context)
// {
// this.deviceProfilesConfig = Context.DeviceProfiles;
// this.deviceProfile = DeviceProfile;
// }
// public override string Scope
// {
// get
// {
// return string.Format("DeviceProfile:{0}", this.deviceProfile.Id);
// }
// }
// public string ComputerNameTemplate
// {
// get
// {
// return this.GetValue("ComputerNameTemplate", "DeviceProfile.ShortName + '-' + SerialNumber");
// }
// set
// {
// this.SetValue("ComputerNameTemplate", value);
// }
// }
// public enum DeviceProfileDistributionTypes : int
// {
// OneToMany = 0,
// OneToOne = 1
// }
// public DeviceProfileDistributionTypes DistributionType
// {
// get
// {
// return (DeviceProfileDistributionTypes)this.GetValue("DistributionType", (int)DeviceProfileDistributionTypes.OneToMany);
// }
// set
// {
// this.SetValue("DistributionType", (int)value);
// }
// }
// public string OrganisationalUnit
// {
// get
// {
// return this.GetValue<string>("OrganisationalUnit", null);
// }
// set
// {
// this.SetValue("OrganisationalUnit", value);
// }
// }
// public bool AllocateWirelessCertificate
// {
// get
// {
// return this.GetValue("AllocateWirelessCertificate", false);
// }
// set
// {
// this.SetValue("AllocateWirelessCertificate", value);
// }
// }
// }
//}
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
//
//
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Disco.Models.Repository;
//namespace Disco.Data.Configuration.Modules
//{
// public class DeviceProfileConfiguration : ConfigurationBase
// {
// private DeviceProfilesConfiguration deviceProfilesConfig;
// private DeviceProfile deviceProfile;
// public DeviceProfileConfiguration(ConfigurationContext Context, DeviceProfile DeviceProfile)
// : base(Context)
// {
// this.deviceProfilesConfig = Context.DeviceProfiles;
// this.deviceProfile = DeviceProfile;
// }
// public override string Scope
// {
// get
// {
// return string.Format("DeviceProfile:{0}", this.deviceProfile.Id);
// }
// }
// public string ComputerNameTemplate
// {
// get
// {
// return this.GetValue("ComputerNameTemplate", "DeviceProfile.ShortName + '-' + SerialNumber");
// }
// set
// {
// this.SetValue("ComputerNameTemplate", value);
// }
// }
// public enum DeviceProfileDistributionTypes : int
// {
// OneToMany = 0,
// OneToOne = 1
// }
// public DeviceProfileDistributionTypes DistributionType
// {
// get
// {
// return (DeviceProfileDistributionTypes)this.GetValue("DistributionType", (int)DeviceProfileDistributionTypes.OneToMany);
// }
// set
// {
// this.SetValue("DistributionType", (int)value);
// }
// }
// public string OrganisationalUnit
// {
// get
// {
// return this.GetValue<string>("OrganisationalUnit", null);
// }
// set
// {
// this.SetValue("OrganisationalUnit", value);
// }
// }
// public bool AllocateWirelessCertificate
// {
// get
// {
// return this.GetValue("AllocateWirelessCertificate", false);
// }
// set
// {
// this.SetValue("AllocateWirelessCertificate", value);
// }
// }
// }
//}
@@ -1,70 +1,70 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Disco.Models.Repository;
namespace Disco.Data.Configuration.Modules
{
public class DeviceProfilesConfiguration : ConfigurationBase
{
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
//private Dictionary<int, DeviceProfileConfiguration> deviceProfileConfigurations;
public DeviceProfilesConfiguration(ConfigurationContext Context)
: base(Context)
{
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
//this.deviceProfileConfigurations = new Dictionary<int, DeviceProfileConfiguration>();
}
public override string Scope
{
get { return "DeviceProfiles"; }
}
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
//public DeviceProfileConfiguration DeviceProfile(DeviceProfile Profile)
//{
// DeviceProfileConfiguration dpc = default(DeviceProfileConfiguration);
// if (!this.deviceProfileConfigurations.TryGetValue(Profile.Id, out dpc))
// {
// dpc = new DeviceProfileConfiguration(this.Context, Profile);
// this.deviceProfileConfigurations[Profile.Id] = dpc;
// }
// return dpc;
//}
public int DefaultDeviceProfileId
{
get
{
var v = this.GetValue("DefaultDeviceProfileId", 1);
if (v > 0)
return v;
else
return 1;
}
set
{
if (value < 1)
throw new ArgumentOutOfRangeException("value", "Expected >= 1");
this.SetValue("DefaultDeviceProfileId", value);
}
}
public int DefaultAddDeviceOfflineDeviceProfileId
{
get
{
return this.GetValue("DefaultAddDeviceOfflineDeviceProfileId", 0);
}
set
{
if (value < 0)
throw new ArgumentOutOfRangeException("value", "Expected >= 0");
this.SetValue("DefaultAddDeviceOfflineDeviceProfileId", value);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Disco.Models.Repository;
namespace Disco.Data.Configuration.Modules
{
public class DeviceProfilesConfiguration : ConfigurationBase
{
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
//private Dictionary<int, DeviceProfileConfiguration> deviceProfileConfigurations;
public DeviceProfilesConfiguration(ConfigurationContext Context)
: base(Context)
{
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
//this.deviceProfileConfigurations = new Dictionary<int, DeviceProfileConfiguration>();
}
public override string Scope
{
get { return "DeviceProfiles"; }
}
// Removed 2012-06-14 G# - Properties moved to DeviceProfile model & DB Migrated in DBv3.
//public DeviceProfileConfiguration DeviceProfile(DeviceProfile Profile)
//{
// DeviceProfileConfiguration dpc = default(DeviceProfileConfiguration);
// if (!this.deviceProfileConfigurations.TryGetValue(Profile.Id, out dpc))
// {
// dpc = new DeviceProfileConfiguration(this.Context, Profile);
// this.deviceProfileConfigurations[Profile.Id] = dpc;
// }
// return dpc;
//}
public int DefaultDeviceProfileId
{
get
{
var v = this.GetValue("DefaultDeviceProfileId", 1);
if (v > 0)
return v;
else
return 1;
}
set
{
if (value < 1)
throw new ArgumentOutOfRangeException("value", "Expected >= 1");
this.SetValue("DefaultDeviceProfileId", value);
}
}
public int DefaultAddDeviceOfflineDeviceProfileId
{
get
{
return this.GetValue("DefaultAddDeviceOfflineDeviceProfileId", 0);
}
set
{
if (value < 0)
throw new ArgumentOutOfRangeException("value", "Expected >= 0");
this.SetValue("DefaultAddDeviceOfflineDeviceProfileId", value);
}
}
}
}
@@ -1,89 +1,89 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Disco.Models.BI.Config;
using Disco.Models.Repository;
using Newtonsoft.Json;
namespace Disco.Data.Configuration.Modules
{
public class OrganisationAddressesConfiguration : ConfigurationBase
{
public OrganisationAddressesConfiguration(ConfigurationContext Context) : base(Context) { }
public override string Scope
{
get { return "OrganisationAddresses"; }
}
public OrganisationAddress GetAddress(int Id)
{
var address = default(OrganisationAddress);
var addressString = this.GetValue<string>(Id.ToString(), null);
if (addressString != null)
{
if (addressString.StartsWith("{"))
{
// Assume Json
address = JsonConvert.DeserializeObject<OrganisationAddress>(addressString);
}
else
{
// Assume Old Storage Method
address = OrganisationAddress.FromConfigurationEntry(Id, addressString);
}
}
return address;
}
public OrganisationAddress SetAddress(OrganisationAddress Address)
{
if (!Address.Id.HasValue)
{
Address.Id = NextOrganisationAddressId;
}
string addressString = JsonConvert.SerializeObject(Address);
this.SetValue(Address.Id.ToString(), addressString); //Address.ToConfigurationEntry());
return Address;
}
public void RemoveAddress(int Id)
{
// Set Config Item to null = Remove Configuration Item
this.SetValue<string>(Id.ToString(), null);
}
public List<OrganisationAddress> Addresses
{
get
{
Dictionary<string, ConfigurationItem> configAddress = default(Dictionary<string, ConfigurationItem>);
if (this.Context.ConfigurationDictionary(this.Scope).TryGetValue(this.Scope, out configAddress))
return configAddress.Select(
ca => ca.Value.Value.StartsWith("{") ?
JsonConvert.DeserializeObject<OrganisationAddress>(ca.Value.Value) :
OrganisationAddress.FromConfigurationEntry(int.Parse(ca.Key), ca.Value.Value)
).ToList();
else
return new List<OrganisationAddress>(); // Empty List - No Addresses
}
}
private int NextOrganisationAddressId
{
get
{
int nextId = 0;
while (true)
{
if (this.Context.ConfigurationItem(this.Scope, nextId.ToString()) == null)
break;
nextId++;
}
return nextId;
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Disco.Models.BI.Config;
using Disco.Models.Repository;
using Newtonsoft.Json;
namespace Disco.Data.Configuration.Modules
{
public class OrganisationAddressesConfiguration : ConfigurationBase
{
public OrganisationAddressesConfiguration(ConfigurationContext Context) : base(Context) { }
public override string Scope
{
get { return "OrganisationAddresses"; }
}
public OrganisationAddress GetAddress(int Id)
{
var address = default(OrganisationAddress);
var addressString = this.GetValue<string>(Id.ToString(), null);
if (addressString != null)
{
if (addressString.StartsWith("{"))
{
// Assume Json
address = JsonConvert.DeserializeObject<OrganisationAddress>(addressString);
}
else
{
// Assume Old Storage Method
address = OrganisationAddress.FromConfigurationEntry(Id, addressString);
}
}
return address;
}
public OrganisationAddress SetAddress(OrganisationAddress Address)
{
if (!Address.Id.HasValue)
{
Address.Id = NextOrganisationAddressId;
}
string addressString = JsonConvert.SerializeObject(Address);
this.SetValue(Address.Id.ToString(), addressString); //Address.ToConfigurationEntry());
return Address;
}
public void RemoveAddress(int Id)
{
// Set Config Item to null = Remove Configuration Item
this.SetValue<string>(Id.ToString(), null);
}
public List<OrganisationAddress> Addresses
{
get
{
Dictionary<string, ConfigurationItem> configAddress = default(Dictionary<string, ConfigurationItem>);
if (this.Context.ConfigurationDictionary(this.Scope).TryGetValue(this.Scope, out configAddress))
return configAddress.Select(
ca => ca.Value.Value.StartsWith("{") ?
JsonConvert.DeserializeObject<OrganisationAddress>(ca.Value.Value) :
OrganisationAddress.FromConfigurationEntry(int.Parse(ca.Key), ca.Value.Value)
).ToList();
else
return new List<OrganisationAddress>(); // Empty List - No Addresses
}
}
private int NextOrganisationAddressId
{
get
{
int nextId = 0;
while (true)
{
if (this.Context.ConfigurationItem(this.Scope, nextId.ToString()) == null)
break;
nextId++;
}
return nextId;
}
}
}
}
@@ -1,109 +1,109 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Disco.Data.Configuration.Modules
{
public class WirelessConfiguration : ConfigurationBase
{
public const string Provider_eduSTAR = "eduSTAR";
public const string Provider_eduPaSS = "eduPaSS";
public WirelessConfiguration(ConfigurationContext Context) : base(Context) { }
public override string Scope
{
get { return "Wireless"; }
}
public int CertificateAutoBufferMax
{
get
{
return this.GetValue("CertificateAutoBufferMax", 50);
}
set
{
this.SetValue("CertificateAutoBufferMax", value);
}
}
public int CertificateAutoBufferLow
{
get
{
return this.GetValue("CertificateAutoBufferLow", 10);
}
set
{
this.SetValue("CertificateAutoBufferLow", value);
}
}
public string Provider
{
get
{
return this.GetValue("Provider", Provider_eduSTAR);
}
set
{
if (string.IsNullOrEmpty(value))
throw new ArgumentNullException("value");
if (value.Equals(Provider_eduSTAR, StringComparison.InvariantCultureIgnoreCase))
this.SetValue("Provider", Provider_eduSTAR);
else
throw new NotSupportedException(string.Format("Unsupported Wireless Provider: ", value));
}
}
#region eduSTAR Configuration
public string eduSTAR_Scope
{
get { return "Wireless_eduSTAR"; }
}
public string eduSTAR_ServiceAccountSchoolId
{
get
{
return this.Context.GetConfigurationValue<string>(this.eduSTAR_Scope, "ServiceAccountSchoolId", null);
}
set
{
if (string.IsNullOrEmpty(value))
throw new ArgumentNullException("value");
this.Context.SetConfigurationValue(this.eduSTAR_Scope, "ServiceAccountSchoolId", value);
}
}
public string eduSTAR_ServiceAccountUsername
{
get
{
return this.Context.GetConfigurationValue<string>(this.eduSTAR_Scope, "ServiceAccountUsername", null);
}
set
{
if (string.IsNullOrEmpty(value))
throw new ArgumentNullException("value");
this.Context.SetConfigurationValue(this.eduSTAR_Scope, "ServiceAccountUsername", value);
}
}
public string eduSTAR_ServiceAccountPassword
{
get
{
return ConfigurationContext.DeobsfucateValue(this.Context.GetConfigurationValue<string>(this.eduSTAR_Scope, "ServiceAccountPassword", null));
}
set
{
if (string.IsNullOrEmpty(value))
throw new ArgumentNullException("value");
this.Context.SetConfigurationValue(this.eduSTAR_Scope, "ServiceAccountPassword", ConfigurationContext.ObsfucateValue(value));
}
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Disco.Data.Configuration.Modules
{
public class WirelessConfiguration : ConfigurationBase
{
public const string Provider_eduSTAR = "eduSTAR";
public const string Provider_eduPaSS = "eduPaSS";
public WirelessConfiguration(ConfigurationContext Context) : base(Context) { }
public override string Scope
{
get { return "Wireless"; }
}
public int CertificateAutoBufferMax
{
get
{
return this.GetValue("CertificateAutoBufferMax", 50);
}
set
{
this.SetValue("CertificateAutoBufferMax", value);
}
}
public int CertificateAutoBufferLow
{
get
{
return this.GetValue("CertificateAutoBufferLow", 10);
}
set
{
this.SetValue("CertificateAutoBufferLow", value);
}
}
public string Provider
{
get
{
return this.GetValue("Provider", Provider_eduSTAR);
}
set
{
if (string.IsNullOrEmpty(value))
throw new ArgumentNullException("value");
if (value.Equals(Provider_eduSTAR, StringComparison.InvariantCultureIgnoreCase))
this.SetValue("Provider", Provider_eduSTAR);
else
throw new NotSupportedException(string.Format("Unsupported Wireless Provider: ", value));
}
}
#region eduSTAR Configuration
public string eduSTAR_Scope
{
get { return "Wireless_eduSTAR"; }
}
public string eduSTAR_ServiceAccountSchoolId
{
get
{
return this.Context.GetConfigurationValue<string>(this.eduSTAR_Scope, "ServiceAccountSchoolId", null);
}
set
{
if (string.IsNullOrEmpty(value))
throw new ArgumentNullException("value");
this.Context.SetConfigurationValue(this.eduSTAR_Scope, "ServiceAccountSchoolId", value);
}
}
public string eduSTAR_ServiceAccountUsername
{
get
{
return this.Context.GetConfigurationValue<string>(this.eduSTAR_Scope, "ServiceAccountUsername", null);
}
set
{
if (string.IsNullOrEmpty(value))
throw new ArgumentNullException("value");
this.Context.SetConfigurationValue(this.eduSTAR_Scope, "ServiceAccountUsername", value);
}
}
public string eduSTAR_ServiceAccountPassword
{
get
{
return ConfigurationContext.DeobsfucateValue(this.Context.GetConfigurationValue<string>(this.eduSTAR_Scope, "ServiceAccountPassword", null));
}
set
{
if (string.IsNullOrEmpty(value))
throw new ArgumentNullException("value");
this.Context.SetConfigurationValue(this.eduSTAR_Scope, "ServiceAccountPassword", ConfigurationContext.ObsfucateValue(value));
}
}
#endregion
}
}