private Offset <NickName> WriteNickName(KeyValuePair <string, PersonInstance> value)
        {
            var stringID = WriteString(value.Key);
            var person   = WritePerson(value.Value);

            return(NickName.CreateNickName(_builder, stringID, person));
        }
Esempio n. 2
0
        /// <summary>
        ///     Allows you to generate an HTML representation of the current Address object.
        /// </summary>
        /// <returns>An HTML representation of the current Address object.</returns>
        public string ToHtmlString()
        {
            var sb = new StringBuilder();

            if (NickName.Trim().Length > 0)
            {
                sb.Append("<em>" + NickName + "</em><br />");
            }
            if (LastName.Length > 0 || FirstName.Length > 0)
            {
                sb.Append(FirstName);
                if (MiddleInitial.Trim().Length > 0)
                {
                    sb.Append(" " + MiddleInitial);
                }
                sb.Append(" " + LastName + "<br />");
                if (Company.Trim().Length > 0)
                {
                    sb.Append(Company + "<br />");
                }
            }

            sb.Append(GetLinesHtml());

            return(sb.ToString());
        }
 public async Task <bool> AddAsync(User user, NickName nickName)
 {
     using (var database = new NicknameDatabase())
     {
         return(await database.Register(user, nickName));
     }
 }
Esempio n. 4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Account.Length != 0)
            {
                hash ^= Account.GetHashCode();
            }
            if (NickName.Length != 0)
            {
                hash ^= NickName.GetHashCode();
            }
            if (Level != 0)
            {
                hash ^= Level.GetHashCode();
            }
            if (Coin != 0)
            {
                hash ^= Coin.GetHashCode();
            }
            if (PortraitURL.Length != 0)
            {
                hash ^= PortraitURL.GetHashCode();
            }
            return(hash);
        }
Esempio n. 5
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (NickName != null)
         {
             hashCode = hashCode * 59 + NickName.GetHashCode();
         }
         if (Lat != null)
         {
             hashCode = hashCode * 59 + Lat.GetHashCode();
         }
         if (Lon != null)
         {
             hashCode = hashCode * 59 + Lon.GetHashCode();
         }
         if (LastSeen != null)
         {
             hashCode = hashCode * 59 + LastSeen.GetHashCode();
         }
         return(hashCode);
     }
 }
Esempio n. 6
0
        public void FixGhInput()
        {
            NickName = cleanNickname(NickName);
            NickName = NickName.Replace("_" + Decodes_PythonComponent.attributes_suffix, "_baduser");
            if (String.Compare(NickName, "code", StringComparison.InvariantCultureIgnoreCase) == 0)
            {
                NickName = "baduser";
            }

            Name = NickName; // set name to nickname, omitting array brackets (added below)

            if (Access == GH_ParamAccess.list)
            {
                NickName = "[" + NickName + "]";
            }

            if (string.IsNullOrEmpty(Description))
            {
                Description = string.Format("Script variable {0}", Name);
            }
            Optional  = true;
            ShowHints = true;

            Hints = Decodes_PythonComponent.GetHints();
            if (TypeHint == null)
            {
                TypeHint = Hints[0];
            }
        }
Esempio n. 7
0
        public IActionResult Dashboard(NickName nickName)
        {
            bool isUserNameFree = UsersHandler.Users.FirstOrDefault(x => x.Name == nickName.Name) == null;

            if (!isUserNameFree)
            {
                ModelState.AddModelError("NickNameTaken", "This nickname is already in use!");
            }

            if (!ModelState.IsValid)
            {
                return(this.View("Index", nickName));
            }

            nickName.Score = null;

            if (UsersHandler.Users.Count == 0)
            {
                nickName.IsAdmin = true;
            }

            UsersHandler.Users.Add(nickName);

            return(View(nickName));
        }
