Inheritance: MonoBehaviour
Exemplo n.º 1
0
        private async void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            Log.Debug("[MainPage_Loaded] Intialize ...");

            await IntializeFileOperations();

            SpaceFrame.Navigate(typeof(SpacePage));
            SpacePage = SpacePage.Self;

            LayerFrame.Navigate(typeof(LayerPage));
            LayerPage = LayerPage.Self;

            //Start SocketClient
            MaskManager.GetInstance().ShowMask(MaskType.NoSupportDevice);
            Log.Debug("[MainPage_Loaded] Start client thread");
            startclient();
            Log.Debug("[MainPage_Loaded] Start client thread complete");
            LoadSettings();
            Log.Debug("[MainPage_Loaded] LoadSettings complete");
            DeviceUpdatesPage.Self.UpdateButton_Click(null, null);

            var visibleBounds = ApplicationView.GetForCurrentView().VisibleBounds;

            ResizeButton(visibleBounds.Width);
        }
Exemplo n.º 2
0
        public void TestMaskManagerMultipleLinesWithSameClass()
        {
            var lines = new List <string>()
            {
                "03/22 08:51:06 INFO   :...read_physical_netif: index #0, interface VLINK1 has address 129.1.1.1, ifidx 0 ",
                "03/22 08:51:06 INFO: ...read_physical_netif: index #1, interface TR1 has address 9.37.65.139, ifidx 1",
                "03/22 08:52:06 INFO: ...read_physical_netif: index #1, interface TR1 has address 9.37.65.138, ifidx 1",
                "03/22 08:52:06 INFO: ...read_physical_netif: index #1, interface TR1 has address 9.37.65.139, ifidx 1"
            };
            var maskManager = new MaskManager();
            var masked      = maskManager.Execute(lines);

            Assert.IsNotNull(masked);
            Assert.IsNotNull(masked.Lines);
            Assert.AreEqual(masked.Lines.Count(), 4);
            Assert.IsNotNull(masked.Summery);
            Assert.AreEqual(masked.Summery.Count(), 3);
            Assert.AreEqual(masked.Summery.ElementAt(0).OriginalIP, "129.1.1.1");
            Assert.AreEqual(masked.Summery.ElementAt(1).OriginalIP, "9.37.65.139");
            Assert.AreEqual(masked.Summery.ElementAt(2).OriginalIP, "9.37.65.138");
            var firstMasked  = masked.Summery.ElementAt(0).MaskedIP;
            var secondMasked = masked.Summery.ElementAt(1).MaskedIP;
            var thirdMasked  = masked.Summery.ElementAt(2).MaskedIP;

            Assert.AreNotEqual(firstMasked.NetworkAddress(), secondMasked.NetworkAddress());
            Assert.AreEqual(secondMasked.NetworkAddress(), thirdMasked.NetworkAddress());
            Assert.AreNotEqual(secondMasked.ComputerAddress(), thirdMasked.ComputerAddress());
            Assert.AreEqual(masked.Lines.ElementAt(0).IndexOf(firstMasked), 86);
            Assert.AreEqual(masked.Lines.ElementAt(1).IndexOf(secondMasked), 81);
            Assert.AreEqual(masked.Lines.ElementAt(2).IndexOf(thirdMasked), 81);
            Assert.AreEqual(masked.Lines.ElementAt(3).IndexOf(secondMasked), 81);
        }
Exemplo n.º 3
0
 void Start()
 {
     //Fetch the Raycaster from the GameObject (the Canvas)
     m_Raycaster = GetComponent <GraphicRaycaster>();
     //Fetch the Event System from the Scene
     m_EventSystem = GetComponent <EventSystem>();
     //Fetch the Mask Manager from the GameObject (the Canvas)
     m_MaskManager = GetComponent <MaskManager>();
 }
