当前位置: 首页>>代码示例>>C#>>正文


C# IInput.Get方法代码示例

本文整理汇总了C#中IInput.Get方法的典型用法代码示例。如果您正苦于以下问题:C# IInput.Get方法的具体用法?C# IInput.Get怎么用?C# IInput.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IInput的用法示例。


在下文中一共展示了IInput.Get方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateLogin

 public Login CreateLogin(IInput input)
 {
     var type = input.Get<string>(Login.PropertyTypeIdentifier);
     if (string.IsNullOrEmpty(type) || string.Compare(type, JanRainLogin.JanRainTypeIdentifier, true) != 0)
         return null;
     return new JanRainLogin
            	{
                 UserName = input.Get<string>("username"),
                 Email = input.Get<string>("email"),
            	};
 }
开发者ID:mobytoby,项目名称:beastmud,代码行数:11,代码来源:JanRainLoginValidator.cs

示例2: ValidateLogin

        public bool ValidateLogin(IInput input, Login login)
        {
            var type = input.Get<string>(Login.PropertyTypeIdentifier);
            if (string.IsNullOrEmpty(type) || string.Compare(type, JanRainLogin.JanRainTypeIdentifier, true) != 0)
                return false;

            if (!(login is JanRainLogin))
                return false;

            var jrLogin = login as JanRainLogin;
            return jrLogin.UserName == input.Get<string>("username");
        }
开发者ID:mobytoby,项目名称:beastmud,代码行数:12,代码来源:JanRainLoginValidator.cs

示例3: ValidateLogin

        public bool ValidateLogin(IInput input, Login login)
        {
            var type = input.Get<string>(Login.PropertyTypeIdentifier);
            if (string.IsNullOrEmpty(type) || string.Compare(type, FacebookLogin.FacebookTypeIdentifier, true) != 0)
                return false;

            if (string.IsNullOrEmpty(input.Get<string>("username")) || !(login is FacebookLogin))
                return false;
            var client = new FacebookClient(input.Get<string>("access_token"));
            dynamic me = client.Get("me", new {fields = "id"});

            return me.id == input.Get<string>("username");
        }
开发者ID:mobytoby,项目名称:beastmud,代码行数:13,代码来源:FacebookLoginValidator.cs

示例4: ExecuteOverride

        protected override void ExecuteOverride(IInput input, IConnection connection, ResponseMessage response)
        {
            if (connection.User == null)
            {
                response.Invalidate(CommonResources.LoginRequired);
                return;
            }

            var username = input.Get<string>("username");
            var login = connection.User.Logins.FirstOrDefault(l => l.UserName.ToLower() == username);
            if (login != null)
            {
                response.Invalidate(CommonResources.LoginAlreadyExists);
                return;
            }

            if (!Game.Current.Users.TryCreateLogin(input, out login))
            {
                response.Invalidate(CommonResources.LoginAlreadyExists);
                return;
            }

            connection.User.Logins.Add(login);
            Game.Current.Repository.SaveUser(connection.User);
        }
开发者ID:mobytoby,项目名称:beastmud,代码行数:25,代码来源:AddLoginCommand.cs

示例5: OnLoginSuccess

        public void OnLoginSuccess(User user, Login login, IInput input)
        {
            var fbLogin = login as FacebookLogin;
            if (fbLogin == null)
                return;

            fbLogin.AccessToken = input.Get<string>("access_token");
        }
开发者ID:mobytoby,项目名称:beastmud,代码行数:8,代码来源:FacebookLoginValidator.cs

示例6: Parse

        public ITreeNode Parse(Grammer grammer, IInput input, IGrammerRuleHandler ruleHandler)
        {
            States states = States.BuildStates(grammer);

            input.Parse();

            Stack stack = new Stack();

            TreeNodeStack treeNodeStack = new TreeNodeStack();

            ruleHandler.TreeNodeStack = treeNodeStack;

            IAction action = states.GetAction(stack.Top(), input.Get());
            while(!action.GetType().Equals(typeof(Accept))){
                action.Do(input,stack,ruleHandler);
                action = states.GetAction(stack.Top(),input.Get());
            }

            return treeNodeStack.Pop();
        }
开发者ID:kamatanay,项目名称:MayaLanguage,代码行数:20,代码来源:Parser.cs

示例7: CreateLogin

        public Login CreateLogin(IInput input)
        {
            var username = input.Get<string>("username");
            var password = input.Get<string>("password");
            var email = input.Get<string>("email");

            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
                return null;

            var pwdSalt = Cryptography.CreateSalt();
            var hashedPwd = Cryptography.ComputeHash(password, pwdSalt);

            return new GenericLogin
                   	{
                   		UserName = username,
                   		Password = hashedPwd,
                        PasswordSalt = pwdSalt,
                        Email = email
                   	};
        }
开发者ID:mobytoby,项目名称:beastmud,代码行数:20,代码来源:GenericLoginValidator.cs