Esempio n. 8
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (UserID.Length != 0)
            {
                hash ^= UserID.GetHashCode();
            }
            if (NickName.Length != 0)
            {
                hash ^= NickName.GetHashCode();
            }
            if (Signature.Length != 0)
            {
                hash ^= Signature.GetHashCode();
            }
            if (HeadImageUrl.Length != 0)
            {
                hash ^= HeadImageUrl.GetHashCode();
            }
            if (CreateTime != 0L)
            {
                hash ^= CreateTime.GetHashCode();
            }
            if (Status != 0)
            {
                hash ^= Status.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 9
0
        public async Task <ActionResult <IList <string> > > GetFileInBucket()
        {
            dynamic oauth = await OAuthController.GetInternalAsync();

            // define Engines API
            string     bucketKey = NickName.ToLower() + "_designautomation";
            ObjectsApi objects   = new ObjectsApi();

            objects.Configuration.AccessToken = oauth.access_token;

            try
            {
                dynamic response = await objects.GetObjectsAsyncWithHttpInfo(bucketKey);

                IDictionary <string, dynamic> dict = response.Data.Dictionary["items"].Dictionary;
                List <string> list = new List <string>();
                foreach (dynamic item in dict)
                {
                    list.Add(item.Value.Dictionary["objectKey"]);
                }

                return(Ok(list)); // return list of objects in bucket
            }
            catch
            {
                return(BadRequest());
            }
        }
Esempio n. 10
0
        /// <summary>验证数据,通过抛出异常的方式提示验证失败。</summary>
        /// <param name="isNew"></param>
        public override void Valid(Boolean isNew)
        {
            // 如果没有脏数据,则不需要进行任何处理
            if (!HasDirty)
            {
                return;
            }

            if (Name.IsNullOrEmpty())
            {
                throw new ArgumentNullException(__.Name, _.Name.DisplayName + "不能为空!");
            }
            if (Password.IsNullOrEmpty())
            {
                throw new ArgumentNullException(__.Password, _.Password.DisplayName + "不能为空!");
            }
            //if (Password.Length != 16 && Password.Length != 32) throw new ArgumentOutOfRangeException(__.Password, _.Password.DisplayName + "非法!");
            //if (Name.Length < 8) throw new ArgumentOutOfRangeException(__.Name, _.Name.DisplayName + "最短8个字符!" + Name);
            //if (Name.Length > 16) throw new ArgumentOutOfRangeException(__.Name, _.Name.DisplayName + "最长16个字符!" + Name);

            // 修正显示名
            if (!NickName.IsNullOrEmpty() && NickName.Length > 16)
            {
                NickName = NickName.Substring(0, 16);
            }

            // 建议先调用基类方法,基类方法会对唯一索引的数据进行验证
            base.Valid(isNew);
        }
Esempio n. 11
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (UserID.Length != 0)
            {
                hash ^= UserID.GetHashCode();
            }
            if (Password.Length != 0)
            {
                hash ^= Password.GetHashCode();
            }
            if (NickName.Length != 0)
            {
                hash ^= NickName.GetHashCode();
            }
            if (Signature.Length != 0)
            {
                hash ^= Signature.GetHashCode();
            }
            if (HeadImageData.Length != 0)
            {
                hash ^= HeadImageData.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 12
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (PlayerId != 0L)
            {
                hash ^= PlayerId.GetHashCode();
            }
            if (NickName.Length != 0)
            {
                hash ^= NickName.GetHashCode();
            }
            if (Avatar.Length != 0)
            {
                hash ^= Avatar.GetHashCode();
            }
            if (Coin != 0L)
            {
                hash ^= Coin.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 13
0
        /// <summary>
        /// Returns true if Thing instances are equal
        /// </summary>
        /// <param name="other">Instance of Thing to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(FriendFinder other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     NickName == other.NickName ||
                     NickName != null &&
                     NickName.Equals(other.NickName)
                     ) &&
                 (
                     Lat == other.Lat ||
                     Lat != null &&
                     Lat.Equals(other.Lat)
                 ) &&
                 (
                     LastSeen == other.LastSeen ||
                     LastSeen != null &&
                     LastSeen.Equals(other.LastSeen)
                 ) &&
                 (
                     Lon == other.Lon ||
                     Lon != null &&
                     Lon.Equals(other.Lon)
                 ));
        }
