qol: use type keywords and more interpolated strings
This commit is contained in:
@@ -105,7 +105,7 @@ namespace Disco.Client
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.WriteLine("Error Report Logged to Server; Response: {0}", reportResponse);
|
Debug.WriteLine($"Error Report Logged to Server; Response: {reportResponse}");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ namespace Disco.Client.Extensions
|
|||||||
using (RegistryKey regWinlogon = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", true))
|
using (RegistryKey regWinlogon = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", true))
|
||||||
{
|
{
|
||||||
regWinlogon.SetValue("DefaultDomainName", enrolResponse.DomainName, RegistryValueKind.String);
|
regWinlogon.SetValue("DefaultDomainName", enrolResponse.DomainName, RegistryValueKind.String);
|
||||||
regWinlogon.SetValue("DefaultUserName", String.Empty, RegistryValueKind.String);
|
regWinlogon.SetValue("DefaultUserName", string.Empty, RegistryValueKind.String);
|
||||||
}
|
}
|
||||||
using (RegistryKey regLogonUI = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI", true))
|
using (RegistryKey regLogonUI = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI", true))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace Disco.ClientBootstrapper.Interop
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
throw new IOException(string.Format("Unable to delete folder: ", InstallLocation), ex);
|
throw new IOException($"Unable to delete folder: {InstallLocation}", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!Directory.Exists(InstallLocation))
|
if (!Directory.Exists(InstallLocation))
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ namespace Disco.ClientBootstrapper.Interop
|
|||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string NetConnectionID { get; set; }
|
public string NetConnectionID { get; set; }
|
||||||
public string MACAddress { get; set; }
|
public string MACAddress { get; set; }
|
||||||
public UInt64 Speed { get; set; }
|
public ulong Speed { get; set; }
|
||||||
public UInt16 LastConnectionStatus { get; set; }
|
public ushort LastConnectionStatus { get; set; }
|
||||||
public bool IsWireless { get; set; }
|
public bool IsWireless { get; set; }
|
||||||
public string WirelessInterfaceDescription { get; set; }
|
public string WirelessInterfaceDescription { get; set; }
|
||||||
public int LastWirelessConnectionStatus { get; set; }
|
public int LastWirelessConnectionStatus { get; set; }
|
||||||
@@ -28,12 +28,12 @@ namespace Disco.ClientBootstrapper.Interop
|
|||||||
private void UpdateFromWmi(ManagementObject wmiObject)
|
private void UpdateFromWmi(ManagementObject wmiObject)
|
||||||
{
|
{
|
||||||
WmiPath = (string)wmiObject.GetPropertyValue("__PATH");
|
WmiPath = (string)wmiObject.GetPropertyValue("__PATH");
|
||||||
Index = (UInt32)wmiObject.GetPropertyValue("Index");
|
Index = (uint)wmiObject.GetPropertyValue("Index");
|
||||||
Guid = Guid.Parse((string)wmiObject.GetPropertyValue("GUID"));
|
Guid = Guid.Parse((string)wmiObject.GetPropertyValue("GUID"));
|
||||||
MACAddress = (string)wmiObject.GetPropertyValue("MACAddress");
|
MACAddress = (string)wmiObject.GetPropertyValue("MACAddress");
|
||||||
Name = (string)wmiObject.GetPropertyValue("Name");
|
Name = (string)wmiObject.GetPropertyValue("Name");
|
||||||
NetConnectionID = (string)wmiObject.GetPropertyValue("NetConnectionID");
|
NetConnectionID = (string)wmiObject.GetPropertyValue("NetConnectionID");
|
||||||
Speed = (UInt64)wmiObject.GetPropertyValue("Speed");
|
Speed = (ulong)wmiObject.GetPropertyValue("Speed");
|
||||||
_ = ConnectionStatus;
|
_ = ConnectionStatus;
|
||||||
IsWireless = true;
|
IsWireless = true;
|
||||||
try
|
try
|
||||||
@@ -111,46 +111,46 @@ namespace Disco.ClientBootstrapper.Interop
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public UInt16 ConnectionStatus
|
public ushort ConnectionStatus
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
using (var wmiObject = new ManagementObject(WmiPath))
|
using (var wmiObject = new ManagementObject(WmiPath))
|
||||||
{
|
{
|
||||||
LastConnectionStatus = (UInt16)wmiObject.GetPropertyValue("NetConnectionStatus");
|
LastConnectionStatus = (ushort)wmiObject.GetPropertyValue("NetConnectionStatus");
|
||||||
}
|
}
|
||||||
return LastConnectionStatus;
|
return LastConnectionStatus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public string ConnectionStatusMeaning(UInt16 status)
|
public string ConnectionStatusMeaning(ushort status)
|
||||||
{
|
{
|
||||||
switch (status)
|
switch (status)
|
||||||
{
|
{
|
||||||
case (UInt16)0:
|
case (ushort)0:
|
||||||
return "Disconnected";
|
return "Disconnected";
|
||||||
case (UInt16)1:
|
case (ushort)1:
|
||||||
return "Connecting";
|
return "Connecting";
|
||||||
case (UInt16)2:
|
case (ushort)2:
|
||||||
return "Connected";
|
return "Connected";
|
||||||
case (UInt16)3:
|
case (ushort)3:
|
||||||
return "Disconnecting";
|
return "Disconnecting";
|
||||||
case (UInt16)4:
|
case (ushort)4:
|
||||||
return "Hardware not present";
|
return "Hardware not present";
|
||||||
case (UInt16)5:
|
case (ushort)5:
|
||||||
return "Hardware disabled";
|
return "Hardware disabled";
|
||||||
case (UInt16)6:
|
case (ushort)6:
|
||||||
return "Hardware malfunction";
|
return "Hardware malfunction";
|
||||||
case (UInt16)7:
|
case (ushort)7:
|
||||||
return "Media disconnected";
|
return "Media disconnected";
|
||||||
case (UInt16)8:
|
case (ushort)8:
|
||||||
return "Authenticating";
|
return "Authenticating";
|
||||||
case (UInt16)9:
|
case (ushort)9:
|
||||||
return "Authentication succeeded";
|
return "Authentication succeeded";
|
||||||
case (UInt16)10:
|
case (ushort)10:
|
||||||
return "Authentication failed";
|
return "Authentication failed";
|
||||||
case (UInt16)11:
|
case (ushort)11:
|
||||||
return "Invalid address";
|
return "Invalid address";
|
||||||
case (UInt16)12:
|
case (ushort)12:
|
||||||
return "Credentials required";
|
return "Credentials required";
|
||||||
default:
|
default:
|
||||||
return "Unknown";
|
return "Unknown";
|
||||||
|
|||||||
@@ -139,8 +139,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
|
|||||||
CreateFileAccessPrivate fileAccess = GetMappedFileAccess(access);
|
CreateFileAccessPrivate fileAccess = GetMappedFileAccess(access);
|
||||||
if (fileAccess == CreateFileAccessPrivate.Read && (!File.Exists(imageFilePath) || (CreateFileMode.OpenExisting != mode)))
|
if (fileAccess == CreateFileAccessPrivate.Read && (!File.Exists(imageFilePath) || (CreateFileMode.OpenExisting != mode)))
|
||||||
{
|
{
|
||||||
throw new System.UnauthorizedAccessException(string.Format(CultureInfo.CurrentCulture,
|
throw new System.UnauthorizedAccessException("Read access can be specified only with OpenExisting mode or OpenAlways mode when the .wim file does not exist.");
|
||||||
"Read access can be specified only with OpenExisting mode or OpenAlways mode when the .wim file does not exist."));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -153,7 +152,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
|
|||||||
}
|
}
|
||||||
catch (System.DllNotFoundException ex)
|
catch (System.DllNotFoundException ex)
|
||||||
{
|
{
|
||||||
throw new System.DllNotFoundException(string.Format(CultureInfo.CurrentCulture,
|
throw new System.DllNotFoundException(string.Format(
|
||||||
"Unable to load WIM libraries. Make sure the correct DLLs are present (Wimgapi.dll and Xmlrw.dll)."), ex.InnerException);
|
"Unable to load WIM libraries. Make sure the correct DLLs are present (Wimgapi.dll and Xmlrw.dll)."), ex.InnerException);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,8 +171,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
|
|||||||
//
|
//
|
||||||
//Throw an exception
|
//Throw an exception
|
||||||
//
|
//
|
||||||
throw new System.InvalidOperationException(string.Format(CultureInfo.CurrentCulture,
|
throw new System.InvalidOperationException($"Unable to open the .wim file {imageFilePath}.");
|
||||||
"Unable to open the .wim file {0}.", imageFilePath));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -575,12 +573,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
|
|||||||
//1. Leading 0xFEFF
|
//1. Leading 0xFEFF
|
||||||
//2. Be in <IMAGE></IMAGE>
|
//2. Be in <IMAGE></IMAGE>
|
||||||
//
|
//
|
||||||
string formattedXml = String.Format(CultureInfo.InvariantCulture,
|
string formattedXml = $"{UNICODE_FILE_MARKER}{"<IMAGE>"}{imageInformation}{"</IMAGE>"}";
|
||||||
"{0}{1}{2}{3}",
|
|
||||||
UNICODE_FILE_MARKER,
|
|
||||||
"<IMAGE>",
|
|
||||||
imageInformation,
|
|
||||||
"</IMAGE>");
|
|
||||||
|
|
||||||
NativeMethods.SetImageInformation(m_ImageHandle, formattedXml);
|
NativeMethods.SetImageInformation(m_ImageHandle, formattedXml);
|
||||||
GC.KeepAlive(this);
|
GC.KeepAlive(this);
|
||||||
@@ -691,9 +684,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
|
|||||||
//
|
//
|
||||||
//Everything failed; throw an exception
|
//Everything failed; throw an exception
|
||||||
//
|
//
|
||||||
throw new System.InvalidOperationException(string.Format(CultureInfo.CurrentCulture,
|
throw new System.InvalidOperationException($"Unable to open/create .wim file {imageFile}. Error = {rc}");
|
||||||
"Unable to open/create .wim file {0}. Error = {1}",
|
|
||||||
imageFile, rc));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return windowsImageHandle;
|
return windowsImageHandle;
|
||||||
@@ -728,8 +719,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
|
|||||||
//
|
//
|
||||||
//Throw an exception
|
//Throw an exception
|
||||||
//
|
//
|
||||||
throw new System.InvalidOperationException(string.Format(CultureInfo.CurrentCulture,
|
throw new System.InvalidOperationException($"Unable to close image handle. Error = {rc}");
|
||||||
"Unable to close image handle. Error = {0}", rc));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -764,7 +754,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
|
|||||||
//
|
//
|
||||||
//Throw an exception
|
//Throw an exception
|
||||||
//
|
//
|
||||||
throw new System.InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "Unable to set temporary path. Error = {0}", rc));
|
throw new System.InvalidOperationException($"Unable to set temporary path. Error = {rc}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -801,7 +791,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
|
|||||||
//
|
//
|
||||||
//Throw an exception
|
//Throw an exception
|
||||||
//
|
//
|
||||||
throw new System.InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "Unable to load image. Error = {0}", rc));
|
throw new System.InvalidOperationException($"Unable to load image. Error = {rc}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return hWim;
|
return hWim;
|
||||||
@@ -839,8 +829,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
|
|||||||
//
|
//
|
||||||
//Throw an exception
|
//Throw an exception
|
||||||
//
|
//
|
||||||
throw new System.InvalidOperationException(string.Format(CultureInfo.CurrentCulture,
|
throw new System.InvalidOperationException($"Failed to capture image from {path}. Error = {rc}");
|
||||||
"Failed to capture image from {0}. Error = {1}", path, rc));
|
|
||||||
}
|
}
|
||||||
return hImage;
|
return hImage;
|
||||||
}
|
}
|
||||||
@@ -880,7 +869,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
|
|||||||
//
|
//
|
||||||
//Throw an exception
|
//Throw an exception
|
||||||
//
|
//
|
||||||
throw new System.InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "Unable to get image count. Error = {0}", rc));
|
throw new System.InvalidOperationException($"Unable to get image count. Error = {rc}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
@@ -982,17 +971,14 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
|
|||||||
//
|
//
|
||||||
//Throw an exception
|
//Throw an exception
|
||||||
//
|
//
|
||||||
throw new System.InvalidOperationException(string.Format(CultureInfo.CurrentCulture,
|
throw new System.InvalidOperationException($"Unable to mount image {windowsImageFileName} to {mountPath}.");
|
||||||
"Unable to mount image {0} to {1}.", windowsImageFileName, mountPath));
|
|
||||||
}
|
}
|
||||||
if (status == false)
|
if (status == false)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
//Throw an exception
|
//Throw an exception
|
||||||
//
|
//
|
||||||
throw new System.InvalidOperationException(string.Format(CultureInfo.CurrentCulture,
|
throw new System.InvalidOperationException($"Unable to mount image {windowsImageFileName} to {mountPath}. Error = {rc}");
|
||||||
"Unable to mount image {0} to {1}. Error = {2}",
|
|
||||||
windowsImageFileName, mountPath, rc));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1029,8 +1015,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
|
|||||||
//
|
//
|
||||||
//Throw an exception
|
//Throw an exception
|
||||||
//
|
//
|
||||||
throw new System.InvalidOperationException(string.Format(CultureInfo.CurrentCulture,
|
throw new System.InvalidOperationException($"Unable to apply image to {applicationPath}. Error = {rc}");
|
||||||
"Unable to apply image to {0}. Error = {1}", applicationPath, rc));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1070,8 +1055,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
|
|||||||
//
|
//
|
||||||
//Throw an exception
|
//Throw an exception
|
||||||
//
|
//
|
||||||
throw new System.InvalidOperationException(string.Format(CultureInfo.CurrentCulture,
|
throw new System.InvalidOperationException($"Unable to get image information. Error = {rc}");
|
||||||
"Unable to get image information. Error = {0}", rc));
|
|
||||||
}
|
}
|
||||||
string s = Marshal.PtrToStringUni(info);
|
string s = Marshal.PtrToStringUni(info);
|
||||||
|
|
||||||
@@ -1119,8 +1103,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
|
|||||||
//
|
//
|
||||||
//Throw an exception
|
//Throw an exception
|
||||||
//
|
//
|
||||||
throw new System.InvalidOperationException(string.Format(CultureInfo.CurrentCulture,
|
throw new System.InvalidOperationException($"Unable to set image information. Error = {rc}");
|
||||||
"Unable to set image information. Error = {0}", rc));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1161,8 +1144,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
|
|||||||
//
|
//
|
||||||
//Throw an exception
|
//Throw an exception
|
||||||
//
|
//
|
||||||
throw new System.StackOverflowException(string.Format(CultureInfo.CurrentCulture,
|
throw new System.StackOverflowException($"Unable to unmount image {wimdowsImageFileName} from {mountPath}.",
|
||||||
"Unable to unmount image {0} from {1}.", wimdowsImageFileName, mountPath),
|
|
||||||
ex.InnerException);
|
ex.InnerException);
|
||||||
}
|
}
|
||||||
if (status == false)
|
if (status == false)
|
||||||
@@ -1170,9 +1152,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
|
|||||||
//
|
//
|
||||||
//Throw an exception
|
//Throw an exception
|
||||||
//
|
//
|
||||||
throw new System.InvalidOperationException(string.Format(CultureInfo.CurrentCulture,
|
throw new System.InvalidOperationException($"Unable to unmount image {wimdowsImageFileName} from {mountPath}. Error = {rc}");
|
||||||
"Unable to unmount image {0} from {1}. Error = {2}",
|
|
||||||
wimdowsImageFileName, mountPath, rc));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1228,7 +1208,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
|
|||||||
//
|
//
|
||||||
//Throw an exception
|
//Throw an exception
|
||||||
//
|
//
|
||||||
throw new System.InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "Unable to register message callback."));
|
throw new System.InvalidOperationException("Unable to register message callback.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1260,7 +1240,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
|
|||||||
//
|
//
|
||||||
// Throw an exception
|
// Throw an exception
|
||||||
//
|
//
|
||||||
throw new System.InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "Unable to unregister message callback."));
|
throw new System.InvalidOperationException("Unable to unregister message callback.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1358,7 +1338,7 @@ namespace Disco.ClientBootstrapper.Interop.WIMInterop
|
|||||||
fileAccess = CreateFileAccessPrivate.Write;
|
fileAccess = CreateFileAccessPrivate.Write;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "No file access level specified."));
|
throw new ArgumentException("No file access level specified.");
|
||||||
}
|
}
|
||||||
return fileAccess;
|
return fileAccess;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -177,18 +177,18 @@ namespace Disco.Data.Configuration
|
|||||||
#region Helpers
|
#region Helpers
|
||||||
private static bool IsConvertableFromString(Type t)
|
private static bool IsConvertableFromString(Type t)
|
||||||
{
|
{
|
||||||
if (t == typeof(Boolean) ||
|
if (t == typeof(bool) ||
|
||||||
t == typeof(Char) ||
|
t == typeof(char) ||
|
||||||
t == typeof(SByte) ||
|
t == typeof(sbyte) ||
|
||||||
t == typeof(Byte) ||
|
t == typeof(byte) ||
|
||||||
t == typeof(Int16) || t == typeof(UInt16) ||
|
t == typeof(short) || t == typeof(ushort) ||
|
||||||
t == typeof(Int32) || t == typeof(UInt32) ||
|
t == typeof(int) || t == typeof(uint) ||
|
||||||
t == typeof(Int64) || t == typeof(UInt64) ||
|
t == typeof(long) || t == typeof(ulong) ||
|
||||||
t == typeof(Single) ||
|
t == typeof(float) ||
|
||||||
t == typeof(Double) ||
|
t == typeof(double) ||
|
||||||
t == typeof(Decimal) ||
|
t == typeof(decimal) ||
|
||||||
t == typeof(DateTime) ||
|
t == typeof(DateTime) ||
|
||||||
t == typeof(String))
|
t == typeof(string))
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ namespace Disco.Services.Documents
|
|||||||
|
|
||||||
private static int chooseMaskPattern(BitArray bits, ErrorCorrectionLevel ecLevel, ZXing.QrCode.Internal.Version version, ByteMatrix matrix)
|
private static int chooseMaskPattern(BitArray bits, ErrorCorrectionLevel ecLevel, ZXing.QrCode.Internal.Version version, ByteMatrix matrix)
|
||||||
{
|
{
|
||||||
int minPenalty = Int32.MaxValue; // Lower penalty is better.
|
int minPenalty = int.MaxValue; // Lower penalty is better.
|
||||||
int bestMaskPattern = -1;
|
int bestMaskPattern = -1;
|
||||||
// We try all mask patterns to choose the best one.
|
// We try all mask patterns to choose the best one.
|
||||||
for (int maskPattern = 0; maskPattern < QRCode.NUM_MASK_PATTERNS; maskPattern++)
|
for (int maskPattern = 0; maskPattern < QRCode.NUM_MASK_PATTERNS; maskPattern++)
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ namespace Disco.Services
|
|||||||
AttachmentDataStoreExtensions.RepositoryFilename);
|
AttachmentDataStoreExtensions.RepositoryFilename);
|
||||||
|
|
||||||
if (!publishJobResult.Success)
|
if (!publishJobResult.Success)
|
||||||
throw new Exception(string.Format("Disco ICT Online Services failed with the following message: ", publishJobResult.ErrorMessage));
|
throw new Exception($"Disco ICT Online Services failed with the following message: {publishJobResult.ErrorMessage}");
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(FaultDescription))
|
if (string.IsNullOrWhiteSpace(FaultDescription))
|
||||||
FaultDescription = publishJobResult.PublishMessage;
|
FaultDescription = publishJobResult.PublishMessage;
|
||||||
@@ -433,7 +433,7 @@ namespace Disco.Services
|
|||||||
AttachmentDataStoreExtensions.RepositoryFilename);
|
AttachmentDataStoreExtensions.RepositoryFilename);
|
||||||
|
|
||||||
if (!publishJobResult.Success)
|
if (!publishJobResult.Success)
|
||||||
throw new Exception(string.Format("Disco ICT Online Services failed with the following message: ", publishJobResult.ErrorMessage));
|
throw new Exception($"Disco ICT Online Services failed with the following message: {publishJobResult.ErrorMessage}");
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(RepairDescription))
|
if (string.IsNullOrWhiteSpace(RepairDescription))
|
||||||
RepairDescription = publishJobResult.PublishMessage;
|
RepairDescription = publishJobResult.PublishMessage;
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ namespace Disco.Services.Jobs.JobQueues
|
|||||||
JobId = jqj.JobId,
|
JobId = jqj.JobId,
|
||||||
TechUserId = jqj.AddedUserId,
|
TechUserId = jqj.AddedUserId,
|
||||||
Timestamp = jqj.AddedDate,
|
Timestamp = jqj.AddedDate,
|
||||||
Comments = string.Format("# Added to Queue\r\n**{0}**\r\nPriority: **{1}**\r\n{2}", Environment.NewLine, queue.Name, jqj.Priority.ToString(), string.IsNullOrWhiteSpace(jqj.AddedComment) ? "<no comment>" : jqj.AddedComment)
|
Comments = $"# Added to Queue\r\n**{queue.Name}**\r\nPriority: **{jqj.Priority.ToString()}**\r\n{(string.IsNullOrWhiteSpace(jqj.AddedComment) ? "<no comment>" : jqj.AddedComment)}"
|
||||||
});
|
});
|
||||||
Database.JobLogs.Add(new JobLog()
|
Database.JobLogs.Add(new JobLog()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace Disco.Services.Logging
|
|||||||
private static object _LogModulesLock = new object();
|
private static object _LogModulesLock = new object();
|
||||||
|
|
||||||
private static LogContext _Current;
|
private static LogContext _Current;
|
||||||
private static object _CurrentLock = new Object();
|
private static object _CurrentLock = new object();
|
||||||
public static LogContext Current
|
public static LogContext Current
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ namespace Disco.Services.Plugins
|
|||||||
int num = (obj2 != null) ? (((int)obj2) + 1) : 1000;
|
int num = (obj2 != null) ? (((int)obj2) + 1) : 1000;
|
||||||
ViewPage.ViewContext.HttpContext.Items["DiscoPluginLastFormNum"] = num;
|
ViewPage.ViewContext.HttpContext.Items["DiscoPluginLastFormNum"] = num;
|
||||||
|
|
||||||
builder.GenerateId(string.Format(CultureInfo.InvariantCulture, "form{0}", new object[] { num }));
|
builder.GenerateId($"form{num}");
|
||||||
}
|
}
|
||||||
ViewPage.ViewContext.Writer.Write(builder.ToString(TagRenderMode.StartTag));
|
ViewPage.ViewContext.Writer.Write(builder.ToString(TagRenderMode.StartTag));
|
||||||
MvcForm form = new MvcForm(ViewPage.ViewContext);
|
MvcForm form = new MvcForm(ViewPage.ViewContext);
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ namespace Disco.Services.Plugins
|
|||||||
_PluginAssemblyManifests = _PluginManifests.Values.ToDictionary(p => p.PluginAssembly, p => p);
|
_PluginAssemblyManifests = _PluginManifests.Values.ToDictionary(p => p.PluginAssembly, p => p);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PluginManifest UpdatePlugin(DiscoDataContext Database, PluginManifest ExistingManifest, String UpdatePluginPackageFilePath, PluginLibraryIncompatibility PluginLibraryIncompatibility = null)
|
public static PluginManifest UpdatePlugin(DiscoDataContext Database, PluginManifest ExistingManifest, string UpdatePluginPackageFilePath, PluginLibraryIncompatibility PluginLibraryIncompatibility = null)
|
||||||
{
|
{
|
||||||
PluginManifest updatedManifest;
|
PluginManifest updatedManifest;
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ namespace Disco.Services.Plugins
|
|||||||
int num = (lastFormNumber != null) ? (((int)lastFormNumber) + 1) : 1000;
|
int num = (lastFormNumber != null) ? (((int)lastFormNumber) + 1) : 1000;
|
||||||
ViewPage.ViewContext.HttpContext.Items["DiscoPluginLastFormNum"] = num;
|
ViewPage.ViewContext.HttpContext.Items["DiscoPluginLastFormNum"] = num;
|
||||||
|
|
||||||
builder.GenerateId(string.Format(CultureInfo.InvariantCulture, "form{0}", new object[] { num }));
|
builder.GenerateId($"form{num}");
|
||||||
}
|
}
|
||||||
ViewPage.ViewContext.Writer.Write(builder.ToString(TagRenderMode.StartTag));
|
ViewPage.ViewContext.Writer.Write(builder.ToString(TagRenderMode.StartTag));
|
||||||
MvcForm form = new MvcForm(ViewPage.ViewContext);
|
MvcForm form = new MvcForm(ViewPage.ViewContext);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace Disco.Web.Extensions
|
|||||||
selectItems = organisationAddressess.Select(wpd => new SelectListItem { Value = wpd.Id.Value.ToString(), Text = $"{wpd.Name} ({wpd.ShortName})", Selected = (SelectedId.Equals(wpd.Id)) }).ToList();
|
selectItems = organisationAddressess.Select(wpd => new SelectListItem { Value = wpd.Id.Value.ToString(), Text = $"{wpd.Name} ({wpd.ShortName})", Selected = (SelectedId.Equals(wpd.Id)) }).ToList();
|
||||||
|
|
||||||
if (IncludeInstructionFirst)
|
if (IncludeInstructionFirst)
|
||||||
selectItems.Insert(0, new SelectListItem() { Value = String.Empty, Text = $"<{InstructionMessage}>", Selected = !SelectedId.HasValue });
|
selectItems.Insert(0, new SelectListItem() { Value = string.Empty, Text = $"<{InstructionMessage}>", Selected = !SelectedId.HasValue });
|
||||||
|
|
||||||
return selectItems;
|
return selectItems;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace Disco.Web.Extensions
|
|||||||
var selectItems = items.OrderBy(i => i.Text).ToList();
|
var selectItems = items.OrderBy(i => i.Text).ToList();
|
||||||
|
|
||||||
if (IncludeInstructionFirst)
|
if (IncludeInstructionFirst)
|
||||||
selectItems.Insert(0, new SelectListItem() { Value = String.Empty, Text = $"<{InstructionMessage}>", Selected = (selectedIds?.Count ?? 0) != 0 });
|
selectItems.Insert(0, new SelectListItem() { Value = string.Empty, Text = $"<{InstructionMessage}>", Selected = (selectedIds?.Count ?? 0) != 0 });
|
||||||
|
|
||||||
return selectItems;
|
return selectItems;
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ namespace Disco.Web.Extensions
|
|||||||
selectItems = PluginDefinitions.Select(wpd => new SelectListItem { Value = wpd.Id, Text = wpd.Name, Selected = (SelectedId.Equals(wpd.Id)) }).ToList();
|
selectItems = PluginDefinitions.Select(wpd => new SelectListItem { Value = wpd.Id, Text = wpd.Name, Selected = (SelectedId.Equals(wpd.Id)) }).ToList();
|
||||||
|
|
||||||
if (IncludeInstructionFirst)
|
if (IncludeInstructionFirst)
|
||||||
selectItems.Insert(0, new SelectListItem() { Value = String.Empty, Text = $"<{InstructionMessage}>", Selected = String.IsNullOrEmpty(SelectedId) });
|
selectItems.Insert(0, new SelectListItem() { Value = string.Empty, Text = $"<{InstructionMessage}>", Selected = string.IsNullOrEmpty(SelectedId) });
|
||||||
|
|
||||||
return selectItems;
|
return selectItems;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace Disco.Web
|
|||||||
BundleTable.Add(new FileBundle($"~/ClientScripts/Modules/{f.Name.Substring(0, f.Name.Length - 3)}", f.FullName));
|
BundleTable.Add(new FileBundle($"~/ClientScripts/Modules/{f.Name.Substring(0, f.Name.Length - 3)}", f.FullName));
|
||||||
#else
|
#else
|
||||||
foreach (FileInfo f in new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ClientSource/Scripts/Modules")).EnumerateFiles("*.min.js", SearchOption.TopDirectoryOnly))
|
foreach (FileInfo f in new DirectoryInfo(HttpContext.Current.Server.MapPath("~/ClientSource/Scripts/Modules")).EnumerateFiles("*.min.js", SearchOption.TopDirectoryOnly))
|
||||||
BundleTable.Add(new FileBundle(string.Format("~/ClientScripts/Modules/{0}", f.Name.Substring(0, f.Name.Length - 7)), f.FullName));
|
BundleTable.Add(new FileBundle($"~/ClientScripts/Modules/{f.Name.Substring(0, f.Name.Length - 7)}", f.FullName));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user