예제 #1
0
 public static bool CheckName(PackageBase package, ProjectItemType type, string name)
 {
     if (package == null) return true;
     foreach (var i in package.Items)
     {
         if (i.ItemType == type && i.Name == name)
             return false;
     }
     return true;
 }
예제 #2
0
 void CloseItems(PackageBase package)
 {
     foreach (IProjectItem item in package.Items)
     {
         if (item is PackageBase)
             CloseItems((PackageBase)item);
         if (item is IDocumentItem)
             ((IDocumentItem)item).Close();
     }
 }
예제 #3
0
 public static string GetName(PackageBase package, ProjectItemType type, string initName)
 {
     string n = initName;
     int i = 1;
     do
     {
         if (CheckName(package, type, n))
             return n;
         n = initName + i++;
     }
     while (true);
 }
예제 #4
0
 public void Move(IProjectItem item, PackageBase to)
 {
     if (!to.items.Contains(item))
     {
         if (!Project.CheckName(to, item.ItemType, item.Name))
             throw new BadSyntaxException(Strings.ErrorNameExists.FormatArgs(item.Name));
         items.Remove(item);
         to.items.Add(item);
         item.Package = to;
         OnModified(EventArgs.Empty);
     }
 }