Esempio n. 14
0
        public async Task <IActionResult> OnCallback(string id, string outputFileName, string name, string type, [FromBody] dynamic body)
        {
            try
            {
                dynamic oauth = await OAuthController.GetInternalAsync();

                string bucketkey = NickName.ToLower() + "-designautomation";

                ObjectsApi objectsApi = new ObjectsApi();
                objectsApi.Configuration.AccessToken = oauth.access_token;
                dynamic objIPT = await objectsApi.GetObjectDetailsAsync(bucketkey, outputFileName);

                dynamic urnIPT = null;
                if (type == "part")
                {
                    urnIPT = TranslateObject(objIPT, outputFileName, false);
                }
                else if (type == "assembly")
                {
                    urnIPT = TranslateObject(objIPT, name + ".iam", true);
                }

                await _hubContext.Clients.Client(id).SendAsync("onComplete", (string)await urnIPT);

                //generate a signed URL to download the result file and send to the client
                dynamic signedUrl = await objectsApi.CreateSignedResourceAsyncWithHttpInfo(NickName.ToLower() + "-designautomation", outputFileName, new PostBucketsSigned(10), "read");

                await _hubContext.Clients.Client(id).SendAsync("downloadResult", (string)(signedUrl.Data.signedUrl));
            }
            catch {
            }

            // ALWAYS return ok (200)
            return(Ok());
        }
Esempio n. 15
0
        public async Task <IActionResult> OnCallbackExractParams(string id, string outputFileName, [FromBody] dynamic body)
        {
            try
            {
                // your webhook should return immediately! we can use Hangfire to schedule a job
                JObject bodyJson = JObject.Parse((string)body.ToString());
                await _hubContext.Clients.Client(id).SendAsync("onComplete", bodyJson.ToString());

                var client  = new RestClient(bodyJson["reportUrl"].Value <string>());
                var request = new RestRequest(string.Empty);

                byte[] bs     = client.DownloadData(request);
                string report = System.Text.Encoding.Default.GetString(bs);
                await _hubContext.Clients.Client(id).SendAsync("onComplete", report);

                ObjectsApi objectsApi = new ObjectsApi();
                dynamic    parameters = await objectsApi.GetObjectAsyncWithHttpInfo(NickName.ToLower() + "_designautomation", outputFileName);

                string data;
                using (StreamReader reader = new StreamReader(parameters.Data))
                    data = reader.ReadToEnd();

                await _hubContext.Clients.Client(id).SendAsync("onParameters", data);
            }
            catch (Exception e) { }

            // ALWAYS return ok (200)
            return(Ok());
        }
