コード例 #1
0
ファイル: Build.cs プロジェクト: kirabc/AramBuddy
        /// <summary>
        /// returns The build name.
        /// </summary>
        public static string BuildName()
        {
            var ChampionName = Player.Instance.ChampionName;

            if (ADC.Contains(ChampionName))
            {
                return("ADC");
            }

            if (AD.Contains(ChampionName))
            {
                return("AD");
            }

            if (AP.Contains(ChampionName))
            {
                return("AP");
            }

            if (ManaAP.Contains(ChampionName))
            {
                return("ManaAP");
            }

            if (Tank.Contains(ChampionName))
            {
                return("Tank");
            }

            Console.WriteLine("Failed To Detect " + ChampionName);
            Console.WriteLine(DateTime.Now.ToString("[H:mm:ss - ") + "AramBuddy Info] Using Default Build !");
            return("Default");
        }
コード例 #2
0
        public string AddAccount(string name, string pass, string per)
        {
            User A = new User();

            A.Password = pass;
            A.Status   = 1;
            A.Username = name;
            string[] Access = per.Split('#');
            //List<Screen> LOUA = new List<Screen>();
            List <UserAccess> LOUA = new List <UserAccess>();

            foreach (string AP in Access)
            {
                if (LOUA.Any(p => p.ScreenID == Convert.ToInt32(AP.Replace("Opt1", "").Replace("Show", "").Replace("Edit", "").Replace("Delete", ""))))
                {
                    var UA = LOUA.Where(p => p.ScreenID == Convert.ToInt32(AP.Replace("Opt1", "").Replace("Show", "").Replace("Edit", "").Replace("Delete", ""))).SingleOrDefault();
                    if (AP.Contains("Opt1"))
                    {
                        UA.ScreenID = int.Parse(AP.Replace("Opt1", ""));
                        UA.Opt1     = true;
                        LOUA.Add(UA);
                    }
                    else if (AP.Contains("Show"))
                    {
                        UA.ScreenID = int.Parse(AP.Replace("Show", ""));
                        foreach (string item in Access.Where(p => p.Contains(UA.ScreenID.ToString())).ToList())
                        {
                            if (item.Contains("Opt1"))
                            {
                                UA.Opt1 = true;
                            }
                            if (item.Contains("Edit"))
                            {
                                UA.CanEdit = true;
                            }
                            if (item.Contains("Delete"))
                            {
                                UA.CanDelete = true;
                            }
                        }
                        LOUA.Add(UA);
                    }
                    else
                    {
                        if (AP.Contains("Edit"))
                        {
                            UA.ScreenID = int.Parse(AP.Replace("Edit", ""));
                            UA.CanEdit  = true;
                        }
                        else if (AP.Contains("Delete"))
                        {
                            UA.ScreenID  = int.Parse(AP.Replace("Delete", ""));
                            UA.CanDelete = true;
                        }
                        else
                        {
                            UA.ScreenID = int.Parse(AP);
                        }
                        LOUA.Add(UA);
                    }
                }
                else
                {
                    if (AP.Contains("Opt1"))
                    {
                        UserAccess UA = new UserAccess();
                        UA.ScreenID = int.Parse(AP.Replace("Opt1", ""));
                        UA.Opt1     = true;
                        LOUA.Add(UA);
                    }
                    else if (AP.Contains("Show"))
                    {
                        UserAccess UA = new UserAccess();
                        UA.ScreenID = int.Parse(AP.Replace("Show", ""));
                        foreach (string item in Access.Where(p => p.Contains(UA.ScreenID.ToString())).ToList())
                        {
                            if (item.Contains("Opt1"))
                            {
                                UA.Opt1 = true;
                            }
                            if (item.Contains("Edit"))
                            {
                                UA.CanEdit = true;
                            }
                            if (item.Contains("Delete"))
                            {
                                UA.CanDelete = true;
                            }
                        }
                        LOUA.Add(UA);
                    }
                    else
                    {
                        UserAccess UA = new UserAccess();
                        if (AP.Contains("Edit"))
                        {
                            UA.ScreenID = int.Parse(AP.Replace("Edit", ""));
                            UA.CanEdit  = true;
                        }
                        else if (AP.Contains("Delete"))
                        {
                            UA.ScreenID  = int.Parse(AP.Replace("Delete", ""));
                            UA.CanDelete = true;
                        }
                        else
                        {
                            UA.ScreenID = int.Parse(AP);
                        }
                        LOUA.Add(UA);
                    }
                }
            }
            Returner R = A.CreateAccount(LOUA);

            if (R.Message == Message.Username_Already_Exists)
            {
                return("false");
            }
            else
            {
                return("true");
            }
        }
