public Index(string nm, ushort kl, DateTime udTime) { int sz = DataFile.GetSize(Root); if (DataFile.Exists(nm, "Index")) { File = DataFile.Open(nm, "Index", FileMode.Open); File.Read(Root, DataFile.coSignatureSz, sz); if (DateTime.Compare(Root.LastUpdate, udTime) >= 0 && Root.Closed) { Root.Closed = false; File.Lock(Root); File.Write(Root); return; } File.Close(); DataFile.Delete(nm, "Index"); } File = DataFile.Open(nm, "Index", FileMode.CreateNew); DataFile.Blank(Root, sz); Root.KeyLength = kl; Root.Closed = false; Root.PageSize = (ushort)DataFile.GetSize(new IdxPage(0, 0, 0, kl)); File.Append(Root, sz); File.Lock(Root); }
internal static bool Exists(string nm) { return(DataFile.Exists(nm, "Table")); }