AlbedoDatabaseGenerator.Database.Manifest.Load C# (CSharp) Метод

Load() публичный Метод

public Load ( FileInfo _FileName ) : void
_FileName System.IO.FileInfo
Результат void
            public void Load( FileInfo _FileName )
            {
                m_ManifestFileName = _FileName;

                XmlDocument	Doc = new XmlDocument();
                Doc.Load( _FileName.FullName );

                XmlElement	Root = Doc["Manifest"];
                if ( Root == null )
                    throw new Exception( "Failed to retrieve the root \"Manifest\" node. Is this a manifest file?" );

                // Load source image infos
                XmlElement	SourceInfosElement = Root["SourceInfos"];
                if ( SourceInfosElement == null )
                    throw new Exception( "Failed to retrieve the \"SourceInfos\" element!" );
                m_SourceImageFileName = SourceInfosElement["SourceImageName"].GetAttribute( "Value" );
                m_ISOSpeed = float.Parse( SourceInfosElement["ISOSpeed"].GetAttribute( "Value" ) );
                m_ShutterSpeed = float.Parse( SourceInfosElement["ShutterSpeed"].GetAttribute( "Value" ) );
                m_Aperture = float.Parse( SourceInfosElement["Aperture"].GetAttribute( "Value" ) );

                m_SpatialCorrectionEnabled = SourceInfosElement["SpatialCorrection"].GetAttribute( "Status" ) == "Enabled";
                m_WhiteBalanceCorrectionFactor = float.Parse( SourceInfosElement["WhiteReflectanceCorrectionFactor"].GetAttribute( "Value" ) );
                if ( SourceInfosElement["WhiteBalance"] != null )
                    m_WhiteBalancexyY = Vector.Parse( SourceInfosElement["WhiteBalance"].GetAttribute( "xyY" ) );

                m_SwatchesWidth = int.Parse( SourceInfosElement["SwatchesSize"].GetAttribute( "Width" ) );
                m_SwatchesHeight = int.Parse( SourceInfosElement["SwatchesSize"].GetAttribute( "Height" ) );

                m_TargetFormat = SourceInfosElement["TargetFormat"].GetAttribute( "Value" );

                // Load calibrated texture infos
                XmlElement	CalibratedTextureElement = Root["CalibratedTexture"];
                if ( CalibratedTextureElement == null )
                    throw new Exception( "Failed to retrieve the \"CalibratedTexture\" element!" );
                m_CalibratedTextureFileName = CalibratedTextureElement.GetAttribute( "Name" );
                m_CalibratedTextureWidth = int.Parse( CalibratedTextureElement.GetAttribute( "Width" ) );
                m_CalibratedTextureHeight = int.Parse( CalibratedTextureElement.GetAttribute( "Height" ) );

                XmlElement	DefaultSwatchesElement = CalibratedTextureElement["DefaultSwatches"];
                m_SwatchMin.Load( DefaultSwatchesElement["Min"] );
                m_SwatchMax.Load( DefaultSwatchesElement["Max"] );
                m_SwatchAvg.Load( DefaultSwatchesElement["Avg"] );

                // Load custom swatches
                XmlElement	CustomSwatchesElement = Root["CustomSwatches"];
                if ( CustomSwatchesElement != null )
                {
                    int	CustomSwatchesCount = int.Parse( CustomSwatchesElement.GetAttribute( "Count" ) );
                    m_CustomSwatches = new Swatch[CustomSwatchesCount];
                    for ( int CustomSwatchIndex=0; CustomSwatchIndex < CustomSwatchesCount; CustomSwatchIndex++ )
                    {
                        m_CustomSwatches[CustomSwatchIndex] = new Swatch();
                        XmlElement	CustomSwatchElement = CustomSwatchesElement["Custom" + CustomSwatchIndex];
                        if ( CustomSwatchElement == null )
                            throw new Exception( "Failed to retrieve custom swatch element!" );
                        m_CustomSwatches[CustomSwatchIndex].Load( CustomSwatchElement );
                    }
                }
            }