public void should_use_the_non_default_loopback_ip_as_advertise_info_for_internal()
 {
     Assert.AreEqual(new IPEndPoint(IPFinder.GetNonLoopbackAddress(), 1112),
                     _settings.GossipAdvertiseInfo.InternalTcp);
     Assert.AreEqual(new IPEndPoint(IPFinder.GetNonLoopbackAddress(), 2112),
                     _settings.GossipAdvertiseInfo.InternalHttp);
 }
 public void should_use_the_non_default_loopback_ip_as_advertise_info_for_external()
 {
     Assert.AreEqual(new DnsEndPoint(IPFinder.GetNonLoopbackAddress().ToString(), 1113),
                     _settings.GossipAdvertiseInfo.ExternalTcp);
     Assert.AreEqual(new DnsEndPoint(IPFinder.GetNonLoopbackAddress().ToString(), 2113),
                     _settings.GossipAdvertiseInfo.HttpEndPoint);
 }
Exemplo n.º 3
0
        public void Bind()
        {
            IPFinder __Ip = new IPFinder();

            __Ip.IPDetails();
            Check __Ckh = new Check();

            Country     = __Ip.Country;
            CountryCode = __Ip.CountryCode;
            MobileCode  = __Ckh.stringCheck("select top 1 MobileCode from Country where Country_Name='" + __Ip.Country + "'");
            CountryIcon = __Ckh.stringCheck("select top 1 Country_Icon from Country where Country_Name='" + __Ip.Country + "'");
        }
Exemplo n.º 4
0
        public MainForm()
        {
            InitializeComponent();

            NavigationService.Container = pageContainer;

            // make form dragable
            var drag = DragableBehavior.Create(titleBar, this);

            drag.EnableDrag();

            ServiceLocator.LoadLocale();

            var links = NavigationService.CreateLinks(typeof(Program).Assembly,
                                                      (_) =>
            {
                _.ForeColor        = Color.FromArgb(0, 192, 0);
                _.LinkColor        = Color.FromArgb(0, 192, 0);
                _.VisitedLinkColor = Color.FromArgb(0, 192, 0);
            });


            flowLayoutPanel1.Controls.AddRange(links);

            var ip = Utils.GenerateIP(Environment.TickCount);
            var pc = ServiceLocator.Get <SavedGame>("SavedGame").Computer;

            var ipfind = new IPFinder(pc, ipLabel);

            ipfind.StartFinding();

            pc.IP   = ip;
            pc.Name = "Localhost";


            ServiceLocator.Subscribe("Loaded", _ => {
                yourIPLabel.Text = ServiceLocator._("Your IP:") + ServiceLocator.Get <SavedGame>("SavedGame").Computer.IP;
            });

            yourIPLabel.Text = ServiceLocator._("Your IP:") + ip;

            NavigationService.Navigate(new WelcomePage());
        }
