// Decompiled with JetBrains decompiler // Type: CarotDAV.FsManager // Assembly: CarotDAV, Version=1.13.2.18337, Culture=neutral, PublicKeyToken=null // MVID: C31F2651-A4A8-4D09-916A-8C6106F5E7C8 // Assembly location: F:\Eigene Dateien\Dropbox\portable Collection\Progs\CarotDAV\CarotDAV.exe using Microsoft.VisualBasic.CompilerServices; using Rei.Fs; using System; using System.Collections.Generic; using System.Drawing; using System.IO; using System.Reflection; using System.Windows.Forms; namespace CarotDAV { public class FsManager { private static List pFsTypeList = new List(); private static List pFsNameTypeList = new List(); private static Dictionary pFsTypeDllNameDic = new Dictionary(); private static List pTryCreateMethodInfos = new List(); private static Dictionary pGetDefaultFaviconMethodInfos = new Dictionary(); private static string pFsBaseDllPath; public static System.Type[] FsTypes { get { return FsManager.pFsTypeList.ToArray(); } } public static void LoadFs() { string[] files = Directory.GetFiles(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "*.dll"); System.Type c = typeof (ConnectionSettingBase); List stringList = new List(); Assembly executingAssembly = Assembly.GetExecutingAssembly(); System.Type[] types1 = new System.Type[0]; System.Type[] types2 = new System.Type[2] { typeof (Uri), typeof (ConnectionSettingBase).MakeByRefType() }; System.Type[] types3 = new System.Type[0]; FsManager.pFsBaseDllPath = Assembly.GetAssembly(typeof (FsBase)).Location; AssemblyName[] referencedAssemblies = executingAssembly.GetReferencedAssemblies(); int index1 = 0; FsManager.TypeNamePair typeNamePair; while (index1 < referencedAssemblies.Length) { AssemblyName assemblyRef = referencedAssemblies[index1]; try { if (assemblyRef.FullName.StartsWith("Rei.Fs.")) { Assembly assembly = Assembly.Load(assemblyRef); System.Type[] types4 = assembly.GetTypes(); int index2 = 0; while (index2 < types4.Length) { System.Type key = types4[index2]; if (key.IsClass && key.IsPublic && (!key.IsAbstract && key.IsSubclassOf(c))) { PropertyInfo property = key.GetProperty("TypeName", BindingFlags.Static | BindingFlags.Public, (Binder) null, typeof (string), types1, (ParameterModifier[]) null); if (property != null) { string str = (string) property.GetValue((object) null, (object[]) null); if (str != null && !FsManager.pFsTypeList.Contains(key)) { FsManager.pFsTypeList.Add(key); FsManager.pFsTypeDllNameDic.Add(key, assembly.Location); typeNamePair.Type = key; typeNamePair.Name = str; FsManager.pFsNameTypeList.Add(typeNamePair); MethodInfo method1 = key.GetMethod("TryCreate", BindingFlags.Static | BindingFlags.Public, (Binder) null, types2, (ParameterModifier[]) null); if (method1 != null && method1.ReturnType == typeof (bool)) FsManager.pTryCreateMethodInfos.Add(method1); MethodInfo method2 = key.GetMethod("GetDefaultFavicon", BindingFlags.Static | BindingFlags.Public, (Binder) null, types3, (ParameterModifier[]) null); if (method2 != null && method2.ReturnType == typeof (Icon)) FsManager.pGetDefaultFaviconMethodInfos.Add(key, method2); } } } checked { ++index2; } } } } catch (Exception ex) { ProjectData.SetProjectError(ex); ProjectData.ClearProjectError(); } checked { ++index1; } } string[] strArray = files; int index3 = 0; while (index3 < strArray.Length) { string assemblyFile = strArray[index3]; try { Assembly assembly = Assembly.LoadFrom(assemblyFile); System.Type[] types4 = assembly.GetTypes(); int index2 = 0; while (index2 < types4.Length) { System.Type key = types4[index2]; if (key.IsClass && key.IsPublic && (!key.IsAbstract && key.IsSubclassOf(c))) { PropertyInfo property = key.GetProperty("TypeName", BindingFlags.Static | BindingFlags.Public, (Binder) null, typeof (string), types1, (ParameterModifier[]) null); if (property != null) { string str = (string) property.GetValue((object) null, (object[]) null); if (str != null && !FsManager.pFsTypeList.Contains(key)) { FsManager.pFsTypeList.Add(key); FsManager.pFsTypeDllNameDic.Add(key, assembly.Location); typeNamePair.Type = key; typeNamePair.Name = str; FsManager.pFsNameTypeList.Add(typeNamePair); MethodInfo method1 = key.GetMethod("TryCreate", BindingFlags.Static | BindingFlags.Public, (Binder) null, types2, (ParameterModifier[]) null); if (method1 != null && method1.ReturnType == typeof (bool)) FsManager.pTryCreateMethodInfos.Add(method1); MethodInfo method2 = key.GetMethod("GetDefaultFavicon", BindingFlags.Static | BindingFlags.Public, (Binder) null, types3, (ParameterModifier[]) null); if (method2 != null && method2.ReturnType == typeof (Icon)) FsManager.pGetDefaultFaviconMethodInfos.Add(key, method2); } } } checked { ++index2; } } } catch (Exception ex) { ProjectData.SetProjectError(ex); ProjectData.ClearProjectError(); } checked { ++index3; } } } public static FsManager.TypeNamePair[] GetFsNameAndType() { return FsManager.pFsNameTypeList.ToArray(); } public static bool TryCreate(Uri target, ref ConnectionSettingBase c) { int num1 = 0; int num2 = checked (FsManager.pTryCreateMethodInfos.Count - 1); int index = num1; while (index <= num2) { object[] parameters = new object[2] { (object) target, (object) null }; if ((bool) FsManager.pTryCreateMethodInfos[index].Invoke((object) null, parameters)) { c = (ConnectionSettingBase) parameters[1]; return true; } checked { ++index; } } return false; } public static Icon GetDefaultFavicon(System.Type type) { if (FsManager.pGetDefaultFaviconMethodInfos.ContainsKey(type)) return (Icon) FsManager.pGetDefaultFaviconMethodInfos[type].Invoke((object) null, (object[]) null); return ConnectionSettingBase.GetDefaultFavicon(); } public static string GetDefaultFaviconPath(System.Type type) { if (FsManager.pGetDefaultFaviconMethodInfos.ContainsKey(type)) return Path.Combine(Application.StartupPath, FsManager.pFsTypeDllNameDic[type]); return FsManager.pFsBaseDllPath; } public struct TypeNamePair { public System.Type Type; public string Name; } } }