private TextManipulation(int start, int end, string text, ManipulationType type)
 {
     Start = start;
     End   = end;
     Text  = text;
     Type  = type;
 }
示例#2
0
        private bool IsOnChronometer(Metadata metadata, PointF point, long currentTimestamp)
        {
            bool isOnDrawing = false;

            foreach (AbstractDrawing drawing in metadata.ChronoManager.Drawings)
            {
                int hitResult = drawing.HitTest(point, currentTimestamp, metadata.CalibrationHelper.DistortionHelper, metadata.CoordinateSystem, metadata.CoordinateSystem.Zooming);
                if (hitResult < 0)
                {
                    continue;
                }

                isOnDrawing        = true;
                selectedObjectType = SelectedObjectType.ExtraDrawing;
                metadata.SelectDrawing(drawing);

                if (hitResult > 0)
                {
                    manipulationType = ManipulationType.Resize;
                    resizingHandle   = hitResult;
                }
                else
                {
                    manipulationType = ManipulationType.Move;
                }

                break;
            }

            return(isOnDrawing);
        }
示例#3
0
        public RoleManipulation(ConfigItem rule, string cmdline) : base(rule, cmdline)
        {
            var line = cmdline.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            if (line.Length != 3)
            {
                throw new RuleImportException("Incorrect number of parameters.");
            }

            // Ensure the strings here match those in Response._commands
            switch (line[0].ToLowerInvariant())
            {
            case "addrole":
            case "grantrole":
                _action = ManipulationType.Add;
                break;

            case "delrole":
            case "removerole":
            case "revokerole":
                _action = ManipulationType.Remove;
                break;

            default:
                _action = ManipulationType.None;
                break;
            }
            if (_action == ManipulationType.None)
            {
                throw new RuleImportException("Command not defined. This is a bug.");
            }

            _target = line[1];
            _role   = new EntityName(line[2], EntityType.Role);
        }
示例#4
0
        public static bool SendSoraDefenseStatMessage(ManipulationType manipulationType, string value)
        {
            if (value == "1")
            {
                SoraDefenseStatTimer.Stop();
                SoraDefenseStatTimer.Dispose();
            }
            else
            {
                SoraDefenseStatTimer.Elapsed += (sender, obj) =>
                {
                    memoryProcessor.UpdateMemory(new MemoryObject
                    {
                        Address          = 0x21C6C8DC,
                        Type             = DataType.Byte,
                        ManipulationType = manipulationType,
                        Value            = value
                    });
                };

                SoraDefenseStatTimer.Start();
            }

            return(true);
        }
示例#5
0
        public static bool SendRandomizeMagicCostMessage(ManipulationType manipulationType, string value)
        {
            if (value == "Off")
            {
                SoraMagicCostTimer.Stop();
                SoraMagicCostTimer.Dispose();
            }
            else
            {
                var random = new Random();

                SoraMagicCostTimer.Elapsed += (sender, obj) =>
                {
                    SendFireMagicCostMessage(manipulationType, random.Next(0, 256).ToString());
                    SendBlizzardMagicCostMessage(manipulationType, random.Next(0, 256).ToString());
                    SendThunderMagicCostMessage(manipulationType, random.Next(0, 256).ToString());
                    SendCureMagicCostMessage(manipulationType, random.Next(0, 256).ToString());
                    SendMagnetMagicCostMessage(manipulationType, random.Next(0, 256).ToString());
                    SendReflectMagicCostMessage(manipulationType, random.Next(0, 256).ToString());
                };

                SoraMagicCostTimer.Start();
            }

            return(true);
        }
示例#6
0
        private bool IsOnExtraDrawing(Metadata metadata, PointF mouseCoordinates, long currentTimestamp)
        {
            // Test if we hit an unattached drawing.

            bool isOnDrawing    = false;
            int  hitResult      = -1;
            int  currentDrawing = 0;

            while (hitResult < 0 && currentDrawing < metadata.ExtraDrawings.Count)
            {
                hitResult = metadata.ExtraDrawings[currentDrawing].HitTest(mouseCoordinates, currentTimestamp, metadata.CalibrationHelper.DistortionHelper, metadata.CoordinateSystem, metadata.CoordinateSystem.Zooming);

                if (hitResult < 0)
                {
                    currentDrawing++;
                    continue;
                }

                isOnDrawing        = true;
                selectedObjectType = SelectedObjectType.ExtraDrawing;
                metadata.SelectDrawing(metadata.ExtraDrawings[currentDrawing]);

                if (hitResult > 0)
                {
                    manipulationType = ManipulationType.Resize;
                    resizingHandle   = hitResult;
                }
                else
                {
                    manipulationType = ManipulationType.Move;
                }
            }

            return(isOnDrawing);
        }
