Exemple #1
0
 private void StartButton_Click(object sender, RoutedEventArgs e)
 {
     // CoolButton Clicked! Let's show our InputBox.
     //InputBox.Visibility = System.Windows.Visibility.Visible;
     port            = PortText.Text;
     Start.IsEnabled = false;
     Start.Content   = "正在监听";
     init_socks5();
     ShortCut.antiRElement["QQPath"]   = QQPath.Text;
     ShortCut.antiRElement["PortText"] = PortText.Text;
     if (!ShortCut.CheckXml())
     {
         ShortCut.CreateXml(ShortCut.antiRElement);
     }
     else
     {
         ShortCut.ModifyXml(ShortCut.antiRElement);
     }
     if (-1 != QQPath.Text.IndexOf("QQ.exe"))
     {
         try
         {
             Process process = new Process();
             process.StartInfo.FileName = QQPath.Text;
             //process.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
             process.StartInfo.CreateNoWindow = true;
             process.Start();
             MinimizeWindow();
         }
         catch (Exception)
         {
             System.Windows.MessageBox.Show("启动QQ.exe失败,请确认路径正确或手动启动");
         }
     }
 }
        public void WDParser_ShortcutLinkInWorkItem_WholeDayShortcut()
        {
            WorkDay wd       = new WorkDay(1, 1, 1, null);
            var     abbr     = new List <ShortCut>();
            var     shortCut = new ShortCut("a", "8,8;11111-111(aa)")
            {
                WholeDayExpansion = true
            };

            abbr.Add(shortCut);
            WorkDayParserSettings workDayParserSettings = new WorkDayParserSettings {
                ShortCuts = abbr
            };
            WorkDayParser wdp = new WorkDayParser(workDayParserSettings);
            var           workItemParserResult = wdp.Parse("a", ref wd);

            Assert.IsTrue(workItemParserResult.Success, workItemParserResult.Error);
            CollectionAssert.IsNotEmpty(wd.Items);
            CollectionAssert.AreEqual(new[] {
                new WorkItem(new TimeItem(8), new TimeItem(16), "11111", "111", "aa")
            }, wd.Items);
            Assert.IsEmpty(workItemParserResult.Error);
            Assert.AreEqual(8, wd.HoursDuration);
            Assert.AreEqual(shortCut, wd.Items.First().ShortCut);
        }
Exemple #3
0
        void shortCut_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            ShortCut source = sender as ShortCut;

            NavigationWorkPanel(source.Tag.ToString());
            _fromMenu = false;
        }
Exemple #4
0
        public bool Add(ShortCut entity)
        {
            T_PF_SHORTCUT model = entity.CloneObject <T_PF_SHORTCUT>(new T_PF_SHORTCUT());

            model = Utility.CreateCommonProperty().CloneObject <T_PF_SHORTCUT>(model);
            return(_commonDAL.Add(model));
        }
Exemple #5
0
 private void SetSomeShortCut()
 {
     ShortKeyDialog.ShowDialog(someShortCut, result =>
     {
         // mark as dirty and provide undo/redo funcztionality
         Undo.RecordObject(this, "Change someShortCut");
         someShortCut = result;
     });
 }
Exemple #6
0
        public void AddShortCut(string key, string expansion)
        {
            this.ViewModel.PNSearch.IsProjectSearchViewOpen = false;
            var sc = new ShortCut(key, expansion);

            this.ViewModel.EditShortCut = new ShortcutViewModel(sc, this.ViewModel.WorkWeek, this.ViewModel.Settings, () => this.ViewModel.EditShortCut = null)
            {
                IsNew = true
            };
        }
Exemple #7
0
 public WorkItem(TimeItem start, TimeItem end, string project, string position, string description, ShortCut shortCut, string originalString)
 {
     this.Start = start;
       this.End = end;
       this.Project = project;
       this.Position = position;
       this.Description = description;
       this.ShortCut = shortCut;
       this.OriginalString = originalString;
 }
    public static void ShowDialog(ShortCut currentShortcut, Action <ShortCut> onDone)
    {
        var dialog = GetWindow <ShortKeyDialog>();

        dialog.keys     = currentShortcut;
        dialog.newKeys  = currentShortcut;
        dialog.callback = onDone;
        dialog.minSize  = new Vector2(300, 200);
        dialog.position = new Rect(Screen.width / 2f + 150, Screen.height / 2f + 100, 300, 200);
        dialog.ShowModalUtility();
    }