コード例 #3
0
        public string UpdateUser(string name, string pass, string per)
        {
            string[] Access = per.Split('#');
            //List<Screen> LOUA = new List<Screen>();
            List <UserAccess> LOUA = new List <UserAccess>();

            foreach (string AP in Access)
            {
                if (LOUA.Any(p => p.ScreenID == Convert.ToInt32(AP.Replace("Opt1", "").Replace("Show", "").Replace("Edit", "").Replace("Delete", ""))))
                {
                    var UA = LOUA.Where(p => p.ScreenID == Convert.ToInt32(AP.Replace("Opt1", "").Replace("Show", "").Replace("Edit", "").Replace("Delete", ""))).FirstOrDefault();
                    if (AP.Contains("Opt1"))
                    {
                        UA.ScreenID = int.Parse(AP.Replace("Opt1", ""));
                        UA.Opt1     = true;
                        LOUA.Add(UA);
                    }
                    else if (AP.Contains("Show"))
                    {
                        UA.ScreenID = int.Parse(AP.Replace("Show", ""));
                        foreach (string item in Access.Where(p => p.Contains(UA.ScreenID.ToString())).ToList())
                        {
                            if (item.Contains("Opt1"))
                            {
                                UA.Opt1 = true;
                            }
                            if (item.Contains("Edit"))
                            {
                                UA.CanEdit = true;
                            }
                            if (item.Contains("Delete"))
                            {
                                UA.CanDelete = true;
                            }
                        }
                        LOUA.Add(UA);
                    }
                    else
                    {
                        if (AP.Contains("Edit"))
                        {
                            UA.ScreenID = int.Parse(AP.Replace("Edit", ""));
                            UA.CanEdit  = true;
                        }
                        else if (AP.Contains("Delete"))
                        {
                            UA.ScreenID  = int.Parse(AP.Replace("Delete", ""));
                            UA.CanDelete = true;
                        }
                        else
                        {
                            UA.ScreenID = int.Parse(AP);
                        }
                        LOUA.Add(UA);
                    }
                }
                else
                {
                    if (AP.Contains("Opt1"))
                    {
                        UserAccess UA = new UserAccess();
                        UA.ScreenID = int.Parse(AP.Replace("Opt1", ""));
                        UA.Opt1     = true;
                        LOUA.Add(UA);
                    }
                    else if (AP.Contains("Show"))
                    {
                        UserAccess UA = new UserAccess();
                        UA.ScreenID = int.Parse(AP.Replace("Show", ""));
                        foreach (string item in Access.Where(p => p.Contains(UA.ScreenID.ToString())).ToList())
                        {
                            if (item.Contains("Opt1"))
                            {
                                UA.Opt1 = true;
                            }
                            if (item.Contains("Edit"))
                            {
                                UA.CanEdit = true;
                            }
                            if (item.Contains("Delete"))
                            {
                                UA.CanDelete = true;
                            }
                        }
                        LOUA.Add(UA);
                    }
                    else
                    {
                        UserAccess UA = new UserAccess();
                        if (AP.Contains("Edit"))
                        {
                            UA.ScreenID = int.Parse(AP.Replace("Edit", ""));
                            UA.CanEdit  = true;
                        }
                        else if (AP.Contains("Delete"))
                        {
                            UA.ScreenID  = int.Parse(AP.Replace("Delete", ""));
                            UA.CanDelete = true;
                        }
                        else
                        {
                            UA.ScreenID = int.Parse(AP);
                        }
                        LOUA.Add(UA);
                    }
                }
            }
            Returner R = new User
            {
                ID       = (int)TempData["UID"],
                Username = name,
                Password = pass
            }.Update(LOUA);

            if (R.Message == Message.Username_Already_Exists)
            {
                TempData.Keep();
                return("false");
            }
            else
            {
                TempData.Keep();
                return("true");
            }
        }