示例#7
0
        public static bool SendActivateFormMessage(ManipulationType manipulationType, string value)
        {
            SendDriveTimeMessage(ManipulationType.Set, "0");

            // TODO Check that we don't already have an option up?

            // Display Popup
            memoryProcessor.UpdateMemory(new MemoryObject {
                Address = 0x21C5FF48, Type = DataType.TwoBytes, ManipulationType = ManipulationType.Set, Value = "0"
            });
            // Set Reaction Command Option
            memoryProcessor.UpdateMemory(new MemoryObject {
                Address = 0x21C5FF4E, Type = DataType.TwoBytes, ManipulationType = manipulationType, Value = value
            });
            // Enable Popup
            memoryProcessor.UpdateMemory(new MemoryObject {
                Address = 0x21C5FF51, Type = DataType.Byte, ManipulationType = ManipulationType.Set, Value = "0"
            });
            // Press Triangle Reaction Command
            CreateInterval(new MemoryObject {
                Name = "Press Triangle Reaction Command", Address = 0x2034D45D, Type = DataType.Byte, ManipulationType = ManipulationType.Set, Value = ButtonMapping.Button["Triangle"], IsValueHex = true
            });

            return(true); // TODO How would we tell if this triggered or not?
        }
示例#8
0
        public static bool SendSoraQuickMenuSlot4Message(ManipulationType manipulationType, string value)
        {
            ClientCache.Instance.SoraQuickMenuSlot4 = value;

            if (Conversions.QuickMenuToItem.TryGetValue(value, out var convertedValue))
            {
                SendSoraItemSlot4Message(ManipulationType.Set, convertedValue);
            }
            else if (Conversions.QuickMenuToMagicAddress.TryGetValue(value, out var convertedMagicValue))
            {
                if (memoryProcessor.GetMemory(convertedMagicValue, 1) == 0)
                {
                    memoryProcessor.UpdateMemory(new MemoryObject
                    {
                        Address          = convertedMagicValue,
                        Type             = DataType.Byte,
                        ManipulationType = manipulationType,
                        Value            = "1"
                    });
                }
            }

            return(memoryProcessor.UpdateMemory(new MemoryObject
            {
                Address = 0x2032F22E,
                Type = DataType.TwoBytes,
                ManipulationType = manipulationType,
                Value = value
            }));
        }
示例#9
0
        public static bool SendAllDriveFormsMessage(ManipulationType manipulationType, string value)
        {
            SendValorWisdomMasterFinalAntiMessage(manipulationType, value);
            SendLimitMessage(manipulationType, value == "0" ? "8" : "8");

            return(true);
        }
示例#10
0
        public static bool SendReflectMagicCostMessage(ManipulationType manipulationType, string value)
        {
            ClientCache.Instance.SoraReflectMagicCost = value;

            memoryProcessor.UpdateMemory(new MemoryObject
            {
                Address          = 0x21CCD2D0,
                Type             = DataType.Byte,
                ManipulationType = manipulationType,
                Value            = value
            });

            memoryProcessor.UpdateMemory(new MemoryObject
            {
                Address          = 0x21CCD300,
                Type             = DataType.Byte,
                ManipulationType = manipulationType,
                Value            = value
            });

            memoryProcessor.UpdateMemory(new MemoryObject
            {
                Address          = 0x21CCD330,
                Type             = DataType.Byte,
                ManipulationType = manipulationType,
                Value            = value
            });

            return(true);
        }
示例#11
0
        public static bool SendBossDeactivateStrengthTimerMessage(ManipulationType manipulationType, string value)
        {
            EnemyStrengthTimer.Stop();
            EnemyStrengthTimer.Stop();

            return(true);
        }
示例#12
0
        public static bool SendBossDefenseChangeMessage(ManipulationType manipulationType, string value)
        {
            var change      = value.Split(':')[0];
            var changeValue = value.Split(':')[1];

            var entitySlot = EntitySlotMapping.EntitySlots[EnemyMapping.Enemies[change].EntitySlot];

            var defense = 0;

            switch (changeValue)
            {
            case "Max":
                defense = 255;
                break;

            case "Half":
                defense = 122;
                break;

            case "Zero":
                defense = 0;
                break;

            default:
                break;
            }

            return(memoryProcessor.UpdateMemory(new MemoryObject
            {
                Address = entitySlot.Defense,
                Type = DataType.TwoBytes,
                ManipulationType = manipulationType,
                Value = defense.ToString()
            }));
        }
