コード例 #1
0
        private void AddBtn_Click(object sender, EventArgs e)
        {
            inputBox input = new inputBox("Enter new Category name:");

            input.ShowDialog();
            if (input.DialogResult == DialogResult.OK)
            {
                Category category = new Category(input.text);
                if (Form1.data.categories.Exists(c => c.name.ToLower() == input.text.ToLower()))
                {
                    MessageBox.Show("This category already exists");
                    return;
                }
                Form1.data.categories.Add(category);
                Form1.data.Save(dataPath);

                LoadCategories();
            }
        }
コード例 #2
0
        private void EditBtn_Click(object sender, EventArgs e)
        {
            Category category = SelectedCategory();

            if (Form1.BaseCategories.Contains(category))
            {
                MessageBox.Show("You cannot edit this category.");
                return;
            }

            inputBox input = new inputBox($"Enter new name for [{category.name}]:");

            input.ShowDialog();
            if (input.DialogResult == DialogResult.OK)
            {
                if (Form1.data.categories.Exists(c => c.name.ToLower() == input.text.ToLower()))
                {
                    MessageBox.Show("This name already exists");
                    return;
                }

                Category item2 = Form1.data.categories.Where(i => i.name == category.name).First();
                int      index = Form1.data.categories.IndexOf(item2);

                if (index != -1)
                {
                    Form1.data.categories[index] = new Category(input.text);
                }

                Form1.data.mods.ForEach(x => { Console.WriteLine(x.category.name); if (x.category.name == item2.name)
                                               {
                                                   x.category = Form1.data.categories[index];
                                               }
                                        });

                Form1.data.Save(dataPath);

                LoadCategories();
            }
        }
コード例 #3
0
        public Form1()
        {
            string[] args = Environment.GetCommandLineArgs().Skip(1).ToArray();

            InitializeComponent();
            this.MaximizeBox = false;

            panel1.BorderStyle = BorderStyle.FixedSingle;

            modEnabledFilter.Items.AddRange(new string[] { "Ignore", "Enabled", "Disabled" });
            modEnabledFilter.SelectedIndex = 0;

            progressBar1.Visible = false;
            progressBar1.Value   = 100;

            VisualCategories = new List <string>();

            if (!Directory.Exists(path))
            {
                MessageBox.Show("The Sims 4 folder not found.\r\nIs Sims 4 installed?");
                Environment.Exit(0);
            }

            if (!Directory.Exists(AllFilesPath))
            {
                Directory.CreateDirectory(AllFilesPath);
            }

            //Future plans: getting currently installed mods
            string[] files = Directory.GetFiles(path, "*.package");
            for (int i = 0; i < files.Length; i++)
            {
                Console.WriteLine(files[i]);
            }

            if (File.Exists(dataPath))
            {
                data = new Data().ReadData <Data>(dataPath);
                for (int i = 0; i < data.categories.Count; i++)
                {
                    VisualCategories.Add(data.categories[i].name);
                }
                this.Text = data.user;
            }
            else
            {
                inputBox input = new inputBox("Enter your name");
                input.ShowDialog();
                if (input.DialogResult == DialogResult.OK)
                {
                    data = new Data(input.text);
                    data.openDirectory = path;
                    data.categories.AddRange(BaseCategories);
                    data.Save(dataPath);
                    this.Text = data.user;
                    for (int i = 0; i < data.categories.Count; i++)
                    {
                        VisualCategories.Add(data.categories[i].name);
                    }
                }
                else
                {
                    this.Close();
                }
            }
            filterBox.Items.Add(noCategory.name);
            filterBox.SelectedIndex = 0;
            filterBox.Items.AddRange(VisualCategories.ToArray());

            LoadMods();

            if (false)
            {
                DialogResult dr = MessageBox.Show("Test deeplink?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (dr == DialogResult.Yes)
                {
                    DownloadMod(new string[] {
                        "https://chii.modthesims.info/getfile.php?file=1966250",
                        "test.rar"
                    });
                }
            }

            if (args.Length > 0)
            {
                DownloadMod(args[0].Substring("GS.GMM:".Length).Split(','));;
            }
        }