Exemplo n.º 1
0
 public void CopyModData(LeagueFileIndex targetIndex)
 {
     targetIndex.SetModIndex(this.Mod);
     targetIndex.SetModEntryMap(this.ModEntryMap);
     targetIndex.SetEntryModMap(this.EntryModMap);
     targetIndex.SetWadModMap(this.WadModMap);
 }
Exemplo n.º 2
0
        private async void LoadLeagueFileIndex(bool loadExisting)
        {
            if (File.Exists(INDEX_FILE) && loadExisting)
            {
                this.Index = LeagueFileIndex.Deserialize(File.ReadAllText(INDEX_FILE));
                Log.Information("Loaded File Index from: " + INDEX_FILE);

                CheckIndexVersion();
            }
            else
            {
                try
                {
                    this.Index = new LeagueFileIndex(this.LeagueFolder);
                    Log.Information("Created new Game Index from: " + this.LeagueFolder);
                }
                catch (Exception exception)
                {
                    await DialogHelper.ShowMessageDialog("Failed to create League File Index\n" + exception);

                    Log.Error("Failed to create League File Index");
                    Log.Error(exception.ToString());
                }
            }
        }
Exemplo n.º 3
0
        public void ProcessLeagueFileIndex()
        {
            if (File.Exists(INDEX_FILE))
            {
                LeagueFileIndex currentIndex  = LeagueFileIndex.Deserialize(File.ReadAllText(INDEX_FILE));
                Version         leagueVersion = GetLeagueVersion();
                if (currentIndex.Version != leagueVersion)
                {
                    Log.Information("Index is out of date, creating new Index");
                    Log.Information("Current Index Version: {0}", currentIndex.Version.ToString());
                    Log.Information("League Version: {0}", leagueVersion.ToString());

                    //Create new Index and copy Mod Data from old one
                    this.Index = new LeagueFileIndex(this.LeagueFolder);
                    currentIndex.CopyModData(this.Index);
                    Log.Information("Copied old Mod Index Data to new Index");

                    //We need to reinstall mods
                    foreach (KeyValuePair <string, bool> mod in this.Database.Mods)
                    {
                        if (mod.Value)
                        {
                            InstallMod(this.Database.GetMod(mod.Key));
                        }
                    }

                    Log.Information("Created new Index");
                }
                else
                {
                    this.Index = currentIndex;
                    Log.Information("Loaded File Index from: " + INDEX_FILE);
                }
            }
            else
            {
                this.Index = new LeagueFileIndex(this.LeagueFolder);
                Log.Information("Created new Game Index from: " + this.LeagueFolder);
            }
        }