diff --git a/src/Microsoft.Devices.HardwareDevCenterManager/DevCenterHandler.cs b/src/Microsoft.Devices.HardwareDevCenterManager/DevCenterHandler.cs index 84a2ed2..d885056 100644 --- a/src/Microsoft.Devices.HardwareDevCenterManager/DevCenterHandler.cs +++ b/src/Microsoft.Devices.HardwareDevCenterManager/DevCenterHandler.cs @@ -61,17 +61,17 @@ public async Task InvokeHdcService( HttpMethod method, string uri, object input, Action processContent) { DevCenterErrorReturn returnError = null; - string RequestId = Guid.NewGuid().ToString(); + string requestId = Guid.NewGuid().ToString(); string json = JsonSerializer.Serialize(input ?? new object()); using HttpClient client = new(_authHandler, false); client.DefaultRequestHeaders.Add("MS-CorrelationId", _correlationId.ToString()); - client.DefaultRequestHeaders.Add("MS-RequestId", RequestId); + client.DefaultRequestHeaders.Add("MS-RequestId", requestId); _trace = new DevCenterTrace() { CorrelationId = _correlationId.ToString(), - RequestId = RequestId, + RequestId = requestId, Method = method.ToString(), Url = uri, Content = json @@ -301,8 +301,7 @@ public async Task> GetSubmission(string productId, return await HdcGet(getProductSubmissionUrl, isMany); } - private const string _devCenterPartnerSubmissionUrl = - "/hardware/products/relationships/sourcepubliherid/{0}/sourceproductid/{1}/sourcesubmissionid/{2}"; + private const string _devCenterPartnerSubmissionUrl = "/hardware/products/relationships/sourcepubliherid/{0}/sourceproductid/{1}/sourcesubmissionid/{2}"; /// /// Gets shared submission info from a partner-shared Submission with partner ids diff --git a/src/Microsoft.Devices.HardwareDevCenterManager/Models/HardwareId.cs b/src/Microsoft.Devices.HardwareDevCenterManager/Models/HardwareId.cs index 80f79e8..a45dd6e 100644 --- a/src/Microsoft.Devices.HardwareDevCenterManager/Models/HardwareId.cs +++ b/src/Microsoft.Devices.HardwareDevCenterManager/Models/HardwareId.cs @@ -1,27 +1,27 @@ -/*++ - Copyright (c) Microsoft Corporation. All rights reserved. - - Licensed under the MIT license. See LICENSE file in the project root for full license information. ---*/ - -using System.Text.Json.Serialization; - -namespace Microsoft.Devices.HardwareDevCenterManager.DevCenterApi; - -public class HardwareId -{ - [JsonPropertyName("bundleId")] - public string BundleId { get; set; } - - [JsonPropertyName("infId")] - public string InfId { get; set; } - - [JsonPropertyName("operatingSystemCode")] - public string OperatingSystemCode { get; set; } - - [JsonPropertyName("pnpString")] +/*++ + Copyright (c) Microsoft Corporation. All rights reserved. + + Licensed under the MIT license. See LICENSE file in the project root for full license information. +--*/ + +using System.Text.Json.Serialization; + +namespace Microsoft.Devices.HardwareDevCenterManager.DevCenterApi; + +public class HardwareId +{ + [JsonPropertyName("bundleId")] + public string BundleId { get; set; } + + [JsonPropertyName("infId")] + public string InfId { get; set; } + + [JsonPropertyName("operatingSystemCode")] + public string OperatingSystemCode { get; set; } + + [JsonPropertyName("pnpString")] public string PnpString { get; set; } - [JsonPropertyName("distributionState")] - public string DistributionState { get; set; } -} + [JsonPropertyName("distributionState")] + public string DistributionState { get; set; } +} diff --git a/src/Microsoft.Devices.HardwareDevCenterManager/Models/WorkflowStatus.cs b/src/Microsoft.Devices.HardwareDevCenterManager/Models/WorkflowStatus.cs index 8f8e590..68a8e41 100644 --- a/src/Microsoft.Devices.HardwareDevCenterManager/Models/WorkflowStatus.cs +++ b/src/Microsoft.Devices.HardwareDevCenterManager/Models/WorkflowStatus.cs @@ -39,7 +39,7 @@ public async Task Dump() if (ErrorReport != null) { Console.WriteLine("> Error Report:"); - Utility.BlobStorageHandler bsh = new Utility.BlobStorageHandler(ErrorReport); + Utility.BlobStorageHandler bsh = new(ErrorReport); string errorContent = await bsh.DownloadToString(); Console.WriteLine(errorContent); Console.WriteLine(); diff --git a/src/Microsoft.Devices.HardwareDevCenterManager/Utility/AuthorizationHandler.cs b/src/Microsoft.Devices.HardwareDevCenterManager/Utility/AuthorizationHandler.cs index b9c9e9c..2950ad3 100644 --- a/src/Microsoft.Devices.HardwareDevCenterManager/Utility/AuthorizationHandler.cs +++ b/src/Microsoft.Devices.HardwareDevCenterManager/Utility/AuthorizationHandler.cs @@ -135,7 +135,7 @@ private async Task ObtainAccessToken() client.Timeout = _httpTimeout; Uri restApi = new(DevCenterTokenUrl); - ClientSecretCredential credential = new ClientSecretCredential(_authCredentials.TenantId, _authCredentials.ClientId, _authCredentials.Key); + ClientSecretCredential credential = new(_authCredentials.TenantId, _authCredentials.ClientId, _authCredentials.Key); AccessToken token = await credential.GetTokenAsync(new TokenRequestContext(scopes: new string[] { "https://manage.devcenter.microsoft.com/.default" })); if (string.IsNullOrEmpty(token.Token) == false) diff --git a/src/Microsoft.Devices.HardwareDevCenterManager/Utility/BlobStorageHandler.cs b/src/Microsoft.Devices.HardwareDevCenterManager/Utility/BlobStorageHandler.cs index c1a151b..9e04fe8 100644 --- a/src/Microsoft.Devices.HardwareDevCenterManager/Utility/BlobStorageHandler.cs +++ b/src/Microsoft.Devices.HardwareDevCenterManager/Utility/BlobStorageHandler.cs @@ -35,7 +35,7 @@ public async Task Upload(string filePath) { try { - using System.IO.FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read); + using System.IO.FileStream fileStream = new(filePath, FileMode.Open, FileAccess.Read); await _blockBlobClient.UploadAsync(fileStream, null, default); } catch (RequestFailedException rfe) @@ -61,8 +61,6 @@ private void ReportProgress() // todo: see if we can find a way to write progress using the Azure.Storage namespace } - private long _fileSize; - /// /// Downloads to specified file from HDC Azure Storage ///