Beispiel #1
0
        /// <summary>
        ///     Generates the base menu
        /// </summary>
        private static void GenerateBaseMenu()
        {
            Variables.Menu = new Menu(
                "iSeries: " + ObjectManager.Player.ChampionName,
                "iseries." + ObjectManager.Player.ChampionName,
                true);

            var targetSelectorMenu = new Menu("Target Selector", "Target Selector");

            TargetSelector.AddToMenu(targetSelectorMenu);
            Variables.Menu.AddSubMenu(targetSelectorMenu);

            orbwalking          = Variables.Menu.AddSubMenu(new Menu("Orbwalking", "Orbwalking"));
            Variables.Orbwalker = new Orbwalking.Orbwalker(orbwalking);

            orbwalking.AddItem(new MenuItem("AutoWindup", "iSeries - Auto Windup").SetValue(false)).ValueChanged +=
                (sender, argsEvent) =>
            {
                if (argsEvent.GetNewValue <bool>())
                {
                    CheckAutoWindUp();
                }
            };
            Variables.Menu.AddItem(new MenuItem("com.iseries.autobuy", "AutoBuy (Scrying Orb, etc)").SetValue(true));

            Cleanser.OnLoad(Variables.Menu);

            ItemManager.OnLoad(Variables.Menu);
            // TODO add an item manager / auto qss etc / some utils maybe?
            // Activator# Bik
        }
        public void Core_Text_Cleanser_Attribute()
        {
            var testItem = new CleanserAttributeTester() { CleanseMe = unsafeHtml };

            Cleanser.CleanseAll(testItem);

            Assert.IsTrue(testItem.CleanseMe.Contains(unsafeTag1.SubstringLeft(6)) == false, "Did not work.");
            Assert.IsTrue(testItem.CleanseMe.Contains(safeTag1) == true, "Did not work.");
        }
Beispiel #3
0
        private static void OnUpdate(EventArgs args)
        {
            CondemnLogic.Execute(args);
            Activator.OnUpdate();
            Cleanser.OnUpdate();

            foreach (var module in Variables.moduleList.Where(module => module.GetModuleType() == ModuleType.OnUpdate &&
                                                              module.ShouldGetExecuted()))
            {
                module.OnExecute();
            }
        }
Beispiel #4
0
        void SetUpEvents()
        {
            Cleanser.OnLoad();
            PotionManager.OnLoad(Menu);
            ItemManager.OnLoad(Menu);

            Game.OnGameUpdate                  += Game_OnGameUpdate;
            Orbwalking.AfterAttack             += OrbwalkingAfterAttack;
            AntiGapcloser.OnEnemyGapcloser     += AntiGapcloser_OnEnemyGapcloser;
            Interrupter2.OnInterruptableTarget += Interrupter2_OnInterruptableTarget;
            Drawing.OnDraw += Drawing_OnDraw;
        }
Beispiel #5
0
        static void SetUpEvents()
        {
            Cleanser.OnLoad();
            PotionManager.OnLoad(Menu);
            ItemManager.OnLoad(Menu);

            Game.OnUpdate                      += Game_OnGameUpdate;
            Orbwalking.AfterAttack             += OrbwalkingAfterAttack;
            AntiGapcloser.OnEnemyGapcloser     += AntiGapcloser_OnEnemyGapcloser;
            Interrupter2.OnInterruptableTarget += Interrupter2_OnInterruptableTarget;
            Stealth.OnStealth                  += Stealth_OnStealth;
            Drawing.OnDraw                     += Drawing_OnDraw;
            Obj_AI_Hero.OnPlayAnimation        += Obj_AI_Hero_OnPlayAnimation;
            GameObject.OnCreate                += GameObject_OnCreate;
        }