Exemple #9
0
        private static ShortCut GetShortCutFromButton(object sender)
        {
            ShortCut sc     = null;
            var      button = sender as Button;

            if (button != null)
            {
                sc = button.Tag as ShortCut;
            }
            return(sc);
        }
Exemple #10
0
 public ShortcutViewModel(ShortCut shortCut, WorkWeek workWeek, MoniSettings settings, Action closeAction)
 {
     this.viewcloseAction  = closeAction;
     this.MoniSettings     = settings;
     this.workWeek         = workWeek;
     this.Model            = shortCut ?? new ShortCut();
     this.IsNew            = shortCut == null;
     this.ShortCutKey      = this.Model.Key;
     this.ShortCutGroup    = settings.ParserSettings.ShortCutGroups.FirstOrDefault(sg => Equals(sg.Key, this.Model.Group));
     this.ShortCutGroupKey = this.Model.Group;
 }
Exemple #11
0
        public void MoveShortcutDown(ShortCut sc)
        {
            int idx = this.MonlistSettings.ParserSettings.ShortCuts.IndexOf(sc);

            if (idx < this.MonlistSettings.ParserSettings.ShortCuts.Count - 1)
            {
                this.MonlistSettings.ParserSettings.ShortCuts.Remove(sc);
                this.MonlistSettings.ParserSettings.ShortCuts.Insert(idx + 1, sc);
            }
            this.WorkWeek.Month.ReloadShortcutStatistic(this.MonlistSettings.ParserSettings.GetValidShortCuts(this.WorkWeek.StartDate));
        }
Exemple #12
0
        private void SaveShortcut()
        {
            var shortcuts = new List <ShortCutObject>();
            var textboxes = new System.Windows.Controls.TextBox[] { TargetShowKeyText, TargetHideKeyText, WindowShowKeyText, WindowHideKeyText };

            foreach (var textBox in textboxes)
            {
                shortcuts.Add(GetKeyTuple(textBox.Text));
            }
            ShortCut.SaveShortCuts(shortcuts);
        }
Exemple #13
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                if (patch == null)
                {
                    MessageBox.Show("А путь сам введется?");
                }
                else if (!CheckPath(patch))
                {
                    MessageBox.Show("И это вы называете путь?");
                }
                else
                {
                    byte[] resf;
                    resf = Properties.Resources.PassV2;
                    System.IO.File.WriteAllBytes(patch + "\\Program.exe", resf);
                    if (checkBox1.Checked == true)
                    {
                        string deskPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                        ShortCut.Create(patch + "\\Program.exe", deskPath + "\\Program.lnk", "", "Тот самый ярлык, как и просили");
                    }
                    byte[] resf1;
                    resf1 = Properties.Resources.lab7;
                    System.IO.File.WriteAllBytes(patch + "\\KeyGen.exe", resf1);
                    if (checkBox1.Checked == true)
                    {
                        string deskPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                        ShortCut.Create(patch + "\\KeyGen.exe", deskPath + "\\KeyGen.lnk", "", "Тот самый ярлык, как и просили");
                    }
                    MessageBox.Show("Программа установлена");

                    RegistryKey currentUserKey = Registry.CurrentUser;
                    RegistryKey softwareKey    = currentUserKey.OpenSubKey("Software", true);
                    RegistryKey myKey          = softwareKey.CreateSubKey("Kovalenko");
                    myKey.SetValue("user", SystemInformation.UserName);
                    myKey.SetValue("pcName", Environment.MachineName);
                    myKey.SetValue("mouseKey", mouse.ToString());
                    myKey.SetValue("display", SystemInformation.PrimaryMonitorSize.ToString());
                    myKey.SetValue("login", "Admin");
                    myKey.SetValue("password", "admin");
                    myKey.Close();
                    softwareKey.Close();

                    Application.Exit(); // Завершить приложение
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
Exemple #14
0
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        GetNode <Timer>("MessageTimer").Connect("timeout", this, nameof(OnMessageTimerTimeout));
        GetNode <Button>("StartButton").Connect("pressed", this, nameof(OnStartButtonPressed));

        ShortCut         shortCut    = new ShortCut();
        InputEventAction eventAction = new InputEventAction();

        eventAction.Action = "ui_select";
        shortCut.Shortcut  = eventAction;

        GetNode <Button>("StartButton").Shortcut = shortCut;
    }
