Пример #1
0
        public override bool SetMaterial(object material)
        {
            CasterLogger.Debug("SetMaterial");
            if (material == null)
            {
                return(false);
            }
            if (material is ICapeThermoMaterial)
            {
                //_alreadyFlashed = true;
                MaterialObjectVersion         = 11;
                _capeThermoMaterial           = material as ICapeThermoMaterial;
                _capeThermoMaterialContext    = material as ICapeThermoMaterialContext;
                _capeThermoPhases             = material as ICapeThermoPhases;
                _capeThermoCompounds          = material as ICapeThermoCompounds;
                _capeThermoPropertyRoutine    = material as ICapeThermoPropertyRoutine;
                _capeThermoEquilibriumRoutine = material as ICapeThermoEquilibriumRoutine;
                _capeThermoUniversalConstant  = material as ICapeThermoUniversalConstant;
            }
            else if (material is MaterialObject11)
            {
                SetMaterial(((MaterialObject11)material).CapeThermoMaterialObject);
            }
            else
            {
                throw new ArgumentException("parameter is not a CO1.1 material object");
            }

            GetListOfAllowedPhase(out string[] _, out string _2);
            UpdateCompoundList();
            CasterLogger.Debug("SetMaterial completed");
            return(true);
        }
Пример #2
0
 protected override void Dispose(bool disposing)
 {
     CasterLogger.Debug("Dispose material10.");
     if (_capeThermoMaterial != null && _capeThermoMaterial.GetType().IsCOMObject)
     {
         Marshal.ReleaseComObject(_capeThermoMaterial);
     }
     if (_capeThermoCompounds != null && _capeThermoCompounds.GetType().IsCOMObject)
     {
         Marshal.ReleaseComObject(_capeThermoCompounds);
     }
     if (_capeThermoEquilibriumRoutine != null && _capeThermoEquilibriumRoutine.GetType().IsCOMObject)
     {
         Marshal.ReleaseComObject(_capeThermoEquilibriumRoutine);
     }
     if (_capeThermoMaterialContext != null && _capeThermoMaterialContext.GetType().IsCOMObject)
     {
         Marshal.ReleaseComObject(_capeThermoMaterialContext);
     }
     if (_capeThermoPhases != null && _capeThermoPhases.GetType().IsCOMObject)
     {
         Marshal.ReleaseComObject(_capeThermoPhases);
     }
     if (_capeThermoPropertyRoutine != null && _capeThermoPropertyRoutine.GetType().IsCOMObject)
     {
         Marshal.ReleaseComObject(_capeThermoPropertyRoutine);
     }
     if (_capeThermoUniversalConstant != null && _capeThermoUniversalConstant.GetType().IsCOMObject)
     {
         Marshal.ReleaseComObject(_capeThermoUniversalConstant);
     }
     _capeThermoMaterial           = null;
     _capeThermoMaterialContext    = null;
     _capeThermoPhases             = null;
     _capeThermoCompounds          = null;
     _capeThermoPropertyRoutine    = null;
     _capeThermoEquilibriumRoutine = null;
     _capeThermoUniversalConstant  = null;
     CasterLogger.Debug("Dispose material10 completed.");
 }