Exemplo n.º 1
0
 public void LookupAsync(string address)
 {
     AsyncCallback callback = LookupAsyncCompleteCallback;
     ResolveState ioContext= new ResolveState(address);
     IPAddress hostIPAddress = IPAddress.Parse(address);
     Dns.BeginGetHostEntry(hostIPAddress, callback, ioContext);
 }
Exemplo n.º 2
0
        // Record the IPs in the state object for later use.
        public static void GetHostEntryCallback(IAsyncResult ar)
        {
            ResolveState ioContext = (ResolveState)ar.AsyncState;

            ioContext.IPs = Dns.EndGetHostEntry(ar);
            GetHostEntryFinished.Set();
        }
Exemplo n.º 3
0
        public ResolveState ResovleCaptcha()
        {
            var api = new RecaptchaV2Proxyless
            {
                ClientKey  = captchaStatics.Apikey,
                WebsiteUrl = new Uri(captchaStatics.Url),
                WebsiteKey = YolikerStatics.GooglePublicKey,
            };

            try
            {
                if (!api.CreateTask())
                {
                    resolveState = ResolveState.ERROR;
                }
                //DebugHelper.Out("API v2 send failed. " + api.ErrorMessage, DebugHelper.Type.Error);
                else if (!api.WaitForResult())
                {
                    resolveState = ResolveState.FAIL;
                }
                //DebugHelper.Out("Could not solve the captcha.", DebugHelper.Type.Error);
                else
                {
                    resolveState = ResolveState.SUCCESS;
                }
                captchaStatics.SolvedCaptchaResponse = api.GetTaskSolution().GRecaptchaResponse;
                //DebugHelper.Out("Result: " + api.GetTaskSolution().GRecaptchaResponse, DebugHelper.Type.Success);
            }
            catch
            {
                resolveState = ResolveState.ERROR;
            }
            //Resolve();
            return(resolveState);
        }
        // Record the IPs in the state object for later use.
        public void GetHostEntryCallback(IAsyncResult ar)
        {
            ResolveState ioContext = (ResolveState)ar.AsyncState;

            LookupState returnState = new LookupState();

            returnState.hostName = ioContext.host;

            try
            {
                ioContext.IPs = Dns.EndResolve(ar);

                returnState.successful  = true;
                returnState.resolvedIPs = ioContext.IPs;
            }
            catch (SocketException se)
            {
                returnState.successful = false;
                returnState.message    = se.Message;
            }
            catch (Exception e)
            {
                returnState.successful = false;
                returnState.message    = e.Message;
            }
            GetHostEntryFinished.Set();

            ioContext.Callback.Invoke(returnState);
        }
        // Determine the Internet Protocol (IP) addresses for
        // this host asynchronously.
        public void DoGetHostEntryAsync(string hostname, DnsLookupCallback callback)
        {
            GetHostEntryFinished.Reset();
            ResolveState ioContext = new ResolveState(hostname, callback);

            Dns.BeginResolve(ioContext.host,
                             new AsyncCallback(GetHostEntryCallback), ioContext);
        }
Exemplo n.º 6
0
 protected AbstractBundle(IBundleData bundledata, Framework framework)
 {
     resolveState    = ResolveState.Unresolved;
     state           = BundleState.Installed;
     this.bundledata = (BaseData)bundledata;
     this.bundledata.SetBundle(this);
     this.framework  = framework;
     statechangeLock = new AutoResetEvent(true);
 }
Exemplo n.º 7
0
 public void LookupAsync()
 {
     try {
         AsyncCallback callback = LookupAsyncCompleteCallback;
         ResolveState ioContext = new ResolveState(this.ipaddress, this.ID);
         IPAddress hostIPAddress = IPAddress.Parse(this.ipaddress);
         Dns.BeginGetHostEntry(hostIPAddress, callback, ioContext);
     } catch { }
 }
Exemplo n.º 8
0
 public void LoadAnyComplexTypes()
 {
     if (Spec is IServiceSpec ||
         Spec.IsViewModel ||
         Spec.ContainsFacet(typeof(IComplexTypeFacet)))
     {
         return;
     }
     persistor.LoadComplexTypes(this, ResolveState.IsGhost());
 }
