private void OpenFile(string filename, GameDataType type, bool isCompressed) { // Prepare UI for loading Title = $"{Util.ShortenPath(filename)} - TOK ELF Editor"; EmptyLabel.Visibility = Visibility.Collapsed; LoadingLabel.Visibility = Visibility.Visible; tabControl.Visibility = Visibility.Collapsed; statusLabel.Text = "Loading ELF file..."; Cursor = Cursors.Wait; AllowUIToUpdate(); LoadDataType(type); using BinaryReader reader = CreateFileReader(isCompressed, filename); ElfBinary <object> binary = LoadBinary(reader); loadedBinary = binary; hasUnsavedChanges = false; fileSavePath = null; containingFolderPath = Path.GetDirectoryName(filename) ?? Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); editors.Clear(); GenerateEditorPanel(); if (loadedDataType == GameDataType.DataNpcModel) { GenerateEditorPanel(ElfType.Files, 1); GenerateEditorPanel(ElfType.State, 2); } foreach (EditorPanel editor in editors) { editor.searchBar.HasIndexed = false; } AddRecentlyOpened(filename); openContainingItem.IsEnabled = true; collapseAllObjectsItem.IsEnabled = true; expandAllObjectsItem.IsEnabled = true; LoadingLabel.Visibility = Visibility.Collapsed; tabControl.Visibility = Visibility.Visible; statusLabel.Text = "Loaded file"; Cursor = Cursors.Arrow; }
public SavePopupWindow(ElfBinary <object> binary, string fileSavePath, GameDataType loadedDataType) { InitializeComponent(); this.binary = binary; this.fileSavePath = fileSavePath; this.dataType = loadedDataType; worker = new BackgroundWorker() { WorkerReportsProgress = true, }; worker.DoWork += Worker_DoWork; worker.ProgressChanged += Worker_ProgressChanged; worker.RunWorkerCompleted += Worker_RunWorkerCompleted; }
public ObjectCollector(ElfBinary <T> binary, List <bool> changedObjects) { this.binary = binary; this.changedObjects = changedObjects; }