示例#1
0
        private static Assembly LoadFromFabricCodePath(object sender, ResolveEventArgs args)
        {
            string assemblyName = new AssemblyName(args.Name).Name;

            if (!ResolvableAssemblyNames.Contains(assemblyName))
            {
                return(null);
            }

            if (CachedAssemblies.ContainsKey(assemblyName))
            {
                return(CachedAssemblies[assemblyName]);
            }

            try
            {
                string folderPath   = FabricEnvironment.GetCodePath();
                string assemblyPath = Path.Combine(folderPath, assemblyName + ".dll");
                if (File.Exists(assemblyPath))
                {
                    CachedAssemblies[assemblyName] = Assembly.LoadFrom(assemblyPath);
                    return(CachedAssemblies[assemblyName]);
                }
            }
            catch (Exception)
            {
                // Supress any Exception so that we can continue to
                // load the assembly through other means
            }

            return(null);
        }
        public static Assembly ResolveAssembly(string assemblyName)
        {
            if (!KnownDlls.Contains(assemblyName))
            {
                throw new ArgumentException("Unknown fabric assembly name: " + assemblyName, "assemblyName");
            }

            string assemblyPath = Path.Combine(FabricEnvironment.GetCodePath(), assemblyName);

            return(Assembly.LoadFrom(assemblyPath));
        }
示例#3
0
 public static void SetFabricCodePath(string codePath, string machineName)
 {
     Utility.WrapNativeSyncInvoke(() => FabricEnvironment.SetFabricCodePathHelper(codePath, machineName), "FabricEnvironment.SetFabricCodePath");
 }
示例#4
0
 public static void SetFabricBinRoot(string binRoot, string machineName)
 {
     Utility.WrapNativeSyncInvoke(() => FabricEnvironment.SetFabricBinRootHelper(binRoot, machineName), "FabricEnvironment.SetBinRoot");
 }
示例#5
0
 public static string GetLogRoot(string machineName)
 {
     return(Utility.WrapNativeSyncInvoke(() => FabricEnvironment.GetLogRootHelper(machineName), "FabricEnvironment.GetLogRoot"));
 }
示例#6
0
 public static string GetCodePath(string machineName)
 {
     return(Utility.WrapNativeSyncInvoke(() => FabricEnvironment.GetCodePathHelper(machineName), "FabricEnvironment.GetCodePath"));
 }
示例#7
0
 public static bool GetEnableCircularTraceSession(string machineName)
 {
     return(Utility.WrapNativeSyncInvoke(() => FabricEnvironment.GetEnableCircularTraceSessionHelper(machineName), "FabricEnvironment.GetEnableCircularTraceSession"));
 }
示例#8
0
 public static void SetIsSFVolumeDiskServiceEnabled(bool isSFVolumeDiskServiceEnabled, string machineName)
 {
     Utility.WrapNativeSyncInvoke(() => FabricEnvironment.SetIsSFVolumeDiskServiceEnabledHelper(isSFVolumeDiskServiceEnabled, machineName), "FabricEnvironment.SetIsSFVolumeDiskServiceEnabled");
 }
示例#9
0
 internal static LinuxPackageManagerType GetLinuxPackageManagerType()
 {
     return(Utility.WrapNativeSyncInvokeInMTA(() => FabricEnvironment.GetLinuxPackageManagerTypeHelper(), "FabricEnvironment.GetLinuxPackageManagerType"));
 }
示例#10
0
 public static void SetEnableUnsupportedPreviewFeatures(bool enableUnsupportedPreviewFeatures, string machineName)
 {
     Utility.WrapNativeSyncInvoke(() => FabricEnvironment.SetEnableUnsupportedPreviewFeaturesHelper(enableUnsupportedPreviewFeatures, machineName), "FabricEnvironment.SetEnableUnsupportedPreviewFeatures");
 }
示例#11
0
 public static void SetEnableCircularTraceSession(bool enableCircularTraceSession, string machineName)
 {
     Utility.WrapNativeSyncInvoke(() => FabricEnvironment.SetEnableCircularTraceSessionHelper(enableCircularTraceSession, machineName), "FabricEnvironment.SetEnableCircularTraceSession");
 }
示例#12
0
 public static void SetSfInstalledMoby(string fileContents)
 {
     Utility.WrapNativeSyncInvoke(() => FabricEnvironment.SetSfInstalledMobyHelper(fileContents), "FabricEnvironment.SetSfInstalledMoby");
 }