/// <summary>
 /// Loads a file into memory and prepares for compressing it to TLK
 /// </summary>
 /// <param name="fileName"></param>
 /// <param name="ff"></param>
 /// <param name="debugVersion"></param>
 public void LoadInputData(string fileName, TalkFile.Fileformat ff, bool debugVersion)
 {
     _inputData.Clear();
     LoadXmlInputData(fileName, debugVersion);
     _inputData.Sort();
     PrepareHuffmanCoding();
 }
示例#2
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;
            }
        }
示例#3
0
        public static void moveTLKDown(int index)
        {
            TalkFile tlk = tlkList[index];

            tlkList.RemoveAt(index);
            tlkList.Insert(index + 1, tlk);
            SaveTLKList();
        }
示例#4
0
 public static void LoadTlkData(string fileName)
 {
     if (File.Exists(fileName))
     {
         TalkFile tlk = new TalkFile();
         tlk.LoadTlkData(fileName);
         tlkList.Add(tlk);
     }
 }
示例#5
0
 public static void LoadTlkData(string fileName)
 {
     if (File.Exists(fileName))
     {
         TalkFile tlk = new TalkFile();
         tlk.LoadTlkData(fileName);
         tlkList.Add(tlk);
     }
 }
        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();
        }
 /// <summary>
 /// Prints TLK Header from TalkFile.cs module.
 /// </summary>
 /// <param name="Header"></param>
 static public void PrintHeader(TalkFile.TLKHeader Header)
 {
     Console.Write("Printing TLK Header info:");
     Console.WriteLine("magic: " + Header.magic);
     Console.WriteLine("ver: " + Header.ver);
     Console.WriteLine("min_ver: " + Header.min_ver);
     Console.WriteLine("entry1Count: " + Header.MaleEntryCount);
     Console.WriteLine("entry2Count: " + Header.FemaleEntryCount);
     Console.WriteLine("treeNodeLength: " + Header.treeNodeCount);
     Console.WriteLine("dataLen: " + Header.dataLen);
 }
        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();
        }
示例#9
0
        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);
        }
示例#10
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;
            }
        }
示例#11
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;
            }
        }
示例#12
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();
        }