예제 #1
0
        private void SetUserSettings()
        {
            bool restart = false;

            if (!string.Equals(FProp.Default.FPak_Path, InputTextBox.Text))
            {
                FProp.Default.FPak_Path = InputTextBox.Text;
                restart = true;
            }

            FProp.Default.FDiffFileSize = (bool)bDiffFileSize.IsChecked;
            FProp.Default.ReloadAES     = (bool)bReloadAES.IsChecked;
            FProp.Default.FOpenSounds   = (bool)bOpenSounds.IsChecked;

            if (!string.Equals(FProp.Default.FOutput_Path, OutputTextBox.Text))
            {
                FProp.Default.FOutput_Path = OutputTextBox.Text;
                restart = true;
            }

            if (AssetEntries.AssetEntriesDict != null && !string.Equals(FProp.Default.FLanguage, ((ComboBoxItem)ComboBox_Language.SelectedItem).Content.ToString()))
            {
                AssetTranslations.SetAssetTranslation(((ComboBoxItem)ComboBox_Language.SelectedItem).Content.ToString());
            }
            FProp.Default.FLanguage = ((ComboBoxItem)ComboBox_Language.SelectedItem).Content.ToString();

            FProp.Default.FRarity_Design = ((ComboBoxItem)ComboBox_Design.SelectedItem).Content.ToString();
            FProp.Default.FIsFeatured    = (bool)bFeaturedIcon.IsChecked;
            FProp.Default.FUseWatermark  = (bool)bWatermarkIcon.IsChecked;

            FProp.Default.FWatermarkOpacity = Convert.ToInt32(Opacity_Slider.Value);
            FProp.Default.FWatermarkScale   = Scale_Slider.Value;
            FProp.Default.FWatermarkXPos    = xPos_Slider.Value;
            FProp.Default.FWatermarkYPos    = yPos_Slider.Value;

            FProp.Default.FChallengeWatermark    = WatermarkChallenge_TextBox.Text;
            FProp.Default.FUseChallengeWatermark = (bool)bCustomChallenge.IsChecked;
            FProp.Default.FBannerOpacity         = Convert.ToInt32(OpacityBanner_Slider.Value);

            FProp.Default.Save();

            if (restart)
            {
                DarkMessageBox.Show("FModel is about to restart because you applied your new path(s)", "FModel Path(s) Changed", MessageBoxButton.OK, MessageBoxImage.Information);
                DebugHelper.WriteLine("FModel is restarting");
                System.Windows.Forms.Application.Restart();
                Application.Current.Shutdown();
            }
            else
            {
                DebugHelper.WriteUserSettings();
            }
        }
예제 #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            AssetsEntriesDict = new Dictionary <string, Dictionary <string, string> >();
            foreach (AssetProperties a in Assets)
            {
                AssetsEntriesDict[a.Name]              = new Dictionary <string, string>();
                AssetsEntriesDict[a.Name]["Path"]      = a.Path;
                AssetsEntriesDict[a.Name]["isChecked"] = a.IsChecked.ToString();

                if (a.IsChecked)
                {
                    DebugHelper.WriteLine("UpdateMode: User is about to extract everything in " + a.Path);
                }
            }

            string selectedLang = ((ComboBoxItem)ComboBox_Language.SelectedItem).Content.ToString();

            if (AssetEntries.AssetEntriesDict != null && !string.Equals(FProp.Default.FLanguage, selectedLang))
            {
                AssetTranslations.SetAssetTranslation(selectedLang);
            }
            FProp.Default.FLanguage = selectedLang;

            FProp.Default.FRarity_Design = ((ComboBoxItem)ComboBox_Design.SelectedItem).Content.ToString();
            FProp.Default.FIsFeatured    = (bool)bFeaturedIcon.IsChecked;
            FProp.Default.FUseWatermark  = (bool)bWatermarkIcon.IsChecked;

            FProp.Default.FWatermarkOpacity = Convert.ToInt32(Opacity_Slider.Value);
            FProp.Default.FUM_AssetsType    = JsonConvert.SerializeObject(AssetsEntriesDict, Formatting.Indented);
            FProp.Default.Save();

            DebugHelper.WriteLine("=============== UPDATE MODE ===============");
            DebugHelper.WriteLine("FRarity_Design > " + FProp.Default.FRarity_Design);
            DebugHelper.WriteLine("FLanguage > " + FProp.Default.FLanguage);
            DebugHelper.WriteLine("FIsFeatured > " + FProp.Default.FIsFeatured);
            DebugHelper.WriteLine("FUseWatermark > " + FProp.Default.FUseWatermark);
            DebugHelper.WriteLine("FWatermarkFilePath > " + FProp.Default.FWatermarkFilePath);
            DebugHelper.WriteLine("FWatermarkOpacity > " + FProp.Default.FWatermarkOpacity);
            DebugHelper.WriteLine("FWatermarkScale > " + FProp.Default.FWatermarkScale);
            DebugHelper.WriteLine("FWatermarkXPos > " + FProp.Default.FWatermarkXPos);
            DebugHelper.WriteLine("FWatermarkYPos > " + FProp.Default.FWatermarkYPos);
            DebugHelper.WriteLine("FOpenSounds > " + FProp.Default.FOpenSounds);
            DebugHelper.WriteLine("FAutoExtractRaw > " + FProp.Default.FAutoExtractRaw);
            DebugHelper.WriteLine("FAutoSaveJson > " + FProp.Default.FAutoSaveJson);
            DebugHelper.WriteLine("FAutoSaveImg > " + FProp.Default.FAutoSaveImg);
            DebugHelper.WriteLine("=============================================");

            Close();
        }
