Exemple #1
0
        public ReloadSwfForm(Addon currAddon)
        {
            if (Settings.Default.SwfFilesToIgnore == null)
            {
                Settings.Default.SwfFilesToIgnore = new System.Collections.Specialized.StringCollection();
            }

            InitializeComponent();

            this.currAddon = currAddon;

            string flash3 = Path.Combine(currAddon.GamePath, "resource", "flash3");
            string custom_ui = Path.Combine(flash3, "custom_ui.txt");
            if (!Directory.Exists(flash3) || !File.Exists(custom_ui)) {
                return;
            }
            string[] swfFilesArr = Directory.GetFiles(flash3, "*.swf");
            HashSet<string> swfFiles = new HashSet<string>();
            //HashSet<string> swfFiles = new HashSet<string>();
            foreach (string swf in swfFilesArr) {
                swfFiles.Add(swf);
            }

            foreach (string swfToIgnore in Settings.Default.SwfFilesToIgnore) {
                if (swfFiles.Contains(swfToIgnore)) {
                    swfFiles.Remove(swfToIgnore);
                }
            }

            foreach (string swf in swfFiles) {
                string swfName = swf.Substring(swf.LastIndexOf('\\') + 1);
                swfName = swfName.Replace(".swf", "");
                listView1.Items.Add(swfName);
            }
        }
        public PreferencesForm(Addon a)
        {
            addon = a;
            InitializeComponent();
            preferencesForLabel.Text = "Preferences for " + a.Name + ":";

            foreach (Addon.CombineKVFile cf in a.combineKVFiles) {
                int index = kvFileCheckbox.Items.Add(cf.name);
                //kvFileCheckbox.

            }

            note0LoreCheckBox.Checked = Settings.Default.GenNote0Lore;
            checkForUpdatesCheckbox.Checked = Settings.Default.CheckForUpdates;

            ugcTextBox.Text = Settings.Default.UGCPath;
            this.AcceptButton = submitButton;
        }
Exemple #3
0
        public PreferencesForm(Addon a)
        {
            addon = a;
            InitializeComponent();
            preferencesForLabel.Text = "Preferences for " + a.Name + ":";

            foreach (Addon.CombineKVFile cf in a.combineKVFiles)
            {
                int index = kvFileCheckbox.Items.Add(cf.name);
                //kvFileCheckbox.
            }

            note0LoreCheckBox.Checked       = Settings.Default.GenNote0Lore;
            checkForUpdatesCheckbox.Checked = Settings.Default.CheckForUpdates;

            ugcTextBox.Text   = Settings.Default.UGCPath;
            this.AcceptButton = submitButton;
        }
        public ReloadSwfForm(Addon currAddon)
        {
            if (Settings.Default.SwfFilesToIgnore == null)
            {
                Settings.Default.SwfFilesToIgnore = new System.Collections.Specialized.StringCollection();
            }

            InitializeComponent();

            this.currAddon = currAddon;

            string flash3    = Path.Combine(currAddon.GamePath, "resource", "flash3");
            string custom_ui = Path.Combine(flash3, "custom_ui.txt");

            if (!Directory.Exists(flash3) || !File.Exists(custom_ui))
            {
                return;
            }
            string[]         swfFilesArr = Directory.GetFiles(flash3, "*.swf");
            HashSet <string> swfFiles    = new HashSet <string>();

            //HashSet<string> swfFiles = new HashSet<string>();
            foreach (string swf in swfFilesArr)
            {
                swfFiles.Add(swf);
            }

            foreach (string swfToIgnore in Settings.Default.SwfFilesToIgnore)
            {
                if (swfFiles.Contains(swfToIgnore))
                {
                    swfFiles.Remove(swfToIgnore);
                }
            }

            foreach (string swf in swfFiles)
            {
                string swfName = swf.Substring(swf.LastIndexOf('\\') + 1);
                swfName = swfName.Replace(".swf", "");
                listView1.Items.Add(swfName);
            }
        }
 public ParticleDesignForm(Addon addon)
 {
     // We need a particle system to work with.
     OpenFileDialog fd = new OpenFileDialog();
     fd.InitialDirectory = Path.Combine(addon.ContentPath, "particles");
     fd.Multiselect = true;
     fd.Title = "Select Particles To Design";
     DialogResult res = fd.ShowDialog();
     if (res == DialogResult.OK)
     {
         Ps = new ParticleSystem(fd.FileNames);
     }
     else
     {
         FormCanceled = true;
         return;
     }
     InitializeComponent();
     initiate();
 }
