コード例 #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
ファイル: ZipReader.cs プロジェクト: RSchwoerer/Terminals
		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));
        }
コード例 #5
0
        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
        }
コード例 #8
0
 public IEnumerable <string> FindEntries(nsAUTF8String pattern)
 {
     return(new SimpleGeckoEnumerableCollection <string>(
                () => new Utf8StringEnumerator(_zipReader.Instance.FindEntries(pattern))));
 }
コード例 #9
0
ファイル: ZipReader.cs プロジェクト: RSchwoerer/Terminals
		public IEnumerable<string> FindEntries(nsAUTF8String pattern)
		{
			return new SimpleGeckoEnumerableCollection<string>(
				() => new Utf8StringEnumerator(_zipReader.Instance.FindEntries(pattern)));
		}
コード例 #10
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 );
 }