Skip to content

Commit

Permalink
update and add null checks for label information dump
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Carpenter committed Feb 19, 2023
1 parent 1f4ce09 commit 804f4c4
Showing 1 changed file with 131 additions and 107 deletions.
238 changes: 131 additions & 107 deletions src/Microsoft.Devices.HardwareDevCenterManager/Models/ShippingLabel.cs
Original file line number Diff line number Diff line change
@@ -1,120 +1,144 @@
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT license. See LICENSE file in the project root for full license information.
--*/
using Newtonsoft.Json;
using System;
using System.Collections.Generic;

namespace Microsoft.Devices.HardwareDevCenterManager.DevCenterApi
{
public class ShippingLabel : IArtifact
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("productId")]
public string ProductId { get; set; }

[JsonProperty("submissionId")]
public string SubmissionId { get; set; }

[JsonProperty("publishingSpecifications")]
public PublishingSpecifications PublishingSpecifications { get; set; }

[JsonProperty("targeting")]
public Targeting Targeting { get; set; }

[JsonProperty("workflowStatus")]
public WorkflowStatus WorkflowStatus { get; set; }

[JsonProperty("links")]
public List<Link> Links;

[JsonProperty("name")]
public string Name { get; set; }

[JsonProperty("destination")]
public string Destination { get; set; }