Exemple #6
0
        public ParticleDesignForm(Addon addon)
        {
            // We need a particle system to work with.
            OpenFileDialog fd = new OpenFileDialog();

            fd.InitialDirectory = Path.Combine(addon.ContentPath, "particles");
            fd.Multiselect      = true;
            fd.Title            = "Select Particles To Design";
            DialogResult res = fd.ShowDialog();

            if (res == DialogResult.OK)
            {
                Ps = new ParticleSystem(fd.FileNames);
            }
            else
            {
                FormCanceled = true;
                return;
            }
            InitializeComponent();
            initiate();
        }
 private void getAddons()
 {
     string[] dirs = Directory.GetDirectories(UGCPath);
     foreach (string str in dirs)
     {
         if (str.Contains("game"))
         {
             GameDirectory = str;
             string dota_addons = Path.Combine(GameDirectory, "dota_addons");
             if (Directory.Exists(dota_addons))
             {
                 string[] dirs2 = Directory.GetDirectories(dota_addons);
                 foreach (string str2 in dirs2)
                 {
                     Addon a = new Addon(str2);
                     a.ContentPath = Path.Combine(UGCPath, "content", "dota_addons", a.Name);
                     addons.Add(a);
                 }
             }
         }
     }
     setAddonNames();
 }
Exemple #8
0
 private void selectCurrentAddon(string addon)
 {
     currAddon = getAddonFromName(addon);
     Settings.Default.CurrAddon = currAddon.Name;
     Debug.WriteLine("Current addon: " + currAddon.Name);
     addonDropDown.Text = currAddon.Name;
     calculateSize();
     if (currAddon.GDS_rank != "") {
         gdsButton.Text = "#" + currAddon.GDS_rank;
     } else {
         gdsButton.Text = "";
     }
 }
Exemple #9
0
 private bool isValidAddon(Addon a)
 {
     if (Directory.Exists(a.ContentPath) && Directory.Exists(a.GamePath))
     {
         return true;
     }
     return false;
 }
Exemple #10
0
        // init addon with basic Modkit preferences if it's never been done before.
        private void initPreferences(KeyValue addonKV, Addon a)
        {
            KeyValue pref = new KeyValue("preferences");
            addPreference(pref, "create_note0_lore", "0");
            KeyValue kv_files = new KeyValue("kv_files");
            string[] npcFiles = { "Heroes", "Units", "Items", "Abilities" };
            foreach (string s in npcFiles) {
                KeyValue name = new KeyValue(s);
                string path = Path.Combine(a.GamePath, "scripts", "npc", "npc_" + s.ToLower() + "_custom.txt");
                KeyValue pathKV = new KeyValue("path");
                pathKV.AddChild(new KeyValue(path));
                KeyValue activated = new KeyValue("activated");
                activated.AddChild(new KeyValue("1"));
                name.AddChild(pathKV);
                name.AddChild(activated);
                kv_files.AddChild(name);
            }

            pref.AddChild(kv_files);
            addonKV.AddChild(pref);
        }
Exemple #11
0
 private void getAddons()
 {
     string[] dirs = Directory.GetDirectories(UGCPath);
     foreach (string str in dirs)
     {
         if (str.Contains("game"))
         {
             string dota_addons = Path.Combine(str, "dota_addons");
             if (Directory.Exists(dota_addons))
             {
                 string[] dirs2 = Directory.GetDirectories(dota_addons);
                 foreach (string str2 in dirs2)
                 {
                     // ensure both the game + content dirs exist for this mod.
                     Addon a = new Addon(str2);
                     a.ContentPath = Path.Combine(UGCPath, "content", "dota_addons", a.Name);
                     if (isValidAddon(a))
                     {
                         addons.Add(a);
                     }
                 }
             }
         }
     }
     setAddonData();
     setAddonNames();
 }
Exemple #12
0
        void forkBarebones(Dictionary<string, string> parameters)
        {
            string modName = AddonForm._TextBox.Text;
            ForkBarebones fork = new ForkBarebones(modName, parameters);

            // now move the directories to their appropriate places.
            string lower = modName.ToLower();

            string newG = Path.Combine(UGCPath, "game", "dota_addons", lower);
            string newC = Path.Combine(UGCPath, "content", "dota_addons", lower);

            string game = Path.Combine(Environment.CurrentDirectory, lower, "game", "dota_addons", lower);
            string content = Path.Combine(Environment.CurrentDirectory, lower, "content", "dota_addons", lower);
            Directory.Move(game, newG);
            Directory.Move(content, newC);
            // delete the old dir now.
            Directory.Delete(Path.Combine(Environment.CurrentDirectory, lower), true);

            Addon a = new Addon(newC, newG);
            addons.Add(a);
            // redo the tooltip addon names.
            setAddonNames();
            // add the addon to the AddonInfos
            // make the active addon this one.
            selectCurrentAddon(lower);
            MessageBox.Show("The addon " + modName + " was successfully forked from Barebones.", "D2ModKit",
                MessageBoxButtons.OK,
                MessageBoxIcon.Information);

            Process.Start(Path.Combine(a.GamePath, "scripts", "vscripts"));
        }