コード例 #1
0
ファイル: IoC.cs プロジェクト: jeddawson/ably-dotnet
        /// <summary>Load AblyPlatform.dll, instantiate AblyPlatform.PlatformImpl type.</summary>
        static IoC()
        {
            var name = new AssemblyName("IO.Ably");
            var type = Assembly.Load(name).GetType("IO.Ably.Platform");

            if (type != null)
            {
                var obj = Activator.CreateInstance(type);
                Platform = obj as IPlatform;
            }
            else
            {
                DefaultLogger.Debug("Platform class does not exist. Defaulting Microsoft Websocket library.");
            }
        }
コード例 #2
0
 /// <summary>Load AblyPlatform.dll, instantiate AblyPlatform.PlatformImpl type.</summary>
 static IoC()
 {
     try
     {
         var name = new AssemblyName("IO.Ably");
         var asm  = Assembly.Load(name);
         var type = Assembly.Load(name).GetType("IO.Ably.Platform");
         if (type != null)
         {
             var obj = Activator.CreateInstance(type);
             Platform = obj as IPlatform;
         }
         else
         {
             DefaultLogger.Debug("Platform class does not exist. Defaulting Microsoft Websocket library.");
         }
     }
     catch (FileNotFoundException e)
     {
         DefaultLogger.Debug($"Assembly cannot be loaded. Defaulting Microsoft Websocket library. ({e.Message})");
     }
 }