Пример #1
0
        public static void Register(IUrlResourceStream otherRes, params Assembly[] assemblies)
        {
            foreach (var assembly in assemblies)
            {
                EmbeddedResourceMap.AddAssembly(assembly);
            }

            if (!_isRegistered)
            {
                EmbeddedResourceMap.OtherResourceStream = otherRes;
                var internetSession = GetInternetSession();
                var factory         = new QuokkaProtocolHandlerFactory(EmbeddedResourceMap);
                var guid            = new Guid(QuokkaProtocolHandler.Guid);
                var hr = internetSession.RegisterNameSpace(factory, ref guid, SchemeName, 0, null, 0);
                if (hr != 0)
                {
                    Marshal.ThrowExceptionForHR(hr);
                }
                _isRegistered = true;
                _classFactory = factory;
            }
        }
Пример #2
0
		public static void Register(params Assembly[] assemblies)
		{
			foreach (var assembly in assemblies)
			{
				EmbeddedResourceMap.AddAssembly(assembly);
			}

			if (!_isRegistered)
			{

				var internetSession = GetInternetSession();
				var factory = new QuokkaProtocolHandlerFactory(EmbeddedResourceMap);
				var guid = new Guid(QuokkaProtocolHandler.Guid);
				var hr = internetSession.RegisterNameSpace(factory, ref guid, SchemeName, 0, null, 0);
				if (hr != 0)
				{
					Marshal.ThrowExceptionForHR(hr);
				}
				_isRegistered = true;
				_classFactory = factory;
			}
		}