/* * private void Cancel() * { * * } */ private static HouseGenTemplate LoadTemplate(string path) { string filename = Path.GetFileNameWithoutExtension(path); var schematic = ClipboardBuffer.Load(path); //Template Loading string jsonValue = ""; using (var sr = new StreamReader(new FileStream(Path.GetDirectoryName(path) + "\\" + filename + ".json", FileMode.Open, FileAccess.Read, FileShare.Read))) { jsonValue = sr.ReadToEnd(); } HouseGenTemplateData data = JsonConvert.DeserializeObject <HouseGenTemplateData>(jsonValue); return(new HouseGenTemplate(filename, schematic, data)); }
private void ImportSchematicFile() { var ofd = new OpenFileDialog(); ofd.Filter = "TEdit Schematic File|*.TEditSch"; ofd.Title = "Import Schematic File"; ofd.InitialDirectory = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"My Games\Terraria\Worlds"); ofd.Multiselect = true; if ((bool)ofd.ShowDialog()) { foreach (string file in ofd.FileNames) { var buffer = ClipboardBuffer.Load(file); buffer.Preview = _renderer.RenderBuffer(buffer); ClipboardMan.LoadedBuffers.Insert(0, buffer); } } }