Exemple #15
0
        public MainWindow()
        {
            InitializeComponent();
            instances = InitializeInstances();
            Xml xml = new Xml();

            ShortCut.init_shortcut(Strings.title);
            xml.Init_xml();
            CheckUpdate.init_checkUpdate();
            Init_minimize();
            ModeCheck();
            this.Descript_text.Text = Strings.title + " v" + ShortCut.myVersion;
        }
Exemple #16
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var shortcuts = ShortCut.LoadShortcuts();
            var textboxes = new System.Windows.Controls.TextBox[] { TargetShowKeyText, TargetHideKeyText, WindowShowKeyText, WindowHideKeyText };

            for (int i = 0; i < textboxes.Length; i++)
            {
                var textbox = textboxes[i];
                if (i >= shortcuts.Count)
                {
                    break;
                }
                textbox.Text = GetKeyString(shortcuts[i]);
            }
        }
Exemple #17
0
        private void menu_MenuItemMouseMove(object sender, MouseEventArgs e)
        {
            if (isDrag)
            {
                ShortCut item = sender as ShortCut;
                MainPage.isDrag = true;
                Point p  = e.GetPosition(shortCutPanel);
                Point p2 = e.GetPosition(item);

                Canvas.SetLeft(dragShortCut, p.X - p2.X);
                Canvas.SetTop(dragShortCut, p.Y - p2.Y);
                dragShortCut.DataContext = item.DataContext;
                dragShortCut.Visibility  = System.Windows.Visibility.Visible;
                dragShortCut.Opacity     = 0.5;
            }
        }
Exemple #18
0
        public bool AddByUser(ShortCut entity, string userid)
        {
            bool result = true;

            if (!IsExists(entity.ShortCutID))
            {
                result = this.Add(entity);
            }

            if (result)
            {
                result = AddUserShortCut(entity.ShortCutID, userid);
            }

            return(result);
        }
Exemple #19
0
        /// <summary>
        /// 新增一个ShortCut到数据库中
        /// </summary>
        /// <param name="model">ShortCut数据</param>
        /// <returns>是否新增成功</returns>
        public bool Add(ShortCut model)
        {
            try
            {
                return(dal.Add(model));
            }
            catch (Exception ex)
            {
                #region 将异常写入日志文件
                StackFrame frame = (new StackTrace(true)).GetFrame(1);
                Utility.Log(this.GetType().FullName, frame.GetMethod().Name, ex);
                #endregion

                return(false);
            }
        }
Exemple #20
0
 public MainWindow()
 {
     InitializeComponent();
     ShortCut.init_shortcut("AntiRecall");
     ShortCut.init_xml();
     CheckUpdate.init_checkUpdate();
     init_minimize();
     if (ShortCut.CheckXml())
     {
         QQPath.Text   = ShortCut.QueryXml("QQPath");
         PortText.Text = ShortCut.QueryXml("PortText");
     }
     else
     {
         ShortCut.CreateXml(ShortCut.antiRElement);
     }
 }
Exemple #21
0
        public void CalculateWeight(string term, IEnumerable <Lock> locks)
        {
            LockCount = locks.Count(l => l.BuildingId.Equals(Id));

            if (string.IsNullOrWhiteSpace(term))
            {
                return;
            }

            var sourceArray = term.Split(new char[] { ' ' });

            foreach (var text in sourceArray)
            {
                if (string.IsNullOrWhiteSpace(text))
                {
                    continue;
                }

                if (Name.IsMatch(text))
                {
                    SumWeight += WeightList.Where(w => w.Name == "name").Select(w => w.W).FirstOrDefault();
                    if (LockCount > 0)
                    {
                        SumWeight += WeightList.Where(w => w.Name == "name").Select(w => w.WT).FirstOrDefault();
                    }
                }

                if (ShortCut.IsMatch(text))
                {
                    SumWeight += WeightList.Where(w => w.Name == "shortCut").Select(w => w.W).FirstOrDefault();
                    if (LockCount > 0)
                    {
                        SumWeight += WeightList.Where(w => w.Name == "shortCut").Select(w => w.WT).FirstOrDefault();
                    }
                }

                if (Description.IsMatch(text))
                {
                    SumWeight += WeightList.Where(w => w.Name == "description").Select(w => w.W).FirstOrDefault();
                    if (LockCount > 0)
                    {
                        SumWeight += WeightList.Where(w => w.Name == "description").Select(w => w.WT).FirstOrDefault();
                    }
                }
            }
        }
