public static Dictionary<String, Bitmap> GetFileIcons()
 {
     Dictionary<String, Bitmap> s = new Dictionary<string,Bitmap>();
     foreach (dynamic p in Program.PluginManager.Plugins)
     {
         foreach (Type t in p.FileFormatTypes)
         {
             dynamic q = new StaticDynamic(t);
             Bitmap v = q.Identifier.GetIcon();
             if (v != null) s.Add(t.ToString(), v);
         }
     }
     return s;
 }
 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 static String[] GetFileCategories()
 {
     List<String> s = new List<string>();
     foreach (dynamic p in Program.PluginManager.Plugins)
     {
         foreach (Type t in p.FileFormatTypes)
         {
             dynamic q = new StaticDynamic(t);
             String v = q.Identifier.GetCategory();
             if (!s.Contains(v)) s.Add(v);
         }
     }
     s.Sort();
     s.Insert(0, "Folders");
     return s.ToArray();
 }
예제 #4
0
        public static Dictionary <String, Bitmap> GetFileIcons()
        {
            Dictionary <String, Bitmap> s = new Dictionary <string, Bitmap>();

            foreach (dynamic p in Program.PluginManager.Plugins)
            {
                foreach (Type t in p.FileFormatTypes)
                {
                    dynamic q = new StaticDynamic(t);
                    Bitmap  v = q.Identifier.GetIcon();
                    if (v != null)
                    {
                        s.Add(t.ToString(), v);
                    }
                }
            }
            return(s);
        }
예제 #5
0
        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);
        }
예제 #6
0
        public static String[] GetFileCategories()
        {
            List <String> s = new List <string>();

            foreach (dynamic p in Program.PluginManager.Plugins)
            {
                foreach (Type t in p.FileFormatTypes)
                {
                    dynamic q = new StaticDynamic(t);
                    String  v = q.Identifier.GetCategory();
                    if (!s.Contains(v))
                    {
                        s.Add(v);
                    }
                }
            }
            s.Sort();
            s.Insert(0, "Folders");
            return(s.ToArray());
        }
예제 #7
0
 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();
 }
예제 #8
0
 private void OpenFile(object sender, EventArgs e)
 {
     if (opening) return;
     opening = true;
     String Filter = "";
     List<String> Filters = new List<string>();
     Filters.Add("all files (*.*)|*.*");
     List<String> Extenstions = new List<string>();
     String AllSupportedFilesA = "All Supported Files (";
     String AllSupportedFilesB = "|";
     foreach (Plugin p in Program.PluginManager.Plugins)
     {
         foreach (Type t in p.FileFormatTypes)
         {
             if (t.GetInterfaces().Contains(typeof(IViewable)))
             {
                 dynamic d = new StaticDynamic(t);
                 String FilterString;
                 try
                 {
                     FilterString = d.Identifier.GetFileFilter();
                 }
                 catch (NotImplementedException)
                 {
                     continue;
                 }
                 if (FilterString == null || FilterString.Length == 0) continue;
                 if (!Filters.Contains(FilterString.ToLower()))
                 {
                     string[] strArray = FilterString.Split(new char[] { '|' });
                     if ((strArray == null) || ((strArray.Length % 2) != 0)) continue;
                     string[] q = FilterString.Split('|');
                     for (int i = 1; i < q.Length; i += 2)
                     {
                         foreach (string f in q[i].Split(';'))
                         {
                             if (!Extenstions.Contains(f.ToLower()))
                             {
                                 Extenstions.Add(f.ToLower());
                                 if (!AllSupportedFilesA.EndsWith("(")) AllSupportedFilesA += ", ";
                                 AllSupportedFilesA += f.ToLower();
                                 if (!AllSupportedFilesB.EndsWith("|")) AllSupportedFilesB += ";";
                                 AllSupportedFilesB += f.ToLower();
                             }
                         }
                     }
                     Filters.Add(FilterString.ToLower());
                     if (Filter != "") Filter += "|";
                     Filter += FilterString;
                 }
             }
         }
     }
     if (Filter != "")
     {
         Filter = AllSupportedFilesA + ")" + AllSupportedFilesB + "|" + Filter;
         Filter += "|";
     }
     Filter += "All Files (*.*)|*.*";
     openFileDialog1.Filter = Filter;
     if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK
         && openFileDialog1.FileName.Length > 0)
     {
         foreach (String s in openFileDialog1.FileNames)
         {
             Program.FileManager.OpenFile(new EFEDiskFile(s));
         }
     }
     opening = false;
 }