Exemple #1
0
        // Perform a late bound call.
        public static Object CallByName
            (Object ObjectRef, String ProcName,
            CallType UseCallType, Object[] Args)
        {
            switch (UseCallType)
            {
            case CallType.Method:
            {
                return(LateBinding.LateCallWithResult
                           (ObjectRef, null, ProcName, Args, null, null));
            }
            // Not reached.

            case CallType.Get:
            {
                return(LateBinding.LateGet
                           (ObjectRef, null, ProcName, Args, null, null));
            }
            // Not reached.

            case CallType.Set:
            case CallType.Let:
            {
                LateBinding.LateSet
                    (ObjectRef, null, ProcName, Args, null);
                return(null);
            }
                // Not reached.
            }
            throw new ArgumentException(S._("VB_InvalidCallType"));
        }
        private void MenuItem7_Click(object sender, EventArgs e)
        {
            IEnumerator enumerator = null;

            Transition.Transition transition      = new Transition.Transition();
            TransitionTable       transitionTable = new TransitionTable();

            if (this.Select_Group_A != null)
            {
                if (this.Select_Group_B != null)
                {
                    if (ObjectType.ObjTst(LateBinding.LateGet(this.Select_Group_A.SelectedItem, null, "Name", new object[0], null, null), LateBinding.LateGet(this.Select_Group_B.SelectedItem, null, "Name", new object[0], null, null), false) != 0)
                    {
                        #region Label Formatting

                        //Edit The '↔' To Change How You Want Your Labels To Look
                        //Original 'To' Was The Transition Keyword For The Labels
                        //This Keyword Was Changed To Arrows To Show The Back And Forth Between Transitions
                        string str = string.Format("{0} ↔ {1}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.Select_Group_A.SelectedItem, null, "Name", new object[0], null, null)), RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.Select_Group_B.SelectedItem, null, "Name", new object[0], null, null)));

                        #endregion

                        string      str1        = string.Format("{0}Data\\Engine\\Templates\\2Way_Template.xml", AppDomain.CurrentDomain.BaseDirectory);
                        XmlDocument xmlDocument = new XmlDocument();
                        transitionTable.Clear();
                        try
                        {
                            xmlDocument.Load(str1);
                            try
                            {
                                enumerator = xmlDocument.SelectNodes("//Wizard/Tile").GetEnumerator();
                                while (enumerator.MoveNext())
                                {
                                    XmlElement            current     = (XmlElement)enumerator.Current;
                                    string                attribute   = current.GetAttribute("Pattern");
                                    string                attribute1  = current.GetAttribute("MapTile");
                                    string                attribute2  = current.GetAttribute("StaticTile");
                                    Transition.Transition transition1 = new Transition.Transition(str, attribute, (ClsTerrain)this.Select_Group_A.SelectedItem, (ClsTerrain)this.Select_Group_B.SelectedItem, this.Get_MapTiles(attribute1), this.Get_StaticTiles(attribute2));
                                    transitionTable.Add(transition1);
                                }
                            }
                            finally
                            {
                                if (enumerator is IDisposable)
                                {
                                    ((IDisposable)enumerator).Dispose();
                                }
                            }
                        }
                        catch (Exception exception)
                        {
                            ProjectData.SetProjectError(exception);
                            Interaction.MsgBox(exception.ToString(), MsgBoxStyle.OkOnly, null);
                            ProjectData.ClearProjectError();
                        }
                        transitionTable.Save(string.Format("{0}.xml", str));
                    }
                }
            }
        }
        //Save
        private void MenuItem7_Click(object sender, EventArgs e)
        {
            IEnumerator enumerator = null;

            Transition.Transition transition      = new Transition.Transition();
            TransitionTable       transitionTable = new TransitionTable();

            if (this.Select_Group_A != null)
            {
                if (this.Select_Group_B != null)
                {
                    if (ObjectType.ObjTst(LateBinding.LateGet(this.Select_Group_A.SelectedItem, null, "Name", new object[0], null, null), LateBinding.LateGet(this.Select_Group_B.SelectedItem, null, "Name", new object[0], null, null), false) != 0)
                    {
                        string      str         = string.Format("{0} To {1}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.Select_Group_A.SelectedItem, null, "Name", new object[0], null, null)), RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.Select_Group_B.SelectedItem, null, "Name", new object[0], null, null)));
                        string      str1        = string.Format("{0}Data\\System\\2Way_Template.xml", AppDomain.CurrentDomain.BaseDirectory);
                        XmlDocument xmlDocument = new XmlDocument();
                        transitionTable.Clear();
                        try
                        {
                            xmlDocument.Load(str1);
                            try
                            {
                                enumerator = xmlDocument.SelectNodes("//Wizard/Tile").GetEnumerator();
                                while (enumerator.MoveNext())
                                {
                                    XmlElement            current     = (XmlElement)enumerator.Current;
                                    string                attribute   = current.GetAttribute("Pattern");
                                    string                attribute1  = current.GetAttribute("MapTile");
                                    string                attribute2  = current.GetAttribute("StaticTile");
                                    Transition.Transition transition1 = new Transition.Transition(str, attribute, (ClsTerrain)this.Select_Group_A.SelectedItem, (ClsTerrain)this.Select_Group_B.SelectedItem, this.Get_MapTiles(attribute1), this.Get_StaticTiles(attribute2));
                                    transitionTable.Add(transition1);
                                }
                            }
                            finally
                            {
                                if (enumerator is IDisposable)
                                {
                                    ((IDisposable)enumerator).Dispose();
                                }
                            }
                        }
                        catch (Exception exception)
                        {
                            ProjectData.SetProjectError(exception);
                            Interaction.MsgBox(exception.ToString(), MsgBoxStyle.OkOnly, null);
                            ProjectData.ClearProjectError();
                        }
                        transitionTable.Save(string.Format("{0}.xml", str));
                    }
                }
            }
        }
        public static object CallByName(object ObjectRef, string ProcName, CallType UseCallType, params object[] Args)
        {
            switch (UseCallType)
            {
            case CallType.Method:
                return(LateBinding.InternalLateCall(ObjectRef, null, ProcName, Args, null, null, false));

            case CallType.Get:
                return(LateBinding.LateGet(ObjectRef, null, ProcName, Args, null, null));

            case CallType.Let:
            case CallType.Set:
            {
                System.Type objType = null;
                LateBinding.InternalLateSet(ObjectRef, ref objType, ProcName, Args, null, false, UseCallType);
                return(null);
            }
            }
            throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue1", new string[] { "CallType" }));
        }
Exemple #5
0
        private void Button1_Click(object sender, EventArgs e)
        {
            string text = this.SelectGroupName.Text;

            if (StringType.StrCmp(text, "Select Group A", false) == 0)
            {
                CreateTransitions tedit = (CreateTransitions)this.Tag;
                tedit.Selected_Terrain_A = (ClsTerrain)this.SelectGroup.SelectedItem;
                tedit.MenuTerrainA.Text  = string.Format("Select Terrain A - {0}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.SelectGroup.SelectedItem, (Type)null, "Name", new object[0], (string[])null, (bool[])null)));
            }
            else if (StringType.StrCmp(text, "Select Group B", false) == 0)
            {
                CreateTransitions tedit = (CreateTransitions)this.Tag;
                tedit.Selected_Terrain_B = (ClsTerrain)this.SelectGroup.SelectedItem;
                tedit.MenuTerrainB.Text  = string.Format("Select Terrain B - {0}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.SelectGroup.SelectedItem, (Type)null, "Name", new object[0], (string[])null, (bool[])null)));
            }
            else if (StringType.StrCmp(text, "Select Group C", false) == 0)
            {
                CreateTransitions tedit = (CreateTransitions)this.Tag;
                tedit.Selected_Terrain_C = (ClsTerrain)this.SelectGroup.SelectedItem;
                tedit.MenuTerrainC.Text  = string.Format("Select Terrain C - {0}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.SelectGroup.SelectedItem, (Type)null, "Name", new object[0], (string[])null, (bool[])null)));
            }
            else if (StringType.StrCmp(text, "Clone Group A", false) == 0)
            {
                CreateTransitions tedit = (CreateTransitions)this.Tag;
                tedit.Selected_Terrain_A    = (ClsTerrain)this.SelectGroup.SelectedItem;
                tedit.Menu_CloneGroupA.Text = string.Format("Select Terrain A - {0}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.SelectGroup.SelectedItem, (Type)null, "Name", new object[0], (string[])null, (bool[])null)));
            }
            else if (StringType.StrCmp(text, "Clone Group B", false) == 0)
            {
                CreateTransitions tedit = (CreateTransitions)this.Tag;
                tedit.Selected_Terrain_B    = (ClsTerrain)this.SelectGroup.SelectedItem;
                tedit.Menu_CloneGroupB.Text = string.Format("Select Terrain B - {0}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.SelectGroup.SelectedItem, (Type)null, "Name", new object[0], (string[])null, (bool[])null)));
            }
            this.Close();
        }
Exemple #6
0
 public void LateGet(object obj, Type objType, string name, object[] args, string[] paramNames, bool[] copyBack, object expected)
 {
     Assert.Equal(expected, LateBinding.LateGet(obj, objType, name, args, paramNames, copyBack));
 }
        private void Button1_Click(object sender, EventArgs e)
        {
            string text = this.SelectGroupName.Text;

            if (StringType.StrCmp(text, "Select Group A", false) == 0)
            {
                TEdit tag = (TEdit)this.Tag;
                tag.Selected_Terrain_A = (ClsTerrain)this.SelectGroup.SelectedItem;
                tag.MenuTerrainA.Text  = string.Format("Select Terrain A - {0}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.SelectGroup.SelectedItem, null, "Name", new object[0], null, null)));
                tag = null;
            }
            else if (StringType.StrCmp(text, "Select Group B", false) == 0)
            {
                TEdit selectedItem = (TEdit)this.Tag;
                selectedItem.Selected_Terrain_B = (ClsTerrain)this.SelectGroup.SelectedItem;
                selectedItem.MenuTerrainB.Text  = string.Format("Select Terrain B - {0}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.SelectGroup.SelectedItem, null, "Name", new object[0], null, null)));
                selectedItem = null;
            }
            else if (StringType.StrCmp(text, "Select Group C", false) == 0)
            {
                TEdit tEdit = (TEdit)this.Tag;
                tEdit.Selected_Terrain_C = (ClsTerrain)this.SelectGroup.SelectedItem;
                tEdit.MenuTerrainC.Text  = string.Format("Select Terrain C - {0}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.SelectGroup.SelectedItem, null, "Name", new object[0], null, null)));
                tEdit = null;
            }
            else if (StringType.StrCmp(text, "Clone Group A", false) == 0)
            {
                TEdit tag1 = (TEdit)this.Tag;
                tag1.Selected_Terrain_A    = (ClsTerrain)this.SelectGroup.SelectedItem;
                tag1.Menu_CloneGroupA.Text = string.Format("Select Terrain A - {0}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.SelectGroup.SelectedItem, null, "Name", new object[0], null, null)));
                tag1 = null;
            }
            else if (StringType.StrCmp(text, "Clone Group B", false) == 0)
            {
                TEdit selectedItem1 = (TEdit)this.Tag;
                selectedItem1.Selected_Terrain_B    = (ClsTerrain)this.SelectGroup.SelectedItem;
                selectedItem1.Menu_CloneGroupB.Text = string.Format("Select Terrain B - {0}", RuntimeHelpers.GetObjectValue(LateBinding.LateGet(this.SelectGroup.SelectedItem, null, "Name", new object[0], null, null)));
                selectedItem1 = null;
            }
            this.Close();
        }
Exemple #8
0
        public static object LateGet(object Instance, Type Type, string MemberName, object[] Arguments, string[] ArgumentNames, Type[] TypeArguments, bool[] CopyBack)
        {
            if (Arguments == null)
            {
                Arguments = Symbols.NoArguments;
            }
            if (ArgumentNames == null)
            {
                ArgumentNames = Symbols.NoArgumentNames;
            }
            if (TypeArguments == null)
            {
                TypeArguments = Symbols.NoTypeArguments;
            }
            Symbols.Container BaseReference = Type == null ? new Symbols.Container(Instance) : new Symbols.Container(Type);
            BindingFlags      bindingFlags  = BindingFlags.InvokeMethod | BindingFlags.GetProperty;

            if (BaseReference.IsCOMObject)
            {
                return(LateBinding.LateGet(Instance, Type, MemberName, Arguments, ArgumentNames, CopyBack));
            }
            MemberInfo[] members = BaseReference.GetMembers(ref MemberName, true);
            if (members[0].MemberType == MemberTypes.Field)
            {
                if (TypeArguments.Length > 0)
                {
                    throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue"));
                }
                object fieldValue = BaseReference.GetFieldValue((FieldInfo)members[0]);
                if (Arguments.Length == 0)
                {
                    return(fieldValue);
                }
                return(NewLateBinding.LateIndexGet(fieldValue, Arguments, ArgumentNames));
            }
            if (ArgumentNames.Length > Arguments.Length || CopyBack != null && CopyBack.Length != Arguments.Length)
            {
                throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue"));
            }
            OverloadResolution.ResolutionFailure Failure = OverloadResolution.ResolutionFailure.None;
            Symbols.Method TargetProcedure1 = NewLateBinding.ResolveCall(BaseReference, MemberName, members, Arguments, ArgumentNames, TypeArguments, bindingFlags, false, ref Failure);
            if (Failure == OverloadResolution.ResolutionFailure.None)
            {
                return(BaseReference.InvokeMethod(TargetProcedure1, Arguments, CopyBack, bindingFlags));
            }
            if (Arguments.Length > 0)
            {
                Symbols.Method TargetProcedure2 = NewLateBinding.ResolveCall(BaseReference, MemberName, members, Symbols.NoArguments, Symbols.NoArgumentNames, TypeArguments, bindingFlags, false, ref Failure);
                if (Failure == OverloadResolution.ResolutionFailure.None)
                {
                    object Instance1 = BaseReference.InvokeMethod(TargetProcedure2, Symbols.NoArguments, (bool[])null, bindingFlags);
                    if (Instance1 == null)
                    {
                        throw new MissingMemberException(Utils.GetResourceString("IntermediateLateBoundNothingResult1", TargetProcedure2.ToString(), BaseReference.VBFriendlyName));
                    }
                    object obj = NewLateBinding.InternalLateIndexGet(Instance1, Arguments, ArgumentNames, false, ref Failure);
                    if (Failure == OverloadResolution.ResolutionFailure.None)
                    {
                        return(obj);
                    }
                }
            }
            NewLateBinding.ResolveCall(BaseReference, MemberName, members, Arguments, ArgumentNames, TypeArguments, bindingFlags, true, ref Failure);
            throw new InternalErrorException();
        }