Esempio n. 1
0
        public static ScriptBlock[] FromBlock(TI.IBlock block)
        {
            TI.IElementArray ea    = block.GetElements();
            ScriptBlock[]    value = new ScriptBlock[ea.Count];

            hs_scripts_block hs;

            for (int x = 0; x < value.Length; x++)
            {
                hs = (hs_scripts_block)ea.GetElement(x);
                var v = value[x] = new ScriptBlock();

                v.Name       = hs.Name.ToString();
                v.ScriptType = (short)hs.ScriptType.Value;
                v.ReturnType = (short)hs.ReturnType.Value;
                Blam.DatumIndex index = hs.RootExpressionIndex.Value;
                v.NodeOffset = index.Index;

                if (v.Name == TagInterface.StringId.kEncryptedResult)
                {
                    v.Name = (hs.Name as TagInterface.StringId).Handle.ToUInt32().ToString("X8");
                }
            }

            return(value);
        }
Esempio n. 2
0
        public static GlobalsBlock[] FromBlock(TI.IBlock block)
        {
            TI.IElementArray ea    = block.GetElements();
            GlobalsBlock[]   value = new GlobalsBlock[ea.Count];

            hs_globals_block hs;

            for (int x = 0; x < value.Length; x++)
            {
                hs = (hs_globals_block)ea.GetElement(x);
                var v = value[x] = new GlobalsBlock();

                v.Name = hs.Name.Value;
                v.Type = (short)hs.Type.Value;
                Blam.DatumIndex index = hs.InitExpressionIndex.Value;
                v.NodeOffset = index.Index;

                // We have to dynamically caluclate the node counts as
                // some globals are set at runtime, ie '(* 20 seconds)'
                v.NodeCount = -1;
            }

            return(value);
        }