Exemple #1
0
        internal void LoadHeroBuild(string filename)
        {
            HabPropertiesCollection hpcBuild = new HabPropertiesCollection();

            hpcBuild.ReadFromFile(filename);

            try
            {
                HabProperties hpsHero = hpcBuild.GetByOrder(0);

                // load specified map if current map is empty
                if (Current.map == null)
                {
                    string mapfile = hpsHero.GetStringValue("Map");
                    if (File.Exists(mapfile))
                    {
                        LoadMap(mapfile);
                    }
                    else
                    {
                        MessageBox.Show(
                            "The map file '" + mapfile + "' specified in this hero build cannot be found." +
                            "\nYou can open this map manually (DotA map->Open...) and then try to load this hero build again");
                        return;
                    }
                }

                // pick specified hero
                hlForm.PickNewHero(hpsHero.name);

                if (!Current.unit.IsDisposed)
                {
                    load_hero_build(hpsHero);
                }
                else
                {
                    // delay this build until the hero
                    // will be found by hero provider
                    hpsProvidedHeroBuild = hpsHero;
                }

                UpdateRecentBuild(filename);
            }
            catch
            {
                MessageBox.Show("Invalid Hero Build file");
                return;
            }
        }
Exemple #2
0
        internal void LoadHeroBuild(string filename)
        {
            HabPropertiesCollection hpcBuild = new HabPropertiesCollection();
            hpcBuild.ReadFromFile(filename);

            try
            {
                HabProperties hpsHero = hpcBuild.GetByOrder(0);

                // load specified map if current map is empty
                if (Current.map == null)
                {
                    string mapfile = hpsHero.GetStringValue("Map");
                    if (File.Exists(mapfile))
                        LoadMap(mapfile);
                    else
                    {
                        MessageBox.Show(
                            "The map file '" + mapfile + "' specified in this hero build cannot be found." +
                            "\nYou can open this map manually (DotA map->Open...) and then try to load this hero build again");
                        return;
                    }
                }

                // pick specified hero
                hlForm.PickNewHero(hpsHero.name);

                if (!Current.unit.IsDisposed) load_hero_build(hpsHero);
                else
                    // delay this build until the hero
                    // will be found by hero provider
                    hpsProvidedHeroBuild = hpsHero;

                UpdateRecentBuild(filename);
            }
            catch
            {
                MessageBox.Show("Invalid Hero Build file");
                return;
            }
        }