ReadHeader() 공개 메소드

Read an Encog header.
public ReadHeader ( ) : string>.IDictionary
리턴 string>.IDictionary
예제 #1
0
        /// <summary>
        /// Load the contents of a location.
        /// </summary>
        /// <param name="location">The location to load from.</param>
        public void Load(IPersistenceLocation location)
        {
            PersistReader reader = null;

            this.location = location;

            try
            {
                reader = new PersistReader(location);
                IDictionary <String, String> header = reader.ReadHeader();
                if (header != null)
                {
                    this.FileVersion  = int.Parse(header["fileVersion"]);
                    this.EncogVersion = header["encogVersion"];
                    this.Platform     = header["platform"];
                }
                reader.AdvanceObjectsCollection();
                ReadXML xmlIn = reader.XMLInput;
                this.Contents.Clear();

                while (xmlIn.ReadToTag())
                {
                    if (xmlIn.IsIt(PersistReader.TAG_OBJECTS, false))
                    {
                        break;
                    }

                    String type = xmlIn.LastTag.Name;
                    String name = xmlIn.LastTag.Attributes["name"];

                    IPersistor persistor = PersistorUtil
                                           .CreatePersistor(type);

                    if (persistor == null)
                    {
                        throw new PersistError("Do not know how to load: " + type);
                    }
                    IEncogPersistedObject obj = persistor.Load(xmlIn);
                    this.Contents[name] = obj;
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                BuildDirectory();
            }
        }
        /// <summary>
        /// Build a directory of objects.
        /// </summary>
        public void BuildDirectory()
        {
            PersistReader reader = new PersistReader(this.filePrimary);

            IDictionary <String, String> header = reader.ReadHeader();

            if (header != null)
            {
                this.fileVersion  = int.Parse(header["fileVersion"]);
                this.encogVersion = header["encogVersion"];
                this.platform     = header["platform"];
            }

            this.directory = reader.BuildDirectory();

            reader.Close();
        }
        /// <summary>
        /// Build a directory of objects.
        /// </summary>
        public void BuildDirectory()
        {
            PersistReader reader = new PersistReader(this.filePrimary);

            IDictionary<String, String> header = reader.ReadHeader();
            if (header != null)
            {
                this.fileVersion = int.Parse(header["fileVersion"]);
                this.encogVersion = header["encogVersion"];
                this.platform = header["platform"];
            }

            this.directory = reader.BuildDirectory();

            reader.Close();
        }
        /// <summary>
        /// Load the contents of a location.
        /// </summary>
        /// <param name="location">The location to load from.</param>
        public void Load(IPersistenceLocation location)
        {
            PersistReader reader = null;
            this.location = location;

            try
            {
                reader = new PersistReader(location);
                IDictionary<String, String> header = reader.ReadHeader();
                if (header != null)
                {
                    this.FileVersion = int.Parse(header["fileVersion"]);
                    this.EncogVersion = header["encogVersion"];
                    this.Platform = header["platform"];
                }
                reader.AdvanceObjectsCollection();
                ReadXML xmlIn = reader.XMLInput;
                this.Contents.Clear();

                while (xmlIn.ReadToTag())
                {
                    if (xmlIn.IsIt(PersistReader.TAG_OBJECTS, false))
                    {
                        break;
                    }

                    String type = xmlIn.LastTag.Name;
                    String name = xmlIn.LastTag.Attributes["name"];

                    IPersistor persistor = PersistorUtil
                            .CreatePersistor(type);

                    if (persistor == null)
                    {
                        throw new PersistError("Do not know how to load: " + type);
                    }
                    IEncogPersistedObject obj = persistor.Load(xmlIn);
                    this.Contents[name] = obj;
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                BuildDirectory();
            }

        }