예제 #1
0
            public void WriteHeader()
            {
                _Stream.Seek(0, SeekOrigin.Begin);
                string title = Title;

                if (title.Length > Const.FileTitleLen)
                {
                    title = title.Substring(0, Const.FileTitleLen);
                }
                else
                {
                    while (title.Length < Const.FileTitleLen)
                    {
                        title += Const.FieldFillChar;
                    }
                }
                DBT_FILEHEADER header = new DBT_FILEHEADER();

                header.next      = (uint)Next;
                header.title     = File.TextEncoding.GetBytes(title);
                header.flag      = 0;
                header.blocksize = Const.MemoBlockLen;
                byte[] bytes = Utility.StructureToPtr <DBT_FILEHEADER>(header);
                _Stream.Write(bytes, 0, bytes.GetLength(0));
            }
예제 #2
0
            public bool ReadHeader()
            {
                int len = Marshal.SizeOf(typeof(DBT_FILEHEADER));

                byte[] bytes = new byte[len];

                bool ok = (len == _Stream.Read(bytes, 0, len));

                if (ok)
                {
                    DBT_FILEHEADER header = Utility.PtrToStructure <DBT_FILEHEADER>(bytes);
                    Next = header.next;
                }
                return(ok);
            }