Пример #1
0
        public static void FilterPAKs()
        {
            if (string.IsNullOrEmpty(FProp.FPak_Path))
            {
                string AutoPath = GetGameInstallLocation();
                if (!string.IsNullOrEmpty(AutoPath))
                {
                    DebugHelper.WriteLine("Auto .PAK files detection at " + AutoPath);
                    //    new UpdateMyConsole(".PAK files path detected at ", CColors.White).Append();
                    //   new UpdateMyConsole(AutoPath, CColors.Blue, true).Append();

                    FProp.FPak_Path = AutoPath;
                    // FProp.Default.Save();
                }
            }

            if (Directory.Exists(FProp.FPak_Path))
            {
                PAKEntries.PAKEntriesList = new List <PAKInfosEntry>();
                foreach (string Pak in GetPAKsFromPath())
                {
                    if (!PAKsUtility.IsPAKLocked(new FileInfo(Pak)))
                    {
                        string PAKGuid = PAKsUtility.GetPAKGuid(Pak);
                        DebugHelper.WriteLine("Registering " + Pak + " with GUID " + PAKGuid + " (" + PAKsUtility.GetEpicGuid(PAKGuid) + ")");

                        PAKEntries.PAKEntriesList.Add(new PAKInfosEntry(Pak, PAKGuid, !string.Equals(PAKGuid, "0-0-0-0")));
                        var pk = new PAKInfosEntry(Pak, PAKGuid, !string.Equals(PAKGuid, "0-0-0-0"));

                        /*  FWindow.FMain.Dispatcher.InvokeAsync(() =>
                         * {
                         *    MenuItem MI_Pak = new MenuItem();
                         *    MI_Pak.Header = Path.GetFileName(Pak);
                         *    MI_Pak.Click += new RoutedEventHandler(FWindow.FMain.MI_Pak_Click);
                         *
                         *    FWindow.FMain.MI_LoadOnePAK.Items.Add(MI_Pak);
                         * });*/
                    }
                    else
                    {
                        DebugHelper.WriteLine(Path.GetFileName(Pak) + " is locked by another process.");

                        //    new UpdateMyConsole(Path.GetFileName(Pak), CColors.Blue).Append();
                        // new UpdateMyConsole(" is locked by another process.", CColors.White, true).Append();
                    }
                }

                /*   FWindow.FMain.Dispatcher.InvokeAsync(() =>
                 * {
                 *     FWindow.FMain.MI_LoadOnePAK.IsEnabled = true;
                 *     FWindow.FMain.MI_LoadAllPAKs.IsEnabled = true;
                 *     FWindow.FMain.MI_BackupPAKs.IsEnabled = true;
                 * });*/
            }
            else
            {
                //  new UpdateMyProcessEvents(".PAK Files Input Path is missing", "Error").Update();
            }
        }
Пример #2
0
        public static void FilterPAKs()
        {
            if (Directory.Exists(PAK_PATH))
            {
                PAKEntries.PAKEntriesList = new List <PAKInfosEntry>();
                foreach (string Pak in GetPAKsFromPath())
                {
                    if (!PAKsUtility.IsPAKLocked(new FileInfo(Pak)))
                    {
                        if (PAKsUtility.GetPAKVersion(Pak) == 8)
                        {
                            string PAKGuid = PAKsUtility.GetPAKGuid(Pak);
                            PAKEntries.PAKEntriesList.Add(new PAKInfosEntry(Pak, PAKGuid, string.Equals(PAKGuid, "0-0-0-0") ? false : true));
                            FWindow.FMain.Dispatcher.InvokeAsync(() =>
                            {
                                MenuItem MI_Pak = new MenuItem();
                                MI_Pak.Header   = Path.GetFileName(Pak);
                                MI_Pak.Click   += new RoutedEventHandler(FWindow.FMain.MI_Pak_Click);

                                FWindow.FMain.MI_LoadOnePAK.Items.Add(MI_Pak);
                            });
                        }
                        else
                        {
                            new UpdateMyProcessEvents($"Unsupported .PAK Version for {Path.GetFileName(Pak)}", "Error").Update();
                        }
                    }
                    else
                    {
                        new UpdateMyConsole(Path.GetFileName(Pak), CColors.Blue).Append();
                        new UpdateMyConsole(" is locked by another process.", CColors.White, true).Append();
                    }
                }

                FWindow.FMain.Dispatcher.InvokeAsync(() =>
                {
                    FWindow.FMain.MI_LoadOnePAK.IsEnabled  = true;
                    FWindow.FMain.MI_LoadAllPAKs.IsEnabled = true;
                    FWindow.FMain.MI_BackupPAKs.IsEnabled  = true;
                });
            }
            else
            {
                new UpdateMyProcessEvents(".PAK Files Input Path is missing", "Error").Update();
            }
        }
