Ejemplo n.º 1
0
        internal Exception GetClasslibException(ExceptionIDs id)
        {
#if INPLACE_RUNTIME
            return(RuntimeExceptionHelpers.GetRuntimeException(id));
#else
            DynamicModule *dynamicModule = this.DynamicModule;
            if (dynamicModule != null)
            {
                IntPtr getRuntimeException = dynamicModule->GetRuntimeException;
                if (getRuntimeException != IntPtr.Zero)
                {
                    return(CalliIntrinsics.Call <Exception>(getRuntimeException, id));
                }
            }
            if (IsParameterizedType)
            {
                return(RelatedParameterType->GetClasslibException(id));
            }

            return(EH.GetClasslibExceptionFromEEType(id, GetAssociatedModuleAddress()));
#endif
        }
Ejemplo n.º 2
0
        internal Exception GetClasslibException(ExceptionIDs id)
        {
#if INPLACE_RUNTIME
            return(RuntimeExceptionHelpers.GetRuntimeException(id));
#else
            DynamicModule *dynamicModule = this.DynamicModule;
            if (dynamicModule != null)
            {
                delegate * < System.Runtime.ExceptionIDs, System.Exception > getRuntimeException = dynamicModule->GetRuntimeException;
                if (getRuntimeException != null)
                {
                    return(getRuntimeException(id));
                }
            }
            if (IsParameterizedType)
            {
                return(RelatedParameterType->GetClasslibException(id));
            }

            return(EH.GetClasslibExceptionFromEEType(id, GetAssociatedModuleAddress()));
#endif
        }
Ejemplo n.º 3
0
        public void Render()
        {
            if (this._executedRecordIndex >= this.AllReadObjects.Count - 1)
            {
                return;
                //For looping:
                //foreach (DictionaryEntry de in this._objectByDepth)
                //    ((Sprite)de.Value).Dispose();
                //this._objectByDepth.Clear();
                //this._executedRecordIndex = 0; //loop from start
            }

            //EH.Put("New frame!" + this._executedRecordIndex.ToString() + "/"+this.AllReadObjects.Count.ToString());

            ArrayList newSprites     = new ArrayList();
            ArrayList removedSprites = new ArrayList();

            //loop through the parsed flash file:
            while (this._executedRecordIndex < this.AllReadObjects.Count - 1)
            {
                this._executedRecordIndex++;
                Record record = (Record)this.AllReadObjects[this._executedRecordIndex];
                //EH.Put("Tag: "+record.Tag.ToString());

                if (record is Placement.Placement)
                {
                    // like "put member in sprite on stage"
                    Placement.Placement placement = (Placement.Placement)record;
                    Sprite spExisting             = (Sprite)this._objectByDepth[placement.Depth];
                    Sprite sp = placement.Execute(this, spExisting);
                    if (spExisting == null)
                    {
                        this._objectByDepth.Add(placement.Depth, sp);
                        newSprites.Add(spExisting);
                    }
                }
                else if (record is Placement.Remove)
                {
                    Placement.Remove remove = (Placement.Remove)record;
                    if (!this._objectByDepth.Contains(remove.Depth))
                    {
                        EH.Put("Removing nonexistent sprite?");
                    }
                    else
                    {
                        Sprite sp = (Sprite)this._objectByDepth[remove.Depth];
                        this._objectByDepth.Remove(remove.Depth);
                        removedSprites.Add(sp);
                    }
                }
                else if (record.Tag == Tags.SetBackgroundColor)
                {
                }
                else if (record.Tag == Tags.ShowFrame)
                {
                    break;
                }
            }
//			foreach (Sprite sp in newSprites)
//				sp.Visible = true;
            foreach (Sprite sp in removedSprites)
            {
                sp.Dispose();
            }

            float msecsPerFrame = 1000f / this.FrameRate;

            //float msecsPerFrame = 300; //;
            this._nextUpdateTime = DateTime.Now.Ticks + (int)(msecsPerFrame * 1000 * 10);
        }