Exemplo n.º 9
0
        public void PingDNS()
        {
            // IAsyncResult asyncResult = Dns.BeginGetHostEntry("192.168.2.16", new AsyncCallback(GetHostAddressesCallback), d);

            //  if (!asyncResult.AsyncWaitHandle.WaitOne(1000, false))
            {
                //    MessageBox.Show("false" + addressList.ToString());
            }
            //  else
            {
                //     MessageBox.Show("true" + addressList.ToString());
            }
            try
            {
                // allDone = new ManualResetEvent(false);
                // Create an instance of the RequestState class.
                //RequestState myRequestState = new RequestState();

                // Begin an asynchronous request for information like host name, IP addresses, or
                // aliases for specified the specified URI.
                //  IAsyncResult asyncResult = Dns.BeginGetHostEntry("192.168.2.166", new AsyncCallback(RespCallback), myRequestState);
                // MessageBox.Show("Host nssamehh : ");
                // Wait until asynchronous call completes.
                //   allDone.WaitOne(100);
                // MessageBox.Show("Host namesss111hh : ");
                GetHostEntryFinished.Reset();
                ResolveState ioContext = new ResolveState("192.168.1.1");

                Dns.BeginGetHostEntry(ioContext.host,
                                      new AsyncCallback(GetHostEntryCallback), ioContext);

                // Wait here until the resolve completes (the callback
                // calls .Set())

                //  asyncResult.AsyncWaitHandle.WaitOne(1000);
                if (!GetHostEntryFinished.WaitOne(2000, false))
                {
                    MessageBox.Show("false");
                }
                else
                {
                    MessageBox.Show("true");
                }
                Console.WriteLine("EndGetHostEntry({0}) returns:", ioContext.host);

                //foreach (IPAddress address in ioContext.IPs.AddressList)
                {
                    //     Console.WriteLine($"    {address}");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("dfdgd");
            }
        }
Exemplo n.º 10
0
        public override string ToString()
        {
            var str = new AsString(this);

            ToString(str);

            // don't do title of unresolved objects as this may force the resolving of the object.
            if (ResolveState.IsTransient() || ResolveState.IsResolved() || ResolveState.IsAggregated())
            {
                str.Append("title", TitleString());
            }
            str.AppendAsHex("poco-hash", poco.GetHashCode());
            return(str.ToString());
        }
Exemplo n.º 11
0
        static public ResolveState TryResolve <T>(this IEnumerable <IEnumerable <T> > item, out T resolved)
        {
            foreach (IEnumerable <T> layer in item)
            {
                ResolveState state = layer.TryResolve <T>(out resolved);

                if (state != ResolveState.UnableToResolve_NotFound)
                {
                    return(state);
                }
            }

            resolved = default(T);
            return(ResolveState.UnableToResolve_NotFound);
        }
Exemplo n.º 12
0
        // Record the IPs in the state object for later use.
        public static void GetHostEntryCallback(IAsyncResult ar)
        {
            ResolveState ioContext = (ResolveState)ar.AsyncState;

            try
            {
                ioContext.IPs = Dns.EndGetHostEntry(ar);
                GetHostEntryFinished.Set();
            }
            catch (Exception ex)
            {
                ioContext = null;
                Debug.WriteLine("Errorr");

                //   GetHostEntryFinished.Set();
            }
        }
Exemplo n.º 13
0
        public bool Equals(GroupMemberApplication input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     GroupId == input.GroupId ||
                     (GroupId.Equals(input.GroupId))
                     ) &&
                 (
                     CreationDate == input.CreationDate ||
                     (CreationDate != null && CreationDate.Equals(input.CreationDate))
                 ) &&
                 (
                     ResolveState == input.ResolveState ||
                     (ResolveState != null && ResolveState.Equals(input.ResolveState))
                 ) &&
                 (
                     ResolveDate == input.ResolveDate ||
                     (ResolveDate != null && ResolveDate.Equals(input.ResolveDate))
                 ) &&
                 (
                     ResolvedByMembershipId == input.ResolvedByMembershipId ||
                     (ResolvedByMembershipId.Equals(input.ResolvedByMembershipId))
                 ) &&
                 (
                     RequestMessage == input.RequestMessage ||
                     (RequestMessage != null && RequestMessage.Equals(input.RequestMessage))
                 ) &&
                 (
                     ResolveMessage == input.ResolveMessage ||
                     (ResolveMessage != null && ResolveMessage.Equals(input.ResolveMessage))
                 ) &&
                 (
                     DestinyUserInfo == input.DestinyUserInfo ||
                     (DestinyUserInfo != null && DestinyUserInfo.Equals(input.DestinyUserInfo))
                 ) &&
                 (
                     BungieNetUserInfo == input.BungieNetUserInfo ||
                     (BungieNetUserInfo != null && BungieNetUserInfo.Equals(input.BungieNetUserInfo))
                 ));
        }
