Пример #1
0
        /// <summary>
        /// Displays the contents of a FileRecord in the TextBox as Ascii text
        /// </summary>
        /// <param name="selectedRecord">FileRecord to display</param>
        private void DisplayTextFileAsAscii(FileRecord selectedRecord)
        {
            var buffer = selectedRecord.ReadFileContent(_ggpkPath);

            TextBoxOutput.Visibility = Visibility.Visible;

            TextBoxOutput.Text = Encoding.ASCII.GetString(buffer);
        }
Пример #2
0
        /// <summary>
        /// Displays the contents of a FileRecord in the DatViewer
        /// </summary>
        /// <param name="selectedRecord">FileRecord to display</param>
        private void DisplayDatFile(FileRecord selectedRecord)
        {
            var data = selectedRecord.ReadFileContent(_ggpkPath);

            DatViewerOutput.Visibility = Visibility.Visible;

            DatViewerOutput.Reset(selectedRecord.Name, data);
        }
Пример #3
0
        /// <summary>
        /// Displays the contents of a FileRecord in the RichTextBox
        /// </summary>
        /// <param name="selectedRecord">FileRecord to display</param>
        private void DisplayTextFileAsRichText(FileRecord selectedRecord)
        {
            var buffer = selectedRecord.ReadFileContent(_ggpkPath);

            RichTextOutput.Visibility = Visibility.Visible;

            using (var ms = new MemoryStream(buffer))
            {
                RichTextOutput.Selection.Load(ms, DataFormats.Rtf);
            }
        }
Пример #4
0
        /// <summary>
        /// Displays the contents of a FileRecord in the ImageBox
        /// </summary>
        /// <param name="selectedRecord">FileRecord to display</param>
        private void DisplayImageFile(FileRecord selectedRecord)
        {
            var buffer = selectedRecord.ReadFileContent(_ggpkPath);

            ImageOutput.Visibility = Visibility.Visible;

            using (var ms = new MemoryStream(buffer))
            {
                var bmp = new BitmapImage();
                bmp.BeginInit();
                bmp.CacheOption  = BitmapCacheOption.OnLoad;
                bmp.StreamSource = ms;
                bmp.EndInit();
                ImageOutput.Source = bmp;
            }
        }
Пример #5
0
        /// <summary>
        /// Gets a list of all translatable strings in specified record. Record must be a FileRecord of a valid dat file.
        /// </summary>
        /// <param name="record">Dat File Record to extract translatable strings from</param>
        /// <returns>List of translatable strings contained in specified dat file</returns>
        private List <string> GetTranslatableStringsFromDatFile(FileRecord record)
        {
            // Map of all strings that can be safely translated (not used as ID's, paths, etc) stored by their hash
            var resultList = new HashSet <string>();
            var datBytes   = record.ReadFileContent(ggpkPath);

            using (var datStream = new MemoryStream(datBytes))
            {
                var dc      = new DatContainer(datStream, record.Name);
                var strings = dc.GetUserStrings();
                foreach (var currentDatString in strings)
                {
                    resultList.Add(currentDatString.GetValueString());
                }
            }
            return(resultList.ToList());
        }
Пример #6
0
        /// <summary>
        /// Displays the contents of a FileRecord in the ImageBox (DDS Texture mode)
        /// </summary>
        /// <param name="selectedRecord">FileRecord to display</param>
        private void DisplayDdsFile(FileRecord selectedRecord)
        {
            var buffer = selectedRecord.ReadFileContent(_ggpkPath);

            ImageOutput.Visibility = Visibility.Visible;

            var dds = new DDSImage(buffer);

            using (var ms = new MemoryStream())
            {
                dds.images[0].Save(ms, ImageFormat.Png);

                var bmp = new BitmapImage();
                bmp.BeginInit();
                bmp.CacheOption  = BitmapCacheOption.OnLoad;
                bmp.StreamSource = ms;
                bmp.EndInit();
                ImageOutput.Source = bmp;
            }
        }