Files
2025-07-22 11:34:56 -04:00

96 lines
3.1 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace CCNetLogReader
{
[Serializable]
public class Configuration
{
public class ZendeskConfiguration
{
public string Locale { get; set; } = "en-us";
public string Subdomain { get; set; } = "dtsweb";
public string Username { get; set; }
public string ApiKey { get; set; }
}
public class S3Configuration
{
public string AccessKey { get; set; }
public string SecretKey { get; set; }
public string Region { get; set; }
public string Bucket { get; set; }
public string CloudfrontDomain { get; set; }
}
public class SoftwarePackage
{
public string Name { get; set; }
public string ProjectName { get; set; }
public string PublishedBuild { get; set; }
public DateTime PublishedDate { get; set; }
public string ProjectBuildFolder { get; set; }
//public string LocalPublishFolder { get; set; }
//public string S3PublishFolder { get; set; }
public long ZDArticleID { get; set; }
public string ZDArticleText { get; set; }
public string DeleteOldFiles { get; set; }
public bool ZipContents { get; set; }
public bool DeleteOldPublishedBuilds { get; set; }
public string ReleaseNoteDocxTemplate { get; set; }
}
public string BuildRoot { get; set; } = @"C:\dts\DataPRO Installers\";
public string LocalPublishRoot { get; set; } = @"C:\dts\DataPRO Installers\local\";
public ZendeskConfiguration ZendeskConfig { get; set; }
public S3Configuration S3Config { get; set; }
[XmlArray("SoftwarePackages")]
[XmlArrayItem("SoftwarePackage")]
public List<SoftwarePackage> SoftwarePackages { get; set; }
public Configuration()
{
SoftwarePackages = new List<SoftwarePackage>();
}
public static void Serialize(string file, Configuration opt)
{
XmlSerializer xs
= new XmlSerializer(opt.GetType());
StreamWriter writer = File.CreateText(file);
xs.Serialize(writer, opt);
writer.Flush();
writer.Close();
}
public static Configuration Deserialize(string file)
{
XmlSerializer xs
= new XmlSerializer(
typeof(Configuration));
if (File.Exists(file))
{
StreamReader reader = File.OpenText(file);
Configuration c = (Configuration)xs.Deserialize(reader);
reader.Close();
return c;
}
else { return new Configuration(); }
}
}
}