void LoadCopy(Player p, string file) { string path = FindCopy(p.name, file); if (path == null) { Player.Message(p, "No such copy exists"); return; } using (FileStream fs = File.OpenRead(path)) using (GZipStream gs = new GZipStream(fs, CompressionMode.Decompress)) { CopyState state = new CopyState(0, 0, 0, 0, 0, 0, null, null); if (path.CaselessEnds(".cpb")) { state.LoadFrom(gs); } else { state.LoadFromOld(gs, fs); } p.CopyBuffer = state; } Player.Message(p, "Loaded copy as " + file); }
void LoadCopy(Player p, string file) { string path = FindCopy(p.name, file); if (path == null) { p.Message("No such copy exists"); return; } using (FileStream fs = File.OpenRead(path)) using (GZipStream gs = new GZipStream(fs, CompressionMode.Decompress)) { CopyState state = new CopyState(0, 0, 0, 0, 0, 0); if (path.CaselessEnds(".cpb")) { state.LoadFrom(gs); } else { state.LoadFromOld(gs, fs); } state.CopySource = "file " + file; p.CurrentCopy = state; } p.Message("Loaded copy from " + file); }
void LoadCopy(Player p, string file) { string path = "extra/savecopy/" + p.name + "/" + file; bool existsNew = File.Exists(path + ".cpb"); bool existsOld = File.Exists(path + ".cpy"); if (!existsNew && !existsOld) { Player.SendMessage(p, "No such copy exists"); return; } path = existsNew ? path + ".cpb" : path + ".cpy"; using (FileStream fs = new FileStream(path, FileMode.Open)) using (GZipStream gs = new GZipStream(fs, CompressionMode.Decompress)) { CopyState state = new CopyState(0, 0, 0, 0, 0, 0, null, null); if (existsNew) { state.LoadFrom(gs); } else { state.LoadFromOld(gs, fs); } p.CopyBuffer = state; } Player.SendMessage(p, "Loaded copy as " + file); }