LoadTlkData() public method

Loads a TLK file into memory.
public LoadTlkData ( string fileName ) : void
fileName string
return void
コード例 #1
0
ファイル: SequenceEditor.cs プロジェクト: Dybuk/ME3Explorer
        public SequenceEditor()
        {
            if (String.IsNullOrEmpty(ME3Directory.cookedPath))
            {
                MessageBox.Show("This tool requires ME3 to be installed. Set its path at:\n Options > Set Custom Path > Mass Effect 3");
                this.Close();
                return;
            }
            InitializeComponent();

            graphEditor.BackColor = Color.FromArgb(167, 167, 167);

            var tlkPath = ME3Directory.cookedPath + "BIOGame_INT.tlk";
            talkFile = new TalkFile();
            talkFile.LoadTlkData(tlkPath);
            if(SText.fontcollection == null)
                SText.fontcollection = LoadFont("KismetFont.ttf", 8);
            SObj.talkfile = talkFile;
            if (System.IO.File.Exists(ME3Directory.cookedPath + @"\SequenceViews\SequenceEditorOptions.JSON"))
            {
                Dictionary<string, object> options = JsonConvert.DeserializeObject<Dictionary<string, object>>(System.IO.File.ReadAllText(ME3Directory.cookedPath + @"\SequenceViews\SequenceEditorOptions.JSON"));
                if (options.ContainsKey("AutoSave"))
                    autoSaveViewToolStripMenuItem.Checked = (bool)options["AutoSave"];
                if (options.ContainsKey("OutputNumbers"))
                    showOutputNumbersToolStripMenuItem.Checked = (bool)options["OutputNumbers"];
                if (options.ContainsKey("GlobalSeqRefView"))
                    useGlobalSequenceRefSavesToolStripMenuItem.Checked = (bool)options["GlobalSeqRefView"];
                SObj.OutputNumbers = showOutputNumbersToolStripMenuItem.Checked;
            }
        }
コード例 #2
0
 public static void LoadTlkData(string fileName)
 {
     if (File.Exists(fileName))
     {
         TalkFile tlk = new TalkFile();
         tlk.LoadTlkData(fileName);
         tlkList.Add(tlk);
     }
 }
コード例 #3
0
 public static void LoadTlkData(string fileName)
 {
     if (File.Exists(fileName))
     {
         TalkFile tlk = new TalkFile();
         tlk.LoadTlkData(fileName);
         tlkList.Add(tlk);
     }
 }
