Exemple #1
0
        /*
         * private void pathsOKButton_Click(object sender, RoutedEventArgs e)
         * {
         *  string me1Path = null;
         *  string me2Path = null;
         *  string me3Path = null;
         *  if (File.Exists(Path.Combine(me1PathBox.Text, "Binaries", "MassEffect.exe")))
         *  {
         *      me1Path = me1PathBox.Text;
         *  }
         *  else
         *  {
         *      me1PathBox.Text = "Game Not Found";
         *  }
         *  if (File.Exists(Path.Combine(me2PathBox.Text, "Binaries", "MassEffect2.exe")))
         *  {
         *      me2Path = me2PathBox.Text;
         *  }
         *  else
         *  {
         *      me2PathBox.Text = "Game Not Found";
         *  }
         *  if (File.Exists(Path.Combine(me3PathBox.Text, "Binaries", "Win32", "MassEffect3.exe")))
         *  {
         *      me3Path = me3PathBox.Text;
         *  }
         *  else
         *  {
         *      me3PathBox.Text = "Game Not Found";
         *  }
         *  MEDirectories.SaveSettings(new List<string> { me1Path, me2Path, me3Path});
         *  step1Mask.Visibility = Visibility.Visible;
         *  step1TextBlock.Inlines.Add("--COMPLETE");
         *  step1Complete = true;
         *  prepDLCUnpacking();
         * }*/

        private void DoneButton_Click(object sender, RoutedEventArgs e)
        {
            ME1Directory.gamePath = me1PathBox.Text;
            ME2Directory.gamePath = me2PathBox.Text;
            ME3Directory.gamePath = me3PathBox.Text;
            MEDirectories.SaveSettings(new List <string> {
                me1PathBox.Text, me2PathBox.Text, me3PathBox.Text
            });
            this.Close();
        }
Exemple #2
0
        private void pathsOKButton_Click(object sender, RoutedEventArgs e)
        {
            string me1Path = null;
            string me2Path = null;
            string me3Path = null;

            if (File.Exists(Path.Combine(me1PathBox.Text, "Binaries", "MassEffect.exe")))
            {
                me1Path = me1PathBox.Text;
            }
            else
            {
                me1PathBox.Text = "Game Not Found";
            }
            if (File.Exists(Path.Combine(me2PathBox.Text, "Binaries", "MassEffect2.exe")))
            {
                me2Path = me2PathBox.Text;
            }
            else
            {
                me2PathBox.Text = "Game Not Found";
            }
            if (File.Exists(Path.Combine(me3PathBox.Text, "Binaries", "Win32", "MassEffect3.exe")))
            {
                me3Path = me3PathBox.Text;
            }
            else
            {
                me3PathBox.Text = "Game Not Found";
            }
            MEDirectories.SaveSettings(new List <string> {
                me1Path, me2Path, me3Path
            });
            step1Mask.Visibility = Visibility.Visible;
            step1TextBlock.Inlines.Add("--COMPLETE");
            step1Complete = true;
            prepDLCUnpacking();
        }
Exemple #3
0
 public static IEnumerable <string> GetOfficialFiles(MEGame game) => GetOfficialDLCFiles(game).Prepend(MEDirectories.BioGamePath(game)).SelectMany(directory => GetCookedFiles(game, directory));
Exemple #4
0
        /// <summary>
        /// Gets a Dictionary of all loaded files in the given game. Key is the filename, value is file path
        /// </summary>
        /// <param name="game"></param>
        /// <returns></returns>
        public static Dictionary <string, string> GetFilesLoadedInGame(MEGame game, bool forceReload = false, bool includeTFCs = false, bool includeAFCs = false)
        {
            if (!forceReload)
            {
                if (game == MEGame.ME1 && cachedME1LoadedFiles != null)
                {
                    return(cachedME1LoadedFiles);
                }
                if (game == MEGame.ME2 && cachedME2LoadedFiles != null)
                {
                    bool useCached = true;
                    useCached &= !includeTFCs || !cachedME2LoadedFiles.Keys.Any(x => x.EndsWith(".tfc"));
                    useCached &= !includeAFCs || !cachedME2LoadedFiles.Keys.Any(x => x.EndsWith(".afc"));
                    if (useCached)
                    {
                        return(cachedME2LoadedFiles);
                    }
                }

                if (game == MEGame.ME3 && cachedME3LoadedFiles != null)
                {
                    bool useCached = true;
                    useCached &= !includeTFCs || !cachedME3LoadedFiles.Keys.Any(x => x.EndsWith(".tfc"));
                    useCached &= !includeAFCs || !cachedME3LoadedFiles.Keys.Any(x => x.EndsWith(".afc"));
                    if (useCached)
                    {
                        return(cachedME3LoadedFiles);
                    }
                }
            }

            //make dictionary from basegame files
            var loadedFiles = new Dictionary <string, string>(StringComparer.InvariantCultureIgnoreCase);

            if (game == MEGame.UDK)
            {
                return(loadedFiles);
            }

            foreach (string directory in GetEnabledDLCFiles(game).OrderBy(dir => GetMountPriority(dir, game)).Prepend(MEDirectories.BioGamePath(game)))
            {
                foreach (string filePath in GetCookedFiles(game, directory, includeTFCs, includeAFCs))
                {
                    string fileName = Path.GetFileName(filePath);
                    if (fileName != null)
                    {
                        loadedFiles[fileName] = filePath;
                    }
                }
            }

            if (game == MEGame.ME1)
            {
                cachedME1LoadedFiles = loadedFiles;
            }
            if (game == MEGame.ME2)
            {
                cachedME2LoadedFiles = loadedFiles;
            }
            if (game == MEGame.ME3)
            {
                cachedME3LoadedFiles = loadedFiles;
            }

            return(loadedFiles);
        }
Exemple #5
0
        public static bool IsOfficialDLC(string dir, MEGame game)
        {
            string dlcName = Path.GetFileName(dir);

            return(MEDirectories.OfficialDLC(game).Contains(dlcName));
        }
Exemple #6
0
 public static IEnumerable <string> GetOfficialDLCFiles(MEGame game) =>
 Directory.Exists(MEDirectories.DLCPath(game))
         ? Directory.EnumerateDirectories(MEDirectories.DLCPath(game)).Where(dir => IsOfficialDLC(dir, game))
         : Enumerable.Empty <string>();
Exemple #7
0
 /// <summary>
 /// Gets the base DLC directory of each unpacked DLC/mod that will load in game (eg. C:\Program Files (x86)\Origin Games\Mass Effect 3\BIOGame\DLC\DLC_EXP_Pack001)
 /// Directory Override is used to use a custom path, for things like TFC Compactor, where the directory ME3Exp is pointing to may not be the one you want to use.
 /// </summary>
 /// <returns></returns>
 public static IEnumerable <string> GetEnabledDLCFiles(MEGame game, string directoryOverride = null) =>
 Directory.Exists(MEDirectories.DLCPath(game))
         ? Directory.EnumerateDirectories(directoryOverride ?? MEDirectories.DLCPath(game)).Where(dir => IsEnabledDLC(dir, game))
         : Enumerable.Empty <string>();