Exemplo n.º 4
0
        public MainForm()
        {
            InitializeComponent();

            if (Properties.Settings.Default.UseSavedSizes)
            {
                Width  = Properties.Settings.Default.MainWidth;
                Height = Properties.Settings.Default.MainHeight;
            }

            DateTimeFormat = "dd-MM-yyyy HH:mm:ss";

            subItemTip = new ListViewSubItemTip(listViewTasks);
            toolTip    = new ToolTip();

            if (Properties.Settings.Default.ShowToolTips)
            {
                LoadToolTips();
            }

            tskManager                             = new CrackTaskManager();
            tskManager.TaskAdded                  += tskManager_TaskAdded;
            tskManager.TaskDeleted                += tskManager_TaskDeleted;
            tskManager.TaskMovedToEnd             += tskManager_TaskMovedToEnd;
            tskManager.TaskMovedToStart           += tskManager_TaskMovedToStart;
            tskManager.TaskUpdated                += tskManager_TaskUpdated;
            tskManager.TasksAllDeleted            += tskManager_TasksAllDeleted;
            tskManager.Cracker.SynchronizingObject = this;
            tskManager.Cracker.BeforeStart        += Cracker_BeforeStart;
            tskManager.Cracker.OnStart            += Cracker_OnStart;
            tskManager.Cracker.OnCracking         += Cracker_OnCracking;
            tskManager.Cracker.OnStop             += Cracker_OnStop;

            if (Properties.Settings.Default.LoadOnStartup)
            {
                LoadTasks();
            }

            dictManager = new DictionaryManager();
            LoadDictionaries();

            maskManager = new MaskManager();
            LoadMasks();

            typeof(Control).InvokeMember("DoubleBuffered",
                                         System.Reflection.BindingFlags.SetProperty
                                         | System.Reflection.BindingFlags.Instance
                                         | System.Reflection.BindingFlags.NonPublic,
                                         null, listViewTasks, new object[] { true });

            VisualizeTasks();
            CheckButtons();
        }
Exemplo n.º 5
0
        private void SortDeviceButton_Click(object sender, RoutedEventArgs e)
        {
            EditDoneButton.IsEnabled = true;
            EditBarTextBlock.Text    = resourceLoader.GetString("SortDeviceTitle");
            MaskManager.GetInstance().ShowMask(MaskType.Editing);
            SpacePage.SetSpaceStatus(SpaceStatus.Sorting);

            oldSortingPositions.Clear();
            foreach (var dm in SpacePage.DeviceModelCollection)
            {
                oldSortingPositions.Add(dm, new Point(dm.PixelLeft, dm.PixelTop));
            }
        }