Ejemplo n.º 4
0
        private void OnCombo()
        {
            bool useQ = Menu["combo"]["useq"].Enabled;

            if (useQ)
            {
                var QHuman  = GetBestEnemyHeroTargetInRange(QH.Range);
                var QCougar = GetBestEnemyHeroTargetInRange(QC.Range);
                switch (Menu["combo"]["qo"].As <MenuList>().Value)
                {
                case 0:
                    if (QH.Ready && Player.SpellBook.GetSpell(SpellSlot.Q).Name == "JavelinToss" && QHuman.IsValidTarget(QH.Range))
                    {
                        QH.Cast(QHuman);
                    }
                    else if (QC.Ready && Player.SpellBook.GetSpell(SpellSlot.Q).Name == "Takedown" && QCougar.IsValidTarget(QC.Range))
                    {
                        QC.Cast();
                    }
                    break;

                case 1:
                    if (QH.Ready && Player.SpellBook.GetSpell(SpellSlot.Q).Name == "JavelinToss" && QHuman.IsValidTarget(QH.Range))
                    {
                        QH.Cast(QHuman);
                    }
                    break;

                case 2:
                    if (QC.Ready && Player.SpellBook.GetSpell(SpellSlot.Q).Name == "Takedown" && QCougar.IsValidTarget(QC.Range))
                    {
                        QC.Cast();
                    }
                    break;
                }
            }
            bool useW = Menu["combo"]["usew"].Enabled;

            if (useW)
            {
                var WHuman  = GetBestEnemyHeroTargetInRange(WH.Range);
                var WCougar = GetBestEnemyHeroTargetInRange(WC.Range);
                switch (Menu["combo"]["wo"].As <MenuList>().Value)
                {
                case 0:
                    if (WH.Ready && Player.SpellBook.GetSpell(SpellSlot.W).Name == "Bushwhack" && WHuman.IsValidTarget(WH.Range))
                    {
                        WH.Cast(WHuman);
                    }
                    else if (WC.Ready && Player.SpellBook.GetSpell(SpellSlot.W).Name == "Pounce" && WCougar.IsValidTarget(WC.Range))
                    {
                        WC.Cast(WCougar);
                    }
                    break;

                case 1:
                    if (WH.Ready && Player.SpellBook.GetSpell(SpellSlot.W).Name == "Bushwhack" && WHuman.IsValidTarget(WH.Range))
                    {
                        WH.Cast(WHuman);
                    }
                    break;

                case 2:
                    if (WC.Ready && Player.SpellBook.GetSpell(SpellSlot.W).Name == "Pounce" && WCougar.IsValidTarget(WC.Range))
                    {
                        WC.Cast(WCougar);
                    }
                    else if (WCL.Ready && Player.SpellBook.GetSpell(SpellSlot.W).Name == "Pounce" && WCougar.IsValidTarget(WCL.Range) && WCougar.HasBuff("NidaleePassiveHunted"))
                    {
                        WCL.Cast(WCougar);
                    }
                    break;
                }
            }

            bool  useE  = Menu["combo"]["usee"].Enabled;
            float hpe   = Menu["combo"]["useeh"].As <MenuSlider>().Value;
            float manae = Menu["combo"]["useehm"].As <MenuSlider>().Value;

            if (useE)
            {
                var ECougar = GetBestEnemyHeroTargetInRange(EC.Range);
                switch (Menu["combo"]["eo"].As <MenuList>().Value)
                {
                case 0:
                    if (EH.Ready && Player.SpellBook.GetSpell(SpellSlot.E).Name == "PrimalSurge" && Player.ManaPercent() >= manae && Player.HealthPercent() <= hpe)
                    {
                        EH.Cast(Player);
                    }
                    else if (EC.Ready && Player.SpellBook.GetSpell(SpellSlot.E).Name == "Swipe" && ECougar.IsValidTarget(EC.Range))
                    {
                        EC.Cast(ECougar);
                    }
                    break;

                case 1:
                    if (EH.Ready && Player.SpellBook.GetSpell(SpellSlot.E).Name == "PrimalSurge" && Player.ManaPercent() >= manae && Player.HealthPercent() <= hpe)
                    {
                        EH.Cast(Player);
                    }
                    break;

                case 2:
                    if (EC.Ready && Player.SpellBook.GetSpell(SpellSlot.E).Name == "Swipe" && ECougar.IsValidTarget(EC.Range))
                    {
                        EC.Cast(ECougar);
                    }
                    break;
                }
            }
            bool  useR   = Menu["combo"]["user"].Enabled;
            float rangeR = Menu["combo"]["userr"].As <MenuSlider>().Value;

            if (useR)
            {
                var RTarget = GetBestEnemyHeroTargetInRange(rangeR);
                switch (Menu["combo"]["ro"].As <MenuList>().Value)
                {
                case 0:
                    if (R.Ready && !QH.Ready && Player.SpellBook.GetSpell(SpellSlot.Q).Name == "JavelinToss" && RTarget.IsValidTarget(WC.Range))
                    {
                        R.Cast();
                    }
                    else if (R.Ready && !QC.Ready && Player.SpellBook.GetSpell(SpellSlot.Q).Name == "Takedown" && RTarget.IsValidTarget(QH.Range))
                    {
                        R.Cast();
                    }
                    else if (R.Ready && !RTarget.IsValidTarget(WCL.Range) && Player.SpellBook.GetSpell(SpellSlot.Q).Name != "JavelinToss")
                    {
                        R.Cast();
                    }
                    break;
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Generates a Hashtable with Hashtables with Hashtables: PassNumber:[TextureName:[AnimationName:[ArrayList FileNames]]]
        /// </summary>
        /// <param name="definition"></param>
        /// <param name="pathWithPrefix"></param>
        /// <returns></returns>
        public static Hashtable GenerateFileLists(string definition, string overridePath) //TODO: Node overrides - can override anything
        {
            //Looks first at the Texture node to see what the textures should be called and which FrameSets they contain
            //For each texture, it loops through the FrameSets.
            //If the FrameSet should be included in the current pass, add it to the texure, else ignore it.

            Node rootNode = Endogine.Node.FromTabbed(definition);

            string path = null;

            string[] allFilesnames = null;
            if (rootNode["Input.Files"] != null)
            {
                allFilesnames = new string[rootNode["Input.Files"].ChildNodes.Count];
                Node nodeX = rootNode["Input.Files"].FirstChild;
                for (int i = 0; i < rootNode["Input.Files"].ChildNodes.Count; i++)
                {
                    allFilesnames[i] = nodeX.Name;
                    nodeX            = nodeX.NextSibling;
                }
            }
            else
            {
                path = rootNode["Input.Path"].Text;
                if (overridePath != null)
                {
                    path = overridePath;
                }
                if (rootNode["Input.Search"] != null)
                {
                    path += rootNode["Input.Search"].Text;
                }
            }

            //string path = GetFullSearchPathFromDefinition(definition, overridePath);

            //this will contain all passes (passNumber:textureHashList)
            Hashtable passNumberToTexture = new Hashtable();

            bool usingPasses = false;

            #region Find all IDs and numbers used in Passes section
            int       highestPassNum = 1;
            Hashtable predefRanges   = null;                        //contains rangeId:range definition.
            //TODO: predefRanges is essentially useless! remove and replace with predefRangeIdToPassNumbers!
            Hashtable predefRangeIdToPassNumbers = null;            //contains rangeId:[pass numbers]
            ArrayList allPassNumbers             = new ArrayList(); //contains all numbers that occur in all the pass specifications

            Node passesNode = rootNode["Passes"];
            if (passesNode != null)
            {
                usingPasses  = true;
                predefRanges = new Hashtable();
                predefRangeIdToPassNumbers = new Hashtable();
                for (int i = 0; i < passesNode.ChildNodes.Count; i++)
                {
                    Node      n    = passesNode[i];
                    ArrayList nums = Endogine.Text.IntervalString.CreateArrayFromIntervalString(n.Text);
                    predefRanges.Add(n.Name, n.Text);
                    predefRangeIdToPassNumbers.Add(n.Name, nums);

                    foreach (int num in nums)
                    {
                        if (!allPassNumbers.Contains(num))
                        {
                            highestPassNum = num > highestPassNum ? num : highestPassNum;
                            allPassNumbers.Add(num);
                        }
                    }
                }
            }
            #endregion
            if (allPassNumbers.Count == 0)
            {
                allPassNumbers.Add(1);
            }

            Node texturesNode = rootNode["Textures"];
            Node framesNode   = rootNode["FrameSets"];

            //Are the number specified for each frameset the actual numbers in the regex "variables" (eg [10-45])
            //or just the order index (alphabetical sorting)
            bool bNumbersMeanOrder = false;
            if (allFilesnames != null)
            {
                bNumbersMeanOrder = true;
            }
            else if (rootNode["NumbersMeanOrder"] != null && rootNode["NumbersMeanOrder"].Text.ToLower() == "true")
            {
                bNumbersMeanOrder = true;
                allFilesnames     = Endogine.Files.FileFinder.GetNamesFromFiles(
                    Endogine.Files.FileFinder.GetFiles(path));
            }

            MatchCollection msVariableMatched = null;
            if (allFilesnames == null)
            {
                msVariableMatched = GetVariableMatchesInSearchPattern(path);
            }


            foreach (int passNum in allPassNumbers)
            {
                Hashtable textureNameToAnimations = new Hashtable();
                passNumberToTexture.Add(passNum, textureNameToAnimations);

                for (int texNum = 0; texNum < texturesNode.ChildNodes.Count; texNum++)
                {
                    //find which framesets to use for this texture:
                    Node     node          = texturesNode[texNum];
                    string[] frameSetNames = node.Text.Split(',');
                    if (frameSetNames[0] == "All")
                    {
                        frameSetNames = new string[framesNode.ChildNodes.Count];
                        for (int i = 0; i < framesNode.ChildNodes.Count; i++)
                        {
                            frameSetNames[i] = framesNode[i].Name;
                        }
                    }


                    Hashtable animationNameToFileLists = new Hashtable();

                    foreach (string frameSetName in frameSetNames)
                    {
                        string trimmedFrameSetName = frameSetName.Trim();
                        //TODO: rename range to pass!
                        string[] ranges = framesNode[trimmedFrameSetName].Text.Split('\t');

                        if (bNumbersMeanOrder)
                        {
                            string range = ranges[1];
                            if (range.EndsWith("-"))
                            {
                                range += allFilesnames.Length - 1;
                            }
                            ArrayList indices   = Endogine.Text.IntervalString.CreateArrayFromIntervalString(range);
                            string[]  filenames = new string[indices.Count];
                            for (int i = 0; i < indices.Count; i++)
                            {
                                filenames[i] = allFilesnames[(int)indices[i]];
                            }
                            animationNameToFileLists.Add(trimmedFrameSetName, filenames);
                            //animationNameToFileLists.Add(animationPrefix + trimmedFrameSetName, filenames);
                        }
                        else
                        {
                            //replace []'s in path with the ranges defined in the frameset:
                            //first is the pass, second is
                            string newPath             = path;
                            bool   includeThisFrameSet = true;
                            for (int i = 0; i < msVariableMatched.Count; i++)
                            {
                                //TODO: rename range to pass!
                                string find    = msVariableMatched[i].Value;
                                string range   = ranges[i];
                                string rangeID = range;
                                if (char.IsLetter(range, 0))
                                {
                                    range = (string)predefRanges[range];
                                }


                                //When doing passes, the first column is the one checked for pass numbers:
                                if (usingPasses && i == 0)
                                {
                                    //if pass is not included in the list, don't use in this pass
                                    if (char.IsLetter(range, 0))
                                    {
                                        if (!((ArrayList)predefRangeIdToPassNumbers[rangeID]).Contains(passNum))
                                        {
                                            includeThisFrameSet = false;
                                        }
                                    }
                                    else if (!Endogine.Text.IntervalString.CreateArrayFromIntervalString(range).Contains(passNum))
                                    {
                                        includeThisFrameSet = false;
                                    }

                                    if (!includeThisFrameSet)
                                    {
                                        break;
                                    }

                                    range = passNum.ToString();
                                }

                                //doesn't work with just one number, so make it number-number (13-13 instead of 13)
                                if (range.IndexOf("-") < 0 && range.IndexOf(",") < 0)
                                {
                                    range = range + "-" + range;
                                }
                                string replace = find.Insert(1, range);
                                newPath = Endogine.Text.StringHelpers.Replace(newPath, find, replace, 1);
                            }
                            if (!includeThisFrameSet)
                            {
                                continue;
                            }


                            //EH.Put("FS "+trimmedFrameSetName+" "+newPath);
                            string[] filenames = Endogine.Files.FileFinder.GetNamesFromFiles(
                                Endogine.Files.FileFinder.GetFiles(newPath));

                            if (filenames.Length == 0)
                            {
                                EH.Put("No files found for frameset " + trimmedFrameSetName);
                            }
                            else
                            {
                                string animationPrefix = "";
                                if (rootNode["AnimationPrefix"] != null)
                                {
                                    animationPrefix = rootNode["AnimationPrefix"].Text;
                                }
                                else
                                {
                                    //TODO: should be able to extract AnimationPrefix from newPath somehow...
                                    //First [] or [pad:X] is simply replaced with passNum, and at the next occurrence, remove the rest
                                    //NOPE: exacly what we DON'T want: then add .+ to find anything that starts with this
                                    //@@actor0[1-1]_portrait[1-10pad:4] -> actor01_portrait
                                    //@@actor0\w_isoview0[1-1]_[1-20pad:4] -> actor0\w_isoview01_
                                    //then look at the first found file that matches this:
                                    int indexStartFile = newPath.IndexOf("@@");
                                    animationPrefix = newPath.Remove(0, indexStartFile + 2);
                                    string          regexPattern   = Endogine.Files.FileFinder.GetRegexPatternForRanges();
                                    MatchCollection msRangeMatches = Regex.Matches(animationPrefix, regexPattern);
                                    if (msRangeMatches.Count > 0)
                                    {
                                        if (msRangeMatches.Count > 1)
                                        {
                                            animationPrefix = animationPrefix.Substring(0, msRangeMatches[1].Index);
                                        }
                                        //TODO: use my regex-like replacement. Now it doesn't care about padding.
                                        animationPrefix = Endogine.Text.StringHelpers.Replace(animationPrefix, msRangeMatches[0].Index, msRangeMatches[0].Length, passNum.ToString());
                                    }
                                    //now we have actor01_portrait.+
                                    Match m = Regex.Match(filenames[0], animationPrefix);
                                    if (m.Success)
                                    {
                                        animationPrefix = m.Value;
                                    }
                                }

                                //if (usingPasses) //the animation names should not be the same for the different passes - name after pass number
                                //	animationPrefix+=passNum.ToString().PadLeft(highestPassNum.ToString().Length, '0');
                                animationNameToFileLists.Add(animationPrefix + trimmedFrameSetName, filenames);
                            }
                        }
                    }

                    if (animationNameToFileLists.Count > 0)
                    {
                        textureNameToAnimations.Add(node.Name, animationNameToFileLists);
                    }
                    else
                    {
                        EH.Put("No files found for texture node " + node.Name);
                    }
                }
            }
            return(passNumberToTexture);
        }