예제 #3
0
        private void SetUserSettings()
        {
            if (!string.Equals(FProp.Default.FPak_Path, InputTextBox.Text))
            {
                FProp.Default.FPak_Path = InputTextBox.Text;
                DarkMessageBox.Show("Please, restart FModel to apply your new input path", "FModel Input Path Changed", MessageBoxButton.OK, MessageBoxImage.Information);
            }

            FProp.Default.FDiffFileSize = (bool)bDiffFileSize.IsChecked;
            FProp.Default.ReloadAES     = (bool)bReloadAES.IsChecked;
            FProp.Default.FOpenSounds   = (bool)bOpenSounds.IsChecked;

            if (!string.Equals(FProp.Default.FOutput_Path, OutputTextBox.Text))
            {
                FProp.Default.FOutput_Path = OutputTextBox.Text;
                DarkMessageBox.Show("Please, restart FModel to apply your new output path", "FModel Output Path Changed", MessageBoxButton.OK, MessageBoxImage.Information);
            }

            if (AssetEntries.AssetEntriesDict != null && !string.Equals(FProp.Default.FLanguage, ((ComboBoxItem)ComboBox_Language.SelectedItem).Content.ToString()))
            {
                AssetTranslations.SetAssetTranslation(((ComboBoxItem)ComboBox_Language.SelectedItem).Content.ToString());
            }
            FProp.Default.FLanguage = ((ComboBoxItem)ComboBox_Language.SelectedItem).Content.ToString();

            FProp.Default.FRarity_Design = ((ComboBoxItem)ComboBox_Design.SelectedItem).Content.ToString();
            FProp.Default.FIsFeatured    = (bool)bFeaturedIcon.IsChecked;
            FProp.Default.FUseWatermark  = (bool)bWatermarkIcon.IsChecked;

            FProp.Default.FWatermarkOpacity = Convert.ToInt32(Opacity_Slider.Value);
            FProp.Default.FWatermarkScale   = Scale_Slider.Value;
            FProp.Default.FWatermarkXPos    = xPos_Slider.Value;
            FProp.Default.FWatermarkYPos    = yPos_Slider.Value;

            FProp.Default.FChallengeWatermark    = WatermarkChallenge_TextBox.Text;
            FProp.Default.FUseChallengeWatermark = (bool)bCustomChallenge.IsChecked;
            FProp.Default.FBannerOpacity         = Convert.ToInt32(OpacityBanner_Slider.Value);

            FProp.Default.Save();
        }
