Exemplo n.º 1
0
        public static bool InstallModLoader(string gameFolderPath)
        {
            try
            {
                if (IsModLoaderInstalled(gameFolderPath))
                {
                    return(true);
                }

                if (Directory.Exists(gameFolderPath) == false)
                {
                    return(false);
                }
                if (Directory.Exists(Shrek2Utils.GetGameSystemFolderPath(gameFolderPath)) == false)
                {
                    return(false);
                }

                if (Directory.Exists(Shrek2Utils.GetGameSystemModsFolderPath(gameFolderPath)) == false)
                {
                    Directory.CreateDirectory(Shrek2Utils.GetGameSystemModsFolderPath(gameFolderPath));
                }

                var     zipFilePath = Shrek2Utils.GetModLoaderZipFilePath();
                var     targetDir   = Shrek2Utils.GetGameSystemFolderPath(gameFolderPath);
                FastZip fastZip     = new FastZip();

                fastZip.ExtractZip(zipFilePath, targetDir, null);

                return(true);
            }
            catch (Exception ex)
            {
                Shrek2Utils.LogError(ex);
                return(false);
            }
        }