示例#13
0
        public static bool SendBossHealthChangeMessage(ManipulationType manipulationType, string value)
        {
            var change      = value.Split(':')[0];
            var changeValue = value.Split(':')[1];

            var entitySlot = EntitySlotMapping.EntitySlots[EnemyMapping.Enemies[change].EntitySlot];

            var health = 0;

            switch (changeValue)
            {
            case "Max":
                health = 3400;
                break;

            case "Half":
                health = 1700;
                break;

            case "One":
                health = 1;
                break;

            default:
                break;
            }

            return(memoryProcessor.UpdateMemory(new MemoryObject
            {
                Address = entitySlot.Health,
                Type = DataType.FourBytes,
                ManipulationType = manipulationType,
                Value = health.ToString()
            }));
        }
        private void Manipulation_Mouse3DDown(object sender, MouseDown3DEventArgs e)
        {
            if (e.HitTestResult.ModelHit == negX)
            {
                manipulationType = ManipulationType.PosX;
                direction        = Vector3.UnitX;
            }
            else if (e.HitTestResult.ModelHit == negY)
            {
                manipulationType = ManipulationType.PosY;
                direction        = Vector3.UnitY;
            }
            else if (e.HitTestResult.ModelHit == negZ)
            {
                manipulationType = ManipulationType.PosZ;
                direction        = Vector3.UnitZ;
            }
            else if (e.HitTestResult.ModelHit == posX)
            {
                manipulationType = ManipulationType.SizeX;
                direction        = Vector3.UnitX;
            }
            else if (e.HitTestResult.ModelHit == posY)
            {
                manipulationType = ManipulationType.SizeY;
                direction        = Vector3.UnitY;
            }
            else if (e.HitTestResult.ModelHit == posZ)
            {
                manipulationType = ManipulationType.SizeZ;
                direction        = Vector3.UnitZ;
            }
            else
            {
                manipulationType = ManipulationType.None;
                isCaptured       = false;
                return;
            }

            var material = ((e.HitTestResult.ModelHit as MeshGeometryModel3D).Material as DiffuseMaterial);

            material.DiffuseColor = Color.Yellow;
            currentViewport       = e.Viewport;
            var cameraNormal = Vector3.Normalize(e.Viewport.Camera.CameraInternal.LookDirection);

            this.lastHitPosWS = e.HitTestResult.PointHit;
            var up = Vector3.Cross(cameraNormal, direction);

            normal = Vector3.Cross(up, direction);

            Vector3 hit;

            if (currentViewport.UnProjectOnPlane(e.Position.ToVector2(), lastHitPosWS, normal, out hit))
            {
                currentHit = hit;
                isCaptured = true;
            }
        }
示例#15
0
 public static bool SendLimitMessage(ManipulationType manipulationType, string value)
 {
     return(memoryProcessor.UpdateMemory(new MemoryObject
     {
         Address = 0x2032F1FA,
         Type = DataType.Byte,
         ManipulationType = manipulationType,
         Value = value
     }));
 }
示例#16
0
 public static bool SendMunnyMessage(ManipulationType manipulationType, string value)
 {
     return(memoryProcessor.UpdateMemory(new MemoryObject
     {
         Address = 0x2032DF70,
         Type = DataType.FourBytes,
         ManipulationType = manipulationType,
         Value = value
     }));
 }
示例#17
0
 public static bool SendValorWisdomMasterFinalAntiMessage(ManipulationType manipulationType, string value)
 {
     return(memoryProcessor.UpdateMemory(new MemoryObject
     {
         Address = 0x2032F1F0,
         Type = DataType.Byte,
         ManipulationType = manipulationType,
         Value = value
     }));
 }
示例#18
0
 public static bool SendMaxDriveCounterMessage(ManipulationType manipulationType, string value)
 {
     return(memoryProcessor.UpdateMemory(new MemoryObject
     {
         Address = 0x21C6C902,
         Type = DataType.Byte,
         ManipulationType = manipulationType,
         Value = value
     }));
 }
 private void Manipulation_Mouse3DUp(object sender, MouseUp3DEventArgs e)
 {
     if (isCaptured)
     {
         var material = ((e.HitTestResult.ModelHit as MeshGeometryModel3D).Material as DiffuseMaterial);
         material.DiffuseColor = DiffuseColor;
     }
     manipulationType = ManipulationType.None;
     isCaptured       = false;
 }
