Пример #1
0
		public void UrlTestComIterop()
		{
			var service = Xpcom.GetService<nsIIOService>(Contracts.NetworkIOService);

			nsIURI ret;
			using (var str = new nsAUTF8String("http://www.google.com"))
			{
				ret = service.NewURI(str, null, null);
			}
			if ( ret is nsIURL )
			{
				//ok
				//.NET handle is operator correctly
				// TODO - CHECK IT ON MONO
			}
			else
			{
				Assert.Fail();
			}
			// implicit conversion doesn't increment RCW counter on .NET
			// TODO - CHECK IT ON MONO
			var ret2 = ( nsIURL ) ret;

			var counter = Marshal.ReleaseComObject(ret);
			Assert.AreEqual(counter, 0);
			var serviceCounter = Marshal.ReleaseComObject(service);
			// Xpcom.GetService ref + 1
			// IOService static contrustor ref + 1
#if false
			Assert.AreEqual(serviceCounter, 0);
#endif
		}
Пример #2
0
 public static nsIURI CreateNsIUri(string url)
 {
     nsIURI ret;
     using (var str = new nsAUTF8String(url))
     {
         ret = _service.Instance.NewURI(str, null, null);
     }
     return ret;
 }
Пример #3
0
		public bool Test(nsAUTF8String entry)
		{
			bool ret;
			try
			{
				_zipReader.Instance.Test(entry);
				ret = true;
			}
			catch ( Exception )
			{
				ret = false;
			}
			return ret;
		}
Пример #4
0
        /// <summary>
        /// called to synchronously resolve a hostname.  warning this method may
        /// block the calling thread for a long period of time.  it is extremely
        /// unwise to call this function on the UI thread of an application.
        /// </summary>
        /// <param name="hostName"></param>
        /// <param name="flags"></param>
        /// <returns></returns>
        public static DnsRecord Resolve(string hostName, ResolveFlags flags)
        {
            if (hostName == null)
            {
                throw new ArgumentException("parameter cannot be null", "hostName");
            }
            nsIDNSRecord record = null;

            using (nsAUTF8String value = new nsAUTF8String(hostName))
            {
                record = _dnsService.Instance.Resolve(value, (uint)flags);
            }
            return(record == null ? null : new DnsRecord(record));
        }
        public bool Test(nsAUTF8String entry)
        {
            bool ret;

            try
            {
                _zipReader.Instance.Test(entry);
                ret = true;
            }
            catch (Exception)
            {
                ret = false;
            }
            return(ret);
        }
Пример #6
0
		public void UrlTest()
		{
			var service = Xpcom.GetService<nsIIOService>(Contracts.NetworkIOService);

			nsIURI ret;
			using (var str = new nsAUTF8String("http://www.google.com"))
			{
				ret = service.NewURI(str, null, null);
			}

			var ret2=Xpcom.QueryInterface<nsIURL>( ret );

			var counter=Marshal.ReleaseComObject( ret );
			Assert.AreEqual( counter,1 );
			var serviceCounter=Marshal.ReleaseComObject( service );

			// Xpcom.GetService ref + 1
			// IOService static contrustor ref + 1
#if false
			Assert.AreEqual(serviceCounter, 0);
#endif
		}
Пример #7
0
        public void UrlTest()
        {
            var service = Xpcom.GetService <nsIIOService>(Contracts.NetworkIOService);

            nsIURI ret;

            using (var str = new nsAUTF8String("http://www.google.com"))
            {
                ret = service.NewURI(str, null, null);
            }

            var ret2 = Xpcom.QueryInterface <nsIURL>(ret);

            var counter = Marshal.ReleaseComObject(ret);

            Assert.AreEqual(counter, 1);
            var serviceCounter = Marshal.ReleaseComObject(service);

            // Xpcom.GetService ref + 1
            // IOService static contrustor ref + 1
#if false
            Assert.AreEqual(serviceCounter, 0);
#endif
        }
 public IEnumerable <string> FindEntries(nsAUTF8String pattern)
 {
     return(new SimpleGeckoEnumerableCollection <string>(
                () => new Utf8StringEnumerator(_zipReader.Instance.FindEntries(pattern))));
 }
Пример #9
0
		public IEnumerable<string> FindEntries(nsAUTF8String pattern)
		{
			return new SimpleGeckoEnumerableCollection<string>(
				() => new Utf8StringEnumerator(_zipReader.Instance.FindEntries(pattern)));
		}
 /// <summary>
 /// called to synchronously resolve a hostname.  warning this method may
 /// block the calling thread for a long period of time.  it is extremely
 /// unwise to call this function on the UI thread of an application.
 /// </summary>
 /// <param name="hostName"></param>
 /// <param name="flags"></param>
 /// <returns></returns>
 public static DnsRecord Resolve(string hostName, ResolveFlags flags)
 {
     if (hostName==null)
     {
         throw new ArgumentException( "parameter cannot be null", "hostName" );
     }
     nsIDNSRecord record = null;
     using (nsAUTF8String value=new nsAUTF8String(hostName) )
     {
         record = _dnsService.Instance.Resolve(value, (uint)flags);
     }
     return record == null ? null : new DnsRecord( record );
 }