Пример #3
0
        public static void SetDynamicKeys(bool reaload = false)
        {
            if (FProp.Default.ReloadAES || reaload)
            {
                if (!File.Exists(AESManager_PATH))
                {
                    AESEntries.AESEntriesList = new List <AESInfosEntry>();
                    KeysManager.Serialize(string.Empty, string.Empty);
                }
                else
                {
                    KeysManager.Deserialize();
                    _oldAESEntriesList = AESEntries.AESEntriesList;
                }

                if (PAKEntries.PAKEntriesList != null && PAKEntries.PAKEntriesList.Any())
                {
                    string KeysFromBen = EndpointsUtility.GetKeysFromBen();
                    if (!string.IsNullOrEmpty(KeysFromBen))
                    {
                        Dictionary <string, string> KeysDict = JsonConvert.DeserializeObject <Dictionary <string, string> >(KeysFromBen);
                        if (KeysDict != null)
                        {
                            AESEntries.AESEntriesList = new List <AESInfosEntry>();
                            foreach (PAKInfosEntry Pak in PAKEntries.PAKEntriesList.Where(x => x.bTheDynamicPAK == true && //DYNAMIC PAK ONLY
                                                                                          !AESEntries.AESEntriesList.Where(w => string.Equals(w.ThePAKName, Path.GetFileNameWithoutExtension(x.ThePAKPath))).Any() //IS NOT ALREADY ADDED
                                                                                          ))
                            {
                                if (KeysDict.ContainsKey(Path.GetFileName(Pak.ThePAKPath)))
                                {
                                    KeysManager.Serialize(Path.GetFileNameWithoutExtension(Pak.ThePAKPath), KeysDict[Path.GetFileName(Pak.ThePAKPath)].ToUpperInvariant().Substring(2));

                                    if (_oldAESEntriesList != null)
                                    {
                                        if (!_oldAESEntriesList.Where(x => string.Equals(x.ThePAKKey, KeysDict[Path.GetFileName(Pak.ThePAKPath)].ToUpperInvariant().Substring(2))).Any())
                                        {
                                            new UpdateMyConsole(Path.GetFileName(Pak.ThePAKPath), CColors.Blue).Append();
                                            new UpdateMyConsole(" can now be opened.", CColors.White, true).Append();
                                        }
                                        //else mean there was a FAESManager.xml but the key was already there and didn't change
                                    }
                                    else
                                    {
                                        //mostly for new users
                                        new UpdateMyConsole(Path.GetFileName(Pak.ThePAKPath), CColors.Blue).Append();
                                        new UpdateMyConsole(" can be opened.", CColors.White, true).Append();
                                    }
                                }
                                else
                                {
                                    KeysManager.Serialize(Path.GetFileName(Pak.ThePAKPath), string.Empty);
                                }
                            }
                        }
                    }
                }

                Directory.CreateDirectory(Path.GetDirectoryName(AESManager_PATH));
                using (var fileStream = new FileStream(AESManager_PATH, FileMode.Create))
                {
                    KeysManager.serializer.Serialize(fileStream, AESEntries.AESEntriesList);
                }
            }
            else
            {
                KeysManager.Deserialize();
            }

            FWindow.FMain.Dispatcher.InvokeAsync(() =>
            {
                PAKsUtility.DisableNonKeyedPAKs();
            });
        }
Пример #4
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     SetUserSettings();
     PAKsUtility.DisableNonKeyedPAKs();
     Close();
 }