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); }
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)); } }
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---"); } }
public bool Equals(IIndexFile other) { return(other.PackId.Equals(this.PackId) && other.DatFile == this.DatFile && other.Offset == this.Offset); }
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; }
private void ConstructIndex(IIndexFile file) { IndexMode = file.IndexMode; IndexSha = file.IndexSha; }
public StatusFile(IIndexFile file) { ConstructIndex(file); ConstructFile(file); }