Exemplo n.º 5
0
        private bool _Reg()
        {
            AntiInjection ant = new AntiInjection();

            ant.Email    = true;
            ant.Password = true;
            ant.Url      = true;
            //------------------------------------------
            // anti injection for security purpass
            // it will secure the boolien methord
            //------------------------------------------
            if (ant.StringData(FirstName) &&
                ant.StringData(SureName) &&
                ant.StringData(Email) &&
                ant.StringData(UserName) &&
                ant.StringData(Password) &&
                ant.StringData(Mobile))
            {
                Security_ = true;

                /*---------------------------------
                 *   security is done now the insert and encript process
                 * ----------------------------------*/
                if (UserName_Avaiable(UserName) && Mobile_Avaiable(Mobile) && Email_Avaiable(Email))
                {
                    try
                    {
                        int  Max_App      = 2;/// Comming from main db settings
                        bool EmailVerify  = false;
                        bool MobileVerify = false;
                        //----------------------------------------------
                        Bind();
                        //-----------------------------------------------
                        //-----------------------------------------------
                        StringGenarator __ran = new StringGenarator();
                        __ran.TotalString = 10;/// setting update
                        //-------------------------------------------
                        __ran.Hexadecimal = true;
                        string Encrypt_Key = __ran.RandomStringNumber("DeveloperRegistation", 2, '-');
                        __ran.TotalString   = 5;
                        __ran.Number        = true;
                        __ran.Hexadecimal   = false;
                        __ran.DatabaseEntry = false;
                        string OTP = __ran.RandomStringNumber("OPT");
                        this.OTP            = OTP;
                        __ran.TotalString   = 20;
                        __ran.Number        = true;
                        __ran.ApperCase     = true;
                        __ran.DatabaseEntry = false;
                        string EmailCode = __ran.RandomStringNumber("EmailCode");
                        this.EmailCode = EmailCode;
                        //------------------------------------------------
                        //------------------------------------------------
                        Check    __Chk       = new Check();
                        IPFinder _IPLocation = new IPFinder();
                        //_IPLocation.IPDetails();
                        var          Offset = __Chk.stringCheck("select Offset from TimeZone where Time_Zone='" + _IPLocation.TimeZone + "' ");
                        DateTimeZone __Dt   = new DateTimeZone(Offset);
                        this.Offset = Offset;
                        Settings __Settings = new Settings();
                        var      MaxStorage = __Settings.Get_InValue_Settings(2);//Max Storage in Settings
                        this.MaxStorage = MaxStorage;
                        bool f1 = __Chk.ExcutionNonQuery(string.Format(@"insert into DeveloperRegistation (FastName,LastName,UserName,Email,Mobile,Country,Country_ID,Max_Apps,EmailVerify,MobileVerify,Profileimage,imagebyte,Active,EmailShow,NumberShow,JoinDate,AccountAbility,MaxStorage)
                        values('{0}','{1}','{2}','{3}','{4}','{5}',{6},{7},'{8}','{9}','{10}',{11},'{12}','{13}','{14}','{15}','{16}',{17})",
                                                                       FirstName, SureName, UserName, Email, Mobile, Country, __Chk.stringCheck("select Country_ID from Country where Country_Name='" + Country + "'"), Max_App, EmailCode, OTP, "image/Profile/noimage.jpg", 24576, "Online", "true", "true", __Dt.DateTimes(), "true", MaxStorage));
                        string _Registation_id = __Chk.stringCheck("select Reg_ID from DeveloperRegistation where UserName='******'");

                        //randomly add the encrypt key it unique
                        Encrypt __Enc = new Encrypt();
                        __Enc.EncryptCode = Encrypt_Key;
                        Key = Encrypt_Key;
                        // set the encript key to add database
                        string _UserName = __Enc.HashCode(UserName);
                        string _Password = __Enc.HashCode(Password);
                        bool   f2        = __Chk.ExcutionNonQuery(string.Format(@"insert into Login (Reg_ID,UserName,Password,Encrypt_Code) values({0},'{1}','{2}','{3}')", _Registation_id, _UserName, _Password, Encrypt_Key));
                        Messege_      = string.Format(@"<div class='alert alert-icon-success' role='alert'>
                                <i data-feather='alert-circle'></i>
                                   {0}
                             </div> ", "Registation Complete.");
                        _EmailVerify  = EmailVerify;
                        _MobileVerify = MobileVerify;

                        RegID   = __Chk.stringCheck("select Reg_ID from DeveloperRegistation where UserName='******' ");
                        LoginID = __Chk.stringCheck("select Login_ID from Login where UserName='******' ");
                        if (f1 && f2)
                        {
                            return(true);
                        }
                        else
                        {
                            Messege_ = string.Format(@"<div class='alert alert-icon-danger' role='alert'>
                                <i data-feather='alert-circle'></i>
                                   {0}
                             </div> ", __Chk.Messege);
                            return(false);
                        }
                    }
                    catch (Exception er)
                    {
                        Messege_ = string.Format(@"<div class='alert alert-icon-danger' role='alert'>
                                <i data-feather='alert-circle'></i>
                                   {0}
                             </div> ", er.Message);
                        return(false);
                    }
                }
                else
                {
                    Messege_ = @"<div class='alert alert-icon-danger' role='alert'>
                                <i data-feather='alert-circle'></i>
                                   (Verify your Email, UserName, Moble)
                                   If All are not Avaiable. Try again!
                             </div> ";
                    return(false);
                }
            }
            else
            {
                Messege_ = @"<div class='alert alert-icon-danger' role='alert'>
                                <i data-feather='alert-circle'></i>
                                   Security Threat.
                             </div> ";
                return(false);
            }
        }