예제 #4
0
        private static void LoadPAKFiles(bool bAllPAKs = false)
        {
            if (PAKEntries.PAKEntriesList != null && PAKEntries.PAKEntriesList.Any())
            {
                AssetEntries.ArraySearcher    = new Dictionary <string, FPakEntry[]>();
                AssetEntries.AssetEntriesDict = new Dictionary <string, PakReader.PakReader>();

                //MAIN PAKs LOOP
                foreach (PAKInfosEntry Pak in PAKEntries.PAKEntriesList.Where(x => !x.bTheDynamicPAK))
                {
                    if (!string.IsNullOrEmpty(FProp.Default.FPak_MainAES))
                    {
                        DebugHelper.WriteLine($".PAKs: Loading {Pak.ThePAKPath} with key: {FProp.Default.FPak_MainAES}");

                        byte[] AESKey = AESUtility.StringToByteArray(FProp.Default.FPak_MainAES);
                        PakReader.PakReader reader = null;
                        try
                        {
                            reader = new PakReader.PakReader(Pak.ThePAKPath, AESKey);
                        }
                        catch (Exception ex)
                        {
                            DebugHelper.WriteException(ex, Pak.ThePAKPath);

                            if (string.Equals(ex.Message, "The AES key is invalid"))
                            {
                                UIHelper.DisplayError();
                            }
                            else
                            {
                                new UpdateMyConsole(ex.Message, CColors.Red, true).Append(); return;
                            }
                            break;
                        }

                        if (reader != null)
                        {
                            PAKEntries.PAKToDisplay.Add(Path.GetFileName(Pak.ThePAKPath), reader.FileInfos);

                            if (bAllPAKs)
                            {
                                new UpdateMyProcessEvents($"{Path.GetFileNameWithoutExtension(Pak.ThePAKPath)} mount point: {reader.MountPoint}", "Loading").Update();
                            }
                            foreach (FPakEntry entry in reader.FileInfos)
                            {
                                AssetEntries.AssetEntriesDict[entry.Name] = reader;
                                AssetEntries.ArraySearcher[entry.Name]    = reader.FileInfos;
                            }
                        }
                    }
                }

                //DYNAMIC PAKs LOOP
                foreach (PAKInfosEntry Pak in PAKEntries.PAKEntriesList.Where(x => x.bTheDynamicPAK))
                {
                    byte[] AESKey         = null;
                    string AESFromManager = string.Empty;
                    if (AESEntries.AESEntriesList != null && AESEntries.AESEntriesList.Any())
                    {
                        AESFromManager = AESEntries.AESEntriesList.Where(x => string.Equals(x.ThePAKName, Path.GetFileNameWithoutExtension(Pak.ThePAKPath))).Select(x => x.ThePAKKey).FirstOrDefault();
                        if (!string.IsNullOrEmpty(AESFromManager))
                        {
                            DebugHelper.WriteLine($".PAKs: Loading {Pak.ThePAKPath} with key: {AESFromManager}");
                            AESKey = AESUtility.StringToByteArray(AESFromManager);
                        }
                    }

                    if (AESKey != null)
                    {
                        PakReader.PakReader reader = null;
                        try
                        {
                            reader = new PakReader.PakReader(Pak.ThePAKPath, AESKey);
                        }
                        catch (Exception ex)
                        {
                            DebugHelper.WriteException(ex, Pak.ThePAKPath);

                            if (string.Equals(ex.Message, "The AES key is invalid"))
                            {
                                UIHelper.DisplayError(Path.GetFileNameWithoutExtension(Pak.ThePAKPath), AESFromManager);
                            }
                            else
                            {
                                new UpdateMyConsole(ex.Message, CColors.Red, true).Append(); return;
                            }
                            continue;
                        }

                        if (reader != null)
                        {
                            PAKEntries.PAKToDisplay.Add(Path.GetFileName(Pak.ThePAKPath), reader.FileInfos);

                            if (bAllPAKs)
                            {
                                new UpdateMyProcessEvents($"{Path.GetFileNameWithoutExtension(Pak.ThePAKPath)} mount point: {reader.MountPoint}", "Loading").Update();
                            }
                            foreach (FPakEntry entry in reader.FileInfos)
                            {
                                AssetEntries.AssetEntriesDict[entry.Name] = reader;
                                AssetEntries.ArraySearcher[entry.Name]    = reader.FileInfos;
                            }
                        }
                    }
                    else
                    {
                        DebugHelper.WriteLine($".PAKs: No key found for {Pak.ThePAKPath}");
                    }
                }

                AssetTranslations.SetAssetTranslation(FProp.Default.FLanguage);
            }
        }