Пример #1
0
        private MountInfo(string executablePath, string resourcePath)
        {
            ExecutablePath = executablePath;
            MainDir        = Path.GetDirectoryName(executablePath);
            SpawnerPath    = Path.Combine(MainDir, SPAWN_PATH);
            SpawnerArgs    = SPAWN_ARG;

            string[] resourcePaths = File.ReadAllLines(resourcePath);

            DataDir    = Path.Combine(MainDir, resourcePaths[0]);
            MoviesDir  = Path.Combine(MainDir, resourcePaths[1]);
            MusicDir   = Path.Combine(MainDir, resourcePaths[2]);
            MissionDir = Path.Combine(MainDir, resourcePaths[3]);
            MapDir     = Path.Combine(MainDir, resourcePaths[4]);

            string iniPath = Path.Combine(MainDir, Path.GetFileNameWithoutExtension(executablePath) + ".ini");

            if (File.Exists(iniPath))
            {
                INIFile f = new INIFile(iniPath);
                Language = f.GetString("Options", "Language", "");
            }
            else
            {
                Language = "";
            }

            TextUib = new TextUibFile();
            TextUib.ReadFromFile(Path.Combine(DataDir, "UI_DATA", "text{0}.uib".F(Language)));
        }
Пример #2
0
 public override void Unload()
 {
     dgvTable.Rows.Clear();
     _uib           = null;
     _dirty         = false;
     _path          = null;
     panel1.Enabled = false;
 }
Пример #3
0
        public override bool SaveFile(string path)
        {
            TextUibFile uib = new TextUibFile();

            uib.Entries.Clear();
            foreach (DataGridViewRow dataRow in dgvTable.Rows)
            {
                string key = dataRow.Cells[DcKey.Name].Value?.ToString() ?? "";
                string val = dataRow.Cells[DcValue.Name].Value?.ToString() ?? "";
                uib.Entries.Add(new UibEntry <string>(key, val));
            }
            uib.WriteToFile(path);
            _uib   = uib;
            _dirty = false;
            _path  = path;
            return(true);
        }
Пример #4
0
 public override bool LoadFile(string path)
 {
     try
     {
         TextUibFile uib = new TextUibFile();
         uib.ReadFromFile(path);
         _uib   = uib;
         _dirty = false;
         _path  = path;
         return(true);
     }
     catch
     {
         MessageBox.Show("The file is not a valid text uib file.");
         return(false);
     }
 }