Exemplo n.º 1
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     this.ClientSize = Properties.Settings.Default.formSize;
     Visibility.Update();
     progressMain.ProgressText = "Updating Name Lookups from abgx.net";
     _scanner = new GameScanner();
     _scanner.OnGameProcessed += _loader_OnGameScanned;
     _scanner.OnStatusUpdate  += _loader_OnStatusUpdate;
     _scanner.OnFinish        += _loader_OnScanFinish;
     _scrapper = new WebScrapper();
     _scrapper.OnGameProcessed += _OnGameProcessed;
     _scrapper.OnStatusUpdate  += _loader_OnStatusUpdate;
     _scrapper.OnFinish        += _loader_OnFinish;
     _abgx                     = new AbgxChecker();
     _abgx.OnFinish           += _loader_OnFinish;
     _abgx.OnGameProcessed    += _OnGameProcessed;
     _abgx.OnStatusUpdate     += _loader_OnStatusUpdate;
     _move                     = new MoveProcessor();
     _move.OnFinish           += _loader_OnFinish;
     _move.OnGameProcessed    += _OnGameProcessed;
     _move.OnStatusUpdate     += _loader_OnStatusUpdate;
     _info                     = new ScannerInfo();
     progressMain.ProgressText = "";
     progressSub.ProgressText  = "";
     if (Program.Wizard)
     {
         menuSettings_Click(null, null);
     }
 }
Exemplo n.º 2
0
        private void VerifyIntegrity()
        {
            Log.Info("Verifying game integrity...");

            List <string> queue = new List <string>();

            foreach (string filePath in Directory.GetFileSystemEntries(Launcher.Instance.GtaPath))
            {
                string file = Path.GetFileName(filePath);
                if (GameScanner.CanFileBeVerified(file))
                {
                    queue.Add(file);
                }
            }

            if (queue.Count == GameScanner.CheckableFileCount)
            {
                this.SetBarMaximum(queue.Count);

                Log.Info("Verifying integrity of " + queue.Count + " files...");

                this.integrityVerified = true;

                foreach (string file in queue)
                {
                    Log.Info("Verifying integrity of " + file + "...");
                    this.SetState(file);

                    if (GameScanner.CalculateFileHash(file) != GameScanner.GetVanillaFileHash(file))
                    {
                        this.integrityVerified = false;
                        break;
                    }

                    this.IncrBarValue();
                }
            }
            else
            {
                Log.Info("Found " + queue.Count + " checkable files instead of " + GameScanner.CheckableFileCount + '.');
                this.integrityVerified = false;
            }

            this.Conclude();
        }
        private void DeleteMods()
        {
            try
            {
                List <string> files;
                List <string> dirs;
                GameScanner.ListRootMods(out files, out dirs);
                List <string> dlc = GameScanner.ListDlcMods();

                this.SetBarMaximum(files.Count + dirs.Count + dlc.Count);

                foreach (string mod in files)
                {
                    IOUtils.Delete(mod);
                    this.IncrBarValue();
                }

                foreach (string dir in dirs)
                {
                    if (Directory.Exists(dir))
                    {
                        IOUtils.Delete(dir);
                    }
                    this.IncrBarValue();
                }

                foreach (string mod in dlc)
                {
                    IOUtils.Delete(mod);
                    this.IncrBarValue();
                }

                this.ClosePopup();
            }
            catch (IOException)
            {
                this.Dispatcher.Invoke(new Callback(RetryAfterPermissionUpgrade));
            }
            catch (UnauthorizedAccessException)
            {
                this.Dispatcher.Invoke(new Callback(RetryAfterPermissionUpgrade));
            }
        }
