private static void CreateDefault() { Settings = new ToolbarSettings { Top = new ToolbarButtons { Buttons = new List <ToolbarButton> { new ToolbarButton { Function = ToolbarFunction.Terrain, Tooltip = "Switch to terrain editing mode" }, new ToolbarButton { Function = ToolbarFunction.KeyBinding, Tooltip = "Open keyboard/mouse settings dialog" }, new ToolbarButton { Function = ToolbarFunction.Save, Tooltip = "Save all pending changes" } } }, Left = new ToolbarButtons { Buttons = new List <ToolbarButton>() } }; var serializer = new XmlSerializer(typeof(ToolbarSettings)); Stream strm = null; try { Directory.CreateDirectory(".\\Config"); strm = File.Open(".\\Config\\Toolbars.xml", FileMode.Create, FileAccess.Write, FileShare.None); serializer.Serialize(strm, Settings); } catch (Exception e) { Log.Warning("Unable to save Toolbars.xml: " + e.Message); } finally { if (strm != null) { strm.Dispose(); } } }
private static void CreateDefault() { Settings = new ToolbarSettings { Top = new ToolbarButtons { Buttons = new List<ToolbarButton> { new ToolbarButton {Function = ToolbarFunction.Terrain, Tooltip = "Switch to terrain editing mode" }, new ToolbarButton {Function = ToolbarFunction.KeyBinding, Tooltip = "Open keyboard/mouse settings dialog" }, new ToolbarButton {Function = ToolbarFunction.Save, Tooltip = "Save all pending changes" } } }, Left = new ToolbarButtons { Buttons = new List<ToolbarButton>() } }; var serializer = new XmlSerializer(typeof (ToolbarSettings)); Stream strm = null; try { Directory.CreateDirectory(".\\Config"); strm = File.Open(".\\Config\\Toolbars.xml", FileMode.Create, FileAccess.Write, FileShare.None); serializer.Serialize(strm, Settings); } catch(Exception e) { Log.Warning("Unable to save Toolbars.xml: " + e.Message); } finally { if (strm != null) strm.Dispose(); } }