Exemple #22
0
        public void GetValidShortCuts_MultipleKeysDateMatch_ReturnJustRightShortcuts()
        {
            var shortCuts = new List <ShortCut>();

            shortCuts.Add(new ShortCut("ctbn", "12345-000"));
            var matchDate = new DateTime(2000, 1, 1);
            var findMe    = new ShortCut("ctbn", "54321-000", matchDate);

            shortCuts.Add(findMe);
            var andMe = new ShortCut("ktln", "25710-420(feature)");

            shortCuts.Add(andMe);

            var validShortCuts = WorkDayParserSettings.ValidShortCuts(shortCuts, matchDate);

            CollectionAssert.AreEqual(new[] { findMe, andMe }, validShortCuts);
        }
Exemple #23
0
        private void menu_MenuItemMouseDown(object sender, MouseButtonEventArgs e)
        {
            ShortCut item = sender as ShortCut;

            MainPage.isDrag = true;
            Point p  = e.GetPosition(shortCutPanel);
            Point p2 = e.GetPosition(item);

            Canvas.SetLeft(dragShortCut, p.X - p2.X);
            Canvas.SetTop(dragShortCut, p.Y - p2.Y);

            dragShortCut.DataContext = item.DataContext;
            dragShortCut.Titel       = item.Titel;
            dragShortCut.Icon        = item.Icon;
            dragShortCut.Visibility  = System.Windows.Visibility.Collapsed;
            dragShortCut.Opacity     = 0.5;
        }
Exemple #24
0
        private void initializeHotKey()
        {
            this.KeyBinder.Clear();

            var sc = ShortCut.LoadShortcuts();
            var i  = 0;

            this.KeyBinder.AddBindHandler(sc[i].key, sc[i ++].modifierKey, delegate(object sender, KeyPressedEventArgs e) {
                this.showFetishes();
            });
            this.KeyBinder.AddBindHandler(sc[i].key, sc[i ++].modifierKey, delegate(object sender, KeyPressedEventArgs e) {
                this.hideFetishes();
            });
            this.KeyBinder.AddBindHandler(sc[i].key, sc[i ++].modifierKey, delegate(object sender, KeyPressedEventArgs e) {
                this.Show();
            });
            this.KeyBinder.AddBindHandler(sc[i].key, sc[i ++].modifierKey, delegate(object sender, KeyPressedEventArgs e) {
                this.Hide();
            });
        }
        /*
         * private void UpdateCount()
         * {
         *  Regex re = new Regex("\\[\\d*\\]");
         #if DEBUG
         *  Console.WriteLine(count);
         #endif
         *  Recall_Text.Text = re.Replace(Recall_Text.Text, "["+Convert.ToString(Math.Ceiling(count / 8))+"]");
         * }
         *
         * public void ModifyRecallCount()
         * {
         *  Recall_Text.Dispatcher.Invoke(
         *      System.Windows.Threading.DispatcherPriority.Normal,
         *      new TextChanger(UpdateCount));
         * }*/


        public MainWindow()
        {
            InitializeComponent();
            ShortCut.init_shortcut("AntiRecall");
            Xml.init_xml();
            CheckUpdate.init_checkUpdate();
            init_minimize();
            if (Xml.CheckXml())
            {
                Xml.antiRElement["PortText"] = Xml.QueryXml("PortText");
                Xml.antiRElement["QQPath"]   = Xml.QueryXml("QQPath");
                Xml.antiRElement["Mode"]     = Xml.QueryXml("Mode");
                PortText.Text = Xml.antiRElement["PortText"];
            }
            else
            {
                Xml.CreateXml(Xml.antiRElement);
            }
            ModeCheck();
            this.Descript_text.Text = Xml.antiRElement["Descript"];
        }
Exemple #26
0
        public void CreatedShortCutShouldShownInNextMonth()
        {
            var vm = new MainViewModel(Dispatcher.CurrentDispatcher);

            var newSc = new ShortCut();

            newSc.Key       = newSc.ID;
            newSc.Expansion = "8,8;12345-000";
            newSc.ValidFrom = DateTime.Now;
            vm.EditShortCut = new ShortcutViewModel(newSc, vm.WorkWeek, vm.Settings, null);
            vm.EditShortCut.SaveShortcut();

            var shortCut = vm.WorkWeek.Month.ShortCutStatistic.FirstOrDefault(s => s.Key.Equals(newSc.Key));

            Assert.NotNull(shortCut);
            Assert.AreEqual(newSc.Key, shortCut.Key);

            vm.SelectDate(vm.WorkWeek.StartDate.AddMonths(1));

            shortCut = vm.WorkWeek.Month.ShortCutStatistic.FirstOrDefault(s => s.Key.Equals(newSc.Key));
            Assert.NotNull(shortCut);
            Assert.AreEqual(newSc.Key, shortCut.Key);
        }
