public void addFromData(string path) { //File.WriteAllText(path + os.Name + ".txt", os.getData()); int ind = tabMain.SelectedIndex; string n = ((TabItem)tabMain.Items[ind]).Header.ToString(); string compPath = "config/Templates/" + n + "/" + path + ".txt"; string s = File.ReadAllText(compPath); var deserializeSettings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All }; ObjectStructure os = JsonConvert.DeserializeObject <ObjectStructure>(s); database.addItem(ind, ObjectStructure.fromString(s, loadManifest(n))); }
public void jsonPaste(object sender, RoutedEventArgs e) { int ind = tabMain.SelectedIndex; string n = ((TabItem)tabMain.Items[ind]).Header.ToString(); var deserializeSettings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All }; string s = Clipboard.GetText(); try { ObjectStructure os = JsonConvert.DeserializeObject <ObjectStructure>(s); database.addItem(ind, ObjectStructure.fromString(s, loadManifest(n))); } catch { Console.WriteLine("error in paste"); } }