public SauceInfoDialog(EtoFileInfo file, Document document, bool readOnly = false, bool directSave = true) { this.directSave = directSave; this.file = file; this.document = document; //DisplayMode = DialogDisplayMode.Attached; MinimumSize = new Size(400, 500); if (file == null && document == null) { throw new ArgumentException("Must specify either file or document argument"); } Resizable = true; Title = "Sauce Metadata"; allowRemove = !readOnly; allowSave = !readOnly; if (document != null) { if (document.Sauce != null) { sauce = new SauceInfo(document.Sauce); } } else if (file != null) { using (var stream = file.OpenRead()) { sauce = SauceInfo.GetSauce(stream); } if (file.ReadOnly) { allowRemove = false; allowSave = false; } } if (sauce == null) { sauce = new SauceInfo(); if (document != null) { document.FillSauce(sauce, document.LoadedFormat); } allowRemove = false; } CreateControls(); UpdateDataType(); }
protected override void Execute(CommandExecuteArgs args) { if (main.Document != null) { EtoFileInfo file = main.FileList.SelectedFile; Document doc = (main.EditMode) ? main.Document : null; if (file != null || doc != null) { var si = new SauceInfoDialog(file, doc); if (si.ShowModal(main) == DialogResult.Ok && !main.EditMode) { main.ReloadFile(false, false, false); } } } }
public void ReloadFile(bool hasSavePermissions, bool focus, bool checkModifications) { if (!shouldReload) { return; } if (checkModifications && FileModifiedDialog.Show(this) != DialogResult.Ok) { return; } EtoFileInfo file = fileList.SelectedFile; if (file != null) { //Console.WriteLine ("Reloading file: {0}, format:{1}", file.Name, currentFormat != null ? currentFormat.GetType () : null); if (file != currentFile) { currentFormat = null; } currentFile = file; Format format = currentFormat ?? Settings.Infos.FindFormat(file.FullName, "character", "ansi"); if (format != null) { try { var stream = file.Open(FileMode.Open, FileAccess.Read, FileShare.Read); LoadFile(file.FullName, stream, format, EditMode, false, hasSavePermissions); if (focus) { padpanel.Content.Focus(); } } catch (Exception ex) { SetDocument(null); MessageBox.Show(this, string.Format("Error loading file '{0}'. {1}", file.FullName, ex.Message)); #if DEBUG Debug.Print("Error loading: {0}", ex); throw; #endif } } } }
public bool LoadFile(string fileName, bool hasSavePermissions) { if (FileModifiedDialog.Show(this) != DialogResult.Ok) { return(true); } currentFormat = null; currentFile = null; Format format = Settings.Infos.FindFormat(fileName, "character", "ansi"); if (format != null && File.Exists(fileName)) { var stream = File.OpenRead(fileName); LoadFile(fileName, stream, format, EditMode, true, hasSavePermissions); return(true); } return(false); }
public bool LoadFile(string fileName, bool hasSavePermissions, bool setFileList = true, bool?editMode = null) { if (FileModifiedDialog.Show(this) != DialogResult.Ok) { return(true); } currentFormat = null; currentFile = null; if (File.Exists(fileName)) { using (var stream = File.OpenRead(fileName)) { return(LoadFile(fileName, stream, null, editMode ?? EditMode, setFileList, hasSavePermissions)); } } return(false); }
public bool LoadFile(EtoFileInfo file) { //if (FileModifiedDialog.Show(this) != DialogResult.Ok) return true; Format format = Settings.Infos.FindFormat(file.Name, "character", "ansi"); if (format != null) { try { var stream = file.OpenRead(); this.LoadFile(file.FullName, stream, format); //this.FileList.Initialize(fileName); } catch (Exception e) { MessageBox.Show(Generator, this, string.Format("Unable to load the selected file ({0})", e.ToString())); Console.WriteLine(e.ToString()); } return(true); } return(false); }
public RarDirectoryInfo(EtoFileInfo fileInfo) : base(fileInfo) { }
public SharpCompressDirectoryInfo(EtoFileInfo fileInfo) : base(fileInfo) { }
protected VirtualDirectoryInfo(EtoFileInfo fileInfo) : this() { this.FileInfo = fileInfo; this.VirtualPath = string.Empty; }
public virtual VirtualDirectoryInfo Create(EtoFileInfo fileInfo) { return (VirtualDirectoryInfo)Activator.CreateInstance(Type, fileInfo); }
public ZipDirectoryInfo(EtoFileInfo fileInfo) : base(fileInfo) { }
protected VirtualDirectoryInfo(EtoFileInfo fileInfo) : this() { FileInfo = fileInfo; }