public void LoadFileByVirtualFileName(string virtualFileName) { if (browser == null) { return; } if (VirtualFile.IsInArchive(virtualFileName)) { Log.Warning("WebBrowserControl: LoadFileByVirtualFileName: Loading from archive is not supported."); return; } string url = GetURLFromVirtualFileName(virtualFileName); LoadURL(url); }
private void OnResourceBeginEditMode(EventArgs eventArgs) { if (this.currentResourceObjectEditor == null) { string realPathByVirtual = VirtualFileSystem.GetRealPathByVirtual(this.currentResourcePath); Shell32Api.ShellExecuteEx(null, realPathByVirtual); return; } if (!this.currentResourceObjectEditor.AllowEditMode) { string realPathByVirtual2 = VirtualFileSystem.GetRealPathByVirtual(this.currentResourcePath); Shell32Api.ShellExecuteEx(null, realPathByVirtual2); return; } if (VirtualFile.IsInArchive(this.currentResourceObjectEditor.FileName)) { Log.Warning(ToolsLocalization.Translate("Various", "This file is inside an archive. Unable to edit it.")); return; } this.currentResourceObjectEditor.BeginEditMode(); Log.Info("MainForm.Instance.EngineAppControl.Focus();"); }
public bool ChangeResourceObjectEditor(string fileName) { this.currentResourcePath = fileName; this.currentResourceFileSize = 0L; try { if (!string.IsNullOrEmpty(this.currentResourcePath)) { this.currentResourceFileSize = VirtualFile.GetLength(this.currentResourcePath); } } catch { } this.currentResourceIsArchive = false; try { if (!string.IsNullOrEmpty(this.currentResourcePath)) { this.currentResourceIsArchive = VirtualFile.IsArchive(this.currentResourcePath); } } catch { } this.currentResourceIsInArchive = false; try { if (!string.IsNullOrEmpty(this.currentResourcePath)) { this.currentResourceIsInArchive = VirtualFile.IsInArchive(this.currentResourcePath); } } catch { } if (this.currentResourceObjectEditor != null) { if (fileName != null && string.Compare(this.currentResourceObjectEditor.FileName, fileName, true) == 0) { return(true); } if (this.currentResourceObjectEditor.EditModeActive && !this.currentResourceObjectEditor.EndEditMode()) { return(false); } this.currentResourceObjectEditor.Dispose(); this.currentResourceObjectEditor = null; } if (fileName != null) { string text = Path.GetExtension(fileName); if (!string.IsNullOrEmpty(text)) { text = text.Substring(1); if (ResourceTypeManager.Instance != null) { ResourceType byExtension = ResourceTypeManager.Instance.GetByExtension(text); if (byExtension != null) { Type resourceObjectEditorType = byExtension.ResourceObjectEditorType; ConstructorInfo constructor = resourceObjectEditorType.GetConstructor(new Type[0]); this.currentResourceObjectEditor = (ResourceObjectEditor)constructor.Invoke(new object[0]); this.currentResourceObjectEditor.Create(byExtension, fileName); } } } } if (MainForm.Instance != null && this.currentResourceObjectEditor == null) { MainForm.Instance.PropertiesForm.SelectObjects(null); } return(true); }
public virtual void Create(ResourceType resourceType, string fileName) { this.resourceType = resourceType; this.fileName = fileName; this.isInArchive = VirtualFile.IsInArchive(fileName); }