CreateManifestResult.cs (2309B)
1 // ----------------------------------------------------------------------------- 2 // <copyright file="CreateManifestResult.cs" company="Microsoft Corporation"> 3 // Copyright (c) Microsoft Corporation. Licensed under the MIT License. 4 // </copyright> 5 // ----------------------------------------------------------------------------- 6 7 namespace Microsoft.WinGetUtil.Common 8 { 9 using System; 10 using Microsoft.WinGetUtil.Interfaces; 11 12 /// <summary> 13 /// Class representing create manifest result. 14 /// </summary> 15 public class CreateManifestResult : IDisposable 16 { 17 /// <summary> 18 /// Initializes a new instance of the <see cref="CreateManifestResult"/> class. 19 /// </summary> 20 /// <param name="isValid">Is manifest valid.</param> 21 /// <param name="message">Warning or failure validation message.</param> 22 /// <param name="manifestHandle">Created manifest handle if succeeded.</param> 23 public CreateManifestResult(bool isValid, string message, IWinGetManifest manifestHandle) 24 { 25 this.IsValid = isValid; 26 this.Message = message; 27 this.ManifestHandle = manifestHandle; 28 } 29 30 /// <summary> 31 /// Gets a value indicating whether the manifest is valid. 32 /// </summary> 33 public bool IsValid { get; } = false; 34 35 /// <summary> 36 /// Gets warning or failure validation message. 37 /// </summary> 38 public string Message { get; } = null; 39 40 /// <summary> 41 /// Gets created manifest handle if succeeded. 42 /// </summary> 43 public IWinGetManifest ManifestHandle { get; } = null; 44 45 /// <summary> 46 /// Dispose method. 47 /// </summary> 48 public void Dispose() 49 { 50 this.Dispose(true); 51 GC.SuppressFinalize(this); 52 } 53 54 /// <summary> 55 /// Dispose method to free the manifest handle. 56 /// </summary> 57 /// <param name="disposing">Bool value indicating if Dispose is being run.</param> 58 public void Dispose(bool disposing) 59 { 60 if (disposing) 61 { 62 if (this.ManifestHandle != null) 63 { 64 this.ManifestHandle.Dispose(); 65 } 66 } 67 } 68 } 69 }