using System; using System.IO; using Server; using Server.Gumps; using Server.Network; namespace KCS { public abstract class KCSSystem { public abstract string Name(); public abstract void Enable(); public abstract void Disable(); public abstract void Save(GenericWriter kcs, GenericWriter kitsunic, GenericWriter writer); public abstract void Load(BinaryReader kcs, BinaryReader kitsunic, BinaryReader reader); public abstract void Gump(Mobile from, Gump gump, KCSParams subParams); public abstract void Help(Mobile from, Gump gump); public abstract void OnResponse(NetState state, RelayInfo info, KCSParams subParams); public bool Enabled { get { return KCS.SystEnabled(this.ToString()); } } public void StartSave(string path) { path += Name() + "/"; if(!Directory.Exists(path)) Directory.CreateDirectory(path); try { GenericWriter kcs = new BinaryFileWriter(path + Name() + ".kcs", false); GenericWriter kitsunic = new BinaryFileWriter(path + Name() + ".sunic", false); GenericWriter bin = new BinaryFileWriter(path + Name() + ".bin", true); Console.Write("Brewing {0}...", Name()); Save(kcs, kitsunic, bin); kcs.Close(); kitsunic.Close(); bin.Close(); Console.WriteLine("Brewing Complete"); } catch(Exception exception) { Console.WriteLine(exception.Message); } }//StartSave public void StartLoad(string path) { path += Name() + "/"; string kcsPath = path + Name() + ".kcs"; string kitsunicPath = path + Name() + ".kitsunic"; string binPath = path + Name() + ".bin"; if(!Directory.Exists(path)) Directory.CreateDirectory(path); if(File.Exists(kcsPath)&&File.Exists(kitsunicPath)&&File.Exists(binPath)) { using (FileStream kcs = new FileStream(kcsPath, FileMode.Open, FileAccess.Read, FileShare.Read)) { using(FileStream kitsunic = new FileStream(kitsunicPath, FileMode.Open, FileAccess.Read, FileShare.Read)) { using(FileStream bin = new FileStream(binPath, FileMode.Open, FileAccess.Read, FileShare.Read)) { BinaryReader binReader = new BinaryReader(bin); BinaryReader kitsunicReader = new BinaryReader(kitsunic); BinaryReader kcsReader = new BinaryReader(kcs); Console.Write("Pouring {0}", Name()); Load(kcsReader, kitsunicReader, binReader); kcsReader.Close(); kitsunicReader.Close(); binReader.Close(); kcs.Close(); kitsunic.Close(); bin.Close(); Console.WriteLine("Pouring Complete"); }//bin }//kitsunic }//kcs }//threePaths }//StartLoad }//KCSSystem } //KCS