コード例 #4
0
        private void StartReadingTlkButton_Click(object sender, RoutedEventArgs e)
        {
            BusyReading(true);
            TalkFile.Fileformat ff = TalkFile.Fileformat.Xml;

            var loadingWorker = new BackgroundWorker();

            loadingWorker.WorkerReportsProgress = true;

            loadingWorker.ProgressChanged += delegate(object sender2, ProgressChangedEventArgs e2)
            {
                readingTlkProgressBar.Value = e2.ProgressPercentage;
            };

            loadingWorker.DoWork += delegate
            {
                try
                {
                    TalkFile tf = new TalkFile();
                    tf.LoadTlkData(_inputTlkFilePath);

                    tf.ProgressChanged += loadingWorker.ReportProgress;
                    tf.DumpToFile(_outputTextFilePath, ff);
                    // debug
                    // tf.PrintHuffmanTree();
                    tf.ProgressChanged -= loadingWorker.ReportProgress;
                }
                catch (FileNotFoundException)
                {
                    System.Windows.MessageBox.Show(
                        Properties.Resources.AlertExceptionTlkNotFound, Properties.Resources.Error,
                        MessageBoxButton.OK, MessageBoxImage.Error);
                }
                catch (IOException)
                {
                    System.Windows.MessageBox.Show(
                        Properties.Resources.AlertExceptionTlkFormat, Properties.Resources.Error,
                        MessageBoxButton.OK, MessageBoxImage.Error);
                }
                catch (Exception ex)
                {
                    string message = Properties.Resources.AlertExceptionGeneric;
                    message += Properties.Resources.AlertExceptionGenericDescription + ex.Message;
                    System.Windows.MessageBox.Show(message, Properties.Resources.Error,
                                                   MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
            };

            loadingWorker.RunWorkerCompleted += delegate
            {
                BusyReading(false);
                System.Windows.MessageBox.Show(Properties.Resources.AlertTlkLoadingFinished, Properties.Resources.Done,
                                               MessageBoxButton.OK, MessageBoxImage.Information);
            };

            loadingWorker.RunWorkerAsync();
        }
コード例 #5
0
        private void StartReadingTlkButton_Click(object sender, RoutedEventArgs e)
        {
            BusyReading(true);

            var loadingWorker = new BackgroundWorker
            {
                WorkerReportsProgress = true
            };

            loadingWorker.ProgressChanged += delegate(object sender2, ProgressChangedEventArgs e2)
            {
                readingTlkProgressBar.Value = e2.ProgressPercentage;
            };

            loadingWorker.DoWork += delegate
            {
                try
                {
                    TalkFile tf = new TalkFile();
                    tf.LoadTlkData(InputTlkFilePath);

                    tf.ProgressChanged += loadingWorker.ReportProgress;
                    tf.DumpToFile(OutputTextFilePath);
                    // debug
                    // tf.PrintHuffmanTree();
                    tf.ProgressChanged -= loadingWorker.ReportProgress;
                    MessageBox.Show("Finished reading TLK file.", "Done!",
                                    MessageBoxButton.OK, MessageBoxImage.Information);
                }
                catch (FileNotFoundException)
                {
                    MessageBox.Show("Selected TLK file was not found or is corrupted.", "Error",
                                    MessageBoxButton.OK, MessageBoxImage.Error);
                }
                catch (IOException)
                {
                    MessageBox.Show("Error reading TLK file!\nPlease make sure you have chosen a file in a TLK format for Mass Effect 2 or 3.", "Error",
                                    MessageBoxButton.OK, MessageBoxImage.Error);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error",
                                    MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
            };

            loadingWorker.RunWorkerCompleted += delegate
            {
                BusyReading(false);
            };

            loadingWorker.RunWorkerAsync();
        }
コード例 #6
0
        private void loadAlternateTLKToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog d = new OpenFileDialog();

            d.Filter = "*.tlk|*.tlk";
            if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                talkFile.LoadTlkData(d.FileName);
                RefreshView();
                MessageBox.Show("Done.");
            }
        }
コード例 #7
0
ファイル: PCCEditor2.cs プロジェクト: CreeperLava/ME3Explorer
        public PCCEditor2()
        {
            InitializeComponent();
            LoadRecentList();
            RefreshRecent();
            if (RFiles != null && RFiles.Count != 0)
            {
                int index = RFiles.Count - 1;
                if (File.Exists(RFiles[index]))
                    LoadFile(RFiles[index]);
            }

            scriptTab = tabControl1.TabPages["Script"];
            tabControl1.TabPages.Remove(scriptTab);

            // Load the default TLK file into memory.
            var tlkPath = ME3Directory.cookedPath + "BIOGame_INT.tlk";
            talkFile = new TalkFile();
            talkFile.LoadTlkData(tlkPath);
        }
コード例 #8
0
        public SequenceEditor()
        {
            if (String.IsNullOrEmpty(ME3Directory.cookedPath))
            {
                MessageBox.Show("This tool requires ME3 to be installed. Set its path at:\n Options > Set Custom Path > Mass Effect 3");
                this.Close();
                return;
            }
            InitializeComponent();

            graphEditor.BackColor = Color.FromArgb(167, 167, 167);

            var tlkPath = ME3Directory.cookedPath + "BIOGame_INT.tlk";

            talkFile = new TalkFile();
            talkFile.LoadTlkData(tlkPath);
            if (SText.fontcollection == null)
            {
                SText.fontcollection = LoadFont("KismetFont.ttf", 8);
            }
            SObj.talkfile = talkFile;
            if (System.IO.File.Exists(ME3Directory.cookedPath + @"\SequenceViews\SequenceEditorOptions.JSON"))
            {
                Dictionary <string, object> options = JsonConvert.DeserializeObject <Dictionary <string, object> >(System.IO.File.ReadAllText(ME3Directory.cookedPath + @"\SequenceViews\SequenceEditorOptions.JSON"));
                if (options.ContainsKey("AutoSave"))
                {
                    autoSaveViewToolStripMenuItem.Checked = (bool)options["AutoSave"];
                }
                if (options.ContainsKey("OutputNumbers"))
                {
                    showOutputNumbersToolStripMenuItem.Checked = (bool)options["OutputNumbers"];
                }
                if (options.ContainsKey("GlobalSeqRefView"))
                {
                    useGlobalSequenceRefSavesToolStripMenuItem.Checked = (bool)options["GlobalSeqRefView"];
                }
                SObj.OutputNumbers = showOutputNumbersToolStripMenuItem.Checked;
            }
        }
コード例 #9
0
        public SequenceEditor()
        {
            InitializeComponent();

            graphEditor.BackColor = Color.FromArgb(167, 167, 167);

            var tlkPath = ME3Directory.cookedPath + "BIOGame_INT.tlk";
            talkFile = new TalkFile();
            talkFile.LoadTlkData(tlkPath);
            if(SText.fontcollection == null)
                SText.fontcollection = LoadFont("KismetFont.ttf", 8);
            SObj.talkfile = talkFile;
            if (System.IO.File.Exists(ME3Directory.cookedPath + @"\SequenceViews\SequenceEditorOptions.JSON"))
            {
                Dictionary<string, object> options = JsonConvert.DeserializeObject<Dictionary<string, object>>(System.IO.File.ReadAllText(ME3Directory.cookedPath + @"\SequenceViews\SequenceEditorOptions.JSON"));
                if (options.ContainsKey("AutoSave")) 
                    autoSaveViewToolStripMenuItem.Checked = (bool)options["AutoSave"];
                if (options.ContainsKey("OutputNumbers"))
                    showOutputNumbersToolStripMenuItem.Checked = (bool)options["OutputNumbers"];
                if (options.ContainsKey("GlobalSeqRefView"))
                    useGlobalSequenceRefSavesToolStripMenuItem.Checked = (bool)options["GlobalSeqRefView"];
                SObj.OutputNumbers = showOutputNumbersToolStripMenuItem.Checked;
            }
        }
コード例 #10
0
        private void StartReadingTlkButton_Click(object sender, RoutedEventArgs e)
        {
            BusyReading(true);
            TalkFile.Fileformat ff = TalkFile.Fileformat.Xml;

            var loadingWorker = new BackgroundWorker();
            loadingWorker.WorkerReportsProgress = true;

            loadingWorker.ProgressChanged += delegate(object sender2, ProgressChangedEventArgs e2)
            {
                readingTlkProgressBar.Value = e2.ProgressPercentage;
            };

            loadingWorker.DoWork += delegate
            {
                try
                {
                    TalkFile tf = new TalkFile();
                    tf.LoadTlkData(_inputTlkFilePath);

                    tf.ProgressChanged += loadingWorker.ReportProgress;
                    tf.DumpToFile(_outputTextFilePath, ff);
                    // debug
                    // tf.PrintHuffmanTree();
                    tf.ProgressChanged -= loadingWorker.ReportProgress;
                }
                catch (FileNotFoundException)
                {
                    System.Windows.MessageBox.Show(
                        Properties.Resources.AlertExceptionTlkNotFound, Properties.Resources.Error,
                        MessageBoxButton.OK, MessageBoxImage.Error);
                }
                catch (IOException)
                {
                    System.Windows.MessageBox.Show(
                        Properties.Resources.AlertExceptionTlkFormat, Properties.Resources.Error,
                        MessageBoxButton.OK, MessageBoxImage.Error);
                }
                catch (Exception ex)
                {
                    string message = Properties.Resources.AlertExceptionGeneric;
                    message += Properties.Resources.AlertExceptionGenericDescription + ex.Message;
                    System.Windows.MessageBox.Show(message, Properties.Resources.Error,
                        MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
            };

            loadingWorker.RunWorkerCompleted += delegate
            {
                BusyReading(false);
                System.Windows.MessageBox.Show(Properties.Resources.AlertTlkLoadingFinished, Properties.Resources.Done,
                    MessageBoxButton.OK, MessageBoxImage.Information);
            };

            loadingWorker.RunWorkerAsync();
        }