Ejemplo n.º 1
0
        void FileListSelectionChanged(int selectedIndex)
        {
            string map_path = Path.Combine(curdir, file_listbox.SelectedItem);

            if (selectedScenario != null)
            {
                selectedScenario.Dispose();
            }

            if (selectedIndex < directories.Length)
            {
                selectedScenario = null;
                selectedChk      = null;
            }
            else
            {
                selectedScenario = new MpqArchive(map_path);

                selectedChk = (Chk)selectedScenario.GetResource("staredit\\scenario.chk");
            }

            Elements[MAPTITLE_ELEMENT_INDEX].Text       = selectedChk == null ? "" : selectedChk.Name;
            Elements[MAPDESCRIPTION_ELEMENT_INDEX].Text = selectedChk == null ? "" : selectedChk.Description;

            string mapSizeString = GlobalResources.Instance.GluAllTbl.Strings[MAPSIZE_FORMAT_INDEX];
            //			string mapDimString = GlobalResources.Instance.GluAllTbl.Strings[MAPDIM_FORMAT_INDEX];
            string tileSetString = GlobalResources.Instance.GluAllTbl.Strings[TILESET_FORMAT_INDEX];

            mapSizeString = mapSizeString.Replace("%c", " ");              /* should probably be a tab.. */
            mapSizeString = mapSizeString.Replace("%s",
                                                  (selectedChk == null
                                                                ? ""
                                                                : String.Format("{0}x{1}",
                                                                                selectedChk.Width,
                                                                                selectedChk.Height)));

            tileSetString = tileSetString.Replace("%c", " ");              /* should probably be a tab.. */
            tileSetString = tileSetString.Replace("%s",
                                                  (selectedChk == null
                                                                ? ""
                                                                : String.Format("{0}",
                                                                                selectedChk.Tileset)));

            Elements[MAPSIZE_ELEMENT_INDEX].Text    = mapSizeString;
            Elements[MAPTILESET_ELEMENT_INDEX].Text = tileSetString;

            UpdatePlayersDisplay();
        }