コード例 #1
0
        public override void SetObjectData()
        {
            base.SetObjectData();
            int persistedClassVersion = info.GetInt32("ClassPersistenceVersionSubstance");

            this.name          = info.GetString("Name");
            this.molarWeight   = info.GetDouble("MolarWeight");
            this.isUserDefined = info.GetBoolean("IsUserDefined");
            this.type          = (SubstanceType)info.GetValue("Type", typeof(SubstanceType));
            //this.casRegistryNo = (int)info.GetValue("CasRegistryNo", typeof(int));
            //this.formula = (string)info.GetValue("Formula", typeof(string));
            //this.propsAndCoeffs = info.GetValue("PropsAndCoeffs", typeof(ThermalPropsAndCoeffs)) as ThermalPropsAndCoeffs;
            //this.criticalProps = info.GetValue("CriticalProps", typeof(CriticalProperties)) as CriticalProperties;
            if (persistedClassVersion == 1)
            {
                int casNo = info.GetInt32("CasRegistryNo");
                this.casRegistryNo = casNo.ToString();
            }

            if (persistedClassVersion >= 2)
            {
                this.casRegistryNo  = info.GetString("CasRegistryNo");
                this.htmlTaggedName = info.GetString("HtmlTaggedName");
                this.formula        = (SubstanceFormula)RecallStorableObject("Formula", typeof(SubstanceFormula));
                this.criticalPropsAndAccentricFactor = (CriticalPropsAndAccentricFactor)RecallStorableObject("CriticalPropsAndAccentricFactor", typeof(CriticalPropsAndAccentricFactor));
            }
        }
コード例 #2
0
 public Substance(string name, string htmlTaggedName, SubstanceType type, string casNo, SubstanceFormula formula, double molWt,
                  CriticalPropsAndAccentricFactor criticalPropsAndAccentricFactor)
 {
     this.name           = name;
     this.htmlTaggedName = htmlTaggedName;
     this.type           = type;
     this.casRegistryNo  = casNo;
     this.formula        = formula;
     this.molarWeight    = molWt;
     this.IsUserDefined  = false;
     this.criticalPropsAndAccentricFactor = criticalPropsAndAccentricFactor;
 }