Ejemplo n.º 1
0
            public FileBox(string showedName, OpenFileDialog FileDialog, Action <string> howToUsePath, string toFilePath)
            {
                fileDialogButton.Size       = new Size(23, 23);
                fileDialogButton.Text       = "...";
                fileDialogButton.FontWeight = MetroButtonWeight.Regular;
                ReadOnly                = true;
                BoxName.Text            = showedName + ':';
                BoxName.AutoSize        = true;
                Size                    = new Size(365, 23);
                applyAction             = howToUsePath;
                fileDialog              = FileDialog;
                fileDialogButton.Click += FileDialogButtonClick;
                modFilePath             = toFilePath;

                string exePath        = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                string forDefaultPath = ModConfigForm.getInGooseFilePath(modFilePath);
                string defaultPath    = Path.Combine(exePath, "ModsFiles", MainForm.modName, "Default", forDefaultPath);

                if (!Directory.Exists(Path.GetDirectoryName(defaultPath)))
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(defaultPath));
                }
                try {
                    File.Copy(toFilePath, defaultPath, false);
                } catch (IOException) {
                }
            }
Ejemplo n.º 2
0
            void ModConfigBox.ApplyValue(List <KeyValuePair <string, ConfigFile> > configFiles, ApplyType type)
            {
                //Text = configFiles.Find((p) => { return p.Key == configFilePath; }).Value.getOption(configOption);

                switch (type)
                {
                case ApplyType.inGoose:
                    Text = modFilePath;
                    return;

                case ApplyType.inLauncher:
                    string exePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

                    string forDefaultPath = ModConfigForm.getInGooseFilePath(modFilePath);
                    string defaultPath    = Path.Combine(exePath, "ModsFiles", MainForm.modName, "Default", forDefaultPath);

                    Text = defaultPath;
                    return;
                }

                /*ModsFilesPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ModsFiles", MainForm.modName, "Used Before");
                 * if (configFiles.First().Value.fileLocationPath.StartsWith(ModsFilesPath)) {
                 *  string exePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                 *  string forDefaultPath = ModConfigForm.getInGooseFilePath(modFilePath);
                 *  string defaultPath = Path.Combine(exePath, "ModsFiles", MainForm.modName, "Used Before", forDefaultPath);
                 *
                 *  Text = defaultPath;
                 * }*/
            }
Ejemplo n.º 3
0
        public ModConfigForm(ConfiguratorBasic configurator)
        {
            InitializeComponent();
            thisConfigForm = this;
            OpenMod(MainForm.modName, configurator);


            for (int i = 0; i < actualModConfig.configGUI.Count; i++)
            {
                actualModConfig.configGUI[i].ApplyValue(actualModConfig.configFiles, ModConfigClasses.ApplyType.inGoose);
            }

            for (int i = 0; i < actualModConfig.configGUI.Count; i++)
            {
                Controls.Add((Control)actualModConfig.configGUI[i]);
                actualModConfig.configGUI[i].addControlsToControl(thisConfigForm);
                if (i > 0)
                {
                    actualModConfig.configGUI[i].SetLocation(actualModConfig.configGUI[i - 1].GetNextBoxLocation());
                }
                else
                {
                    actualModConfig.configGUI[i].SetLocation(new Point(23, 33));
                }
            }

            Size = new Size(Size.Width, actualModConfig.configGUI.Last().GetNextBoxLocation().Y + 25 + 23);
        }
Ejemplo n.º 4
0
            void ModConfigBox.Apply(List <KeyValuePair <string, ConfigFile> > configFiles)
            {
                if (Text != modFilePath)
                {
                    if (File.Exists(Text))
                    {
                        applyAction(Text);


                        string exePath        = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                        string forDefaultPath = ModConfigForm.getInGooseFilePath(modFilePath);
                        string defaultPath    = Path.Combine(exePath, "ModsFiles", MainForm.modName, "Used Before", forDefaultPath);
                        try {
                            File.Copy(modFilePath, defaultPath, true);
                        } catch (IOException) {
                        }
                    }
                }
            }