public void LoadArchive(string fileName) { MsgTextArchive arch; ArchiveDescriptor desc; desc = GetArchiveDescriptor(fileName); if (desc == null) return; switch (desc.type) { case 0: arch = new MsgTextArchive(); arch.LoadArchive(); break; case 1: goto case 0; default: throw new NotSupportedException(string.Format("Unknown archive type '{0}'", fileName)); } if (!Exists(arch)) { archs.Add(arch); arch.AddDescriptor(desc); } else Find(arch).AddDescriptor(desc); }
public void LoadJinnText(string fileName) { MsgTextArchive arch; arch = new MsgTextArchive(); arch.JinnLoadText(); if (!Exists(arch)) { throw new NullReferenceException(string.Format("jinn file '{0}' doesn't match any loaded file", fileName)); } else { Streams.writer.strWrite.WriteLine(fileName); arch = (MsgTextArchive)Find(arch); foreach (var desc in arch.descs) Streams.writer.strWrite.WriteLine(desc.fileName); Streams.writer.strWrite.WriteLine(); } }
public TextArchive Find(MsgTextArchive arch) { foreach (var item in archs) if (item == arch) return item; return null; }
public bool Exists(MsgTextArchive arch) { foreach (var item in archs) if (item == arch) return true; return false; }