public ExportCommand(User user, string fileName) : base(user) { this.fileName = WorldEditManager.GetSchematicFileName(fileName); if (!Directory.Exists(WorldEditManager.GetSchematicDirectory())) { Directory.CreateDirectory(WorldEditManager.GetSchematicDirectory()); } if (this.UserSession.Clipboard.Count <= 0) { throw new WorldEditCommandException($"Please /copy a selection first!"); } }
private void OutputToFile(string data) { data = data.Replace("<pos=300>", " "); data = Regex.Replace(data, "<.*?>", String.Empty); if (!Directory.Exists(WorldEditManager.GetSchematicDirectory())) { Directory.CreateDirectory(WorldEditManager.GetSchematicDirectory()); } string file = WorldEditManager.GetSchematicFileName(this.fileName, ".txt"); File.WriteAllText(file, data); }