Пример #1
0
 public void RemoveMethod(string name)
 {
     ProjectChanged = true;
     FileNames.Remove(name);
     Sources.Remove(name);
     Comments.Remove(name);
     FilesChanged.Remove(name);
 }
Пример #2
0
        private void RemoveButton_Click(object sender, RoutedEventArgs e)
        {
            var selected = FileNamesList.SelectedItems.Cast <object>().ToArray();

            foreach (var item in selected)
            {
                FileNames.Remove((string)item);
            }
        }
Пример #3
0
 public void RenameMethod(string name, string newName)
 {
     if (!Sources.ContainsKey(name))
     {
         throw new ArgumentException("Unknown method name");
     }
     if (Sources.ContainsKey(newName))
     {
         throw new ArgumentException("Method " + newName + " already exists.");
     }
     if (newName.Length != name.Length)
     {
         throw new ArgumentException("New method name must have same number of symbols as old name");
     }
     if (newName.Length != 1 && newName.Length != 4)
     {
         throw new ArgumentException("Incorrect length of new method name");
     }
     if (newName.Length == 1 && (!System.Text.RegularExpressions.Regex.IsMatch(newName, "[B-Za-z]") || newName == "A" || newName == "V"))
     {
         throw new ArgumentException("Incorrect method name.\nMethod name must be 1 Latin character except 'A' or 'V'");
     }
     ProjectChanged = true;
     Sources.Add(newName, Sources[name]);
     Sources.Remove(name);
     FileNames.Add(newName, FileNames[name]);
     FileNames.Remove(name);
     FilesChanged.Add(newName, FilesChanged[name]);
     FilesChanged.Remove(name);
     Comments.Add(newName, Comments[name]);
     Comments.Remove(name);
     if (name.Length == 1)
     {
         char old = name[0];
         char nw  = newName[0];
         foreach (var a in Sources.Keys)
         {
             for (int i = 0; i < 16; i++)
             {
                 for (int j = 0; j < 16; j++)
                 {
                     if (Sources[a][i, j] == old)
                     {
                         Sources[a][i, j] = nw;
                     }
                 }
             }
         }
     }
 }
Пример #4
0
        public void Close(TabFileItem tabItem)
        {
            int index = TabFileItems.IndexOf(tabItem);

            FileNames.Remove(tabItem.FileName);
            TabFileItems.Remove(tabItem);
            tabItem.TailService.Dispose();

            if (TabFileItems.Count == 0)
            {
                Buffer.Clear();
            }

            SelectedTab = TabFileItems.Any() ? TabFileItems[Math.Min(index, TabFileItems.Count - 1)] : null;
        }