示例#20
0
 public static bool SendSoraRechargeMagicMessage(ManipulationType manipulationType, string value)
 {
     return(memoryProcessor.UpdateMemory(new MemoryObject
     {
         Address = 0x21C6C90C,
         Type = DataType.Float,
         ManipulationType = manipulationType,
         Value = value
     }));
 }
示例#21
0
        public static bool SendEquipFinalKeybladeMessage(ManipulationType manipulationType, string value)
        {
            ClientCache.Instance.SoraFinalKeyblade = value;

            return(memoryProcessor.UpdateMemory(new MemoryObject
            {
                Address = 0x2032EF04,
                Type = DataType.TwoBytes,
                ManipulationType = manipulationType,
                Value = value
            }));
        }
示例#22
0
        public static bool SendArsArcanumMagicCostMessage(ManipulationType manipulationType, string value)
        {
            ClientCache.Instance.ArsArcanumMagicCost = value;

            return(memoryProcessor.UpdateMemory(new MemoryObject
            {
                Address = 0x21CD30C0,
                Type = DataType.Byte,
                ManipulationType = manipulationType,
                Value = value
            }));
        }
示例#23
0
        public static bool SendSoraCurrentHPMessage(ManipulationType manipulationType, string value)
        {
            ClientCache.Instance.SoraCurrentHP = value;

            return(memoryProcessor.UpdateMemory(new MemoryObject
            {
                Address = 0x21C6C750,
                Type = DataType.FourBytes,
                ManipulationType = manipulationType,
                Value = value
            }));
        }
示例#24
0
        public DrawingToolPointer()
        {
            manipulationType   = ManipulationType.None;
            selectedObjectType = SelectedObjectType.None;
            lastPoint          = PointF.Empty;
            resizingHandle     = 0;
            imgSize            = new Size(320, 240);
            mouseDelta         = PointF.Empty;
            directZoomTopLeft  = new Point(-1, -1);

            SetupHandCursors();
        }
示例#25
0
        public static bool SendSoraLevelMessage(ManipulationType manipulationType, string value)
        {
            ClientCache.Instance.SoraLevel = value;

            return(memoryProcessor.UpdateMemory(new MemoryObject
            {
                Address = 0x2032E02F,
                Type = DataType.Byte,
                ManipulationType = manipulationType,
                Value = value
            }));
        }
示例#26
0
        public static bool SendBlizzardMagicMessage(ManipulationType manipulationType, string value)
        {
            ClientCache.Instance.SoraBlizzardMagic = value;

            return(memoryProcessor.UpdateMemory(new MemoryObject
            {
                Address = 0x2032F0C5,
                Type = DataType.Byte,
                ManipulationType = manipulationType,
                Value = value
            }));
        }
示例#27
0
        public static bool SendSoraItemSlot8Message(ManipulationType manipulationType, string value)
        {
            ClientCache.Instance.SoraItemSlot8 = value;

            return(memoryProcessor.UpdateMemory(new MemoryObject
            {
                Address = 0x2032E062,
                Type = DataType.TwoBytes,
                ManipulationType = manipulationType,
                Value = value
            }));
        }
        private void Scaling_Mouse3DDown(object sender, MouseDown3DEventArgs e)
        {
            if (target == null || !CanBeginTransform(e))
            {
                return;
            }

            if (e.HitTestResult.ModelHit == scaleX)
            {
                manipulationType = ManipulationType.ScaleX;
                direction        = Vector3.UnitX;
            }
            else if (e.HitTestResult.ModelHit == scaleY)
            {
                manipulationType = ManipulationType.ScaleY;
                direction        = Vector3.UnitY;
            }
            else if (e.HitTestResult.ModelHit == scaleZ)
            {
                manipulationType = ManipulationType.ScaleZ;
                direction        = Vector3.UnitZ;
            }
            else
            {
                manipulationType = ManipulationType.None;
                isCaptured       = false;
                return;
            }

            HideAllGeometry();
            (e.HitTestResult.ModelHit as GeometryModel3D).IsRendering = true;

            var material = ((e.HitTestResult.ModelHit as MeshGeometryModel3D).Material as DiffuseMaterial);

            currentColor          = material.DiffuseColor;
            material.DiffuseColor = Color.Yellow;
            currentViewport       = e.Viewport;
            var cameraNormal = Vector3.Normalize(e.Viewport.Camera.CameraInternal.LookDirection);

            this.lastHitPosWS = e.HitTestResult.PointHit;
            var up = Vector3.Cross(cameraNormal, direction);

            normal = Vector3.Cross(up, direction);

            Vector3 hit;

            if (currentViewport.UnProjectOnPlane(e.Position.ToVector2(), lastHitPosWS, normal, out hit))
            {
                currentHit = hit;
                isCaptured = true;
            }
        }
        public static bool SendSoraAntiFormModelMessage(ManipulationType manipulationType, string value)
        {
            memoryProcessor.UpdateMemory(new MemoryObject
            {
                Address          = 0x21CE0B7A,
                Type             = DataType.TwoBytes,
                ManipulationType = manipulationType,
                Value            = value
            });

            SetupModelTimer(SoraFormModelTimer, 0x21CE0B7A, "89", "AntiSora");

            return(true);
        }
