Goedel.Persistence.LogPersistenceStore.Init C# (CSharp) Méthode

Init() protected méthode

Initialization method. May be called by subclasses.
protected Init ( string FileName, bool ReadOnly, string Type, string Comment ) : void
FileName string Log file.
ReadOnly bool If true, persistence store must exist /// and will be opened in read-only mode. If false, persistence store /// is opened in read/write mode and a new store will be created /// if none exists.
Type string Type of data to store (the schema name).
Comment string Comment to be written to the log.
Résultat void
        protected void Init(string FileName, bool ReadOnly,
                string Type, string Comment) {
            if (ReadOnly) {
                //Trace.WriteLine("Open store ReadOnly");
                FileStream = new FileStream(FileName, FileMode.Open,
                    FileAccess.Read, FileShare.ReadWrite);
                Read();
                }
            else {
                //Trace.WriteLine("Open store ReadWrite");
                FileStream = new FileStream(FileName, FileMode.OpenOrCreate,
                    FileAccess.ReadWrite, FileShare.Read);
                if (FileStream.Length <= 0) {
                    MakeHeader(Type, Comment);
                    }
                else {
                    Read();
                    }


                //Dump.Write(FileName);
                }
            }