Example #1
0
        private void folderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //MyGlobal.createNewDirectory(server.serverPort.Stream,)
            InputBoxForm di = new InputBoxForm();

            di.Response = "New Folder";
            di.initiateText("Enter the name of folder", "Add New Folder");
            if (di.ShowDialog(this) == DialogResult.OK)
            {
                string des = "";
                if (addressBox.Text.EndsWith("\\"))
                {
                    des = addressBox.Text + di.Response;
                }
                else
                {
                    des = $"{addressBox.Text}\\{di.Response}";
                }

                MyGlobal.createNewDirectory(server.serverPort.Stream, des);

                refreshContent();
            }
            di.Dispose();
        }
Example #2
0
        private void renameToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ListViewItem sItem = contentView.SelectedItems[0];  //GET THE SELECTED OBJECT

            switch (recognizeSelectedItem(sItem))
            {
            case 1:     //DRIVE
                break;

            case 2:     //DIRECTORY
                r.DirectoryInformationResponse.DirectoryInfo dir = (r.DirectoryInformationResponse.DirectoryInfo)sItem.Tag;
                InputBoxForm di = new InputBoxForm();
                di.Response = dir.Name;
                di.initiateText("Enter the new name of folder", "Rename Folder");
                if (di.ShowDialog(this) == DialogResult.OK)
                {
                    string des = dir.FullName.Substring(0, dir.FullName.Length - dir.Name.Length) + di.Response;
                    if (des != dir.FullName)
                    {
                        FileSystem.RequestRename(server.serverPort.Stream, dir.FullName, des);
                    }
                }
                di.Dispose();
                break;

            case 3:     //FILE
                r.FileInformationResponse.FileInfo fil = (r.FileInformationResponse.FileInfo)sItem.Tag;
                InputBoxForm diF = new InputBoxForm();
                diF.Response = fil.Name;
                diF.initiateText("Enter the new name of file", "Rename File");
                if (diF.ShowDialog(this) == DialogResult.OK)
                {
                    string des = fil.FullName.Substring(0, fil.FullName.Length - fil.Name.Length) + diF.Response;
                    if (des != fil.FullName)
                    {
                        FileSystem.RequestRename(server.serverPort.Stream, fil.FullName, des);
                    }
                }
                diF.Dispose();
                break;

            case 0:
                MessageBox.Show("UnKnown Item found", "Error");
                break;
            }
            refreshContent();       //REQUEST FOR NEW CONTENTS
        }