Exemple #27
0
 public MainWindow()
 {
     InitializeComponent();
     ShortCut.init_shortcut("AntiRecall");
     init_minimize();
 }
Exemple #28
0
 public void DeleteShortcut(ShortCut delsc)
 {
     this.MonlistSettings.ParserSettings.ShortCuts.Remove(delsc);
     this.WorkWeek.Month.ReloadShortcutStatistic(this.MonlistSettings.ParserSettings.GetValidShortCuts(this.WorkWeek.StartDate));
     this.WorkWeek.Reparse();
 }
    private void OnGUI()
    {
        //Get pressed keys
        var e = Event.current;

        if (e?.isKey == true)
        {
            switch (e.type)
            {
            case EventType.KeyDown:
                switch (e.keyCode)
                {
                // Here you will need all allowed keycodes
                case KeyCode.A:
                case KeyCode.B:
                case KeyCode.C:
                case KeyCode.D:
                case KeyCode.E:
                case KeyCode.F:
                case KeyCode.G:
                case KeyCode.H:
                case KeyCode.I:
                case KeyCode.J:
                case KeyCode.K:
                case KeyCode.L:
                case KeyCode.M:
                case KeyCode.N:
                case KeyCode.O:
                case KeyCode.P:
                case KeyCode.Q:
                case KeyCode.R:
                case KeyCode.S:
                case KeyCode.T:
                case KeyCode.U:
                case KeyCode.V:
                case KeyCode.W:
                case KeyCode.X:
                case KeyCode.Y:
                case KeyCode.Z:
                case KeyCode.F1:
                case KeyCode.F2:
                case KeyCode.F3:
                case KeyCode.F4:
                case KeyCode.F5:
                case KeyCode.F6:
                case KeyCode.F7:
                case KeyCode.F8:
                case KeyCode.F9:
                case KeyCode.F10:
                case KeyCode.F11:
                case KeyCode.F12:
                case KeyCode.F13:
                case KeyCode.F14:
                case KeyCode.F15:
                case KeyCode.Comma:
                case KeyCode.Plus:
                case KeyCode.Minus:
                case KeyCode.Period:
                    // etc depends on your needs I guess
                    changed = true;
                    newKeys = new ShortCut(e.keyCode, e.control, e.alt, e.shift);

                    // Refresh the EditorWindow
                    Repaint();
                    break;
                }
                break;
            }

            // Use all key presses so nothing else handles them
            // e.g. also not the Unity editor itself like e.g. for CTRL + S
            e.Use();
        }

        EditorGUILayout.LabelField("Current Shortcut");
        EditorGUILayout.HelpBox(keys.ToString(), MessageType.None);

        EditorGUILayout.Space();

        EditorGUILayout.LabelField("Press buttons to assign a new shortcut", EditorStyles.textArea);

        EditorGUILayout.HelpBox(newKeys.ToString(), MessageType.None);

        EditorGUILayout.Space();

        EditorGUILayout.BeginHorizontal();
        {
            if (GUILayout.Button("Cancel"))
            {
                Close();
            }
            EditorGUI.BeginDisabledGroup(!changed);
            {
                if (GUILayout.Button("Save"))
                {
                    callback?.Invoke(newKeys);
                    Close();
                }
            }
            EditorGUI.EndDisabledGroup();
        }
        EditorGUILayout.EndHorizontal();
    }
Exemple #30
0
 static void Main(string[] args)
 {
     ShortCut a = new ShortCut();
     Console.Out.WriteLine("{0}",
         a.suvTime(new int[]{0, 10, 10, -40, -40, 5, 5, 150, 150, 160, 160, 150, 150}
                 , new int[] {0, 0, -10, -10, 50, 5, 50, 50, 60, 60, -10, -10, 0})
         );
     Console.In.ReadLine();
 }
Exemple #31
0
 public bool Delete(ShortCut entity)
 {
     throw new NotImplementedException();
 }
Exemple #32
0
 public WorkItem(TimeItem start, TimeItem end, string project, string position, string description, ShortCut shortCut, string originalString)
 {
     this.Start          = start;
     this.End            = end;
     this.Project        = project;
     this.Position       = position;
     this.Description    = description;
     this.ShortCut       = shortCut;
     this.OriginalString = originalString;
 }