Beispiel #1
0
        public MainForm()
        {
            InitializeComponent();

            var gr2Pane = new GR2Pane(this)
            {
                Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right,
                Size   = gr2Tab.ClientSize
            };

            gr2Tab.Controls.Add(gr2Pane);

            packagePane = new PackagePane
            {
                Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right,
                Size   = packageTab.ClientSize
            };
            packageTab.Controls.Add(packagePane);

            var resourcePane = new ResourcePane(this)
            {
                Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right,
                Size   = resourceTab.ClientSize
            };

            resourceTab.Controls.Add(resourcePane);

            var osirisPane = new OsirisPane
            {
                Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right,
                Size   = osirisTab.ClientSize
            };

            osirisTab.Controls.Add(osirisPane);

            Text += $" (LSLib v{Common.LibraryVersion()})";
            gr2Game.SelectedIndex = 2;
        }
        public MainForm()
        {
            InitializeComponent();

            Settings = new ConverterAppSettings();

            try
            {
                if (File.Exists("settings.json"))
                {
                    using (System.IO.StreamReader file = File.OpenText("settings.json"))
                    {
                        JsonSerializer serializer = new JsonSerializer();
                        Settings = (ConverterAppSettings)serializer.Deserialize(file, typeof(ConverterAppSettings));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Error reading settings: {ex.ToString()}");
            }

            var gr2Pane = new GR2Pane(this)
            {
                Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right,
                Size   = gr2Tab.ClientSize
            };

            gr2Tab.Controls.Add(gr2Pane);

            packagePane = new PackagePane(this)
            {
                Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right,
                Size   = packageTab.ClientSize
            };
            packageTab.Controls.Add(packagePane);

            var resourcePane = new ResourcePane(this)
            {
                Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right,
                Size   = resourceTab.ClientSize
            };

            resourceTab.Controls.Add(resourcePane);

            var osirisPane = new OsirisPane(this)
            {
                Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right,
                Size   = osirisTab.ClientSize
            };

            osirisTab.Controls.Add(osirisPane);

            var debugPane = new DebugPane(this)
            {
                Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right,
                Size   = debugTab.ClientSize
            };

            debugTab.Controls.Add(debugPane);

            Text += $" (LSLib v{Common.LibraryVersion()})";

            gr2Game.SelectedIndex = gr2Game.Items.Count - 1;
            gr2Game.DataBindings.Add("SelectedIndex", Settings, "SelectedGame", true, DataSourceUpdateMode.OnPropertyChanged);

            Settings.Version = Common.LibraryVersion();
            Settings.SetPropertyChangedEvent(SaveSettings);
        }