Beispiel #1
0
        /// <summary>
        /// Write the receipt to disk.
        /// </summary>
        /// <param name="FileName">Output filename</param>
        public void Write(string FileName)
        {
            using (JsonWriter Writer = new JsonWriter(FileName))
            {
                Writer.WriteObjectStart();
                Writer.WriteValue("TargetName", TargetName);
                Writer.WriteValue("Platform", Platform.ToString());
                Writer.WriteValue("Configuration", Configuration.ToString());
                Writer.WriteValue("BuildId", BuildId);

                Writer.WriteObjectStart("Version");
                Version.Write(Writer);
                Writer.WriteObjectEnd();

                Writer.WriteArrayStart("BuildProducts");
                foreach (BuildProduct BuildProduct in BuildProducts)
                {
                    Writer.WriteObjectStart();
                    Writer.WriteValue("Path", BuildProduct.Path);
                    Writer.WriteValue("Type", BuildProduct.Type.ToString());
                    if (BuildProduct.IsPrecompiled)
                    {
                        Writer.WriteValue("IsPrecompiled", BuildProduct.IsPrecompiled);
                    }
                    Writer.WriteObjectEnd();
                }
                Writer.WriteArrayEnd();

                Writer.WriteArrayStart("RuntimeDependencies");
                foreach (RuntimeDependency RuntimeDependency in RuntimeDependencies)
                {
                    Writer.WriteObjectStart();
                    Writer.WriteValue("Path", RuntimeDependency.Path);
                    Writer.WriteValue("Type", RuntimeDependency.Type.ToString());
                    Writer.WriteObjectEnd();
                }
                Writer.WriteArrayEnd();

                if (AdditionalProperties.Count > 0)
                {
                    Writer.WriteArrayStart("AdditionalProperties");
                    foreach (ReceiptProperty AdditionalProperty in AdditionalProperties)
                    {
                        Writer.WriteObjectStart();
                        Writer.WriteValue("Name", AdditionalProperty.Name);
                        Writer.WriteValue("Value", AdditionalProperty.Value);
                        Writer.WriteObjectEnd();
                    }
                    Writer.WriteArrayEnd();
                }

                Writer.WriteObjectEnd();
            }
        }