private void NaviBoxEvent_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            string newName = CurrentDirectoryPath + e.Label;

            if (e.Label == null)
            {
                return;
            }
            ASCIIEncoding AE = new ASCIIEncoding();

            char[] temp = e.Label.ToCharArray();

            for (int x = 0; x < temp.Length; x++)
            {
                byte[] bc = AE.GetBytes(temp[x].ToString());

                if (bc[0] > 47 && bc[0] < 58)
                {
                    e.CancelEdit = true;
                    MessageBox.Show("The text for the item cannot contain numerical values.");
                    return;
                }
            }
            if (NavigatorBoxControl.IsItADirectory(NavigatorBoxControl.SelectionPath))
            {
                FileAndDirOperations.RenameDirectory(NavigatorBoxControl.SelectionPath, newName);
            }
            FileAndDirOperations.RenameFile(NavigatorBoxControl.SelectionPath, newName);
            NavigatorBoxControl.SelectionPath = newName;
        }
Exemple #2
0
 public static void CheckIfDecryptable()
 {
     if (!IsItADirectory(SelectionPath))
     {
         try
         {
             FileAndDirOperations.DecryptFile(SelectionPath);
             return;
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex);
         }
     }
     CustomDialog.ErrorMessage("Selection is not a file: it cannot be decrypted.", "Error");
 }
        public bool KeyPressed(Keys key)
        {
            if (key == Keys.Enter)
            {
                return(true);
            }

            if (key == Keys.Back)
            {
                NavigateOneDirectoryUp();
            }

            if (key == Keys.F2 && NaviBox.SelectedItems.Count > 0)
            {
                NaviBox.SelectedItems[0].BeginEdit();
            }

            if (key == Keys.F3)
            {
                FileAndDirOperations.PackFile(NavigatorBoxControl.MakeFileInfoFromPath());
            }

            if (key == Keys.F4)
            {
                FileAndDirOperations.UnpackFile(NavigatorBoxControl.MakeFileInfoFromPath());
            }

            if (key == Keys.F5)
            {
                NavigatorBoxControl.ShowFileProperties(NavigatorBoxControl.SelectionPath);
            }

            if (key == Keys.Delete)
            {
                if (NavigatorBoxControl.IsItADirectory(NavigatorBoxControl.SelectionPath))
                {
                    FileAndDirOperations.DeleteDirectory(NavigatorBoxControl.SelectionPath);
                }
                FileAndDirOperations.DeleteFile(NavigatorBoxControl.SelectionPath);
            }

            if (key == Keys.Escape)
            {
                Application.Exit();
            }
            return(false);
        }
 private void deleteDELToolStripMenuItem_Click(object sender, EventArgs e)
 {
     FileAndDirOperations.DeleteFile(NavigatorBoxControl.SelectionPath);
 }
 private void unpackToolStripMenuItem_Click(object sender, EventArgs e)
 {
     FileAndDirOperations.UnpackFile(NavigatorBoxControl.MakeFileInfoFromPath());
 }