qol: interpolated strings
This commit is contained in:
@@ -51,15 +51,15 @@ namespace Disco.Services.Interop.DiscoServices
|
||||
.ToList()
|
||||
.ForEach(a =>
|
||||
{
|
||||
formData.Add(new StringContent(a.Attachment.Filename), string.Format("Attachments[{0}].Filename", a.Index));
|
||||
formData.Add(new StringContent(a.Attachment.MimeType), string.Format("Attachments[{0}].MimeType", a.Index));
|
||||
formData.Add(new StringContent(a.Attachment.Timestamp.ToISO8601()), string.Format("Attachments[{0}].CreatedDate", a.Index));
|
||||
formData.Add(new StringContent(a.Attachment.Filename), $"Attachments[{a.Index}].Filename");
|
||||
formData.Add(new StringContent(a.Attachment.MimeType), $"Attachments[{a.Index}].MimeType");
|
||||
formData.Add(new StringContent(a.Attachment.Timestamp.ToISO8601()), $"Attachments[{a.Index}].CreatedDate");
|
||||
if (a.Attachment.DocumentTemplateId != null)
|
||||
formData.Add(new StringContent(a.Attachment.DocumentTemplateId), string.Format("Attachments[{0}].DocumentTemplateId", a.Index));
|
||||
formData.Add(new StringContent(a.Attachment.DocumentTemplateId), $"Attachments[{a.Index}].DocumentTemplateId");
|
||||
if (a.Attachment.Comments != null)
|
||||
formData.Add(new StringContent(a.Attachment.Comments), string.Format("Attachments[{0}].Comments", a.Index));
|
||||
formData.Add(new StringContent(a.Attachment.Comments), $"Attachments[{a.Index}].Comments");
|
||||
|
||||
formData.Add(new ByteArrayContent(File.ReadAllBytes(a.Filename)), string.Format("Attachments[{0}].File", a.Index), a.Attachment.Filename);
|
||||
formData.Add(new ByteArrayContent(File.ReadAllBytes(a.Filename)), $"Attachments[{a.Index}].File", a.Attachment.Filename);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -63,10 +63,10 @@ namespace Disco.Services.Interop.DiscoServices
|
||||
return new PluginIncompatibility() { PluginId = r.PluginId, Version = rVersion, Reason = "This plugin release is blocked by Disco ICT Online Services" };
|
||||
|
||||
if (r.HostMinVersion != null && hostVersion < Version.Parse(r.HostMinVersion))
|
||||
return new PluginIncompatibility() { PluginId = r.PluginId, Version = rVersion, Reason = string.Format("This plugin requires v{0} or newer", r.HostMinVersion) };
|
||||
return new PluginIncompatibility() { PluginId = r.PluginId, Version = rVersion, Reason = $"This plugin requires v{r.HostMinVersion} or newer" };
|
||||
|
||||
if (r.HostMaxVersion != null && hostVersion > Version.Parse(r.HostMaxVersion))
|
||||
return new PluginIncompatibility() { PluginId = r.PluginId, Version = rVersion, Reason = string.Format("This plugin requires v{0} or older", r.HostMaxVersion) };
|
||||
return new PluginIncompatibility() { PluginId = r.PluginId, Version = rVersion, Reason = $"This plugin requires v{r.HostMaxVersion} or older" };
|
||||
|
||||
return null;
|
||||
}).Where(i => i != null).ToList()
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Disco.Services.Interop.DiscoServices
|
||||
|
||||
public static string FormatVersion(Version Version)
|
||||
{
|
||||
return string.Format("{0}.{1}.{2:0000}.{3:0000}", Version.Major, Version.Minor, Version.Build, Version.Revision);
|
||||
return $"{Version.Major}.{Version.Minor}.{Version.Build:0000}.{Version.Revision:0000}";
|
||||
}
|
||||
|
||||
public static string HashDeploymentData(DiscoDataContext Database, string Data)
|
||||
@@ -79,7 +79,7 @@ namespace Disco.Services.Interop.DiscoServices
|
||||
|
||||
request.ContentType = "application/json; charset=utf-8; encoding=gzip";
|
||||
request.Method = WebRequestMethods.Http.Post;
|
||||
request.UserAgent = string.Format("Disco/{0} (Update)", discoVersion);
|
||||
request.UserAgent = $"Disco/{discoVersion} (Update)";
|
||||
|
||||
using (var requestStream = request.GetRequestStream())
|
||||
{
|
||||
@@ -117,13 +117,13 @@ namespace Disco.Services.Interop.DiscoServices
|
||||
Database.DiscoConfiguration.UpdateLastCheckResponse = updateResult;
|
||||
Database.SaveChanges();
|
||||
|
||||
Status.SetFinishedMessage(string.Format("The update server reported Version {0} is the latest.", updateResult.LatestVersion));
|
||||
Status.SetFinishedMessage($"The update server reported Version {updateResult.LatestVersion} is the latest.");
|
||||
|
||||
return updateResult;
|
||||
}
|
||||
else
|
||||
{
|
||||
Status.SetTaskException(new WebException(string.Format("Server responded with: [{0}] {1}", response.StatusCode, response.StatusDescription)));
|
||||
Status.SetTaskException(new WebException($"Server responded with: [{response.StatusCode}] {response.StatusDescription}"));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -216,7 +216,7 @@ namespace Disco.Services.Interop.DiscoServices
|
||||
DeviceIdentifier = HashDeploymentData(Database, j.DeviceSerialNumber),
|
||||
UserIdentifier = HashDeploymentData(Database, j.UserId),
|
||||
TechnicianIdentifier = HashDeploymentData(Database, j.JobTechnicianId),
|
||||
DeviceModel = string.Format("{0};{1}", j.DeviceModelManufacturer, j.DeviceModelModel),
|
||||
DeviceModel = $"{j.DeviceModelManufacturer};{j.DeviceModelModel}",
|
||||
Repairer = j.JobType == JobType.JobTypeIds.HWar ? j.WarrantyRepairer : j.Repairer,
|
||||
RepairerLogged = j.JobType == JobType.JobTypeIds.HWar ? j.WarrantyRepairerLoggedDate : j.RepairerLoggedDate,
|
||||
RepairerCompleted = j.JobType == JobType.JobTypeIds.HWar ? j.WarrantyRepairerCompletedDate : j.RepairerCompletedDate
|
||||
|
||||
Reference in New Issue
Block a user