Exemplo n.º 14
0
        // Determine the Internet Protocol (IP) addresses for
        // this host asynchronously.
        public static void DoGetHostEntryAsync(string hostname)
        {
            GetHostEntryFinished.Reset();
            ResolveState ioContext = new ResolveState(hostname);

            Dns.BeginGetHostEntry(ioContext.host,
                                  new AsyncCallback(GetHostEntryCallback), ioContext);

            // Wait here until the resolve completes (the callback
            // calls .Set())
            GetHostEntryFinished.WaitOne();

            Console.WriteLine("EndGetHostEntry({0}) returns:", ioContext.host);

            foreach (IPAddress address in ioContext.IPs.AddressList)
            {
                Console.WriteLine($"    {address}");
            }
        }
Exemplo n.º 15
0
 private bool ElementsLoaded()
 {
     return(ResolveState.IsTransient() || ResolveState.IsResolved());
 }
Exemplo n.º 16
0
 static void Main()
 {
     //Application.EnableVisualStyles();
     //Application.SetCompatibleTextRenderingDefault(false);
     //Application.Run(new Form1());
     AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs e)
     {
         Console.WriteLine(e);
     };
     DnsLookuper d = new DnsLookuper("");
     List<string> s = d.CheckOut();
     List<string> r = new List<string>();
     ThreadPooler.ThreadPooler tp = new ThreadPooler.ThreadPooler(40);
     foreach (string k in s)
     {
         FuncationCaller f = new FuncationCaller();
         f.Arguments = new object[] { k };
         f.CallBack = delegate(FuncationCaller x, ResultEventArg e)
         {
             if (!((bool)e.Result))
             {
                 r.Add(x.Arguments[0].ToString());
             }
         };
         f.Funcation = delegate(object[] b)
         {
             //string d = string.Format("{0}{1}", b[0]);
             string dx = b[0].ToString();
             try
             {
                 ResolveState ioContext = new ResolveState(dx);
                 ManualResetEvent state = new ManualResetEvent(false);
                 state.Reset();
                 Dns.BeginGetHostEntry(ioContext.host, delegate(IAsyncResult ar)
                 {
                     ioContext = (ResolveState)ar.AsyncState;
                     try
                     {
                         ioContext.IPs = Dns.EndGetHostEntry(ar);
                     }
                     catch (Exception ce)
                     {
                         string u = string.Format("{0}:{1}", dx, ce.Message);
                         Console.WriteLine(u);
                         r.Add(u);
                     }
                     state.Set();
                 }, ioContext);
                 state.WaitOne();
                 string sr = "";
                 if (ioContext.IPs.AddressList.Length > 0)
                 {
                     foreach (var item in ioContext.IPs.AddressList)
                     {
                         sr += "," + item.ToString();
                     }
                 }
                 else
                 {
                     sr = "no ip found;";
                 }
                 Console.WriteLine("{0}:{1}", dx, sr);
                 return true;
             }
             catch (Exception ce)
             {
                 string u = string.Format("{0}:{1}", dx, ce.Message);
                 System.Diagnostics.Debug.Print(u);
                 //Console.WriteLine(u);
                 //r.Add(u);
                 //dom.Add(d);
                 return false;
             }
         };
         tp.AddFunction(f);
     }
     tp.Run();
     Console.ReadKey();
 }