void SaveCopy(Player p, string file) { if (!Directory.Exists("extra/savecopy")) { Directory.CreateDirectory("extra/savecopy"); } if (!Directory.Exists("extra/savecopy/" + p.name)) { Directory.CreateDirectory("extra/savecopy/" + p.name); } if (Directory.GetFiles("extra/savecopy/" + p.name).Length > 15) { p.Message("You can only save a maxmium of 15 copies. /copy delete some."); return; } CopyState cState = p.CurrentCopy; if (cState == null) { p.Message("You haven't copied anything yet"); return; } string path = "extra/savecopy/" + p.name + "/" + file + ".cpb"; using (FileStream fs = File.Create(path)) using (GZipStream gs = new GZipStream(fs, CompressionMode.Compress)) { cState.SaveTo(gs); } p.Message("Saved copy as " + file); }