public async void Dump()
{
Console.WriteLine("---- Shipping Label: " + Id);
Console.WriteLine(" Name: " + Name);
Console.WriteLine(" ProductId: " + ProductId);
Console.WriteLine(" SubmissionId: " + SubmissionId);
Console.WriteLine(" Destination: " + Destination);

Console.WriteLine(" Publishing Specifications:");
if (PublishingSpecifications != null)
{
Console.WriteLine(" publishToWindows10s: " + PublishingSpecifications.PublishToWindows10S);
Console.WriteLine(" isDisclosureRestricted: " + PublishingSpecifications.IsDisclosureRestricted);
Console.WriteLine(" isAutoInstallOnApplicableSystems: " + PublishingSpecifications.IsAutoInstallOnApplicableSystems);
Console.WriteLine(" isAutoInstallDuringOSUpgrade: " + PublishingSpecifications.IsAutoInstallDuringOSUpgrade);
Console.WriteLine(" goLiveDate: " + PublishingSpecifications.GoLiveDate);
Console.WriteLine(" additionalInfoForMsApproval:");
Console.WriteLine(" businessJustification: " + PublishingSpecifications.AdditionalInfoForMsApproval.BusinessJustification);
Console.WriteLine(" hasUiSoftware: " + PublishingSpecifications.AdditionalInfoForMsApproval.HasUiSoftware);
Console.WriteLine(" isCoEngineered: " + PublishingSpecifications.AdditionalInfoForMsApproval.IsCoEngineered);
Console.WriteLine(" isForUnreleasedHardware: " + PublishingSpecifications.AdditionalInfoForMsApproval.IsForUnreleasedHardware);
Console.WriteLine(" isRebootRequired: " + PublishingSpecifications.AdditionalInfoForMsApproval.IsRebootRequired);
Console.WriteLine(" microsoftContact: " + PublishingSpecifications.AdditionalInfoForMsApproval.MicrosoftContact);
Console.WriteLine(" validationsPerformed: " + PublishingSpecifications.AdditionalInfoForMsApproval.ValidationsPerformed);
Console.WriteLine(" affectedOems:");
foreach (string oem in PublishingSpecifications.AdditionalInfoForMsApproval.AffectedOems)
{
Console.WriteLine(" " + oem);
}
}

Console.WriteLine(" Targeting:");
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT license. See LICENSE file in the project root for full license information.
--*/
using Newtonsoft.Json;
using System;
using System.Collections.Generic;

namespace Microsoft.Devices.HardwareDevCenterManager.DevCenterApi
{
public class ShippingLabel : IArtifact
{
[JsonProperty("id")]
public string Id { get; set; }

[JsonProperty("productId")]
public string ProductId { get; set; }

[JsonProperty("submissionId")]
public string SubmissionId { get; set; }

[JsonProperty("publishingSpecifications")]
public PublishingSpecifications PublishingSpecifications { get; set; }

[JsonProperty("targeting")]
public Targeting Targeting { get; set; }

[JsonProperty("workflowStatus")]
public WorkflowStatus WorkflowStatus { get; set; }

[JsonProperty("links")]
public List<Link> Links;

[JsonProperty("name")]
public string Name { get; set; }

[JsonProperty("destination")]
public string Destination { get; set; }

public async void Dump()
{
Console.WriteLine("---- Shipping Label: " + Id);
Console.WriteLine(" Name: " + Name);
Console.WriteLine(" ProductId: " + ProductId);
Console.WriteLine(" SubmissionId: " + SubmissionId);
Console.WriteLine(" Destination: " + Destination);

Console.WriteLine(" Publishing Specifications:");
if (PublishingSpecifications != null)
{
Console.WriteLine(" publishToWindows10s: " + PublishingSpecifications.PublishToWindows10S);
Console.WriteLine(" isDisclosureRestricted: " + PublishingSpecifications.IsDisclosureRestricted);
Console.WriteLine(" isAutoInstallOnApplicableSystems: " + PublishingSpecifications.IsAutoInstallOnApplicableSystems);
Console.WriteLine(" isAutoInstallDuringOSUpgrade: " + PublishingSpecifications.IsAutoInstallDuringOSUpgrade);
Console.WriteLine(" goLiveDate: " + PublishingSpecifications.GoLiveDate);
Console.WriteLine(" additionalInfoForMsApproval:");
Console.WriteLine(" businessJustification: " + PublishingSpecifications.AdditionalInfoForMsApproval.BusinessJustification);
Console.WriteLine(" hasUiSoftware: " + PublishingSpecifications.AdditionalInfoForMsApproval.HasUiSoftware);
Console.WriteLine(" isCoEngineered: " + PublishingSpecifications.AdditionalInfoForMsApproval.IsCoEngineered);
Console.WriteLine(" isForUnreleasedHardware: " + PublishingSpecifications.AdditionalInfoForMsApproval.IsForUnreleasedHardware);
Console.WriteLine(" isRebootRequired: " + PublishingSpecifications.AdditionalInfoForMsApproval.IsRebootRequired);
Console.WriteLine(" microsoftContact: " + PublishingSpecifications.AdditionalInfoForMsApproval.MicrosoftContact);
Console.WriteLine(" validationsPerformed: " + PublishingSpecifications.AdditionalInfoForMsApproval.ValidationsPerformed);
Console.WriteLine(" affectedOems:");
foreach (string oem in PublishingSpecifications.AdditionalInfoForMsApproval.AffectedOems)
{
Console.WriteLine(" " + oem);
}
}

Console.WriteLine(" Targeting:");
if (Targeting != null)
{
// hardware ids
Console.WriteLine(" hardwareIds:");
foreach (HardwareId hid in Targeting.HardwareIds)
if (Targeting.HardwareIds.Count > 0)
{
Console.WriteLine(" bundledId: " + hid.BundleId);
Console.WriteLine(" infId: " + hid.InfId);
Console.WriteLine(" operatingSystemCode: " + hid.OperatingSystemCode);
Console.WriteLine(" pnpString: " + hid.PnpString);
Console.WriteLine(" distributionsState: " + hid.DistributionState);
foreach (HardwareId hid in Targeting.HardwareIds)
{
Console.WriteLine(" bundledId: " + hid.BundleId);
Console.WriteLine(" infId: " + hid.InfId);
Console.WriteLine(" operatingSystemCode: " + hid.OperatingSystemCode);
Console.WriteLine(" pnpString: " + hid.PnpString);
Console.WriteLine(" distributionsState: " + hid.DistributionState);
}
}

// chids
Console.WriteLine(" chids:");
foreach (CHID chid in Targeting.Chids)
if (Targeting.Chids.Count > 0)
{
Console.WriteLine(" chid: " + chid.Chid);
Console.WriteLine(" distributionState: " + chid.DistributionState);
foreach (CHID chid in Targeting.Chids)
{
Console.WriteLine(" chid: " + chid.Chid);
Console.WriteLine(" distributionState: " + chid.DistributionState);
}
}

// audiences
Console.WriteLine(" restrictedToAudiences:");
foreach (string audience in Targeting.RestrictedToAudiences)
if (Targeting.RestrictedToAudiences.Count > 0)
{
Console.WriteLine(" " + audience);
foreach (string audience in Targeting.RestrictedToAudiences)
{
Console.WriteLine(" " + audience);
}
}

// in service publish information
Console.WriteLine(" inServicePublishInfo:");
Console.WriteLine(" flooring: " + Targeting.InServicePublishInfo.Flooring);
Console.WriteLine(" ceiling: " + Targeting.InServicePublishInfo.Ceiling);
if (Targeting.InServicePublishInfo != null)
{
Console.WriteLine(" flooring: " + Targeting.InServicePublishInfo.Flooring);
Console.WriteLine(" ceiling: " + Targeting.InServicePublishInfo.Ceiling);
}

// co-engineering driver publish information
Console.WriteLine(" coEngDriverPublishInfo:");
Console.WriteLine(" flooringBuildNumber: " + Targeting.CoEngDriverPublishInfo.FlooringBuildNumber);
Console.WriteLine(" ceilingBuildNumber: " + Targeting.CoEngDriverPublishInfo.CeilingBuildNumber);
}

Console.WriteLine(" Links:");
if (Links != null)
{
foreach (Link link in Links)
{
link.Dump();
}
}

Console.WriteLine(" Status:");
if (WorkflowStatus != null)
{
await WorkflowStatus.Dump();
}
Console.WriteLine();
}
}
}
if (Targeting.CoEngDriverPublishInfo != null)
{
Console.WriteLine(" flooringBuildNumber: " + Targeting.CoEngDriverPublishInfo.FlooringBuildNumber);
Console.WriteLine(" ceilingBuildNumber: " + Targeting.CoEngDriverPublishInfo.CeilingBuildNumber);
}
}

Console.WriteLine(" Links:");
if (Links != null)
{
foreach (Link link in Links)
{
link.Dump();
}
}

Console.WriteLine(" Status:");
if (WorkflowStatus != null)
{
await WorkflowStatus.Dump();
}
Console.WriteLine();
}
}
}

0 comments on commit 804f4c4

Please sign in to comment.