Exemplo n.º 4
0
        public MainViewModel()
        {
            //MakeGamesBiggerCommand = new CommandRunner(MakeBigger);
            SearchForGamesText = "Search for a game";
            GameGenresCBX      = new ObservableCollection <string>
            {
                "All Genres",
                "----------------------------------------",
                "FPS",
                "RPG",
                "ACTION",
                "ADVENTURE",
                "HORROR",
                "RACING"
            };
            //Properties.Settings.Default.Reset();
            CloseSettingsCommand = new CommandRunner(CloseSettings);
            //FirstTimeConfiguration();
            ScanGamesCommand              = new CommandRunner(ScanGames);
            AddFolderPathCommand          = new CommandRunner(AddDir);
            DeleteFolderPathCommand       = new CommandRunner(DeleteDir);
            FilterGamesCommand            = new CommandRunner(FilterGamesByPlatform);
            ResetAllSettingsCommand       = new CommandRunner(ResetAllSettings);
            PassSelectedGameToViewCommand = new CommandRunner(PassSelectedGameToGameDetailedViewModel);
            Scanner = new GameScanner();
            Scanner.Scan();
            Games = Scanner.GetExecutables();

            //SGDBAPIController = new SGDBAPIController(Games);
            //PickRandomWideGameCover();

            GamesFoundText = string.Format($"We found {Games.Count.ToString()} games installed on your system.");
            MyProperty     = Scanner.GetExecutables();
            FilteredGames  = CollectionViewSource.GetDefaultView(Games);
            //APIController = new IGDBAPIController(Games);
            //TEST();
            ImageHeight = 208;
            ImageWidth  = 400;
        }
Exemplo n.º 5
0
        public override void Perform(WorkManager manager)
        {
            try
            {
                if (manager.ProgressDisplay is IJobDisplay)
                {
                    ((IJobDisplay)manager.ProgressDisplay).Description = I18n.Localize("Label", "DeletingMods");
                }

                GameScanner.ListRootMods(out List <string> files, out List <string> dirs);
                List <string> dlc = GameScanner.ListDlcMods();

                foreach (string mod in files)
                {
                    IOUtil.Delete(mod);
                }

                foreach (string dir in dirs)
                {
                    if (Directory.Exists(dir))
                    {
                        IOUtil.Delete(dir);
                    }
                }

                foreach (string mod in dlc)
                {
                    IOUtil.Delete(mod);
                }
            }
            catch (IOException e)
            {
                Log.Error(e.ToString());
                LocalizedMessage.Show(Launcher.Instance.Window, "ProfileSwitchError", "FatalError", DialogIcon.Error, DialogButtons.Ok);
                Process.GetCurrentProcess().Kill();
            }
        }
Exemplo n.º 6
0
    private void OnGUI()
    {
        GUILayout.Space(500);
        GUILayout.Label("Connected: " + Client.Connected);

        if (GUILayout.Button("Connect to server"))
        {
            Client.Initialize();
        }

        if (Client.Connected)
        {
            if (GUILayout.Button("Send World"))
            {
                gs = new GameScanner();
                gs.SendGO();
            }

            if (GUILayout.Button("Send Comps"))
            {
                StartCoroutine(gs.SendComps());
            }
        }
    }
Exemplo n.º 7
0
        /* methods */

        /// <summary>
        /// Process the selected archive
        /// Identified the first allowed file based on systemid and populates FileName and MD5Hash properties
        /// </summary>
        public void ProcessArchive()
        {
            // determine archive type
            if (ArchiveExtension == ".zip")
            {
                using (ZipArchive zip = ZipFile.OpenRead(ArchivePath))
                {
                    foreach (ZipArchiveEntry entry in zip.Entries)
                    {
                        if (GameScanner.IsFileAllowed(entry.FullName, SystemId) == true)
                        {
                            IsAllowed = true;

                            using (var md5 = MD5.Create())
                            {
                                using (var stream = entry.Open())
                                {
                                    string h = BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", string.Empty);
                                    MD5Hash  = h;
                                    FileName = entry.FullName;
                                }
                            }
                        }
                        else
                        {
                            continue;
                        }
                    }
                }
            }

            if (ArchiveExtension == ".7z")
            {
                var archive = ArchiveFactory.Open(ArchivePath);
                foreach (SevenZipArchiveEntry entry in archive.Entries)
                {
                    if (entry.IsDirectory)
                    {
                        continue;
                    }

                    if (GameScanner.IsFileAllowed(entry.Key, SystemId) == true && !entry.IsDirectory)
                    {
                        IsAllowed = true;

                        using (var md5 = MD5.Create())
                        {
                            using (var stream = entry.OpenEntryStream())
                            {
                                string h = BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", string.Empty);
                                MD5Hash  = h;
                                FileName = entry.Key;
                                FileSize = entry.Size;
                            }
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
            }
        }
Exemplo n.º 8
0
 private void Start()
 {
     gs     = new GameScanner();
     Client = new TCP_CoreClient();
     PackagesApplier.Launch();
 }