Esempio n. 16
0
        public void Logout()
        {
            try
            {
                NickName.Click();
                List <IWebElement> lstProfileitem = new List <IWebElement>(lstProfile.FindElements(By.TagName("button")));

                if (lstProfileitem.Count > 0)
                {
                    foreach (var item in lstProfileitem)
                    {
                        if (item.Text.Contains("Abmelden"))
                        {
                            Console.WriteLine("Successfully Logging off");
                            item.Click();
                            System.Threading.Thread.Sleep(5000);
                            Assert.AreEqual(true, SignInButton.Displayed);
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 17
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////


        #region Serialization
        /////////////////////////////////////////////////////////////////////////////////////////////////////

        public override XElement ToXML(bool internalPurpose = true)
        {
            XDocument res = Utilities.CreateXMLDoc("User", false);

            res.Root.Add(
                new XElement(ConfigReader.S2CNS + "ID", ID),
                new XElement(ConfigReader.S2CNS + "EMail", EMail),
                new XElement(ConfigReader.S2CNS + "Name", Name.FixXML()),
                new XElement(ConfigReader.S2CNS + "LastName", LastName.FixXML()),
                new XElement(ConfigReader.S2CNS + "NickName", NickName.FixXML()),
                //new XElement(ConfigReader.S2CNS + "Active", Active),
                //new XElement(ConfigReader.S2CNS + "AcctCreated", AcctCreated),
                //new XElement(ConfigReader.S2CNS + "LoginFirst", LoginFirst),
                //new XElement(ConfigReader.S2CNS + "LoginLast", LoginLast),
                new XElement(ConfigReader.S2CNS + "PictureID", PictureID),
                //new XElement(ConfigReader.S2CNS + "HasValidMail", HasValidMail),
                new XElement(ConfigReader.S2CNS + "Points", Points),
                new XElement(ConfigReader.S2CNS + "Role", Role),
                new XElement(ConfigReader.S2CNS + "PersonalGroupID", PersonalGroupID),
                new XElement(ConfigReader.S2CNS + "DefaultGroupID", DefaultGroupID),
                Preferences.ToXML(false)
                );

            return(res.Root);
        }
Esempio n. 18
0
        public XElement ToXML( )
        {
            XElement xPerson = new XElement(Fb2Const.fb2DefaultNamespace + ElementName);

            if (FirstName != null)
            {
                xPerson.Add(FirstName.ToXML(FirstNameElementName));
            }
            if (MiddleName != null)
            {
                xPerson.Add(MiddleName.ToXML(MiddleNameElementName));
            }
            if (LastName != null)
            {
                xPerson.Add(LastName.ToXML(LastNameElementName));
            }
            if (NickName != null)
            {
                xPerson.Add(NickName.ToXML(NickNameElementName));
            }
            if (HomePage != null)
            {
                xPerson.Add(HomePage.ToXML(HomePageElementName));
            }
            if (EMail != null)
            {
                xPerson.Add(EMail.ToXML(EMailElementName));
            }
            if (UID != null)
            {
                xPerson.Add(UID.ToXML(IdElementName));
            }
            return(xPerson);
        }
Esempio n. 19
0
 public ApplicationUser(Guid id, Email email, Name firstName, Name lastName, NickName nickName)
 {
     Id        = id;
     Email     = email;
     FirstName = firstName;
     LastName  = lastName;
     NickName  = nickName;
 }
Esempio n. 20
0
        /// <summary>
        /// Function to provide nickname
        /// </summary>
        /// <param name="nickname"></param>
        /// <returns></returns>


        public QuotePage UpdateNickname(String nickname)
        {
            Thread.Sleep(2000);
            driver.WaitForElementToBecomeVisibleWithinTimeout(NickName, 10000);
            NickName.EnterText(nickname);
            _logger.Info($": Successfully added quote nickname as {nickname}");
            return(this);
        }
Esempio n. 21
0
        public override int GetHashCode()
        {
            int hash = 17;

            hash = hash * 23 + NickName.GetHashCode();
            hash = hash * 23 + UserName.GetHashCode();
            return(hash);
        }
        public virtual bool CanStartInGame => true; //clue will have exceptions.

        public override bool Equals(object obj)
        {
            if (!(obj is SimplePlayer Temps))
            {
                return(false);
            }
            return(NickName.Equals(Temps.NickName));
        }
Esempio n. 23
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((NickName != null ? NickName.GetHashCode() : 0) * 397) ^
                (SubName != null ? SubName.GetHashCode() : 0));
     }
 }
 void ReleaseDesignerOutlets()
 {
     if (BoyButton != null)
     {
         BoyButton.Dispose();
         BoyButton = null;
     }
     if (BubbleImg != null)
     {
         BubbleImg.Dispose();
         BubbleImg = null;
     }
     if (BubbleImgTopOffset != null)
     {
         BubbleImgTopOffset.Dispose();
         BubbleImgTopOffset = null;
     }
     if (ContinueBtn != null)
     {
         ContinueBtn.Dispose();
         ContinueBtn = null;
     }
     if (GirlButton != null)
     {
         GirlButton.Dispose();
         GirlButton = null;
     }
     if (Input != null)
     {
         Input.Dispose();
         Input = null;
     }
     if (NavBarBlendView != null)
     {
         NavBarBlendView.Dispose();
         NavBarBlendView = null;
     }
     if (NavBarBlendViewHeightConstraint != null)
     {
         NavBarBlendViewHeightConstraint.Dispose();
         NavBarBlendViewHeightConstraint = null;
     }
     if (NickName != null)
     {
         NickName.Dispose();
         NickName = null;
     }
     if (SwitchSignUpType != null)
     {
         SwitchSignUpType.Dispose();
         SwitchSignUpType = null;
     }
     if (ThemeSelectorContainerView != null)
     {
         ThemeSelectorContainerView.Dispose();
         ThemeSelectorContainerView = null;
     }
 }
Esempio n. 25
0
        public async Task <ClaimsIdentity> GenerateUserIdentityAsync(UserManager <ApplicationUser> manager)
        {
            // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
            var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);

            // Add custom user claims here
            userIdentity.AddClaim(new Claim("NickName", NickName.ToString()));
            return(userIdentity);
        }
Esempio n. 26
0
        /// <summary>显示友好名称</summary>
        /// <returns></returns>
        public override String ToString()
        {
            if (!NickName.IsNullOrEmpty())
            {
                return(NickName);
            }

            return(Name);
        }
Esempio n. 27
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (NickName != null ? NickName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Email != null ? Email.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (IsReady != null ? IsReady.GetHashCode() : 0);
         return(hashCode);
     }
 }
