示例#1
0
        public static File Get(Pack pack, IIndexFile file)
        {
            var stream = pack.GetDataStream(file.DatFile);

            stream.Position = file.Offset;

            var header = new FileCommonHeader(file, stream);

            switch (header.FileType)
            {
            case FileType.Empty:
                return(new EmptyFile(pack, header));

            case FileType.Default:
                return(new FileDefault(pack, header));

            case FileType.Image:
                return(new ImageFile(pack, header));

            case FileType.Model:
                return(new ModelFile(pack, header));

            default:
                throw new NotSupportedException(string.Format("Unknown file type {0:X2}h", (int)header.FileType));
            }
        }
        public FileCommonHeader(IIndexFile index, Stream stream)
        {
            if (index == null)
                throw new ArgumentNullException("index");
            if (stream == null)
                throw new ArgumentNullException("stream");

            Index = index;

            Read(stream);
        }
        public FileCommonHeader(IIndexFile index, Stream stream)
        {
            if (index == null)
            {
                throw new ArgumentNullException("index");
            }
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            Index = index;

            Read(stream);
        }
示例#4
0
        public static File Get(Pack pack, IIndexFile file) {
            var stream = pack.GetDataStream(file.DatFile);
            stream.Position = file.Offset;

            var header = new FileCommonHeader(file, stream);

            switch (header.FileType) {
                case FileType.Empty:
                    return new EmptyFile(pack, header);
                case FileType.Default:
                    return new FileDefault(pack, header);
                case FileType.Image:
                    return new ImageFile(pack, header);
                case FileType.Model:
                    return new ModelFile(pack, header);
                default:
                    throw new NotSupportedException(string.Format("Unknown file type {0:X2}h", (int)header.FileType));
            }
        }
示例#5
0
        private static void OpenNDX()
        {
            Console.WriteLine("Isn't realized fully yet!");

            string dbfName = "test_ix.dbf";
            string ndxName = "test_ix.ndx";

            using (DbfTable test = DbfTable.Open(dbfName, Encoding.GetEncoding(437)))
            {
                Console.WriteLine();
                Console.WriteLine("Open index: " + ndxName);

                IIndexFile ndx = test.JoinIndexFile(ndxName);

                Console.WriteLine("Index key : " + ndx.KeyExpression);
                Console.WriteLine();

                var row = ndx.Top();

                Console.WriteLine("----------------------------- 'AAA' field --------------------------------------");
                Console.WriteLine("Top()   : '" + row.GetString("AAA") + "'");

                row = ndx.Bottom();

                Console.WriteLine();
                Console.WriteLine("Bottom(): '" + row.GetString("AAA") + "'");

                Console.WriteLine("All rows:");
                row = ndx.Top();                                            // dBase/Clipper style read

                int rowCount = 0;

                while (!ndx.eof)
                {
                    rowCount++;

                    Console.WriteLine(rowCount.ToString("00000") + ": '" + row.GetString("AAA") + "'");
                    row = ndx.Next();
                }

                Console.WriteLine("---eof---");
            }
        }
示例#6
0
 public bool Equals(IIndexFile other)
 {
     return(other.PackId.Equals(this.PackId) &&
            other.DatFile == this.DatFile &&
            other.Offset == this.Offset);
 }
示例#7
0
 public IndexFile(string path, IIndexFile indexFileInterface, IndexFileProxy indexProxy)
 {
     _IndexFileInterface = indexFileInterface;
     _Path           = Hubble.Framework.IO.Path.AppendDivision(path, '\\');
     _IndexFileProxy = indexProxy;
 }
 public bool Equals(IIndexFile other)
 {
     return other.PackId.Equals(this.PackId)
         && other.DatFile == this.DatFile
         && other.Offset == this.Offset;
 }
 public BinaryStorage(StorageConfiguration configuration, IIndexFile index)
 {
     this.configuration = Utils.CheckNotNull(configuration, Messages.ConfigurationNull);
     storage            = new FileStream(Path.Combine(configuration.WorkingFolder, STORAGE_FILE_NAME), FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);
     this.index         = index;
 }
示例#10
0
 private void ConstructIndex(IIndexFile file)
 {
     IndexMode = file.IndexMode;
     IndexSha = file.IndexSha;
 }
示例#11
0
 public StatusFile(IIndexFile file)
 {
     ConstructIndex(file);
     ConstructFile(file);
 }