qol: simplify calls
This commit is contained in:
@@ -414,7 +414,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
|
||||
if (System.IO.File.Exists(tempFileName))
|
||||
{
|
||||
DJoinResult = System.Convert.ToBase64String(System.IO.File.ReadAllBytes(tempFileName));
|
||||
DJoinResult = Convert.ToBase64String(System.IO.File.ReadAllBytes(tempFileName));
|
||||
System.IO.File.Delete(tempFileName);
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(DJoinResult))
|
||||
|
||||
@@ -388,7 +388,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
netbootGUID = NetbootGUIDFromMACAddress(MACAddress);
|
||||
}
|
||||
|
||||
if (netbootGUID != System.Guid.Empty && netbootGUID != NetbootGUID)
|
||||
if (netbootGUID != Guid.Empty && netbootGUID != NetbootGUID)
|
||||
{
|
||||
SetNetbootGUID(WritableDomainController, netbootGUID);
|
||||
return true;
|
||||
@@ -418,7 +418,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
}
|
||||
else
|
||||
{
|
||||
NetbootGUIDFromMACAddress = System.Guid.Empty;
|
||||
NetbootGUIDFromMACAddress = Guid.Empty;
|
||||
}
|
||||
return NetbootGUIDFromMACAddress;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
return domain.GetAvailableDomainController().RetrieveADUserAccount(User.UserId, AdditionalProperties);
|
||||
}
|
||||
|
||||
public static IEnumerable<ADUserAccount> SearchADUserAccounts(string Term, bool Quick, int? ResultLimit = ActiveDirectory.DefaultSearchResultLimit, params string[] AdditionalProperties)
|
||||
public static IEnumerable<ADUserAccount> SearchADUserAccounts(string Term, bool Quick, int? ResultLimit = DefaultSearchResultLimit, params string[] AdditionalProperties)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Term))
|
||||
throw new ArgumentNullException("Term");
|
||||
@@ -133,7 +133,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
return domain.GetAvailableDomainController().RetrieveADGroupWithSecurityIdentifier(SecurityIdentifier, AdditionalProperties);
|
||||
}
|
||||
|
||||
public static IEnumerable<ADGroup> SearchADGroups(string Term, int? ResultLimit = ActiveDirectory.DefaultSearchResultLimit, params string[] AdditionalProperties)
|
||||
public static IEnumerable<ADGroup> SearchADGroups(string Term, int? ResultLimit = DefaultSearchResultLimit, params string[] AdditionalProperties)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Term))
|
||||
throw new ArgumentNullException("Term");
|
||||
@@ -279,7 +279,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
else
|
||||
{
|
||||
AccountUsername = AccountId.Substring(slashIndex + 1);
|
||||
return ActiveDirectory.Context.TryGetDomainByNetBiosName(AccountId.Substring(0, slashIndex), out Domain);
|
||||
return Context.TryGetDomainByNetBiosName(AccountId.Substring(0, slashIndex), out Domain);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ namespace Disco.Services.Interop.ActiveDirectory
|
||||
{
|
||||
var slashIndex = AccountId.IndexOf('\\');
|
||||
|
||||
if (slashIndex > 0 && AccountId.Substring(0, slashIndex).Equals(ActiveDirectory.Context.PrimaryDomain.NetBiosName, StringComparison.OrdinalIgnoreCase))
|
||||
if (slashIndex > 0 && AccountId.Substring(0, slashIndex).Equals(Context.PrimaryDomain.NetBiosName, StringComparison.OrdinalIgnoreCase))
|
||||
return AccountId.Substring(slashIndex + 1);
|
||||
else
|
||||
return AccountId;
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace Disco.Services.Interop.DiscoServices
|
||||
};
|
||||
var requestJson = JsonConvert.SerializeObject(body);
|
||||
|
||||
using (var request = new ByteArrayContent(System.Text.Encoding.UTF8.GetBytes(requestJson)))
|
||||
using (var request = new ByteArrayContent(Encoding.UTF8.GetBytes(requestJson)))
|
||||
{
|
||||
request.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Disco.Services.Interop.DiscoServices
|
||||
{
|
||||
Attachments
|
||||
.Select(a => new { Attachment = a, Filename = AttachmentFilenameRetriever(a, Database) })
|
||||
.Where(a => System.IO.File.Exists(a.Filename))
|
||||
.Where(a => File.Exists(a.Filename))
|
||||
.Select((a, i) => new { Attachment = a.Attachment, Filename = a.Filename, Index = i })
|
||||
.ToList()
|
||||
.ForEach(a =>
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Disco.Services.Interop.DiscoServices
|
||||
var appVersion = typeof(LicenseValidationTask).Assembly.GetName().Version.ToString(4);
|
||||
var updateUrl = $"{DiscoServiceHelpers.ServicesUrl}API/License/V1";
|
||||
|
||||
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(updateUrl);
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(updateUrl);
|
||||
|
||||
// Fix for Proxy Servers which don't support KeepAlive
|
||||
request.KeepAlive = false;
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace Disco.Services.Interop.DiscoServices
|
||||
|
||||
var manifestJson = JsonConvert.SerializeObject(result, Formatting.Indented);
|
||||
|
||||
var manifestFile = PluginLibrary.ManifestFilename(Database);
|
||||
var manifestFile = ManifestFilename(Database);
|
||||
|
||||
if (!Directory.Exists(Path.GetDirectoryName(manifestFile)))
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(manifestFile));
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Disco.Services.Interop.DiscoServices
|
||||
|
||||
var discoVersion = CurrentDiscoVersionFormatted();
|
||||
|
||||
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(UpdateUrl());
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(UpdateUrl());
|
||||
|
||||
// Fix for Proxy Servers which don't support KeepAlive
|
||||
request.KeepAlive = false;
|
||||
@@ -223,7 +223,7 @@ namespace Disco.Services.Interop.DiscoServices
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
m.InstalledPlugins = Disco.Services.Plugins.Plugins.GetPlugins().Select(manifest => new StatisticString() { Key = manifest.Id, Value = manifest.VersionFormatted }).ToList();
|
||||
m.InstalledPlugins = Plugins.Plugins.GetPlugins().Select(manifest => new StatisticString() { Key = manifest.Id, Value = manifest.VersionFormatted }).ToList();
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Disco.Services.Interop.VicEduDept
|
||||
{
|
||||
var DiscoBIVersion = UpdateQuery.CurrentDiscoVersionFormatted();
|
||||
|
||||
HttpWebRequest wReq = (HttpWebRequest)HttpWebRequest.Create("http://broadband.doe.wan/ipsearch/showresult.php");
|
||||
HttpWebRequest wReq = (HttpWebRequest)WebRequest.Create("http://broadband.doe.wan/ipsearch/showresult.php");
|
||||
|
||||
// Fix for Proxy Servers which don't support KeepAlive
|
||||
wReq.KeepAlive = false;
|
||||
|
||||
Reference in New Issue
Block a user