Exemplo n.º 6
0
        private void EditDoneButton_Click(object sender, RoutedEventArgs e)
        {
            if (SpacePage.GetSpaceStatus() == SpaceStatus.ReEditing)
            {
                LayerModel          layer    = LayerPage.CheckedLayer;
                DeviceZonesPairList oldpairs = new DeviceZonesPairList();
                DeviceZonesPairList newpairs = new DeviceZonesPairList();

                foreach (DeviceModel dm in SpacePage.DeviceModelCollection)
                {
                    var oldzones = layer.GetDeviceZones(dm.Type);
                    oldpairs.Add(new DevicZonesPair(dm.Type, oldzones));

                    List <int> selectedIndex = new List <int>();

                    foreach (var zone in dm.AllZones)
                    {
                        if (zone.Selected == true)
                        {
                            selectedIndex.Add(zone.Index);
                        }
                    }

                    layer.SetDeviceZones(dm.Type, selectedIndex.ToArray());
                    newpairs.Add(new DevicZonesPair(dm.Type, selectedIndex.ToArray()));
                }

                ReUndoManager.Store(new EditZonesCommand(layer, oldpairs, newpairs));
                SpacePage.WatchLayer(layer);
            }
            else // Sorting
            {
                var dmPositions = new Dictionary <DeviceModel, Tuple <double, double> >();

                foreach (var pair in oldSortingPositions)
                {
                    DeviceModel dm    = pair.Key;
                    double      moveX = dm.PixelLeft - pair.Value.X;
                    double      moveY = dm.PixelTop - pair.Value.Y;

                    SpacePage.Self.DeleteOverlappingTempDevice(dm);
                    SpacePage.Self.MoveMousePosition(dm, RoundToGrid(moveX), RoundToGrid(moveY));
                    dmPositions.Add(dm, new Tuple <double, double>(moveX, moveY));
                }

                ReUndoManager.Store(new MoveDevicesCommand(dmPositions));
                SpacePage.GoToBlankEditing();
            }

            MaskManager.GetInstance().ShowMask(MaskType.None);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 初始化掩码员,更新文本框
        /// </summary>
        public void Initialize()
        {
            //AtDebug.Trace("初始化掩码员");
            // 移除掩码管理者的附加事件
            if (_masker != null)
            {
                _masker.LocalEditAction -= new CancelEventHandler(OnLocalEditAction);
                _masker.EditTextChanged -= new EventHandler(OnEditTextChanged);
            }

            _masker = CreateDefaultMaskManager();
            // 为掩码管理者附加事件
            _masker.LocalEditAction += new CancelEventHandler(OnLocalEditAction);
            _masker.EditTextChanged += new EventHandler(OnEditTextChanged);
            SetInitialEditValue(_owner.Value);
        }
        private void TaskEditorForm_Load(object sender, EventArgs e)
        {
            tskManager  = (this.Owner as MainForm).MainCrackTaskManager;
            dictManager = (this.Owner as MainForm).DictionaryManager;
            maskManager = (this.Owner as MainForm).MaskManager;
            FillFormWithTaskData();

            //for (int index = 0; index < dictManager.Dictionaries.Length; index++)
            //{
            //    checkedListBoxDictionary.Items.Add(dictManager.Dictionaries[index].Description);
            //}

            //for (int index = 0; index < maskManager.Masks.Length; index++)
            //{
            //    checkedListBoxMask.Items.Add(maskManager.Masks[index].Description);
            //}

            int indexer = 1;

            for (int dictIndex = 0; dictIndex < dictManager.Dictionaries.Length; dictIndex++, indexer++)
            {
                string[] items =
                {
                    indexer.ToString(),
                    "Dictionary",
                    dictManager.Dictionaries[dictIndex].Description,
                    dictManager.Dictionaries[dictIndex].FileName,
                    dictManager.Dictionaries[dictIndex].FormattedSize
                };

                (listViewMultipleAttacks.Items.Add(new ListViewItem(items))).Tag = dictIndex;
            }

            for (int maskIndex = 0; maskIndex < maskManager.Masks.Length; maskIndex++, indexer++)
            {
                string[] items =
                {
                    indexer.ToString(),
                    "Mask",
                    maskManager.Masks[maskIndex].Description,
                    maskManager.Masks[maskIndex].BruteMask,
                    maskManager.Masks[maskIndex].CharsetString
                };

                (listViewMultipleAttacks.Items.Add(new ListViewItem(items))).Tag = maskIndex;
            }
        }
Exemplo n.º 9
0
        public SettingsForm(MainForm mainForm)
        {
            InitializeComponent();

            if (Properties.Settings.Default.UseSavedSizes)
            {
                Width  = Properties.Settings.Default.SettingsWidth;
                Height = Properties.Settings.Default.SettingsHeight;
            }

            this.mainForm     = mainForm;
            dictionaryManager = mainForm.DictionaryManager;
            maskManager       = mainForm.MaskManager;

            VisualizeAllDictionaries();
            VisualizeAllMasks();
        }
        public static bool DontLaunch(EyeShuttleController __instance)
        {
            QSBPlayerManager.PlayerList.Where(x => x.IsInEyeShuttle).ForEach(x => MaskManager.WentOnSolanumsWildRide.Add(x));

            if (__instance._isPlayerInside)
            {
                return(true);
            }

            MaskManager.FlickerOutShuttle();
            __instance._hasLaunched      = true;
            __instance._hasArrivedAtMask = true;
            __instance._hasPlayedOneShot = true;
            __instance.enabled           = false;

            return(false);
        }
        public MaskEditorForm(MaskManager maskManager,
                              int changingMaskId = -1)
        {
            InitializeComponent();

            if (Properties.Settings.Default.UseSavedSizes)
            {
                Width  = Properties.Settings.Default.MaskEditorWidth;
                Height = Properties.Settings.Default.MaskEditorHeight;
            }

            this.maskManager    = maskManager;
            this.changingMaskId = changingMaskId;

            if (changingMaskId > -1)
            {
                FillFormWithData();
            }
        }
Exemplo n.º 12
0
        private void EditCancelButton_Click(object sender, RoutedEventArgs e)
        {
            if (SpacePage.GetSpaceStatus() == SpaceStatus.ReEditing)
            {
                LayerModel layer = LayerPage.CheckedLayer;
                SpacePage.WatchLayer(layer);
            }
            else // Sorting
            {
                SpacePage.GoToBlankEditing();

                foreach (var pair in oldSortingPositions)
                {
                    pair.Key.PixelLeft = pair.Value.X;
                    pair.Key.PixelTop  = pair.Value.Y;
                }
            }

            SpacePage.StopScrollTimer();
            MaskManager.GetInstance().ShowMask(MaskType.None);
        }
Exemplo n.º 13
0
        public async Task Rescan()
        {
            try
            {
                Log.Debug("[Rescan] Start !");

                List <DeviceModel> remainDMs  = new List <DeviceModel>(DeviceModelCollection);
                List <DeviceModel> newDMs     = new List <DeviceModel>();
                string             deviceList = await GetPluggedDevicesFromService();

                string[] deviceArray = deviceList.Split(':');

                foreach (var deviceString in deviceArray)
                {
                    if (deviceString == "")
                    {
                        continue;
                    }

                    string[] deviceData = deviceString.Split(',');

                    if (deviceData.Length != 6)
                    {
                        Log.Debug("[Rescan] Invalid device info : " + deviceArray);
                        continue;
                    }

                    var get = DeviceModelCollection.Find(find => find.ModelName == deviceData[0]);
                    if (get == null)
                    {
                        DeviceModel dm = await DeviceModel.ToDeviceModelAsync(
                            deviceData[0], deviceData[1], deviceData[2],
                            deviceData[3], deviceData[4], deviceData[5]);

                        if (dm != null)
                        {
                            newDMs.Add(dm);
                        }
                    }
                    else
                    {
                        if (deviceData[5] == "true")
                        {
                            get.Plugged = true;
                            get.Sync    = true;
                        }
                        else if (deviceData[5] == "false")
                        {
                            get.Plugged = true;
                            get.Sync    = false;
                        }

                        remainDMs.Remove(get);
                    }
                }

                foreach (var dm in newDMs)
                {
                    Rect  r = new Rect(0, 0, dm.PixelWidth, dm.PixelHeight);
                    Point p = GetFreeRoomPositionForRect(r);
                    dm.PixelLeft = p.X;
                    dm.PixelTop  = p.Y;
                    dm.Plugged   = true;

                    // Delete temp data as same type as new, because new device is plugging
                    LayerPage.Self.ClearDeviceData(dm.Type);

                    if (dm.Type == (int)DeviceType.Notebook || dm.Type == (int)DeviceType.Desktop)
                    {
                        DeviceModelCollection.Insert(0, dm);
                    }
                    else
                    {
                        DeviceModelCollection.Add(dm);
                    }
                }

                // The rest mean device was unplugged
                foreach (var dm in remainDMs)
                {
                    dm.Plugged = false;
                }

                RefreshStage();
                NotifyConnectedDialog();
            }
            catch
            {
                MaskManager.GetInstance().ShowMask(MaskType.NoSupportDevice);
                Log.Debug("[Rescan] Rescan pluggeddevices failed !");
            }
        }
Exemplo n.º 14
0
        public void RefreshStage()
        {
            List <MouseDetectedRegion> regions = new List <MouseDetectedRegion>();

            SpaceCanvas.Children.Clear();
            SpaceCanvas.Children.Add(GridImage);
            SpaceCanvas.Children.Add(RestrictLineLeft);
            SpaceCanvas.Children.Add(RestrictLineRight);
            SpaceCanvas.Children.Add(RestrictLineTop);
            SpaceCanvas.Children.Add(RestrictLineBottom);
            SpaceCanvas.Children.Add(MouseRectangle);

            var onStageList = DeviceModelCollection.FindAll(d => d.Plugged == true && d.Sync == true);

            foreach (var dm in onStageList)
            {
                List <ZoneModel> allzones = dm.AllZones;
                SortByZIndex(allzones);

                foreach (var zone in allzones)
                {
                    Rect relative = zone.GetRect();
                    Rect absolute = new Rect(
                        new Point(relative.Left + dm.PixelLeft, relative.Top + dm.PixelTop),
                        new Point(relative.Right + dm.PixelLeft, relative.Bottom + dm.PixelTop)
                        );

                    MouseDetectedRegion r = new MouseDetectedRegion()
                    {
                        RegionIndex   = -1,
                        DetectionRect = absolute,
                        GroupIndex    = dm.Type
                    };

                    r.Callback = zone.OnReceiveMouseEvent;

                    regions.Add(r);
                }

                DeviceView view = new DeviceView();
                view.DataContext = dm;
                SpaceCanvas.Children.Add(view);
            }

            m_MouseEventCtrl.DetectionRegions = regions.ToArray();
            GoToBlankEditing();
            StopScrollTimer();


            if (DeviceModelCollection.FindAll(find => find.Plugged == true).Count == 0)
            {
                MaskManager.GetInstance().ShowMask(MaskType.NoSupportDevice);
            }
            else if (DeviceModelCollection.Find(find => find.Sync == true) == null)
            {
                MaskManager.GetInstance().ShowMask(MaskType.NoSyncDevice);
            }
            else
            {
                MaskManager.GetInstance().ShowMask(MaskType.None);
            }
        }
Exemplo n.º 15
0
 private void HideMask()
 {
     MaskManager.GetInstance().ShowMask(MaskType.None);
 }
Exemplo n.º 16
0
 public void ShowReEditMask(LayerModel layer)
 {
     EditBarTextBlock.Text = resourceLoader.GetString("EditLayerText") + layer.Name;
     MaskManager.GetInstance().ShowMask(MaskType.Editing);
 }
Exemplo n.º 17
0
 private void Awake()
 {
     maskManager = this.gameObject.AddComponent <MaskManager>();
 }
Exemplo n.º 18
0
 void Awake()
 {
     instance = this;
 }
Exemplo n.º 19
0
    void Update()
    {
        if (Container == null)
        {
            return;
        }

        var  offset   = TileDataProvider.WorldPosToOffsetTile(pysicItem.GetBottomPos());
        bool isStairs = MapGenerator.GetTile(new Vector2Int(offset.x, offset.y)).IsStairs();

        joystickH = UltimateJoystick.GetHorizontalAxis("Joystick1");
        joystickV = UltimateJoystick.GetVerticalAxis("Joystick1");

        //jamp
        if (Input.GetKeyDown(KeyCode.Space) || Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.W) /*|| (joystickV >= 0 && joystickV < 0.4)*/)
        {
            if (oldJampFrame != Time.frameCount && (Collision.Raycast(pysicItem.Position, viewReciver.size, Vector2.down).Count != 0 || isStairs))
            {
                countJampFrame = 0;
                pysicItem.AddVelocity(new Vector2(0, -pysicItem.velocity.y));
                oldJampFrame = Time.frameCount;
            }
        }


        //jamp isStairs
        if (isStairs && (Input.GetKey(KeyCode.Space) || Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.W) ||
                         joystickV > .5))
        {
            pysicItem.ApplayVelocity(new Vector2(0, 4));
        }

        // Down
        if (oldDownFrame != Time.frameCount && Input.GetKey(KeyCode.DownArrow) || Input.GetKey(KeyCode.S) ||
            joystickV < -.5)
        {
            pysicItem.AddVelocity(new Vector2(0, -Speed));
            oldDownFrame = Time.frameCount;

            if (isStairs)
            {
                pysicItem.ApplayVelocity(new Vector2(0, -4));
            }
        }



        // Left
        if (oldLeftFrame != Time.frameCount && Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.A) ||
            (joystickH < -.2))
        {
            var speed = joystickH != 0 ? Speed * joystickH : -Speed;

            pysicItem.AddVelocity(new Vector2(speed, 0));
            oldLeftFrame = Time.frameCount;
            controller.Rotat(-1);

            if (!isStairs)
            {
                if (Collision.Raycast(pysicItem.Position, viewReciver.size, Vector2.down).Count != 0)
                {
                    var countTile = MaskManager.GetMaskLJamp(pysicItem.GetBottomLeftPos());
                    if (countTile > 0)
                    {
                        pysicItem.AddVelocity(new Vector2(0, -pysicItem.velocity.y));
                        pysicItem.SetPosition(new Vector2(pysicItem.Position.x - 1,
                                                          pysicItem.Position.y + 16 * countTile + 1));
                    }
                }
            }
        }



        // Right
        if (oldRightFrame != Time.frameCount && Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.D) ||
            (joystickH > .2))
        {
            var speed = joystickH != 0 ? Speed * joystickH : Speed;
            pysicItem.AddVelocity(new Vector2(speed, 0));
            oldRightFrame = Time.frameCount;
            controller.Rotat(1);


            if (!isStairs)
            {
                if (Collision.Raycast(pysicItem.Position, viewReciver.size, Vector2.down).Count != 0)
                {
                    var countTile = MaskManager.GetMaskRJamp(pysicItem.GetBottomRightPos());
                    //Debug.LogError(countTile);
                    if (countTile > 0)
                    {
                        pysicItem.AddVelocity(new Vector2(0, -pysicItem.velocity.y));
                        pysicItem.SetPosition(new Vector2(pysicItem.Position.x + 1,
                                                          pysicItem.Position.y + 16 * countTile + 1));
                    }
                }
            }
        }


        var joystickH2 = UltimateJoystick.GetHorizontalAxis("Joystick2");
        var joystickV2 = UltimateJoystick.GetVerticalAxis("Joystick2");

        bool joystick  = Vector2.Distance(new Vector2(joystickH2, joystickV2), Vector2.zero) > 0.1;
        bool joystick0 = UltimateJoystick.GetIsDown("Joystick1");

        var pos = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        if (!Settings.IS_EDIT_MOD && (
                (!joystick0 || joystick0 && joystick) && (Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.LeftControl) || joystick)) && !UICamera.IsGuiClick)
        {
            if (model.CurrentWeapon != null)
            {
                if (!joystick)
                {
                    var dir = (pos - transform.position).normalized;
                    controller.Rotat(dir.x);
                }
                else
                {
                    controller.Rotat(joystickH2);
                }
                model.CurrentWeapon.Fire(pos, joystick);
            }
        }

        if (((!Settings.IS_EDIT_MOD) && (
                 (!joystick0 || joystick0 && joystick) && (Input.GetMouseButton(0) || Input.GetKey(KeyCode.LeftControl) || joystick)) && !UICamera.IsGuiClick))
        {
            if (model.CurrentWeapon != null)
            {
                if (!joystick)
                {
                    var dir = (pos - transform.position).normalized;
                    controller.Rotat(dir.x);
                }
                else
                {
                    controller.Rotat(joystickH2);
                }
                model.CurrentWeapon.FireCycle(pos, joystick);
            }
        }

        if (model.CurrentWeapon != null)
        {
            var rot = pos;
            if (joystick)
            {
                var v = UltimateJoystick.GetVerticalAxis("Joystick2");
                var h = UltimateJoystick.GetHorizontalAxis("Joystick2");
                rot = transform.position + new Vector3(h, v) * 100;
            }
            model.CurrentWeapon.Rotate(rot);
        }


        //Bag
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            model.UseItem(1);
        }

        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            model.UseItem(2);
        }

        if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            model.UseItem(3);
        }

        if (Input.GetKeyDown(KeyCode.Alpha4))
        {
            model.UseItem(4);
        }

        if (Input.GetKeyDown(KeyCode.Alpha5))
        {
            model.UseItem(5);
        }

        if (Input.GetKeyDown(KeyCode.Alpha6))
        {
            model.UseItem(6);
        }

        if (Input.GetKeyDown(KeyCode.Alpha7))
        {
            model.UseItem(7);
        }

        if (Input.GetKeyDown(KeyCode.Alpha8))
        {
            model.UseItem(8);
        }

        if (Input.GetKeyDown(KeyCode.Alpha9))
        {
            model.UseItem(9);
        }
    }