Beispiel #1
0
        public override ErrorType Check()
        {
            if (textBox.Text.Length == 0)
            {
                ErrorString = "Name must be specified.";
                return(ErrorType.Error);
            }

            HistoryCache.Add(GetType().ToString(), Value);
            ErrorString = null;
            return(ErrorType.None);
        }
Beispiel #2
0
        public override ErrorType Check()
        {
            if (textBox.Text.Length == 0)
            {
                ErrorString = "Client hasn't been specified.";
                return(ErrorType.Warning);
            }

            if (!System.IO.File.Exists(textBox.Text))
            {
                ErrorString = "Client \"" + textBox.Text + "\" doesn't exist.";
                return(ErrorType.Warning);
            }

            HistoryCache.Add(GetType().ToString(), Value);
            ErrorString = null;
            return(ErrorType.None);
        }
Beispiel #3
0
        public override ErrorType Check()
        {
            if (textBox.Text.Length == 0)
            {
                ErrorString = "Address hasn't been specified.";
                return(ErrorType.Warning);
            }

            Regex regex = new Regex(@"\A(?:[a-zA-Z0-9]|\x5F|\x2E)+,\d+\z");

            if (!regex.IsMatch(textBox.Text))
            {
                ErrorString = "Address has invalid format.\n\nExamples:\nlogin.owo.com,7775\n127.0.0.1,2593\n\n";
                return(ErrorType.Warning);
            }

            HistoryCache.Add(GetType().ToString(), Value);
            ErrorString = null;
            return(ErrorType.None);
        }
Beispiel #4
0
        public override ErrorType Check()
        {
            if (textBox.TextLength == 0)
            {
                ErrorString = "Account must be specified.";
                return(ErrorType.Error);
            }

            for (int i = 0; i < textBox.TextLength; i++)
            {
                if (textBox.Text[i] < 33)
                {
                    ErrorString = "Account contains some invalid characters.";
                    return(ErrorType.Warning);
                }
            }

            HistoryCache.Add(GetType().ToString(), Value);
            ErrorString = null;
            return(ErrorType.None);
        }
Beispiel #5
0
        public ClientExeBox()
        {
            InitializeComponent();

            textBox.AutoCompleteCustomSource.AddRange(HistoryCache.GetPosibilities(GetType().ToString()));
        }
Beispiel #6
0
        public static CommandResult Run(CommandArguments args)
        {
            if (args.Arguments.Length == 0)
            {
                return new CommandResult
                       {
                           Type   = CommandResultType.MESSAGE,
                           Result = $"Usuage: !with [Mods] (Mods) (Mods)... or !with reset to reset."
                       }
            }
            ;
            Mod[] mods = null;


            BanchoUserHistory history = HistoryCache.Get(args.Username);

            if (history == null)
            {
                HistoryCache.Init(args.Username);
            }
            history = HistoryCache.Get(args.Username);


            if (args.Arguments[0] == "reset")
            {
                history.RecentMod = new Mod[] { };
                return(new CommandResult
                {
                    Type = CommandResultType.MESSAGE,
                    Result = $"Reseted mods."
                });
            }
            try
            {
                mods = Common.GetMods(args.Arguments, new OsuRuleset()).ToArray();
            }
            catch (Exception ex)
            {
                return(new CommandResult
                {
                    Type = CommandResultType.MESSAGE,
                    Result = ex.Message
                });
            }
            history.RecentMod = mods;
            StringBuilder sb = new StringBuilder();

            foreach (Mod mod in mods)
            {
                sb.Append(mod.Acronym);
            }


            OsuCalculator calc = new OsuCalculator(history.RecentBeatmapId);

            calc.Mod = mods;
            CalculateMessage msg = new CalculateMessage(calc);
            CommandResult    rs  = new CommandResult
            {
                Type   = CommandResultType.MESSAGE,
                Result = msg.ToString().Split("\n")[1]
            };

            return(rs);
        }
    }
Beispiel #7
0
        public static CommandResult Run(CommandArguments args)
        {
            if (args.Arguments.Length == 0)
            {
                return new CommandResult
                       {
                           Type   = CommandResultType.MESSAGE,
                           Result = $"Usuage: !acc [Accuracy] (Miss) (Max Combo)"
                       }
            }
            ;
            double acc       = -1;
            int    miss      = 0;
            int    max_combo = -1;

            try
            {
                var accraw = double.Parse(args.Arguments[0]);

                acc       = accraw > 1 ? accraw : accraw / 100;
                miss      = args.Arguments.Length > 1 ? int.Parse(args.Arguments[1]) : 0;
                max_combo = args.Arguments.Length > 2 ? int.Parse(args.Arguments[2]) : -1;
            }
            catch
            {
                return(new CommandResult
                {
                    Type = CommandResultType.MESSAGE,
                    Result = $"Wrong Argument. (Not a number.)"
                });
            }
            BanchoUserHistory history = HistoryCache.Get(args.Username);

            if (history.RecentBeatmapId == 0)
            {
                return(new CommandResult
                {
                    Type = CommandResultType.MESSAGE,
                    Result = $"Oops! we dont have history! plase /np and do it again!"
                });
            }
            OsuCalculator calc = new OsuCalculator(history.RecentBeatmapId);

            if (history.RecentMod.Length > 0)
            {
                calc.Mod = history.RecentMod;
            }
            calc.Misses = miss;
            CalculateMessage msg = new CalculateMessage(calc);

            msg.Acc = acc;
            if (max_combo != -1)
            {
                calc.Combo = max_combo;
            }
            CommandResult rs = new CommandResult()
            {
                Type   = CommandResultType.MESSAGE,
                Result = msg.ToString()
            };


            return(rs);
        }
    }