Example #1
0
        private void CopyData(XDocument xml)
        {
            foreach (var copy in xml.Root.Elements("copys").Elements("copy"))
            {
                bool ctrl, shift, window;

                bool.TryParse(copy.Element("shift").Value, out shift);
                bool.TryParse(copy.Element("window").Value, out window);
                bool.TryParse(copy.Element("ctrl").Value, out ctrl);

                var  header  = copy.Element("string").Element("header").Value;
                var  footer  = copy.Element("string").Element("footer").Value;
                var  content = copy.Element("string").Element("content").Value;
                Keys key;
                var  keyValue = copy.Element("key").Value;
                keyValue = char.ToUpper(keyValue[0]) + keyValue.Substring(1);
                if (!Enum.TryParse(keyValue, out key))
                {
                    var message = "Unable to convert string " + keyValue + " to key. Your hotkeys.xml file is invalid.";
                    MessageBox.Show(message);
                    throw new InvalidConfigFileException(message);
                }
                var order    = copy.Element("string").Element("order").Value;
                var orderBy  = copy.Element("string").Element("order_by").Value;
                var modifier = ConvertToModifierKey(ctrl, false, shift, window);
                Copy.Add(new CopyKey(header, footer, content, modifier, key, orderBy, order));
            }
        }
Example #2
0
        private void CopyData(XDocument xml)
        {
            try
            {
                foreach (var copy in xml.Root.Elements("copys").Elements("copy"))
                {
                    bool ctrl, shift, window;

                    bool.TryParse(copy.Element("shift").Value, out shift);
                    bool.TryParse(copy.Element("window").Value, out window);
                    bool.TryParse(copy.Element("ctrl").Value, out ctrl);

                    var  header          = copy.Element("string").Element("header").Value.Replace("{body}", "");
                    var  footer          = copy.Element("string").Element("footer").Value.Replace("{body}", "");
                    var  content         = copy.Element("string").Element("content").Value.Replace("{body}", "");
                    var  lowDpsContent   = copy.Element("string").Element("low_dps_content")?.Value.Replace("{body}", "") ?? content;
                    var  lowDpsTreshold  = int.Parse(copy.Element("string").Element("low_dps_threshold")?.Value ?? "4");
                    var  limitNameLength = int.Parse(copy.Element("string").Element("limit_name_length")?.Value ?? "0");
                    Keys key;
                    var  keyValue = copy.Element("key").Value;
                    if (!Enum.TryParse(keyValue, out key))
                    {
                        var message = LP.Unable_to_get_key_from_string + " " + keyValue + ". " + LP.Your_hotkeys_xml_file_is_invalid;
                        MessageBox.Show(message);
                        continue;
                    }
                    var order    = copy.Element("string").Element("order").Value;
                    var orderBy  = copy.Element("string").Element("order_by").Value;
                    var modifier = ConvertToModifierKey(ctrl, false, shift, window);
                    Copy.Add(new CopyKey(header, footer, content, new HotKey(key, modifier), orderBy, order, lowDpsContent, lowDpsTreshold, limitNameLength));
                }
            }
            catch { MessageBox.Show(LP.Your_hotkeys_xml_file_is_invalid); }
        }
        private Task Add(Command command)
        {
            switch (command)
            {
            case Command.ToggleWindow:
                return(ToggleWindow.Add());

            case Command.NextTab:
                return(NextTab.Add());

            case Command.PreviousTab:
                return(PreviousTab.Add());

            case Command.NewTab:
                return(NewTab.Add());

            case Command.CloseTab:
                return(CloseTab.Add());

            case Command.NewWindow:
                return(NewWindow.Add());

            case Command.ShowSettings:
                return(ShowSettings.Add());

            case Command.Copy:
                return(Copy.Add());

            case Command.Paste:
                return(Paste.Add());
            }

            return(Task.CompletedTask);
        }
Example #4
0
 void ProcessFoundByChecksum(FileObjectMapping file, string found)
 {
     if (found.Equals(file.FilePath, StringComparison.OrdinalIgnoreCase))
     {
         ChangedCase.Add(found, file.FilePath);
     }
     else if (Copy.ContainsKey(found))
     {
         Copy[found].Add(file.FilePath);
     }
     else
     {
         Copy.Add(found, new List <string> {
             file.FilePath
         });
     }
 }
Example #5
0
        private void CopyData(XDocument xml)
        {
            foreach (var copy in xml.Root.Elements("copys").Elements("copy"))
            {
                bool ctrl, alt, shift, window;
                bool.TryParse(copy.Element("ctrl").Value, out ctrl);
                bool.TryParse(copy.Element("alt").Value, out alt);
                bool.TryParse(copy.Element("shift").Value, out shift);
                bool.TryParse(copy.Element("window").Value, out window);
                string header  = copy.Element("string").Element("header").Value;
                string footer  = copy.Element("string").Element("footer").Value;
                string content = copy.Element("string").Element("content").Value;
                Keys   key;
                if (!Enum.TryParse(copy.Element("key").Value, out key))
                {
                    Console.WriteLine("Unable to convert string {0} to key", copy.Element("key").Value);
                    throw new Exception("Unable to convert string " + copy.Element("key").Value + " to key");
                }

                var modifier = ConvertToModifierKey(ctrl, alt, shift, window);
                Copy.Add(new CopyKey(header, footer, content, modifier, key));
            }
        }
Example #6
0
        private void CopyData(XDocument xml)
        {
            try
            {
                foreach (

                    var copy in xml.Root.Elements("copys").Elements("copy"))
                {
                    bool ctrl, shift, window;

                    bool.TryParse(copy.Element("shift").Value, out shift);
                    bool.TryParse(copy.Element("window").Value, out window);
                    bool.TryParse(copy.Element("ctrl").Value, out ctrl);

                    var  header  = copy.Element("string").Element("header").Value;
                    var  footer  = copy.Element("string").Element("footer").Value;
                    var  content = copy.Element("string").Element("content").Value;
                    Keys key;
                    var  keyValue = copy.Element("key").Value;
                    if (!Enum.TryParse(keyValue, out key))
                    {
                        var message = LP.Unable_to_get_key_from_string + " " + keyValue + ". " + LP.Your_hotkeys_xml_file_is_invalid;
                        MessageBox.Show(message);
                        continue;
                    }
                    var order    = copy.Element("string").Element("order").Value;
                    var orderBy  = copy.Element("string").Element("order_by").Value;
                    var modifier = ConvertToModifierKey(ctrl, false, shift, window);
                    Copy.Add(new CopyKey(header, footer, content, modifier, key, orderBy, order));
                }
            }
            catch
            {
                MessageBox.Show(LP.Your_hotkeys_xml_file_is_invalid);
            }
        }