示例8: ExecuteOverride

        protected override void ExecuteOverride(IInput input, IConnection connection, ResponseMessage response)
        {
            var commandName = input.Get<string>("command");
            var cmd = Game.Current.Commands.FindCommandInternal(commandName);
            if (cmd == null)
            {
                response.Invalidate(CommonResources.HelpNotFoundFormat, commandName);
                return;
            }

            connection.Write(NotificationMessage.Heading(CommonResources.HelpName), NotificationMessage.Normal(cmd.Metadata.Name));
            connection.Write(NotificationMessage.Heading(CommonResources.HelpDescription), NotificationMessage.Normal(cmd.Metadata.Description));
            connection.Write(NotificationMessage.Heading(CommonResources.HelpSynopsis), NotificationMessage.Normal(cmd.Metadata.Synopsis));
            connection.Write(NotificationMessage.Heading(CommonResources.HelpAliases), NotificationMessage.Normal(string.Join(",", cmd.Metadata.Aliases)));
        }
开发者ID:mobytoby,项目名称:beastmud,代码行数:15,代码来源:StandardCommands.cs

示例9: OnLoginSuccess

        public void OnLoginSuccess(User user, IInput input)
        {
            var username = input.Get<string>("username");
            if (string.IsNullOrEmpty(username))
                return;

            var login = user.Logins.FirstOrDefault(l => l.UserName.ToLower() == username.ToLower());
            if (login == null)
                return;

            var validator = LoginValidators.FirstOrDefault(v => v.CanValidateLogin(login));
            if (validator != null)
                validator.OnLoginSuccess(user, login, input);

            login.DateLastLogin = DateTime.UtcNow;

            Game.Current.Repository.SaveUser(user);
        }
开发者ID:mobytoby,项目名称:beastmud,代码行数:18,代码来源:UserManager.cs

示例10: ValidateLogin

 public bool ValidateLogin(IInput input, Login login)
 {
     var password = input.Get<string>("password");
     if (!string.IsNullOrEmpty(password))
     {
         var genLogin = login as GenericLogin;
         if (genLogin != null)
         {
             var hashedPwd = Cryptography.ComputeHash(password, genLogin.PasswordSalt);
             if (hashedPwd == genLogin.Password)
             {
                 // Valid login.
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:mobytoby,项目名称:beastmud,代码行数:18,代码来源:GenericLoginValidator.cs

示例11: CreateLogin

 public Login CreateLogin(IInput input)
 {
     var type = input.Get<string>(Login.PropertyTypeIdentifier);
     if (string.IsNullOrEmpty(type) || string.Compare(type, FacebookLogin.FacebookTypeIdentifier, true) != 0)
         return null;
     return new FacebookLogin
            	{
                 UserName = input.Get<string>("username"),
                 FirstName = input.Get<string>("first_name"),
                 LastName = input.Get<string>("last_name"),
                 Gender = input.Get<string>("gender"),
                 AccessToken = input.Get<string>("access_token"),
                 TypeIdentifier = type
            	};
 }
开发者ID:mobytoby,项目名称:beastmud,代码行数:15,代码来源:FacebookLoginValidator.cs

示例12: TryGetUser

        public bool TryGetUser(IInput input, out User user)
        {
            var username = input.Get<string>("username");

            if (string.IsNullOrEmpty(username))
            {
                user = null;
                return false;
            }

            user = Game.Current.Repository.GetUser(username);
            if (user != null)
            {
                var login = user.Logins.FirstOrDefault(l => l.UserName.ToLower() == username.ToLower());
                if (login != null)
                {
                    return (from validator in LoginValidators where validator.CanValidateLogin(login) select validator.ValidateLogin(input, login)).FirstOrDefault();
                }
            }
            return false;
        }
开发者ID:mobytoby,项目名称:beastmud,代码行数:21,代码来源:UserManager.cs

示例13: ExecuteOverride

        protected override void ExecuteOverride(IInput input, IConnection connection, ResponseMessage response)
        {
            CreateType createType;
            if (!Enum.TryParse(input.Get<string>("type"), true, out createType))
            {
                response.Invalidate(CommonResources.CreateCommandInvalidTypeArg);
                return;
            }

            var type = typeof(GameObject);
            switch (createType)
            {
                case CreateType.Item:
                    type = typeof(Item);
                    break;
                case CreateType.Place:
                    type = typeof(Place);
                    break;
                case CreateType.Mobile:
                    type = typeof(Mobile);
                    break;
                case CreateType.Character:
                    type = typeof(Character);
                    break;
            }

            IGameObject obj;
            string errorMessage;
            if (!Game.Current.TryCreateObject(type, input, out errorMessage, out obj))
            {
                response.Invalidate(errorMessage);
                return;
            }

            response.Data = obj;
        }
开发者ID:mobytoby,项目名称:beastmud,代码行数:36,代码来源:CreateCommand.cs


注:本文中的IInput.Get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。