示例#1
0
        private void btnAddButton_Click(object sender, EventArgs e)
        {
            var editor = new ButtonEditor();

            editor.TabName = tcButtonHousing.SelectedTab.Name;
            if (editor.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            var info = new ButtonInfo()
            {
                TabName     = editor.TabName,
                Title       = editor.ButtonTitle,
                Description = editor.ButtonDescription
            };

            _AllButtons.Buttons.Add(info);
            using (StreamWriter writer = new StreamWriter("DynamicButtons.txt"))
            {
                ButtonSet.WriteButtons(writer, _AllButtons);
            }
            this.LoadButtons("");
            return;

            var process = Process.Start("notepad.exe", "DynamicButtons.txt");

            process.EnableRaisingEvents = true;
            process.Exited += Process_Exited;
        }
示例#2
0
        private static ButtonInfo ReadButtonLine(string line)
        {
            var info = new ButtonInfo();

            char[]   delimiters = new char[] { '|' };
            string[] fragments  = line.Split(delimiters);
            if (fragments.Length < 2)
            {
                return(null);
            }
            int i = 0;

            if (fragments.Length < 3)
            {
                info.TabName = "Main";
            }
            else
            {
                info.TabName = fragments[i++];
            }
            info.Title       = fragments[i++];
            info.Description = fragments[i++];
            return(info);
        }
示例#3
0
 public static string WriteLine(ButtonInfo info)
 {
     return(string.Format("{0}|{1}|{2}", Encode(info.TabName), Encode(info.Title), Encode(info.Description)));
 }