Exemplo n.º 1
0
        private void OnClickRename(object sender, RoutedEventArgs e)
        {
            ItemType    type;
            List <Item> items = GetSelected();

            foreach (var x in items)
            {
                if (x.Directory != null)
                {
                    type = ItemType.Directory;
                }
                else
                {
                    type = ItemType.File;
                }
                RenameDialog dialog = new RenameDialog(type, x.Name, x.Extension);
                dialog.ShowDialog();
                if (dialog.Name != "")
                {
                    if (type == ItemType.Directory)
                    {
                        FileSystem.Rename(x.Directory, dialog.Name);
                    }
                    else
                    {
                        FileSystem.Rename(x.File, dialog.Name + dialog.Extension);
                    }
                }
            }
            NotifyObserves("Rename");
        }
Exemplo n.º 2
0
        private void OnClickNew(object sender, RoutedEventArgs e)
        {
            RenameDialog dialog = new RenameDialog();
            var          panel  = GetActivePanel();

            dialog.ShowDialog();
            if (dialog.Name != "")
            {
                FileSystem.New(panel.GetCurrentDirectory(), dialog.Type, dialog.Name, dialog.Extension);
                NotifyObserves("New");
            }
        }
Exemplo n.º 3
0
 private void OnClickRename(object sender, RoutedEventArgs e)
 {
     ItemType type;
     List<Item> items = GetSelected();
     foreach (var x in items)
     {
         if (x.Directory != null) type = ItemType.Directory;
         else type = ItemType.File;
         RenameDialog dialog = new RenameDialog(type, x.Name, x.Extension);
         dialog.ShowDialog();
         if (dialog.Name != "")
         {
             if (type == ItemType.Directory) FileSystem.Rename(x.Directory, dialog.Name);
             else FileSystem.Rename(x.File, dialog.Name + dialog.Extension);
         }
     }
     NotifyObserves("Rename");
 }
Exemplo n.º 4
0
 private void OnClickNew(object sender, RoutedEventArgs e)
 {
     RenameDialog dialog = new RenameDialog();
     var panel = GetActivePanel();
     dialog.ShowDialog();
     if (dialog.Name != "")
     {
         FileSystem.New(panel.GetCurrentDirectory(), dialog.Type, dialog.Name, dialog.Extension);
         NotifyObserves("New");
     }
 }
Exemplo n.º 5
0
 private void OnClickRename(object sender, RoutedEventArgs e)
 {
     ItemType type;
     List<Item> items = GetSelected();
     foreach (var x in items)
     {
         if (x.Directory != null) type = ItemType.Directory;
         else type = ItemType.File;
         RenameDialog dialog = new RenameDialog(type, x.Name, x.Extension);
         dialog.ShowDialog();
         if ((x.Directory != null && dialog.Name.Length + x.Directory.Parent.FullName.Length >= FileSystem.MaxPathLength)
             || (x.File != null && dialog.Name.Length + dialog.Extension.Length + x.File.Directory.FullName.Length >= FileSystem.MaxPathLength))
         {
             MessageBox.Show("A full path cannot be longer than " + FileSystem.MaxPathLength + " symbols");
             return;
         }
         if ((dialog.Name != x.Name)
             || (type == ItemType.File && dialog.Extension != x.Extension))
         {
             if (type == ItemType.Directory)
             {
                 string correctName = dialog.Name;
                 int dotOrSpace = correctName.Length - 1;
                 while (correctName[dotOrSpace] == '.' || correctName[dotOrSpace] == ' ')
                     --dotOrSpace;
                 if (dotOrSpace != correctName.Length - 1) correctName = correctName.Remove(dotOrSpace + 1);
                 if (correctName != x.Name) FileSystem.Rename(x.Directory, correctName);
             }
             else FileSystem.Rename(x.File, dialog.Name, dialog.Extension);
             NotifyObserves("Rename");
         }
     }
 }
Exemplo n.º 6
0
 private void OnClickNew(object sender, RoutedEventArgs e)
 {
     RenameDialog dialog = new RenameDialog();
     var panel = GetActivePanel();
     dialog.ShowDialog();
     if (dialog.Name.Length + dialog.Extension.Length + panel.GetCurrentDirectory().FullName.Length >= FileSystem.MaxPathLength)
     {
         MessageBox.Show("A full path cannot be longer than " + FileSystem.MaxPathLength + " symbols");
         return;
     }
     else if (dialog.Name != "")
     {
         FileSystem.New(panel.GetCurrentDirectory(), dialog.Type, dialog.Name, dialog.Extension);
         NotifyObserves("New");
     }
 }