public RenameForm(string originalName, string extension, string _windowTitle, object containerObject, Window parent = null, Mode _mode = Mode.Asset, int _stringSize = -1) { switch (_mode) { case Mode.Asset: assetContainer = containerObject as AssetContainerTool; break; case Mode.Texture: EmbFile = containerObject as EMB_File; break; case Mode.Material: EmmFile = containerObject as EMM_File; break; } LengthLimit = _stringSize; NameValue = originalName; Extension = extension; InitializeComponent(); Title = _windowTitle; DataContext = this; Owner = parent; textBox.Focus(); OriginalName = NameValue + Extension; CurrentMode = _mode; }
public TextureSelector(EMB_File _embFile, Window parent, EmbEntry initialSelection) { embFile = _embFile; InitializeComponent(); DataContext = this; Owner = parent; listBox_Textures.SelectedItem = initialSelection; listBox_Textures.ScrollIntoView(initialSelection); }
private void Uninstall_EMB(string path, _File file) { try { EMB_File binaryFile = (EMB_File)GetParsedFile <EMB_File>(path, false); EMB_File cpkBinFile = (EMB_File)GetParsedFile <EMB_File>(path, true); Section section = file.GetSection(Sections.EMB_Entry); if (section != null) { for (int i = 0; i < section.IDs.Count; i++) { int idNum; if (int.TryParse(section.IDs[i], out idNum)) { //ID is number (index) EmbEntry original = (cpkBinFile != null) ? cpkBinFile.GetEntry(idNum) : null; binaryFile.RemoveEntry(section.IDs[i], original); } else { //ID is string (name) EmbEntry original = (cpkBinFile != null) ? cpkBinFile.GetEntry(section.IDs[i]) : null; var existingEntry = binaryFile.Entry.FirstOrDefault(x => x.Name == section.IDs[i]); if (existingEntry != null) { binaryFile.RemoveEntry(binaryFile.Entry.IndexOf(existingEntry).ToString(), original); } } } binaryFile.TrimNullEntries(); } } catch (Exception ex) { string error = string.Format("Failed at {0} uninstall phase ({1}).", ErrorCode.EMB, path); throw new Exception(error, ex); } }
public EmbEditForm(EMB_File _embFile, AssetContainerTool _container, AssetType _assetType, EepkEditor _parent, bool isForContainer = true, string windowTitle = null) { IsForContainer = isForContainer; EmbFile = _embFile; container = _container; assetType = _assetType; InitializeComponent(); DataContext = this; //Owner = parent; parent = _parent; if (windowTitle != null) { Title += String.Format(" ({0})", windowTitle); } if (assetType != AssetType.PBIND && assetType != AssetType.TBIND && isForContainer) { MessageBox.Show("EmbEditForm cannot be used on AssetType: " + assetType); Close(); } //EmbFile.LoadDdsImages(false); }