Esempio n. 28
0
        public async Task <IActionResult> Show()
        {
            Random   random = new Random();
            int      rnd    = random.Next(0, 51);
            NickName NN     = await db.NickNames.FirstOrDefaultAsync(p => p.Id == rnd);

            ViewData["Nick"] = NN.Nick;
            ViewData["Name"] = HomeController.UserName;
            return(View());
        }
 /// <summary>
 /// 用户注册
 /// </summary>
 private async void UserSignup()
 {
     if (UserName != null && UserPassword != null && ConfirmPassword != null && NickName != null && Age != null)
     {
         string userName        = UserName.Trim();
         string userPassword    = UserPassword.Trim();
         string confirmPassword = ConfirmPassword.Trim();
         string nickName        = NickName.Trim();
         int    age             = int.Parse(Age.Trim());
         string gender          = Gender == true ? "男" : "女";
         if (!userName.Equals(string.Empty) && !userPassword.Equals(string.Empty) && !confirmPassword.Equals(string.Empty) && !nickName.Equals(string.Empty))
         {
             if (userPassword.Length >= 6 && userPassword.Equals(confirmPassword))
             {
                 signupCanExecute = false;
                 miniClient       = new MiniClient(userName, Config.ClientAddressFamily, Config.ClientAgreement, Config.GetServerIPEndPoint());
                 miniClient.ClientRequestResult += MiniClient_ClientRequestResult;
                 miniClient.OpenClient();
                 if (await miniClient.ConnectionServerAsync())
                 {
                     User user = new User()
                     {
                         UserName = userName,
                         Password = ClientHelper.Encryption(userPassword),
                         NickName = nickName,
                         Gender   = gender,
                         Age      = age,
                         HeadIcon = ClientHelper.GetBytes(gender == "男" ? new Uri("/Resources/Images/boy.png", UriKind.Relative) : new Uri("/Resources/Images/girl.png", UriKind.Relative))
                     };
                     if (miniClient.SendDatabaseRequest(user, "Signup", null))
                     {
                         if (!await ClientHelper.WaitAsync(() => signupCanExecute, 20))
                         {
                             signupCanExecute = true;
                             miniClient?.CloseClient();
                             miniClient = null;
                             MessageBox.Show("服务器连接超时!", Config.Name, MessageBoxButton.OK, MessageBoxImage.Error);
                         }
                         return;
                     }
                 }
                 signupCanExecute = true;
                 miniClient?.CloseClient();
                 miniClient = null;
                 MessageBox.Show("无法连接到服务器!", Config.Name, MessageBoxButton.OK, MessageBoxImage.Error);
                 return;
             }
             MessageBox.Show("密码不符合要求!", Config.Name, MessageBoxButton.OK, MessageBoxImage.Warning);
             return;
         }
     }
     MessageBox.Show("用户信息不能为空!", Config.Name, MessageBoxButton.OK, MessageBoxImage.Warning);
 }
        public void Validate()
        {
            AddNotifications(new Contract()
                             .Requires()
                             .IsBetween(NickName.Length0IfNullOrEmpty(), 3, 256, "NickName", Messages.V_IsBetween.ToFormat("NickName", "3", "256"))

                             .HasLen(Country, 2, "Country", Messages.V_HasLen.ToFormat("Country", "2"))

                             .IsNotNullOrEmpty(Avatar, "Avatar", Messages.V_IsNotNullOrEmpty.ToFormat("Avatar"))
                             .IsNotNull(IdUser, "IdUser", Messages.V_IsNotNullOrEmpty.ToFormat("IdUser"))
                             .IsNotNull(IdGame, "IdGame", Messages.V_IsNotNullOrEmpty.ToFormat("IdGame"))
                             );
        }