using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Serialization; namespace KMBIM.Revit.Tools.Cmd.Assembly { public class AssemDataStorage { //public string strType { get; set; } //public string strLaggingType { get; set; } //public double dblLaggingThickness { get; set; } public List MainAssemLst { get; set; } public List SubAssemLst { get; set; } public double dblMain2SubDist { get; set; } public double dblSubPipeDia { get; set; } public string AssemName { get; set; } public AssemDataStorage() { AssemName = string.Empty; MainAssemLst = new List(); SubAssemLst = new List(); dblMain2SubDist = 0; dblSubPipeDia = 0; } //public DataStorage(string Type, string laggingType, double laggingThickness, bool isNew) public AssemDataStorage(string AssemName, List MainLst, List SubLst, double Main2SubDist, double SubPipeDia) { this.AssemName = AssemName; MainAssemLst = MainLst; SubAssemLst = SubLst; dblMain2SubDist = Main2SubDist; dblSubPipeDia = SubPipeDia; } } [XmlInclude(typeof(AssemDataStorage))] public class AssemTblDataStorage { [XmlArray(ElementName = "DataStorage_List")] [XmlArrayItem(ElementName = "DataStorage")] public List m_table = null; public AssemTblDataStorage() { m_table = new List(); } //public void Add(string strCategoryName, bool bisPipe, string pipeType, string laggingType, double laggingThickness, bool isNew = false) public void Add(string AssemName, List MainDataLst, List SubDataLst, double Main2SubDst, double SubPipeDia) { m_table.Add(new AssemDataStorage(AssemName, MainDataLst, SubDataLst, Main2SubDst, SubPipeDia)); } public AssemDataStorage Find(string strCategoryName, bool bisPipe, string Type) { return m_table.Find(x => x.AssemName == Type); } public void Remove(string Type) { m_table.Remove(m_table.Find(x => x.AssemName == Type)); } public List GetTable() { return m_table; } public List GetTable(string strCategoryName, bool bisPipe) { return m_table; } public string toJson() { return JsonConvert.SerializeObject(m_table); } public void LoadJson(string json) { m_table = JsonConvert.DeserializeObject>(json); } public class InsulationType { public int index { get; set; } public string strType { get; set; } public InsulationType() { index = 0; strType = string.Empty; } public InsulationType(int idx, string Type) { index = idx; strType = Type; } } public class TblInsulationType { int idx = 0; private List m_table = null; public TblInsulationType() { m_table = new List(); } public void Add(string strType) { m_table.Add(new InsulationType(idx, strType)); idx++; } public void Remove(string pipeType) { //m_table.Remove(); } public List GetTable() { return m_table; } } public class PipeDiameterOfThickness { public int nDiameter { get; set; } public double dblThickness { get; set; } public PipeDiameterOfThickness() { nDiameter = 0; dblThickness = 0; } public PipeDiameterOfThickness(int ndia, int thick) { nDiameter = ndia; dblThickness = thick; } } public class TblPipeDiameterOfThickness { int idx = 0; private List m_table = null; public TblPipeDiameterOfThickness() { m_table = new List(); } public void Add(int dia, int thick) { m_table.Add(new PipeDiameterOfThickness(dia, thick)); idx++; } public void Remove(string pipeType) { //m_table.Remove(); } public List GetTable() { return m_table; } } } }