예제 #1
0
 public TestClass()
 {
     _objectDictionary.Add(10, new MyData {
         a = 11, b = 12
     });
     _objectDictionary.Add(20, new MyData {
         a = 21, b = 22
     });
 }
예제 #2
0
        private IEnumerable <SettingsProperty> GetSettingsProperties(object baseObject, Type type, SettingsPropertyName path, PropertyInfo basePropInfo, object context)
        {
            if (Reflector.HasParameterLessDefaultConstructor(type))
            {
                object obj = Activator.CreateInstance(type);
                ObjDict.Add(path, context, obj);

                if (baseObject != null)
                {
                    basePropInfo.SetValue(baseObject, obj);
                }

                foreach (var tuple in Reflector.GetNameAndType(type))
                {
                    if (Reflector.IsSimpleType(tuple.Item2))
                    {
                        yield return(new SettingsProperty(path + tuple.Item1, tuple.Item2, null)
                        {
                            InternalContext = new Dictionary <string, object>
                            {
                                { "__SettAccessor", tuple.Item3 },
                            }
                        });
                    }
                    else
                    {
                        foreach (var settingsProperty in GetSettingsProperties(obj, tuple.Item2, path + tuple.Item1, tuple.Item3, context))
                        {
                            yield return(settingsProperty);
                        }
                    }
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Lit la liste des objets du jeu
        /// </summary>
        private static void ReadObjectList()
        {
            var currentObject = new PObject(FirstObject);

            //var currentObject = FirstObject;
            //var nextObject = FirstObject;

            while (currentObject.BaseAddress != uint.MinValue && currentObject.BaseAddress % 2 == uint.MinValue)
            {
                if (currentObject.GUID == LocalGUID)
                {
                    MyPlayer.BaseAddress = currentObject.BaseAddress;
                }

                if (!ObjectDictionary.ContainsKey(currentObject.GUID))
                {
                    PObject obj = null;
                    // Add the object based on it's *actual* type. Note: WoW's Object descriptors for OBJECT_FIELD_TYPE
                    // is a bitmask. We want to use the type at 0x14, as it's an 'absolute' type.

                    /* switch (currentObject.Type)
                     * {
                     *  // Belive it or not, the base Object class is hardly used in WoW.
                     *  case (int)Constants.ObjectType.Object:
                     *      obj = new PObject(currentObject.BaseAddress);
                     *      break;
                     *  case (int)Constants.ObjectType.Unit:
                     *      obj = new PUnit(currentObject.BaseAddress);
                     *      break;
                     *  case (int)Constants.ObjectType.Player:
                     *      obj = new PPlayer(currentObject.BaseAddress);
                     *      break;
                     *  case (int)Constants.ObjectType.GameObject:
                     *      obj = new PGameObject(currentObject.BaseAddress);
                     *      break;
                     *  case (int)Constants.ObjectType.Item:
                     *      obj = new PItem(currentObject.BaseAddress);
                     *      break;
                     *  case (int)Constants.ObjectType.Container:
                     *      obj = new PContainer(currentObject.BaseAddress);
                     *      break;
                     *  // These two aren't used in most bots, as they're fairly pointless.
                     *  // They are AI and area triggers for NPCs handled by the client itself.
                     *  case (int)Constants.ObjectType.AiGroup:
                     *  case (int)Constants.ObjectType.AreaTrigger:
                     *      break;
                     * } */
                    if (obj != null)
                    {
                        ObjectDictionary.Add(currentObject.GUID, obj);
                    }
                }
                else
                {
                    ObjectDictionary[currentObject.GUID].BaseAddress = currentObject.BaseAddress;
                }

                currentObject.BaseAddress = Wow.ReadUInt(currentObject.BaseAddress + (uint)Common.Offsets.ObjectManager.NextObject);
            }
        }
예제 #4
0
        public void SetProjectManagerGroupAssociationsAsync(object context, EventHandler <SetProjectManagerGroupAssociationsCompletedEventArgs> action, GlymaSecurableObject securableObject)
        {
            var guid = Guid.NewGuid();

            ObjectDictionary.Add(guid, context);
            SetProjectManagerGroupAssociationsCompletedEventHandlers.Add(guid, action);
            Client.SetProjectManagerGroupAssociationsAsync(App.Params.SiteUrl, securableObject, guid);
        }
예제 #5
0
        public void UpdateSecurityAssociationsAsync(object context, EventHandler <UpdateSecurityAssociationsCompletedEventArgs> action, ObservableCollection <GlymaSecurityAssociation> updateQueries)
        {
            var guid = Guid.NewGuid();

            ObjectDictionary.Add(guid, context);
            UpdateSecurityAssociationsCompletedEventHandlers.Add(guid, action);
            Client.UpdateSecurityAssociationsAsync(App.Params.SiteUrl, updateQueries, guid);
        }
예제 #6
0
        public void GetAllSecurityGroupsAsync(object context, EventHandler <GetAllSecurityGroupsCompletedEventArgs> action)
        {
            var guid = Guid.NewGuid();

            ObjectDictionary.Add(guid, context);
            GetAllSecurityGroupsCompletedEventHandlers.Add(guid, action);
            Client.GetAllSecurityGroupsAsync(App.Params.SiteUrl, guid);
        }
예제 #7
0
        public void GetSecurityAssociationsAsync(object context, EventHandler <GetSecurityAssociationsCompletedEventArgs> action, ObservableCollection <GlymaSecurityGroup> groups, GlymaSecurableObject securableObject)
        {
            var guid = Guid.NewGuid();

            ObjectDictionary.Add(guid, context);
            GetSecurityAssociationsCompletedEventHandlers.Add(guid, action);
            Client.GetSecurityAssociationsAsync(App.Params.SiteUrl, groups, securableObject, guid);
        }
예제 #8
0
        public void GetPermissionNameForObjectAsync(object context, EventHandler <GetPermissionNameForObjectCompletedEventArgs> action, GlymaSecurableObject securableObject)
        {
            var guid = Guid.NewGuid();

            ObjectDictionary.Add(guid, context);
            GetPermissionNameForObjectCompletedEventHandlers.Add(guid, action);
            Client.GetPermissionNameForObjectAsync(App.Params.SiteUrl, securableObject, guid);
        }
예제 #9
0
        public void GetUsersPermissionLevelNameAsync(object context, EventHandler <GetUsersPermissionLevelNameCompletedEventArgs> action)
        {
            var guid = Guid.NewGuid();

            ObjectDictionary.Add(guid, context);
            GetUsersPermissionLevelNameCompletedEventHandlers.Add(guid, action);
            Client.GetUsersPermissionLevelNameAsync(App.Params.SiteUrl, guid);
        }
예제 #10
0
        public void Basic()
        {
            var dictionary = new ObjectDictionary();

            Assert.Throws <KeyNotFoundException>(() => dictionary.Get <string>("test"));
            Assert.Null(dictionary.Get <string>("test", null));
            Assert.Equal("default", dictionary.Get <string>("test", "default"));

            dictionary.Add("test-bool", true);
            Assert.True(dictionary.Get <bool>("test-bool"));
            Assert.Throws <InvalidCastException>(() => dictionary.Get <string>("test-bool"));
            Assert.True(dictionary.Get <bool>("does-not-exist", true));
            Assert.False(dictionary.Get <bool>("does-not-exist", false));

            dictionary.Add("test-int", 1234);
            Assert.Equal(1234, dictionary.Get <int>("test-int"));
            Assert.Throws <InvalidCastException>(() => dictionary.Get <string>("test-bool"));
            Assert.Equal(1234, dictionary.Get <int>("does-not-exist", 1234));
        }
예제 #11
0
        public void RestoreRootMapInheritanceAsync(object context, EventHandler <RestoreRootMapInheritanceCompletedEventArgs> action, Guid parentGuid, Guid objectGuid)
        {
            var guid = Guid.NewGuid();

            ObjectDictionary.Add(guid, context);
            RestoreRootMapInheritanceCompletedEventHandlers.Add(guid, action);
            Client.RestoreRootMapInheritanceAsync(App.Params.SiteUrl, new GlymaSecurableObject {
                SecurableParentUid = parentGuid, SecurableObjectUid = objectGuid
            }, guid);
        }
예제 #12
0
파일: CallFrame.cs 프로젝트: jdruin/F5Eagle
        ///////////////////////////////////////////////////////////////////////

        public bool SetMark(
            bool mark,
            string name,
            object value
            )
        {
            CheckDisposed();

            //
            // NOTE: Null and/or empty string tag names are not allowed.
            //
            if (!String.IsNullOrEmpty(name))
            {
                if (tags != null)
                {
                    if (mark && !tags.ContainsKey(name))
                    {
                        //
                        // NOTE: Try to add the tag.
                        //
                        tags.Add(name, value);

                        //
                        // NOTE: Yes, we added the tag.
                        //
                        return(true);
                    }
                    else if (!mark && tags.ContainsKey(name))
                    {
                        //
                        // NOTE: Try to remove the tag.
                        //
                        tags.Remove(name);

                        //
                        // NOTE: Yes, we removed the tag.
                        //
                        return(true);
                    }
                }
            }

            //
            // NOTE: For whatever reason, we did not add/remove the tag.
            //
            return(false);
        }
예제 #13
0
        private static void ReadObjectList()
        {
            var currentObject = new PObject(Memory.Read <uint>(CurrentManager + (uint)Pointers.ObjectManager.FirstObject));

            LocalGUID = Memory.Read <UInt64>(CurrentManager + (uint)Pointers.ObjectManager.LocalGUID);
            while (currentObject.BaseAddress != UInt32.MinValue &&
                   currentObject.BaseAddress % 2 == UInt32.MinValue)
            {
                // Keep the static reference to the local player updated... at all times.
                if (currentObject.GUID == LocalGUID)
                {
                    //MessageBox.Show("Found localplayer! 0x" + currentObject.ToString("X8"));
                    MyPlayer.UpdateBaseAddress(currentObject.BaseAddress);
                }
                if (!ObjectDictionary.ContainsKey(currentObject.GUID))
                {
                    PObject obj = null;
                    // Add the object based on it's *actual* type. Note: WoW's Object descriptors for OBJECT_FIELD_TYPE
                    // is a bitmask. We want to use the type at 0x14, as it's an 'absolute' type.
                    switch (currentObject.Type)
                    {
                    // Belive it or not, the base Object class is hardly used in WoW.
                    case (int)Constants.ObjectType.Object:
                        obj = new PObject(currentObject.BaseAddress);
                        break;

                    case (int)Constants.ObjectType.Unit:
                        obj = new PUnit(currentObject.BaseAddress);
                        break;

                    case (int)Constants.ObjectType.Player:
                        obj = new PPlayer(currentObject.BaseAddress);
                        break;

                    case (int)Constants.ObjectType.GameObject:
                        obj = new PGameObject(currentObject.BaseAddress);
                        break;

                    case (int)Constants.ObjectType.Item:
                        obj = new PItem(currentObject.BaseAddress);
                        break;

                    case (int)Constants.ObjectType.Container:
                        obj = new PContainer(currentObject.BaseAddress);
                        break;

                    // These two aren't used in most bots, as they're fairly pointless.
                    // They are AI and area triggers for NPCs handled by the client itself.
                    case (int)Constants.ObjectType.AiGroup:
                    case (int)Constants.ObjectType.AreaTrigger:
                        break;
                    }
                    if (obj != null)
                    {
                        // We have a valid object that isn't in the object list already.
                        // So lets add it.
                        ObjectDictionary.Add(currentObject.GUID, obj);
                    }
                }
                else
                {
                    // The object already exists, just update the pointer.
                    ObjectDictionary[currentObject.GUID].UpdateBaseAddress(currentObject.BaseAddress);
                }
                // We need the next object.
                currentObject.BaseAddress =
                    Memory.Read <uint>(currentObject.BaseAddress + (uint)Pointers.ObjectManager.NextObject);
            }
        }
예제 #14
0
파일: Namespace.cs 프로젝트: jdruin/F5Eagle
        ///////////////////////////////////////////////////////////////////////

        public ReturnCode AddImport(
            INamespace targetNamespace,
            string qualifiedImportName,
            string qualifiedExportName,
            ref Result error
            )
        {
            CheckDisposed();

            if (qualifiedImportName == null)
            {
                error = "invalid import name";
                return(ReturnCode.Error);
            }

            if (qualifiedExportName == null)
            {
                error = "invalid export name";
                return(ReturnCode.Error);
            }

            if (interpreter == null)
            {
                error = "invalid interpreter";
                return(ReturnCode.Error);
            }

            if (imports == null)
            {
                error = String.Format(
                    "imports not available in namespace \"{0}\"",
                    GetDisplayName());

                return(ReturnCode.Error);
            }

            IAlias alias       = null;
            Result localResult = null;

            if (interpreter.AddAlias(
                    qualifiedImportName, CommandFlags.None,
                    AliasFlags.NamespaceImport, _Public.ClientData.Empty,
                    interpreter, null, new ArgumentList(qualifiedExportName),
                    null, 0, ref alias, ref localResult) == ReturnCode.Ok)
            {
                alias.SourceNamespace = this;
                alias.TargetNamespace = targetNamespace;
            }
            else
            {
                error = localResult;
                return(ReturnCode.Error);
            }

            string nameToken = alias.NameToken;

            if (nameToken == null)
            {
                //
                // NOTE: This should not happen as the alias was successfully
                //       added to the interpreter and the name token cannot be
                //       null in that case.
                //
                error = "invalid alias name";
                return(ReturnCode.Error);
            }

            if (imports.ContainsKey(qualifiedImportName))
            {
                Result     localError = null;
                ResultList errors     = new ResultList();

                errors.Add(String.Format(
                               "can't add import \"{0}\" in \"{1}\": already exists",
                               nameToken, GetDisplayName()));

                if (interpreter.RemoveAliasAndCommand(
                        nameToken, null, false,
                        ref localError) != ReturnCode.Ok)
                {
                    errors.Add(localError);
                }

                error = errors;
                return(ReturnCode.Error);
            }

            imports.Add(qualifiedImportName, alias);
            return(ReturnCode.Ok);
        }
예제 #15
0
        static void Main(string[] args)
        {
            ObjectDictionary objectDictionary = new ObjectDictionary();


            int intX = 12;
            int intY = 12;


            bool on = true;

            Object objectPoint = new Object();

            objectPoint.intIndex = 1;


            objectPoint.arrayApearance.Add(new PairOrdenated(0, 0), 10);


            //objectPoint.arrayApearance.Add(new PairOrdenated(-1, 0), 0);
            //objectPoint.arrayApearance.Add(new PairOrdenated(1, 0), 0);
            //objectPoint.arrayApearance.Add(new PairOrdenated(0, -1), 0);
            //objectPoint.arrayApearance.Add(new PairOrdenated(0, 1), 0);
            objectPoint.arrayColisionMesh = new PairOrdenated[] { new PairOrdenated(0, 0) };
            objectPoint.pairPosition      = new PairOrdenated(2, 2);


            int intSpeedX = 1;
            int intSpeedY = 1;

            Object objectWall = new Object();

            //Pontos para fazer o array Wall
            objectWall.arrayApearance.Add(new PairOrdenated(0, 0), 12); // Cor (Vermelho)
            objectWall.arrayApearance.Add(new PairOrdenated(0, 1), 15); // Cor (Branco)
            objectWall.arrayApearance.Add(new PairOrdenated(0, 2), 12); // Cor (Vermelho)

            objectWall.arrayColisionMesh = new PairOrdenated[] { new PairOrdenated(0, 0), new PairOrdenated(0, 1), new PairOrdenated(0, 2) };

            // Fim desses pontos

            objectWall.intIndex     = 2;
            objectWall.pairPosition = new PairOrdenated(5, 5);

            int origX = Console.CursorTop;
            int origY = Console.CursorLeft;

            objectDictionary.Add(objectDictionary, objectWall);
            objectDictionary.Add(objectDictionary, objectPoint);


            while (on)
            {
                Console.CursorVisible = false;

                objectPoint.pairSpeed.intX = 0;
                objectPoint.pairSpeed.intY = 0;

                if (Console.KeyAvailable == true)
                {
                    ConsoleKeyInfo keyPressed = Console.ReadKey(true);

                    if (keyPressed.Key == ConsoleKey.S)
                    {
                        objectPoint.pairSpeed.intY = 1 * intSpeedY;
                        objectPoint.pairSpeed.intX = 0;
                    }

                    else if (keyPressed.Key == ConsoleKey.W)
                    {
                        objectPoint.pairSpeed.intY = -1 * intSpeedY;
                        objectPoint.pairSpeed.intX = 0;
                    }
                    else if (keyPressed.Key == ConsoleKey.D)
                    {
                        objectPoint.pairSpeed.intX = 1 * intSpeedX;
                        objectPoint.pairSpeed.intY = 0;
                    }
                    else if (keyPressed.Key == ConsoleKey.A)
                    {
                        objectPoint.pairSpeed.intX = -1 * intSpeedX;
                        objectPoint.pairSpeed.intY = 0;
                    }
                } // Ler o teclado

                Object.Transform(objectPoint, objectWall);


                ImageBuffer imageBuffer = new ImageBuffer();
                imageBuffer.ImageBuffering(imageBuffer, objectDictionary);
                imageBuffer.ConsoleImageProjector(imageBuffer);


                Console.SetCursorPosition(origX + intX, origY + intY);
                Console.BackgroundColor = ConsoleColor.Black;

                Console.WriteLine();
                Console.Write($"X: {objectPoint.pairPosition.intX} Y: {objectPoint.pairPosition.intY}");
                Console.Write($"Speed: X= {objectPoint.pairSpeed.intX} Y= {objectPoint.pairSpeed.intY}");
                Console.WriteLine();
            }
        }
예제 #16
0
        private static void ReadObjectList()
        {
            var localPlayerGuid =
                Memory.ReadAtOffset <ulong>(CurrentManager, (uint)Offsets.ObjectManager.LocalGUID);
            var current =
                Memory.ReadAtOffset <IntPtr>(CurrentManager, (uint)Offsets.ObjectManager.FirstObject);

            if (current == IntPtr.Zero || ((uint)current & 1) == 1)
            {
                Reset(WowProcess);
                return;
            }

            while (current != IntPtr.Zero && ((uint)current & 1) != 1)
            {
                var guid = WowObject.GetStorageField <ulong>(current,
                                                             (uint)Descriptors.WowObjectFields.OBJECT_FIELD_GUID);

                if (!ObjectDictionary.ContainsKey(guid))
                {
                    var oType =
                        (Offsets.ObjectType)Memory.ReadAtOffset <uint>(current, (uint)Offsets.ObjectManager.ObjectType);

                    WowObject wowObject = null;

                    switch (oType)
                    {
                    case Offsets.ObjectType.GameObject:
                        wowObject = new WowGameObject(current);
                        break;

                    case Offsets.ObjectType.Object:
                        wowObject = new WowObject(current);
                        break;

                    case Offsets.ObjectType.Player:
                        wowObject = new WowPlayer(current);
                        break;

                    case Offsets.ObjectType.Unit:
                        wowObject = new WowUnit(current);
                        break;

                    default:
                        break;
                    }

                    if (wowObject != null)
                    {
                        ObjectDictionary.Add(guid, wowObject);
                    }
                }
                else
                {
                    ObjectDictionary[guid].BaseAddress = current;
                }

                //  Keep the local player's GUID up-to-date
                if (localPlayerGuid == guid)
                {
                    Me.BaseAddress = current;
                }

                current = Memory.ReadAtOffset <IntPtr>(current, (uint)Offsets.ObjectManager.NextObject);
            }
        }