Beispiel #6
0
        public static void OnLoad(EventArgs args)
        {
            Player = ObjectManager.Player;
            Config = new Menu("DZAIO", "dzaio", true);
            TargetSelector.AddToMenu(Config.SubMenu("Target selector"));
            Orbwalker = new Orbwalking.Orbwalker(Config.SubMenu("Orbwalking"));
            Game.PrintChat("<b><font color='#FF0000'>[DZAIO]</font></b><font color='#FFFFFF'> DZAIO Loaded!</font> v{0}", Assembly.GetExecutingAssembly().GetName().Version);

            if (ChampList.ContainsKey(Player.ChampionName))
            {
                CurrentChampion = ChampList[Player.ChampionName].Invoke();
                CurrentChampion.OnLoad(Config);
                CurrentChampion.SetUpSpells();
                CurrentChampion.RegisterEvents();
                ItemManager.OnLoad(Config);
                Game.PrintChat("<b><font color='#FF0000'>[DZAIO] </font></b><font color='#FFFFFF'>Loaded</font> <b><font color='#FF0000'>{0}</font></b> plugin! <font color='#FFFFFF'> Have fun! </font>", Player.ChampionName);
            }
            Game.PrintChat("<b><font color='#FF0000'>[DZAIO] </font></b><font color='#FFFFFF'>Special credits to:</font>  <b><font color='#FF0000'>Hellsing</font></b>, <b><font color='#FF0000'>ChewyMoon</font></b> ");

            Cleanser.OnLoad();
            ChatHook.OnLoad();
            DebugHelper.OnLoad();
            NotificationDrawing.OnLoad();
            PotionManager.OnLoad(Config);
            Config.AddItem(new MenuItem("dzaio.hpdraw.disable", "Disable HP Bar Drawing").SetValue(false));
            var aboutMenu = new Menu(Player.ChampionName + " - About", "dzaio.about");

            {
                aboutMenu.AddItem(new MenuItem("dzaio.about.line1", "DZAIO By Asuna/DZ191"));
                aboutMenu.AddItem(new MenuItem("dzaio.about.line2", "v." + Assembly.GetExecutingAssembly().GetName().Version));
                aboutMenu.AddItem(new MenuItem("dzaio.about.line3", " "));
                aboutMenu.AddItem(new MenuItem("dzaio.about.line4", "If you liked/appreciated the assembly"));
                aboutMenu.AddItem(new MenuItem("dzaio.about.line5", "Feel free to donate at:"));
                aboutMenu.AddItem(new MenuItem("dzaio.about.line6", "*****@*****.**"));
            }
            Config.AddSubMenu(aboutMenu);

            Config.AddToMainMenu();
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <returns></returns>
        public BaseTemplate_Update <T, V> Update()
        {
            try
            {
                // first of all, we check if user has the right to perform this operation!
                if (HasUserToBeAuthenticated())
                {
                    if (!IsUserAuthenticated() || !HasUserPrivilege())
                    {
                        return(this);
                    }
                }
                //Run the parameters through the cleanse process
                dynamic cleansedParams = Cleanser.Cleanse(Request.parameters);

                try
                {
                    DTO = GetDTO(cleansedParams);
                }
                catch
                {
                    throw new InputFormatException();
                }

                DTO = Sanitizer.Sanitize(DTO);

                DTOValidationResult = Validator.Validate(DTO);

                if (!DTOValidationResult.IsValid)
                {
                    OnDTOValidationError();
                    return(this);
                }

                Ado.StartTransaction(IsolationLevel.Snapshot);

                // The Actual Creation should happen here by the specific class!
                if (!Execute())
                {
                    Ado.RollbackTransaction();
                    OnExecutionError();
                    return(this);
                }

                Ado.CommitTransaction();
                OnExecutionSuccess();

                return(this);
            }
            catch (FormatException formatException)
            {
                //An error has been caught, rollback the transaction, log the error and return a message to the caller
                Ado.RollbackTransaction();
                Log.Instance.Error(formatException);
                Response.error = Label.Get("error.schema");
                return(this);
            }
            catch (InputFormatException inputError)
            {
                //An error has been caught, rollback the transaction, log the error and return a message to the caller
                Ado.RollbackTransaction();
                Log.Instance.Error(inputError);
                Response.error = Label.Get("error.schema");
                return(this);
            }
            catch (Exception ex)
            {
                Ado.RollbackTransaction();
                //An error has been caught, rollback the transaction, log the error and return a message to the caller
                Log.Instance.Error(ex);
                Response.error = Label.Get("error.exception");
                return(this);
            }
            finally
            {
                Dispose();
            }
        }
        public static void OnLoad()
        {
            var RootMenu = Variables.Menu;

            var OWMenu = new Menu("[VHR] Orbwalker", "dz191.vhr.orbwalker");
            {
                Variables.Orbwalker = new Orbwalking.Orbwalker(OWMenu);
                RootMenu.AddSubMenu(OWMenu);
            }

            var TSMenu = new Menu("[VHR] TS", "dz191.vhr.ts");
            {
                TargetSelector.AddToMenu(TSMenu);
                RootMenu.AddSubMenu(TSMenu);
            }

            var comboMenu = new Menu("[VHR] Combo", "dz191.vhr.combo");
            {
                var manaMenu = new Menu("Mana Manager", "dz191.vhr.combo.mm");
                {
                    manaMenu.AddManaLimiter(Enumerations.Skills.Q, Orbwalking.OrbwalkingMode.Combo);
                    manaMenu.AddManaLimiter(Enumerations.Skills.E, Orbwalking.OrbwalkingMode.Combo);
                    manaMenu.AddManaLimiter(Enumerations.Skills.R, Orbwalking.OrbwalkingMode.Combo);

                    comboMenu.AddSubMenu(manaMenu);
                }

                comboMenu.AddSkill(Enumerations.Skills.Q, Orbwalking.OrbwalkingMode.Combo);
                comboMenu.AddSkill(Enumerations.Skills.E, Orbwalking.OrbwalkingMode.Combo);
                comboMenu.AddSkill(Enumerations.Skills.R, Orbwalking.OrbwalkingMode.Combo, false);

                comboMenu.AddSlider("dz191.vhr.combo.r.minenemies", "Min. R Enemies", new Tuple <int, int, int>(2, 1, 5)).SetTooltip("Minimum enemies in range for R");
                comboMenu.AddBool("dz191.vhr.combo.q.2wstacks", "Only Q if 2W Stacks on Target").SetTooltip("Will Q for 3rd proc only. Enable if you want AA AA Q AA");

                RootMenu.AddSubMenu(comboMenu);
            }

            var harassMenu = new Menu("[VHR] Harass", "dz191.vhr.mixed");
            {
                var manaMenu = new Menu("Mana Manager", "dz191.vhr.mixed.mm");
                {
                    manaMenu.AddManaLimiter(Enumerations.Skills.Q, Orbwalking.OrbwalkingMode.Mixed);
                    manaMenu.AddManaLimiter(Enumerations.Skills.E, Orbwalking.OrbwalkingMode.Mixed);

                    harassMenu.AddSubMenu(manaMenu);
                }

                harassMenu.AddSkill(Enumerations.Skills.Q, Orbwalking.OrbwalkingMode.Mixed);
                harassMenu.AddSkill(Enumerations.Skills.E, Orbwalking.OrbwalkingMode.Mixed);

                harassMenu.AddBool("dz191.vhr.mixed.q.2wstacks", "Only Q if 2W Stacks on Target").SetTooltip("Will Q for 3rd proc only. Enable if you want AA AA Q AA");
                harassMenu.AddBool("dz191.vhr.mixed.ethird", "Use E for Third Proc").SetTooltip("Uses E for 3rd W proc. Enable if you want AA Q AA E");

                RootMenu.AddSubMenu(harassMenu);
            }

            var farmMenu = new Menu("[VHR] Farm", "dz191.vhr.farm");
            {
                farmMenu.AddSkill(Enumerations.Skills.Q, Orbwalking.OrbwalkingMode.LaneClear).SetTooltip("Q Laneclear");
                farmMenu.AddManaLimiter(Enumerations.Skills.Q, Orbwalking.OrbwalkingMode.LaneClear, 45, true);
                farmMenu.AddSkill(Enumerations.Skills.Q, Orbwalking.OrbwalkingMode.LastHit).SetTooltip("Q Lasthit");
                farmMenu.AddManaLimiter(Enumerations.Skills.Q, Orbwalking.OrbwalkingMode.LastHit, 45, true);
                farmMenu.AddBool("dz191.vhr.farm.condemnjungle", "Use E to condemn jungle mobs", true).SetTooltip("Use Condemn against jungle creeps");
                farmMenu.AddBool("dz191.vhr.farm.qjungle", "Use Q against jungle mobs", true).SetTooltip("Use Tumble in the Jungle");

                RootMenu.AddSubMenu(farmMenu);
            }

            var miscMenu = new Menu("[VHR] Misc", "dz191.vhr.misc");
            {
                var miscQMenu = new Menu("Misc - Q (Tumble)", "dz191.vhr.misc.tumble");
                {
                    miscQMenu.AddStringList("dz191.vhr.misc.condemn.qlogic", "Q Logic", new[] { "Reborn", "Normal", "Kite melees", "Kurisu" }).SetTooltip("The Tumble Method. Reborn = Safest & Besto");
                    miscQMenu.AddBool("dz191.vhr.mixed.mirinQ", "Q to Wall when Possible (Mirin Mode)", true).SetTooltip("Will Q to walls when possible for really fast bursts!");
                    miscQMenu.AddBool("dz191.vhr.misc.tumble.smartq", "Try to QE when possible").SetTooltip("Will try to do the Tumble + Condemn combo when possible");                                               //Done
                    miscQMenu.AddKeybind("dz191.vhr.misc.tumble.noaastealthex", "Don't AA while stealthed", new Tuple <uint, KeyBindType>('K', KeyBindType.Toggle)).SetTooltip("Will not AA while you are in Ult+Q"); //Done
                    miscQMenu.AddSlider("dz191.vhr.misc.tumble.noaastealthex.hp", "^ Only if HP % < x", new Tuple <int, int, int>(35, 0, 100)).SetTooltip("If true it will not Q into 2 or more enemies");            //done
                    miscQMenu.AddBool("dz191.vhr.misc.tumble.ijava", "iJava Stealth").SetTooltip("If you are not iJava, Don't press me :^)");                                                                         //Done
                    miscQMenu.AddSlider("dz191.vhr.misc.tumble.noaastealth.duration", "Duration to wait (iJava Only)", new Tuple <int, int, int>(700, 0, 1000));
                    miscQMenu.AddBool("dz191.vhr.misc.tumble.noqenemies", "Don't Q into enemies").SetTooltip("If true it will not Q into 2 or more enemies");                                                         //done
                    miscQMenu.AddBool("dz191.vhr.misc.tumble.noqenemies.old", "Use Old Don't Q into enemies").SetTooltip("Uses the old algorithm.");                                                                  //done
                    miscQMenu.AddBool("dz191.vhr.misc.tumble.dynamicqsafety", "Use dynamic Q Safety Distance").SetTooltip("Use the enemy AA range as the 'Don't Q into enemies' safety distance?");                   //done
                    miscQMenu.AddBool("dz191.vhr.misc.tumble.qspam", "Ignore Q checks").SetTooltip("Ignores 'Safe Q' and 'Don't Q into enemies' checks");                                                             //Done
                    miscQMenu.AddBool("dz191.vhr.misc.tumble.qinrange", "Q For KS", true).SetTooltip("Uses Q to KS by Qing in range if you can kill with Q + AA");                                                    //Done
                    miscQMenu.AddSlider(
                        "dz191.vhr.misc.tumble.noaa.enemies", "Min Enemies for No AA Stealth",
                        new Tuple <int, int, int>(3, 2, 5));

                    miscMenu.AddSubMenu(miscQMenu);
                }

                var miscEMenu = new Menu("Misc - E (Condemn)", "dz191.vhr.misc.condemn");
                {
                    miscEMenu.AddStringList("dz191.vhr.misc.condemn.condemnmethod", "Condemn Method",
                                            new[] { "VH Revolution", "VH Reborn", "Marksman/Gosu", "Shine#" }).SetTooltip("The condemn method. Recommended: Revolution > Shine/Reborn > Marksman");

                    miscEMenu.AddSlider("dz191.vhr.misc.condemn.pushdistance", "E Push Distance",
                                        new Tuple <int, int, int>(420, 350, 470)).SetTooltip("The E Knockback distance the script uses. Recommended: 400-430");

                    miscEMenu.AddSlider("dz191.vhr.misc.condemn.accuracy", "Accuracy (Revolution Only)",
                                        new Tuple <int, int, int>(45, 1, 65)).SetTooltip("The Condemn Accuracy. Recommended value: 40-45");

                    miscEMenu.AddItem(
                        new MenuItem("dz191.vhr.misc.condemn.enextauto", "E Next Auto").SetValue(
                            new KeyBind('T', KeyBindType.Toggle))).SetTooltip("If On it will fire E after the next Auto Attack is landed");

                    miscEMenu.AddItem(
                        new MenuItem("dz191.vhr.misc.condemn.flashcondemn", "Condemn -> Flash").SetValue(
                            new KeyBind('W', KeyBindType.Press)))
                    .SetTooltip("Uses the Condemn -> Flash pro play on an enemy on which it is possible to do so.");

                    miscEMenu.AddBool("dz191.vhr.misc.condemn.onlystuncurrent", "Only stun current target").SetTooltip("Only uses E on the current orbwalker target");  //done
                    miscEMenu.AddBool("dz191.vhr.misc.condemn.autoe", "Auto E").SetTooltip("Uses E whenever possible");                                                 //Done
                    miscEMenu.AddBool("dz191.vhr.misc.condemn.eks", "Smart E KS").SetTooltip("Uses E to KS when they have 2 W Stacks and they can be killed by W + E"); //Done
                    miscEMenu.AddSlider("dz191.vhr.misc.condemn.noeaa", "Don't E if Target can be killed in X AA",
                                        new Tuple <int, int, int>(1, 0, 4)).SetTooltip("Does not condemn if you can kill the target in X Auto Attacks");                //Done

                    miscEMenu.AddBool("dz191.vhr.misc.condemn.trinketbush", "Trinket Bush on Condemn", true).SetTooltip("Uses Blue / Yellow trinket on bush if you condemn in there.");
                    miscEMenu.AddBool("dz191.vhr.misc.condemn.lowlifepeel", "Peel with E when low health").SetTooltip("Uses E on melee enemies if your health < 15%");
                    miscEMenu.AddBool("dz191.vhr.misc.condemn.condemnflag", "Condemn to J4 flag", true).SetTooltip("Tries to make the assembly condemn on J4 Flags");
                    miscEMenu.AddBool("dz191.vhr.misc.condemn.noeturret", "No E Under enemy turret").SetTooltip("Does not condemn if you are under their turret");
                    miscEMenu.AddBool("dz191.vhr.misc.condemn.repelflash", "Use E on Enemy Flashes").SetTooltip("Uses E on enemy flashes that get too close.");
                    miscEMenu.AddBool("dz191.vhr.misc.condemn.repelkindred", "Use E to push enemies out of kindred ult").SetTooltip("Uses E on enemies inside Kindred's ult.");

                    miscMenu.AddSubMenu(miscEMenu);
                }

                var miscGeneralSubMenu = new Menu("Misc - General", "dz191.vhr.misc.general"); //Done
                {
                    miscGeneralSubMenu.AddBool("dz191.vhr.misc.general.antigp", "Anti Gapcloser").SetTooltip("Uses E to stop gapclosers");
                    miscGeneralSubMenu.AddBool("dz191.vhr.misc.general.interrupt", "Interrupter", true).SetTooltip("Uses E to interrupt skills");
                    miscGeneralSubMenu.AddSlider("dz191.vhr.misc.general.antigpdelay", "Anti Gapcloser Delay (ms)",
                                                 new Tuple <int, int, int>(0, 0, 1000)).SetTooltip("Sets a delay before the Condemn for Antigapcloser is casted.");

                    miscGeneralSubMenu.AddBool("dz191.vhr.misc.general.specialfocus", "Focus targets with 2 W marks").SetTooltip("Tries to focus targets that have 2W Rings on them");
                    miscGeneralSubMenu.AddBool("dz191.vhr.misc.general.reveal", "Stealth Reveal (Pink Ward / Lens)").SetTooltip("Reveals stealthed champions using Pink Wards / Lenses");

                    miscGeneralSubMenu.AddBool("dz191.vhr.misc.general.disablemovement", "Disable Orbwalker Movement").SetTooltip("Disables the Orbwalker movements as long as it's active");
                    miscGeneralSubMenu.AddBool("dz191.vhr.misc.general.disableattk", "Disable Orbwalker Attack").SetTooltip("Disables the Orbwalker attacks as long as it's active");

                    miscMenu.AddSubMenu(miscGeneralSubMenu);
                }

                RootMenu.AddSubMenu(miscMenu);
            }

            var drawMenu = new Menu("[VHR] Drawings", "dz191.vhr.draw");

            {
                drawMenu.AddBool("dz191.vhr.draw.spots", "Draw Spots", true);
                drawMenu.AddBool("dz191.vhr.draw.range", "Draw Enemy Ranges", true);
                drawMenu.AddBool("dz191.vhr.draw.condemn", "Draw Condemn Rectangles", true);
                drawMenu.AddBool("dz191.vhr.draw.qpos", "Reborn Q Position (Debug)");

                RootMenu.AddSubMenu(drawMenu);
            }

            //CustomAntigapcloser.BuildMenu(RootMenu);
            DZAntigapcloserVHR.BuildMenu(RootMenu, "[VHR] AntiGapclosers List", "dz191.vhr.agplist");
            Activator.LoadMenu();
            Cleanser.LoadMenu(RootMenu);
            ProfileSelector.OnLoad(RootMenu);
            TranslationInterface.OnLoad(RootMenu);

            RootMenu.AddToMainMenu();
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <returns></returns>
        public BaseTemplate_Read <T, V> Read()
        {
            try
            {
                // first of all, we check if user has the right to perform this operation!
                if (HasUserToBeAuthenticated())
                {
                    if (!IsUserAuthenticated() || !HasUserPrivilege())
                    {
                        return(this);
                    }
                }
                //Run the parameters through the cleanse process
                dynamic cleansedParams = Cleanser.Cleanse(Request.parameters);

                try
                {
                    DTO = GetDTO(cleansedParams);
                }
                catch
                {
                    throw new InputFormatException();
                }

                DTO = Sanitizer.Sanitize(DTO);

                DTOValidationResult = Validator.Validate(DTO);

                if (!DTOValidationResult.IsValid)
                {
                    OnDTOValidationError();

                    return(this);
                }

                //Create the analytic data if required
                Security.Analytic_BSO_Create.Create(Ado, DTO, HttpContext.Current.Request, Request);

                //See if there's a cache in the process
                if (MethodReader.MethodHasAttribute(Request.method, "CacheRead"))
                {
                    cDTO = new CacheMetadata("CacheRead", Request.method, DTO);
                    MemCachedD_Value cache = MemCacheD.Get_BSO <dynamic>(cDTO.Namespace, cDTO.ApiName, cDTO.Method, DTO);
                    if (cache.hasData)
                    {
                        Response.data = cache.data;
                        return(this);
                    }
                }

                // The Actual Read should happen here by the specific class!
                if (!Execute())
                {
                    OnExecutionError();
                    return(this);
                }

                OnExecutionSuccess();

                return(this);
            }
            catch (UnmatchedParametersException unmatchException)
            {
                Log.Instance.Debug(unmatchException);
                OnDTOValidationError();
                return(this);
            }
            catch (FormatException formatException)
            {
                //A FormatException error has been caught, log the error and return a message to the caller
                Log.Instance.Error(formatException);
                Response.error = Label.Get("error.schema");
                return(this);
            }
            catch (Exception ex)
            {
                //An error has been caught,  log the error and return a message to the caller
                Log.Instance.Error(ex);
                Response.error = Label.Get("error.exception");

                return(this);
            }
            finally
            {
                Dispose();
            }
        }
Beispiel #10
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <returns></returns>
        public BaseTemplate_Read <T, V> Read()
        {
            try
            {
                // first of all, we check if user has the right to perform this operation!
                if (HasUserToBeAuthenticated())
                {
                    if (!IsUserAuthenticated() || !HasUserPrivilege())
                    {
                        OnAuthenticationFailed();
                        return(this);
                    }
                }
                //if we didn't attempt to authenticate and it's an external call then we still need to the the SamAccountName
                if (SamAccountName == null && Request.sessionCookie != null)
                {
                    Log.Instance.Debug("Session cookie: " + Request.sessionCookie.Value);

                    //Does the cookie correspond with a live token for a user?
                    ADO_readerOutput user;
                    using (Login_BSO lBso = new Login_BSO())
                    {
                        user = lBso.ReadBySession(Request.sessionCookie.Value);
                        if (user.hasData)
                        {
                            SamAccountName = user.data[0].CcnUsername;
                        }
                    }
                }

                //Run the parameters through the cleanse process
                dynamic cleansedParams;

                //If the API has the IndividualCleanseNoHtml attribute then parameters are cleansed individually
                //Any of these parameters whose corresponding DTO property contains the NoHtmlStrip attribute will not be cleansed of HTML tags
                if (Resources.MethodReader.MethodHasAttribute(Request.method, "IndividualCleanseNoHtml"))
                {
                    dynamic dto = GetDTO(Request.parameters);
                    cleansedParams = Cleanser.Cleanse(Request.parameters, dto);
                }
                else
                {
                    cleansedParams = Cleanser.Cleanse(Request.parameters);
                }

                try
                {
                    DTO = GetDTO(cleansedParams);
                }
                catch
                {
                    throw new InputFormatException();
                }

                DTO = Sanitizer.Sanitize(DTO);

                DTOValidationResult = Validator.Validate(DTO);

                if (!DTOValidationResult.IsValid)
                {
                    OnDTOValidationError();

                    return(this);
                }

                ////Has the user hit a limit of how many queries are allowed?
                //if (Throttle_BSO.IsThrottled(Ado, HttpContext.Current.Request, Request, SamAccountName))
                //{
                //    OnThrottle();
                //    return this;
                //}

                //Create the analytic data if required
                Security.Analytic_BSO_Create.Create(Ado, DTO, HttpContext.Current.Request, Request);

                //See if there's a cache in the process
                if (MethodReader.MethodHasAttribute(Request.method, "CacheRead"))
                {
                    cDTO = new CacheMetadata("CacheRead", Request.method, DTO);
                    MemCachedD_Value cache = MemCacheD.Get_BSO <dynamic>(cDTO.Namespace, cDTO.ApiName, cDTO.Method, DTO);
                    if (cache.hasData)
                    {
                        Response.data = cache.data;
                        return(this);
                    }
                }



                // The Actual Read should happen here by the specific class!
                if (!Execute())
                {
                    OnExecutionError();
                }
                else
                {
                    OnExecutionSuccess();
                }



                return(this);
            }
            catch (UnmatchedParametersException unmatchException)
            {
                Log.Instance.Debug(unmatchException);
                OnDTOValidationError();
                return(this);
            }
            catch (FormatException formatException)
            {
                //A FormatException error has been caught, log the error and return a message to the caller
                Log.Instance.Error(formatException);
                Response.error = Label.Get("error.schema");
                return(this);
            }
            catch (Exception ex)
            {
                //An error has been caught,  log the error and return a message to the caller
                Log.Instance.Error(ex);
                Response.error = Label.Get("error.exception");

                return(this);
            }
            finally
            {
                Dispose();
            }
        }
Beispiel #11
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <returns></returns>
        public BaseTemplate_Update <T, V> Update()
        {
            try
            {
                // first of all, we check if user has the right to perform this operation!
                if (HasUserToBeAuthenticated())
                {
                    if (!IsUserAuthenticated() || !HasUserPrivilege())
                    {
                        OnAuthenticationFailed();
                        return(this);
                    }
                }
                //if we didn't attempt to authenticate and it's an external call then we still need to the the SamAccountName
                if (SamAccountName == null && Request.sessionCookie != null)
                {
                    //Does the cookie correspond with a live token for a user?
                    ADO_readerOutput user;
                    using (Login_BSO lBso = new Login_BSO())
                    {
                        user = lBso.ReadBySession(Request.sessionCookie.Value);
                        if (user.hasData)
                        {
                            SamAccountName = user.data[0].CcnUsername;
                        }
                    }
                }

                //Run the parameters through the cleanse process
                dynamic cleansedParams;

                //If the API has the IndividualCleanseNoHtml attribute then parameters are cleansed individually
                //Any of these parameters whose corresponding DTO property contains the NoHtmlStrip attribute will not be cleansed of HTML tags
                if (Resources.MethodReader.MethodHasAttribute(Request.method, "IndividualCleanseNoHtml"))
                {
                    dynamic dto = GetDTO(Request.parameters);
                    cleansedParams = Cleanser.Cleanse(Request.parameters, dto);
                }
                else
                {
                    cleansedParams = Cleanser.Cleanse(Request.parameters);
                }

                try
                {
                    DTO = GetDTO(cleansedParams);
                }
                catch
                {
                    throw new InputFormatException();
                }

                DTO = Sanitizer.Sanitize(DTO);

                DTOValidationResult = Validator.Validate(DTO);

                if (!DTOValidationResult.IsValid)
                {
                    OnDTOValidationError();
                    return(this);
                }

                Ado.StartTransaction();

                // The Actual Creation should happen here by the specific class!
                if (!Execute())
                {
                    Ado.RollbackTransaction();
                    OnExecutionError();
                }
                else
                {
                    Ado.CommitTransaction();
                    OnExecutionSuccess();
                }



                return(this);
            }
            catch (FormatException formatException)
            {
                //An error has been caught, rollback the transaction, log the error and return a message to the caller
                Ado.RollbackTransaction();
                Log.Instance.Error(formatException);
                Response.error = Label.Get("error.schema");
                return(this);
            }
            catch (InputFormatException inputError)
            {
                //An error has been caught, rollback the transaction, log the error and return a message to the caller
                Ado.RollbackTransaction();
                Log.Instance.Error(inputError);
                Response.error = Label.Get("error.schema");
                return(this);
            }
            catch (Exception ex)
            {
                Ado.RollbackTransaction();
                //An error has been caught, rollback the transaction, log the error and return a message to the caller
                Log.Instance.Error(ex);
                Response.error = Label.Get("error.exception");
                return(this);
            }
            finally
            {
                Dispose();
            }
        }
Beispiel #12
0
        /// <summary>
        ///     TODO The create menu.
        /// </summary>
        private static void CreateMenu()
        {
            Menu = new Menu("iDzLucian", "com.idzlucian", true);

            var orbMenu = new Menu("Lucian - Orbwalker", "com.idzlucian.orbwalker");

            orbwalker = new Orbwalking.Orbwalker(orbMenu);
            Menu.AddSubMenu(orbMenu);

            var tsMenu = new Menu("Lucian - Target Selector", "com.idzlucian.ts");

            TargetSelector.AddToMenu(tsMenu);
            Menu.AddSubMenu(tsMenu);

            var comboMenu = new Menu("Lucian - Combo", "com.idzlucian.combo");

            comboMenu.AddModeMenu(
                Mode.Combo,
                new[] { SpellSlot.Q, SpellSlot.W, SpellSlot.E },
                new[] { true, true, false, false });
            comboMenu.AddManaManager(Mode.Combo, new[] { SpellSlot.Q, SpellSlot.W, SpellSlot.E }, new[] { 35, 35, 25 });

            var skillOptionsCombo = new Menu("Skill Options", "com.idzlucian.combo.skilloptions");

            {
                skillOptionsCombo.AddItem(
                    new MenuItem("com.idzlucian.skilloptions.weave", "Spell Weaving").SetValue(true));
                skillOptionsCombo.AddItem(
                    new MenuItem("com.idzlucian.combo.useextendedq", "Use Extended Q Combo").SetValue(true));
                skillOptionsCombo.AddItem(
                    new MenuItem("com.idzlucian.harass.useextendedq", "Use Extended Q Harass").SetValue(true));
                skillOptionsCombo.AddItem(new MenuItem("com.idzlucian.combo.useEQSteal", "Use EQ KS").SetValue(true));
            }

            comboMenu.AddSubMenu(skillOptionsCombo);

            Menu.AddSubMenu(comboMenu);

            var harassMenu = new Menu("Lucian - Harass", "com.idzlucian.harass");

            harassMenu.AddModeMenu(Mode.Harass, new[] { SpellSlot.Q, SpellSlot.W }, new[] { true, true });
            harassMenu.AddManaManager(Mode.Harass, new[] { SpellSlot.Q, SpellSlot.W }, new[] { 35, 35 });

            // harassMenu.AddItem(
            // new MenuItem("com.idzlucian.harass.useextendedq", "Use Extended Q Harass").SetValue(true));
            Menu.AddSubMenu(harassMenu);

            var farmMenu = new Menu("Lucian - Farm", "com.idzlucian.farm");

            farmMenu.AddModeMenu(Mode.Laneclear, new[] { SpellSlot.Q }, new[] { true });
            farmMenu.AddManaManager(Mode.Laneclear, new[] { SpellSlot.Q }, new[] { 35 });
            var farmOptions = new Menu("Farm Options", "com.idzlucian.farm.farm");

            {
                farmOptions.AddItem(
                    new MenuItem("com.idzlucian.farm.q.lc.minhit", "Min Minions for Q LC").SetValue(new Slider(2, 1, 6)));
            }

            farmMenu.AddSubMenu(farmOptions);

            Menu.AddSubMenu(farmMenu);

            var miscMenu = new Menu("Lucian - Misc", "com.idzlucian.misc");
            {
                miscMenu.AddHitChanceSelector();
                miscMenu.AddItem(
                    new MenuItem("com.idzlucian.misc.antigpe", "Use E Against enemy gapclosers").SetValue(false));
                miscMenu.AddItem(new MenuItem("com.idzlucian.misc.debug", "Debug").SetValue(false));
            }
            var noExtQOnMenu = new Menu("Misc - Don't Use Extended Q Harass On", "com.idzlucian.misc.noextq");

            {
                foreach (var Hero in HeroManager.Enemies)
                {
                    noExtQOnMenu.AddItem(
                        new MenuItem(
                            "com.idzlucian.misc.noextq." + Hero.ChampionName.ToLowerInvariant(), Hero.ChampionName).SetValue(false));
                }
            }
            Menu.AddSubMenu(miscMenu);
            Cleanser.OnLoad();

            Menu.AddToMainMenu();
        }