示例#30
0
        private bool IsOnTrack(Metadata metadata, PointF mouseCoordinates, long currentTimeStamp)
        {
            // Track have their own special hit test because we need to differenciate the interactive case from the edit case.
            bool isOnDrawing = false;

            foreach (AbstractDrawing drawing in metadata.TrackManager.Drawings)
            {
                DrawingTrack track = drawing as DrawingTrack;
                if (track == null)
                {
                    continue;
                }

                int hitResult = drawing.HitTest(mouseCoordinates, currentTimeStamp, metadata.CalibrationHelper.DistortionHelper, metadata.CoordinateSystem, metadata.CoordinateSystem.Zooming);
                if (hitResult < 0)
                {
                    continue;
                }

                isOnDrawing        = true;
                selectedObjectType = SelectedObjectType.ExtraDrawing;
                metadata.SelectDrawing(drawing);

                manipulationType = ManipulationType.Move;

                switch (track.Status)
                {
                case TrackStatus.Interactive:
                    if (hitResult == 0 || hitResult == 1)
                    {
                        manipulationType = ManipulationType.Resize;
                        resizingHandle   = hitResult;
                    }
                    break;

                case TrackStatus.Configuration:
                    if (hitResult > 1)
                    {
                        manipulationType = ManipulationType.Resize;
                        resizingHandle   = hitResult;
                    }
                    break;
                }

                break;
            }

            return(isOnDrawing);
        }
示例#31
0
 public void ManipulateDB(Box b, ManipulationType type)
 {
     SqlCommand cmd = new SqlCommand();
     cmd.Connection = DatabaseConnection.GetInstance();
     switch (type)
     {
         case ManipulationType.Insert:
             // create INSERT SQL string
             cmd.CommandText = "INSERT INTO ScanExpert_DEV_TEST (DateIn, productCode recipient_name recipient_loc recipient_address recipient_tel recipient_cc date_out delivered_to sender deliverer ware document customs comment creator) VALUES('" + b.DateIn + "', 'b.productCode', 'b.recipient_name', 'b.recipient_loc', 'b.recipient_address', 'b.recipient_tel', 'b.recipient_cc', 'b.date_out', 'b.delivered_to', 'b.sender', 'b.deliverer', 'b.ware', 'b.document', 'b.customs', 'b.comment', 'b.creator')";
             break;
         case ManipulationType.Update:
             // create Update SQL string
             cmd.CommandText = "UPDATE ScanExpert_DEV_TEST SET DateIn=@DateIn productCode=@productCode recipient_name=@recipient_name recipient_loc=@recipient_loc recipient_address=@recipient_address recipient_tel=@recipient_tel recipient_cc=@recipient_cc date_out=@date_out delivered_to=@delivered_to sender=@sender deliverer=@deliverer ware=@ware document=@document customs=@customs comment=@comment creator=@creator WHERE Id=@Id";
             break;
         case ManipulationType.Delete:
             // create DELETE SQL string
             cmd.CommandText = "DELETE FROM ScanExpert_DEV_TEST WHERE Id=@Id";
             cmd.Parameters.AddWithValue("@Id", b.ID);
             break;
         default:
             break;
     }
     // exutenonquery= sqlcommand ausführen aber keine Datenbankabfrage
     cmd.ExecuteNonQuery();
     // die liste der boxen wird geupdated nachdem id hinzugefügt wurde
     this.UpdateBoxes();
 }