public Type[] GetPossibleFormats(EFEFile File) { Dictionary <Type, FormatMatch> Formats = new Dictionary <Type, FormatMatch>(); bool gotContent = false; foreach (Plugin p in Program.PluginManager.Plugins) { foreach (Type t in p.FileFormatTypes) { dynamic d = new StaticDynamic(t); FormatMatch m = d.Identifier.IsFormat(File); if (m == FormatMatch.Content) { gotContent = true; } if (m != FormatMatch.No && !(gotContent && m == FormatMatch.Extension)) { Formats.Add(t, m); } } } if (gotContent) { foreach (Type t in Formats.Keys) { if (Formats[t] == FormatMatch.Extension) { Formats.Remove(t); } } } return(Formats.Keys.ToArray()); }
public override FormatMatch IsFormat(EFEFile File) { if (File.Data.Length > 6 && File.Data[0] == 'M' && File.Data[1] == 'O' && File.Data[2] == 'D' && File.Data[3] == 'S' && File.Data[4] == 'N' && File.Data[5] == '3') { return(FormatMatch.Content); } return(FormatMatch.No); }
public override FormatMatch IsFormat(EFEFile File) { if (File.Data.Length > 0x40 && File.Data[0] == 0x00 && File.Data[1] == 0x20 && File.Data[2] == 0xAF && File.Data[3] == 0x30) { return(FormatMatch.Content); } return(FormatMatch.No); }
public override FormatMatch IsFormat(EFEFile File) { if (File.Data.Length > 0x28 && File.Data[File.Data.Length - 0x28] == 'C' && File.Data[File.Data.Length - 0x27] == 'L' && File.Data[File.Data.Length - 0x26] == 'I' && File.Data[File.Data.Length - 0x25] == 'M' && IOUtil.ReadU32LE(File.Data, File.Data.Length - 0x4) == (File.Data.Length - 0x28)) { return(FormatMatch.Content); } return(FormatMatch.No); }
public override FormatMatch IsFormat(EFEFile File) { if (File.Name.ToLower().EndsWith(".mtl")) { return(FormatMatch.Extension); } return(FormatMatch.No); }
public override FormatMatch IsFormat(EFEFile File) { if (File.Name.Equals("body_LZ.bin")) { return(FormatMatch.Content); } return(FormatMatch.No); }
public override FormatMatch IsFormat(EFEFile File) { if (File.Data.Length > 16 && File.Data[0] == 'R' && File.Data[1] == 'I' && File.Data[2] == 'F' && File.Data[3] == 'F' && File.Data[8] == 'W' && File.Data[9] == 'A' && File.Data[10] == 'V' && File.Data[11] == 'E') { return(FormatMatch.Content); } return(FormatMatch.No); }
public override FormatMatch IsFormat(EFEFile File) { if (File.Data.Length > 4 && File.Data[0] == 0x55 && File.Data[1] == 0xAA && File.Data[2] == 0x38 && File.Data[3] == 0x2D) { return(FormatMatch.Content); } return(FormatMatch.No); }
public override FormatMatch IsFormat(EFEFile File) { if (File.Data.Length > 0x10 && File.Data[0] == 'Y' && File.Data[1] == 'B' && File.Data[2] == 1 && File.Data[3] == 0) { return(FormatMatch.Content); } return(FormatMatch.No); }
public override FormatMatch IsFormat(EFEFile File) { if (File.Name.ToLower() == "utility.bin") { return(FormatMatch.Extension); } return(FormatMatch.No); }
public override FormatMatch IsFormat(EFEFile File) { if (File.Data.Length > 45 && File.Data[0] == 'C' && File.Data[1] == 'G' && File.Data[2] == 'R' && File.Data[3] == 'P' && File.Data[0x40] == 'I' && File.Data[0x41] == 'N' && File.Data[0x42] == 'F' && File.Data[0x43] == 'O') { return(FormatMatch.Content); } return(FormatMatch.No); }
public override FormatMatch IsFormat(EFEFile File) { if (File.Data.Length > 7 && File.Data[0] == 'M' && File.Data[1] == 'E' && File.Data[2] == 'S' && File.Data[3] == 'G' && File.Data[4] == 'b' && File.Data[5] == 'm' && File.Data[6] == 'g' && File.Data[7] == '1') { return(FormatMatch.Content); } return(FormatMatch.No); }
public override FormatMatch IsFormat(EFEFile File) { if (File.Data.Length > 4 && File.Data[0] == 'R' && File.Data[1] == 'S' && File.Data[2] == 'A' && File.Data[3] == 'R' && File.Data[0x40] == 'S' && File.Data[0x41] == 'Y' && File.Data[0x42] == 'M' && File.Data[0x43] == 'B') { return(FormatMatch.Content); } return(FormatMatch.No); }
public override FormatMatch IsFormat(EFEFile File) { if (File.Data.Length > 20 && File.Data[0] == 'S' && File.Data[1] == 'A' && File.Data[2] == 'R' && File.Data[3] == 'C' && File.Data[0x14] == 'S' && File.Data[0x15] == 'F' && File.Data[0x16] == 'A' && File.Data[0x17] == 'T') { return(FormatMatch.Content); } return(FormatMatch.No); }
public override FormatMatch IsFormat(EFEFile File) { if (File.Data.Length > 4 && File.Data[0] == 'C' && File.Data[1] == 'W' && File.Data[2] == 'A' && File.Data[3] == 'V') { return(FormatMatch.Content); } return(FormatMatch.No); }
public override FormatMatch IsFormat(EFEFile File) { if (File.Data.Length > 10 && File.Data[0] == 'M' && File.Data[1] == 's' && File.Data[2] == 'g' && File.Data[3] == 'S' && File.Data[4] == 't' && File.Data[5] == 'd' && File.Data[6] == 'B' && File.Data[7] == 'n') { return(FormatMatch.Content); } return(FormatMatch.No); }
public override FormatMatch IsFormat(EFEFile File) { if (File.Name.EndsWith(".icn")) { return(FormatMatch.Extension); } else { return(FormatMatch.No); } }
public override FormatMatch IsFormat(EFEFile File) { if (File.Name.Equals("rf3Archive.arc")) { return(FormatMatch.Content); } else { return(FormatMatch.No); } }
public ViewableFile GetViewableFileFromFile(EFEFile File) { foreach (var v in ViewedFiles) { if (v.File.Equals(File)) { return(v); } } return(null); }
public override FormatMatch IsFormat(EFEFile File) { if (File.Data.Length > 0x3C && File.Data[0] == 0x3C && File.Data[1] == 0 && File.Data[2] == 0 && File.Data[3] == 0 && File.Data[0x10] == 0 && File.Data[0x11] == 0 && File.Data[0x12] == 0xF0 && File.Data[0x13] == 0x41 && File.Data[0x38] == 0 && File.Data[0x39] == 0 && File.Data[0x3A] == 0xC8 && File.Data[0x3B] == 0x41 ) { return(FormatMatch.Content); } return(FormatMatch.No); }
public override FormatMatch IsFormat(EFEFile File) { if (File.Data.Length < 9) { return(FormatMatch.No); } byte[] signature = new byte[9]; Array.Copy(File.Data, signature, 9); try { string data = System.Text.Encoding.UTF8.GetString(signature); return(data.StartsWith("#$MSC") ? FormatMatch.Content : FormatMatch.No); } catch (Exception) { return(FormatMatch.No); } }
public static ListViewItem GetFileItem(EFEFile File) { Type[] formats = Program.FileManager.GetPossibleFormats(File); ListViewItem i = new ListViewItem(File.Name); StringBuilder b = new StringBuilder(50); Win32Util.StrFormatByteSize(File.Data.Length, b, 50); i.SubItems.Add(b.ToString()); if (formats.Length == 1) { i.ImageKey = formats[0].ToString(); dynamic q = new StaticDynamic(formats[0]); i.Tag = q.Identifier.GetCategory(); } if (File.IsCompressed) { i.ForeColor = Color.Blue; } return(i); }
public override FormatMatch IsFormat(EFEFile File) { if (File.Data.Length > 0x40 && File.Data[0x20] == 'M' && File.Data[0x21] == 'A' && File.Data[0x22] == 'R' && File.Data[0x23] == 'I' && File.Data[0x24] == 'O' && File.Data[0x25] == 'K' && File.Data[0x26] == 'A' && File.Data[0x27] == 'R' && File.Data[0x28] == 'T' && File.Data[0x29] == '6' && File.Data[0x2A] == '4' && File.Data[0x3B] == 'N' && File.Data[0x3C] == 'K' && File.Data[0x3D] == 'T' && File.Data[0x3E] == 'E') { return(FormatMatch.Content); } return(FormatMatch.No); }
public static void OpenFile(EFEFile File, EFEFile Parent = null) { Program.FileManager.OpenFile(File, Parent); }
public static ViewableFile GetViewableFileFromFile(EFEFile File) { return(Program.FileManager.GetViewableFileFromFile(File)); }
public bool OpenFile(EFEFile File, EFEFile Parent = null) { foreach (var v in ViewedFiles) { if (v.File.Equals(File)) { MessageBox.Show("This file has already been opened!"); ((Form1)Application.OpenForms[0]).BringMDIWindowToFront(v.Dialog); return(false); } } Type[] formats = GetPossibleFormats(File); if (formats.Length == 0) { return(false); } List <Type> Viewables = new List <Type>(); foreach (Type t in formats) { if (t.GetInterfaces().Contains(typeof(IViewable))) { Viewables.Add(t); } } Type tt; if (Viewables.Count == 0) { return(false); } else if (Viewables.Count == 1) { tt = Viewables[0]; } else { MessageBox.Show("Multiple types match!"); return(false); } ViewableFile vv = new ViewableFile(File, tt); ViewedFiles.Add(vv); vv.DialogClosing += new ViewableFile.DialogClosingEventHandler(v_DialogClosing); vv.ShowDialog(Application.OpenForms[0]); if (Parent != null) { File.Parent = Parent; Parent.Children.Add(File); } foreach (var v in ViewedFiles) { if (vv != v && v.Dialog is IUseOtherFiles) { ((IUseOtherFiles)v.Dialog).FileOpened(vv); } } return(true); }