コード例 #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
 /// <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();
 }
コード例 #3
0
 public static void LoadTlkData(string fileName)
 {
     if (File.Exists(fileName))
     {
         TalkFile tlk = new TalkFile();
         tlk.LoadTlkData(fileName);
         tlkList.Add(tlk);
     }
 }
コード例 #4
0
 /// <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);
 }
コード例 #5
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);
        }
コード例 #6
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;
            }
        }
コード例 #7
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();
        }