示例#1
0
        private void LaunchUpdater()
        {
            var ticks = (uint)Environment.TickCount;
            var key   = ticks & 0xFFFF_0000;

            var argumentBuilder = new ArgumentBuilder()
                                  .Append("T", ticks.ToString())
                                  .Append("BootVersion", XIVGame.GetLocalBootVer())
                                  .Append("CallerWindow", _windowHwnd.ToString())
                                  .Append("GameVersion", XIVGame.GetLocalGameVer())
                                  .Append("IsSteam", "0")
                                  .Append("NextExe", Path.Combine(Settings.GetGamePath(), "game", "ffxiv.exe"))
                                  .Append("ShowMode", "2")
                                  .Append("UserPath", _userPath);

            Debug.WriteLine($"Launching ffxivupdater with key {key}: {argumentBuilder.Build()}");

            var process = new Process
            {
                StartInfo = new ProcessStartInfo
                {
                    FileName  = Path.Combine(_userPath, "downloads", "ffxivupdater.exe"),
                    Arguments = argumentBuilder.BuildEncrypted(key)
                }
            };

            process.Start();
        }
示例#2
0
        public static async Task <(CompareResult compareResult, string report, IntegrityCheckResult remoteIntegrity)> CompareIntegrityAsync(IProgress <IntegrityCheckProgress> progress)
        {
            IntegrityCheckResult remoteIntegrity;

            try
            {
                remoteIntegrity = DownloadIntegrityCheckForVersion(XIVGame.GetLocalGameVer());
            }
            catch (WebException)
            {
                return(CompareResult.NoServer, null, null);
            }

            var localIntegrity = await RunIntegrityCheckAsync(new DirectoryInfo(Settings.GetGamePath()), progress);

            var report = "";

            foreach (var hashEntry in remoteIntegrity.Hashes)
            {
                if (localIntegrity.Hashes.Any(h => h.Key == hashEntry.Key))
                {
                    if (localIntegrity.Hashes.First(h => h.Key == hashEntry.Key).Value != hashEntry.Value)
                    {
                        report += $"Mismatch: {hashEntry.Key}\n";
                    }
                }
                else
                {
                    Debug.WriteLine("File not found in local integrity: " + hashEntry.Key);
                }
            }

            return(string.IsNullOrEmpty(report) ? CompareResult.Valid : CompareResult.Invalid, report, remoteIntegrity);
        }
示例#3
0
        private static async Task <IntegrityCheckResult> RunIntegrityCheckAsync(DirectoryInfo gameDirectory, IProgress <IntegrityCheckProgress> progress)
        {
            var hashes = new Dictionary <string, string>();

            using (var sha1 = new SHA1Managed())
            {
                CheckDirectory(gameDirectory, sha1, gameDirectory.FullName, ref hashes, progress);
            }

            return(new IntegrityCheckResult
            {
                GameVersion = XIVGame.GetLocalGameVer(),
                Hashes = hashes
            });
        }