Exemple #1
0
        private void button_uploadstep1continue_Click(object sender, EventArgs e)
        {
            string addonName = textBox_uploadaddonname.Text;
            string addonType = comboBox_uploadaddontype.Text;
            string addonTag1 = comboBox_uploadaddontags1.Text;
            string addonTag2 = comboBox_uploadaddontags2.Text;
            List<string> addonTags = new List<string>
            {
                addonTag1
            };
            List<string> addonIgnore = new List<string>
            {
                "*.exe",
                "*.txt",
                "*.db",
                "*.gma",
                "*.json"
            };
            if (addonTag2 != "")
            {
                addonTags = new List<string>
                {
                    addonTag1,
                    addonTag2
                };
            }

            if( addonName == "" )
            {
                MessageBox.Show("Please give your addon a name :(");
            }
            else if( addonType == "" )
            {
                MessageBox.Show("Please select your addon's type.");
            }
            else if (addonTag1 == "")
            {
                MessageBox.Show("Your addon requires at least one tag.");
            }
            else
            {
                Json json = new Json
                {
                    title = addonName,
                    type = addonType,
                    tags = addonTags,
                    ignore = addonIgnore,
                };
                using (StreamWriter file = File.CreateText(Settings.Default.WorkshopDirectory + "\\addon.json"))
                {
                    JsonSerializer serializer = new JsonSerializer();
                    serializer.Serialize(file, json);
                }
                Settings.Default.JsonFilePath = Settings.Default.WorkshopDirectory + "\\addon.json";
                MessageBox.Show("Great! We'll be generating the .GMA file for you now. This may take a while depending on your addon's size. It will be placed in your addon's directory.");

                Settings.Default.NewAddonName = addonName;
                Settings.Default.GeneratedGMA = Settings.Default.WorkshopDirectory + "\\" + addonName + ".gma";
                Settings.Default.GmadArgs = "create -folder \"" + Settings.Default.WorkshopDirectory + "\" -out \"" + Settings.Default.GeneratedGMA + "\"";
                Settings.Default.Process = "gmad";
                Settings.Default.Save();

                Form_Upload_GMAOutput Form_Upload_GMAOutput = new Form_Upload_GMAOutput();
                Form_Upload_GMAOutput.BackToMenu = BackToMenu;
                this.Close();
                Form_Upload_GMAOutput.Show();

            }
        }
Exemple #2
0
        private void button_update_finished_Click(object sender, EventArgs e)
        {
            if (textBox_update_name.TextLength < 2)
            {
                MessageBox.Show("Please give your addon a name that is at least 2 characters long.");
            }
            else if (comboBox_update_type.Text == "")
            {
                MessageBox.Show("Please give your addon a type.");
            }
            else if (comboBox_update_tag1.Text == "")
            {
                MessageBox.Show("Please give your addon at least one tag.");
            }
            else
            {
                string addonName = textBox_update_name.Text;
                string addonType = comboBox_update_type.Text;
                string addonTag1 = comboBox_update_tag1.Text;
                string addonTag2 = comboBox_update_tag2.Text;
                List<string> addonTags = new List<string>
                {
                    addonTag1
                };

                List<string> addonIgnore = new List<string>
                {
                    "*.exe",
                    "*.txt",
                    "*.db",
                    "*.gma",
                    "*.json"
                };

                if (addonTag2 != "")
                {
                    addonTags = new List<string>
                    {
                        addonTag1,
                        addonTag2
                    };
                }

                Json json = new Json
                {
                    title = addonName,
                    type = addonType,
                    tags = addonTags,
                    ignore = addonIgnore,
                };

                using (StreamWriter file = File.CreateText(Settings.Default.WorkshopDirectory + "\\addon.json"))
                {
                    JsonSerializer serializer = new JsonSerializer();
                    serializer.Serialize(file, json);
                }

                Settings.Default.JsonFilePath = Settings.Default.WorkshopDirectory + "\\addon.json";
                Settings.Default.NewAddonName = addonName;
                Settings.Default.GeneratedGMA = Settings.Default.WorkshopDirectory + "\\" + addonName + ".gma";
                Settings.Default.AddonID = textBox_update_addonID.Text;
                Settings.Default.UpdateStep1 = true;
                Settings.Default.IsUpdating = true;
                Settings.Default.FinalStep = false;
                Settings.Default.Process = "gmad";
                Settings.Default.GmadArgs = "create -folder \"" + Settings.Default.WorkshopDirectory + "\" -out \"" + Settings.Default.WorkshopDirectory + "\\" + addonName + ".gma\"";

                string gmafile = Settings.Default.GeneratedGMA;
                string addonid = Settings.Default.AddonID;
                string changes = "";
                if (textBox_update_changelog.Text != "")
                {
                    changes = textBox_update_changelog.Text;
                    Fchangelog = true;
                }
                if (Fchangelog)
                {
                    Settings.Default.GmpublishArgs = "update -addon \"" + gmafile + "\" -id \"" + addonid + "\"" + " -changes \"" + changes + "\"";
                }
                else
                {
                    Settings.Default.GmpublishArgs = "update -addon \"" + gmafile + "\" -id \"" + addonid + "\"";
                }
                Settings.Default.Save();

                Form_Upload_GMAOutput Form_Upload_GMAOutput = new Form_Upload_GMAOutput();
                Form_Upload_GMAOutput.BackToMenu = BackToMenu;
                Form_Upload_GMAOutput.Show();
                this.Close();

            }
        }