Exemplo n.º 1
0
 void DocumentManager_DocCreated(FormDocument doc, EventArgs e)
 {
     ListFiles.BeginUpdate();
     ListFiles.Items.Add(doc);
     ListFiles.SelectedItem = doc;
     ListFiles.EndUpdate();
 }
Exemplo n.º 2
0
        public static Assembly CompilerAndLoad(string[] source, string out_name)
        {
            if (Assemblys == null)
            {
                Assemblys = new Dictionary <string, Assembly>();
            }
            if (Assemblys.ContainsKey(out_name))
            {
                return(Assemblys[out_name]);
            }
            if (source == null || source.Length == 0)
            {
                throw new Exception("База проектов пуста!!!");
            }
            ListFiles listFiles = new ListFiles(out_name + ".txt");

            if (!FileSystem.ExistsFile(out_name) || listFiles.TestUpdate(source) || listFiles.GetFilesMaxDate() > FileSystem.GetLastWriteTime(out_name))
            {
                listFiles.ClearFiles();
                listFiles.Files.AddRange(source);
                listFiles.Write();
                var result = Compile(source, out_name);
                Assemblys.Add(out_name, result);
                return(result);
            }
            else
            {
                var result = Assembly.LoadFrom(out_name);
                Assemblys.Add(out_name, result);
                return(result);
            }
        }
Exemplo n.º 3
0
 private void ListDirectories_SelectionChanged()
 {
     if (ListDirectories.GetSelected() != null)
     {
         ListFiles.SetPath(ListDirectories.GetSelected().Value, filterList);
     }
 }
Exemplo n.º 4
0
        private void ImportMessageRename(List <MessageFileItem> listFiles, MessageItem messageItem)
        {
            if (messageItem == null || messageItem.Item == null)
            {
                return;
            }

            if ((listFiles != null && listFiles.Count > 0) || !messageItem.IsValid)
            {
                MessageFilesRenameForm frm = new MessageFilesRenameForm(listFiles, messageItem);
                frm.ShowModalDialog();
                if (frm.IsRefresh)
                {
                    ListFiles.AddRange(frm.Files);
                    _isSucceed = LibraryGroup.Current.ImportMessage(ListFiles, frm.Message.Item, ControlService.SignCombo.Current);
                    _name      = frm.Message.Item.Name;
                }
            }
            else
            {
                if (ListFiles.Count > 0)
                {
                    _isSucceed = LibraryGroup.Current.ImportMessage(ListFiles, messageItem.Item, ControlService.SignCombo.Current);
                }
                else
                {
                    _isSucceed = LibraryGroup.Current.Messages.Add(messageItem.Item);
                }
                _name = messageItem.Item.Name;
            }
        }
Exemplo n.º 5
0
        public CommandProcessor(SystemUser currentUser, SystemInfo info, ref FileSystem fs)
        {
            _currentUser    = currentUser;
            CurrentLocation = currentUser.HomeDir;
            _info           = info;

            /*
             *  COMMANDS HANDLERS INITIALIZATION
             */

            var listFiles = new ListFiles(ref fs);

            var changeDir = new ChangeDirectory(ref fs);

            // Update location
            changeDir.Navigated += delegate(string location)
            {
                CurrentLocation = location;
            };
            // Set current location to current user home directory
            changeDir.NavigatedToHome += delegate(string location)
            {
                CurrentLocation = _currentUser.HomeDir;
            };
            _commands = new List <Command>
            {
                changeDir,
                listFiles,
                new CreateFile(ref fs),
                new CreateDirectory(ref fs),
                new RemoveFile(ref fs),
                new Echo(ref fs),
                new ReadFile(ref fs),
            };
        }
Exemplo n.º 6
0
 public void ExtendedUncPathTests()
 {
     Assert.True(ListFiles.EnsureUncPrefixPresent(@"c:\plop") == @"\\?\c:\plop", @"local path case");
     Assert.True(ListFiles.EnsureUncPrefixPresent(@"\\localhost\plop") == @"\\?\unc\localhost\plop", @"\\<server> case");
     Assert.True(ListFiles.EnsureUncPrefixPresent(@"\\?\c:\plop") == @"\\?\c:\plop", @"no-op case with local path");
     Assert.True(ListFiles.EnsureUncPrefixPresent(@"\\?\unc\localhost\plop") == @"\\?\unc\localhost\plop", @"no-op case with network path");
 }
Exemplo n.º 7
0
 private void EditFilter_TextChanged(object sender, EventArgs e)
 {
     if (EditFilter.Text == EditFilter.PlaceholderText)
     {
         return;
     }
     ListFiles.BeginUpdate();
     ListFiles.Items.Clear();
     if (String.IsNullOrEmpty(EditFilter.Text))
     {
         ListFiles.Items.Clear();
         ListFiles.Items.AddRange(DocumentManager._Documents.ToArray());
     }
     else
     {
         foreach (FormDocument doc in DocumentManager._Documents)
         {
             if (doc.ToString().ToLowerInvariant().Contains(EditFilter.Text.ToLowerInvariant()))
             {
                 ListFiles.Items.Add(doc);
             }
         }
     }
     ListFiles.EndUpdate();
 }
Exemplo n.º 8
0
        private void ListFiles_OnDoubleTouchDown(object sender, TouchEventArgs e)
        {
            var file = ListFiles.GetSelected();

            if (file != null)
            {
                mainC.Exec(ImpCommand.OpenFile, file);
            }
        }
Exemplo n.º 9
0
        public void ButtonAddSelected_Clicked(object sender)
        {
            var list = ListFiles.GetSelectedList();

            foreach (var fileImpInfo in list)
            {
                mainC.Exec(ImpCommand.AddFile, fileImpInfo);
            }
        }
Exemplo n.º 10
0
        private void ImportPlaylistRename(List <MessageFileItem> listFiles, List <MessageItem> listMessages, List <TimeSliceGroupItem> listTimesliceGroups, List <PlaylistItem> listPlaylists, PlaylistItem playlistItem)
        {
            if (playlistItem == null || playlistItem.Item == null)
            {
                return;
            }
            if ((listFiles != null && listFiles.Count > 0) || (listMessages != null && listMessages.Count > 0) || (listTimesliceGroups != null && listTimesliceGroups.Count > 0) || (listPlaylists != null && listPlaylists.Count > 0) || !playlistItem.IsValid)
            {
                //Add playlistItem in listPlaylists

                PlaylistRenameForm frm = new PlaylistRenameForm(listFiles, listMessages, listTimesliceGroups, listPlaylists, playlistItem);
                frm.ShowModalDialog();
                if (frm.IsRefresh)
                {
                    ListFiles.AddRange(frm.Files);
                    if (_listMessages == null)
                    {
                        _listMessages = new List <MessageItem>();
                    }
                    _listMessages.AddRange(frm.Messages);
                    if (_listTimeSliceGroups == null)
                    {
                        _listTimeSliceGroups = new List <TimeSliceGroupItem>();
                    }
                    if (_listPlaylists == null)
                    {
                        _listPlaylists = new List <PlaylistItem>();
                    }
                    _listTimeSliceGroups.AddRange(frm.TimeSliceGroups);
                    _listPlaylists.AddRange(frm.Playlists);
                    _isSucceed = LibraryGroup.Current.ImportPlaylist(ListFiles, _listMessages, _listTimeSliceGroups, _listPlaylists, frm.PlaylistItem, ControlService.SignCombo.Current);
                    _name      = frm.PlaylistItem.Item.Name;
                    if (_listTimeSliceGroups != null && _listTimeSliceGroups.Count > 0)
                    {
                        LocalMessageBus.Send(this, new LibraryImportTimeSliceGroupMessage(null, LibraryType.TimeSliceGroup));
                    }
                }
            }
            else
            {
                if (ListFiles.Count > 0 || (_listMessages != null && _listMessages.Count > 0) || (_listTimeSliceGroups != null && _listTimeSliceGroups.Count > 0) || (_listPlaylists != null && _listPlaylists.Count > 0))
                {
                    _isSucceed = LibraryGroup.Current.ImportPlaylist(ListFiles, _listMessages, _listTimeSliceGroups, _listPlaylists, playlistItem, ControlService.SignCombo.Current);
                }
                else
                {
                    _isSucceed = LibraryGroup.Current.Playlists.Add(playlistItem.Item);
                }
                _name = playlistItem.Item.Name;
                if (_listTimeSliceGroups != null && _listTimeSliceGroups.Count > 0)
                {
                    LocalMessageBus.Send(this, new LibraryImportTimeSliceGroupMessage(null, LibraryType.TimeSliceGroup));
                }
                //LocalMessageBus.Send(this, new LibraryImportTimeSliceGroupMessage(playlistItem.Item.Name, playlistItem.Item.Type));
            }
        }
Exemplo n.º 11
0
 private void ListFiles_Click(object sender, EventArgs e)
 {
     try
     {
         FormDocument doc = (FormDocument)ListFiles.SelectedItem;
         doc.BringToFront();
         ListFiles.Focus();
     }
     catch { }
 }
Exemplo n.º 12
0
        public ListFilesResponse OnListFile(ListFiles list)
        {
            Loger.Process(LogType.INFO, "list {0} unittest files", list.UnitTest);
            ListFilesResponse response = new ListFilesResponse();
            TestInfo          test     = mTestFolderManager.GetInfo(list.UnitTest);

            if (test != null)
            {
                response.Files = test.ListFiles();
            }
            return(response);
        }
Exemplo n.º 13
0
        public MainWindow()
        {
            InitializeComponent();

            ListFiles   = new ListFiles(list_box_files_info);
            ListFormats = new ListFormats(list_box_formats);

            Folder = new Folder(label_path_info, text_folder);
            Folder.ChangePath(Properties.Settings.Default.Path);

            LoadUI();
        }
Exemplo n.º 14
0
        private void ListFiles_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var file = ListFiles.GetSelected();

            if (file != null)
            {
                mainC.Exec(ImpCommand.OpenFile, file);
            }
            //var files = ListFiles.GetSelectedList();
            //if (files.Count > 0)
            //    mainC.Exec(ImpCommand.OpenFile, files[0]);
        }
        public ActionResult ChooseFile(string dir, string curDir)
        {
            try
            {
                currentData = (CurrentData)Session["currentData"];
            }
            catch (Exception)
            {
                RedirectToAction("FileNull");
            }

            ListFiles lf = new ListFiles();

            lf.curDirectory = AppDomain.CurrentDomain.BaseDirectory + "App_Data";
            lf.prevdir      = "";
            if (curDir != null && dir != null)
            {
                lf.curDirectory = lf.curDirectory + curDir + dir;
                lf.prevdir      = curDir;
            }
            try
            {
                lf.files       = System.IO.Directory.GetFiles(lf.curDirectory);
                lf.directories = System.IO.Directory.GetDirectories(lf.curDirectory);
            }
            catch (System.IO.DirectoryNotFoundException)
            {
                currentData.errortext  = "Невозможно получить доступ к папке, попробуйте снова"; //для случаев, когда папка была удалена после получения списка
                Session["currentData"] = currentData;
                return(RedirectToAction("FileNull"));
            }

            for (int i = 0; i < lf.files.Count(); i++)
            {
                lf.files[i] = lf.files[i].Replace(lf.curDirectory, "");
            }
            for (int i = 0; i < lf.directories.Count(); i++)
            {
                lf.directories[i] = lf.directories[i].Replace(lf.curDirectory, "");
            }
            lf.curDirectory = lf.curDirectory.Replace(AppDomain.CurrentDomain.BaseDirectory + "App_Data", "");

            Session["currentData"] = currentData;
            return(PartialView(lf));

            //return HttpNotFound();
        }
Exemplo n.º 16
0
        public void FileNotExistsError()
        {
            var info   = A.Fake <ServerConnectionInformation>();
            var server = A.Fake <FTPTestWrapperAbstract>();

            info.UserName   = "******";
            info.PassWord   = "******";
            info.ServerName = "ftp://localhost";
            FtpWebResponse a = null;


            A.CallTo(() => server.getResp()).Returns(a);
            ListFiles crd  = new ListFiles(info);
            String    resp = crd.create(server);

            Assert.IsTrue(resp.Equals("success"));
        }
Exemplo n.º 17
0
        public void FileExistsReturnSuccess()
        {
            var info   = A.Fake <ServerConnectionInformation>();
            var server = A.Fake <FTPTestWrapperAbstract> ();

            info.UserName   = "******";
            info.PassWord   = "******";
            info.ServerName = "ftp://localhost";
            WebException ex = new WebException(
                "The remote server returned success (file found)",
                WebExceptionStatus.ProtocolError);


            Console.WriteLine(ex.Message);
            A.CallTo(() => server.getResp()).Throws(ex);
            ListFiles crd  = new ListFiles(info);
            String    resp = crd.create(server);

            Console.WriteLine(resp);
            Assert.IsTrue(resp.Equals("The remote server returned success (file found)"));
        }
Exemplo n.º 18
0
        } // end Main()

        private static void OnTimedEvent(object source, ElapsedEventArgs e)//Reference: https://docs.microsoft.com/en-us/dotnet/api/system.timers.timer?view=netframework-4.8
        {
            ServerConnectionInformation conn = new ServerConnectionInformation(username, password, server);

            Console.WriteLine(" You chose 3, List Files In Directory:  \n");
            ListFiles listFiles = new ListFiles(conn);
            String    response3 = listFiles.ListFilesOnRemoteServer();

            if (response3 == "success")
            {
                Console.Write("Success: Still connected to server \n");
                timeout = false;
                DisplayMenu();
                return;
            }
            else
            {
                Console.Write("Error: not connected to server");
                System.Environment.Exit(1);
            }
        }
Exemplo n.º 19
0
        private void ImportTimeSliceGroupRename(List <MessageFileItem> listFiles, List <MessageItem> listMessages, TimeSliceGroupItem groupItem)
        {
            if (groupItem == null || groupItem.Item == null)
            {
                return;
            }
            if ((listFiles != null && listFiles.Count > 0) || (listMessages != null && listMessages.Count > 0) || !groupItem.IsValid)
            {
                TimeSlieceGroupRenameForm frm = new TimeSlieceGroupRenameForm(listFiles, listMessages, groupItem);
                frm.ShowModalDialog();
                if (frm.IsRefresh)
                {
                    ListFiles.AddRange(frm.Files);
                    if (_listMessages == null)
                    {
                        _listMessages = new List <MessageItem>();
                    }
                    _listMessages.AddRange(frm.Messages);
                    _isSucceed = LibraryGroup.Current.ImportTimeSliceGroup(ListFiles, _listMessages, frm.Group.Item, ControlService.SignCombo.Current);
                    _name      = frm.Group.Item.Name;
                    LocalMessageBus.Send(this, new LibraryImportTimeSliceGroupMessage(frm.Group.Item.Name, frm.Group.Item.Type));
                }
            }
            else
            {
                if ((ListFiles.Count > 0) || (_listMessages != null && _listMessages.Count > 0))
                {
                    _isSucceed = LibraryGroup.Current.ImportTimeSliceGroup(ListFiles, _listMessages, groupItem.Item, ControlService.SignCombo.Current);
                }
                else
                {
                    _isSucceed = LibraryGroup.Current.TimeSliceGroups.Add(groupItem.Item);
                }
                _name = groupItem.Item.Name;

                LocalMessageBus.Send(this, new LibraryImportTimeSliceGroupMessage(groupItem.Item.Name, groupItem.Item.Type));
            }
        }
Exemplo n.º 20
0
        private void butStart_Click(object sender, EventArgs e)
        {
            SessionInfo  currentsession = new SessionInfo();
            WorkflowInfo current        = _workflowProvider.WorkflowsList[comboboxWorkflows.SelectedIndex];

            currentsession.WorkflowName = current.Name;
            for (int i = 0; i < current.EVLogs.Count; i++)
            {
                if (ListEv.GetItemChecked(i) == true)
                {
                    currentsession.SelectedEVLogs.Add(current.EVLogs[i]);
                }
            }
            for (int i = 0; i < current.FileLogs.Count; i++)
            {
                if (ListFiles.GetItemChecked(i) == true)
                {
                    currentsession.SelectedFileLogs.Add(current.FileLogs[i]);
                }
            }
            for (int i = 0; i < current.Traces.Count; i++)
            {
                if (ListTraces.GetItemChecked(i) == true)
                {
                    currentsession.SelectedTraces.Add(current.Traces[i]);
                }
            }
            if (butInformation.Checked)
            {
                currentsession.LogLevel = LogLevelEnum.Information;
            }
            if (butWarning.Checked)
            {
                currentsession.LogLevel = LogLevelEnum.Warning;
            }
            if (butError.Checked)
            {
                currentsession.LogLevel = LogLevelEnum.Error;
            }
            if (currentsession.SelectedEVLogs.Count == 0 && currentsession.SelectedFileLogs.Count == 0 && currentsession.SelectedTraces.Count == 0)
            {
                MessageBox.Show(this,
                                "At least one log or traces should be selected.",
                                "Start Session Error",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
            else
            {
                try
                {
                    _sessionProvider.StartSession(currentsession);
                }catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                ExistingSessionFormUi window1 = new ExistingSessionFormUi(_sessionProvider, this);
                this.Hide();
                window1.ShowDialog();
                this.Close();
            }
            this.butAll.Enabled = true;
        }
Exemplo n.º 21
0
 public void StripUncPathTests()
 {
     Assert.True(ListFiles.EnsureUncPrefixIsNotPresent(@"c:\plop") == @"c:\plop", @"no-op case");
     Assert.True(ListFiles.EnsureUncPrefixIsNotPresent(@"\\?\c:\plop") == @"c:\plop", @"\\?\ case");
     Assert.True(ListFiles.EnsureUncPrefixIsNotPresent(@"\\?\unc\localhost\plop") == @"\\localhost\plop", @"\\?\unc\ case");
 }
Exemplo n.º 22
0
        } // end DisplayMenu()

        public static bool GetResponce(String username, String password, String server, String getAnswer, LogFiles MyLogFile)
        {
            //string getAnswer = "";
            bool MyAnswer = false;

            getAnswer = Console.ReadLine();
            ServerConnectionInformation conn = new ServerConnectionInformation(username, password, server);

            switch (getAnswer)
            {
            case "14":
                Console.Clear();
                Console.Write(username);
                Console.WriteLine(" Logged out from server! \n");
                Console.WriteLine(" ########################################### \n");
                //Set response to 'true' to logout
                MyLogFile.WriteLog(username + " Logged Out From Server " + server);
                MyAnswer = true;
                break;

            case "13":
                Console.Clear();
                conn.Save();
                Console.WriteLine("Connection Info Saved.");
                System.Threading.Thread.Sleep(2000);
                Console.Clear();
                MyLogFile.WriteLog(username + "Saved Connecton Info");
                MyAnswer = false;
                break;

            case "12":
                Console.Clear();
                FileDownloadMultiple fdm = new FileDownloadMultiple(conn);
                string r = fdm.Download();
                if (r == "disconnect")
                {
                    Console.WriteLine("Download Files Failed\n");
                    MyLogFile.WriteLog(username + " downloading files failed");
                }
                else if (r == "success")
                {
                    Console.WriteLine("Download Files Successful\n");
                    MyLogFile.WriteLog(username + " downloading files successful");
                }
                MyAnswer = false;
                break;

            case "11":
                //Put Multiple files on remote server
                PutMultipleFiles PutFilesToRemote = new PutMultipleFiles(conn);
                Console.WriteLine(" \n ** Specify local directory path of files to be uploaded \n (Mention absolute path in this format, for ex: C:/xyz/test/ ** \n");
                String sourcefile_m = PutFilesToRemote.getFileName();
                Console.WriteLine(" \n ** Specify files to be uploaded from aforementioned path. (Mention each file name separated by a comma. for ex: abc.txt, xyz.png, 123.txt). Filetypes accepted: .txt, .jpg, .png ** \n");
                String inputfilenames_m = PutFilesToRemote.getFileName();
                Console.WriteLine(" \n ** Specify directory name on server where source directory is to be copied (for ex: test). \n");
                String destinationfileonserver_m = PutFilesToRemote.getFileName();
                String res_m = PutFilesToRemote.CopyFiles(sourcefile_m, destinationfileonserver_m, inputfilenames_m);
                if (res_m == "success")
                {
                    Console.Write("\n **** Uploade files complete. Please check messages for further info **** \n \n");
                    MyLogFile.WriteLog(username + " Upload Files Complete");
                }
                else
                {
                    Console.Write("\n **** Could not upload files due to an error: \n" + res_m + "\n");
                    MyLogFile.WriteLog(username + " Could Not Upload Files due to an error: " + res_m);
                }
                MyAnswer = false;
                break;

            case "10":
                //Copy Directory (including all files and subdirectory)
                CopyDirectory CopyDirectoryToRemote = new CopyDirectory(conn);
                Console.WriteLine(" ** Specify Directory to be copied to remote server \n (Mention absolute path in this format, for ex: C:/xyz/test/. Filetypes accepted: .txt, .jpg, .png ** \n");
                String sourcefile = CopyDirectoryToRemote.getFileName();
                Console.WriteLine(" \n ** Specify directory name on server where source directory is to be copied (for ex: test). \n");
                String destinationfileonserver = CopyDirectoryToRemote.getFileName();
                String res = CopyDirectoryToRemote.CopyDirectoryAndSubDirectories(sourcefile, destinationfileonserver);
                if (res == "success")
                {
                    Console.Write("\n **** Successfully copied directory **** \n \n");
                    MyLogFile.WriteLog(username + "successfully copied source directory: " + sourcefile);
                    MyLogFile.WriteLog(username + "successfully copied to destination directory: " + destinationfileonserver);
                }
                else
                {
                    Console.Write("**** Could not copy directory due to an error.\n" + res + "\n");
                    MyLogFile.WriteLog(username + " - Copy from " + sourcefile + " to " + destinationfileonserver + " failed");
                }
                MyAnswer = false;
                break;

            case "9":
                //Rename local file
                RenameLocal localRename = new RenameLocal();
                Console.WriteLine("Enter the directory path followed by the file you wish to rename: ");
                Console.WriteLine("(i.e. C:\\xyz\\Desktop\\file.txt");
                String fileLocal = Console.ReadLine();
                Console.WriteLine("Enter the directory path followed by the new name for the file: ");
                Console.WriteLine("(i.e. C:\\xyz\\Desktop\\Newfile.txt");
                String newFileLocal = Console.ReadLine();
                String response10   = localRename.RenameFileLocal(fileLocal, newFileLocal);
                if (response10 == "success")
                {
                    Console.Write("File renamed\n\n");
                    MyLogFile.WriteLog(username + " renamed local file: " + fileLocal + " to : " + newFileLocal);
                }
                else
                {
                    Console.Write("Could not rename file due to an error.\n" + response10 + "\n\n");
                    MyLogFile.WriteLog(username + " could not rename local file " + fileLocal);
                }
                MyAnswer = false;
                break;

            case "8":
                Console.Clear();
                ListDirectoryLocal list = new ListDirectoryLocal();
                //get user input
                Console.WriteLine("Enter an absolute path to directory:");
                string Dir    = Console.ReadLine();
                bool   result = list.ListDirectory(Dir);
                MyLogFile.WriteLog(username + "Listed a local directory: " + Dir);
                MyAnswer = false;
                break;

            case "7":
                //Rename remote file
                RenameFileRemote renameRemote = new RenameFileRemote(conn);
                Console.WriteLine("Enter the file you wish to rename: \n");
                String fileRename;
                fileRename = Console.ReadLine();
                Console.WriteLine("Enter the name which you wish to rename the file with: \n");
                String newName;
                newName = Console.ReadLine();
                String response2 = renameRemote.RenameFileOnRemoteServer(fileRename, newName);
                if (response2 == "success")
                {
                    Console.Write("File renamed\n");
                    MyLogFile.WriteLog(username + "renamed remote file " + fileRename + " to " + newName);
                }
                else
                {
                    Console.Write("Could not rename file due to an error.\n" + response2 + "\n");
                    MyLogFile.WriteLog(username + "could not rename remote file " + fileRename + " to " + newName);
                }

                MyAnswer = false;
                break;

            case "6":
                Console.WriteLine("You chose - 6: Change Permissions. Please Note that Changing Permissions Requires an *NIX Server supporting 'SITE CHMOD'. Windows Servers are not supported.");
                //Change file permissions
                ChangePermissions perms       = new ChangePermissions(conn);
                FluentWrapper     permwrapper = new FluentWrapper();
                permwrapper.setConn(conn);
                perms.setDir(permwrapper);
                perms.setPerms(permwrapper);
                String permresponse = perms.change(permwrapper);

                if (permresponse.Equals("Server Validation Failed\n") == true)
                {
                    Console.WriteLine("\nServer Validation Failed");
                    MyLogFile.WriteLog(username + "could not change permissions");
                    MyAnswer = true;
                }
                else
                {
                    if (permresponse.Equals("success"))
                    {
                        Console.WriteLine("Permissions Changed");
                        MyLogFile.WriteLog(username + "Changed Permissions");
                    }
                    else
                    {
                        Console.WriteLine("Could Not Change Permissions due to Error:");
                        Console.WriteLine(permresponse);
                        MyLogFile.WriteLog(username + " Could not change permissions");
                    }

                    MyAnswer = false;
                }
                break;

            case "5":
                Console.WriteLine(" You chose 5, Delete File From Remote:  \n");
                //Delete file on remote server
                DeleteFromRemote deleteRemote = new DeleteFromRemote(conn);
                Console.WriteLine("Enter the file you wish to delete: \n");
                String file;
                file = Console.ReadLine();
                String response1 = deleteRemote.DeleteFileOnRemoteServer(file);
                if (response1 == "success")
                {
                    Console.Write("File deleted\n");
                    MyLogFile.WriteLog(username + " Successfully deleted file " + file);
                }
                else
                {
                    Console.Write("Could not delete file due to an error.\n" + response1 + "\n");
                    MyLogFile.WriteLog(username + " Could not delete file due to an error. " + file + " " + response1);
                }

                MyAnswer = false;
                break;

            case "4":
                Console.WriteLine(" You chose 4, Create Directory:  \n");
                //create remote directory

                CreateRemoteDirectory createRemDir  = new CreateRemoteDirectory(conn);
                FtpTestWrapper        newdirwrapper = new FtpTestWrapper();
                String directory = createRemDir.getDirectoryName();
                createRemDir.setWrapper(newdirwrapper);
                createRemDir.setup(directory);
                String changeresponse = createRemDir.create(createRemDir.getWrapper());
                if (changeresponse == "success")
                {
                    Console.Write("Directory Created\n");
                    MyLogFile.WriteLog(username + " Successfully Created Directory " + directory);
                }
                else if (changeresponse == "disconnect")
                {
                    //If lost connection to server, log out
                    MyLogFile.WriteLog(username + "lost connection");
                    MyAnswer = true;
                    break;
                }
                else
                {
                    Console.Write("Could not create directory due to an error.\n" + changeresponse + "\n");
                    MyLogFile.WriteLog(username + "Could not create directory due to an error: " + directory + " " + changeresponse);
                }
                MyAnswer = false;
                break;

            case "3":
                Console.WriteLine(" You chose 3, List Files In Directory:  \n");
                ListFiles listFiles = new ListFiles(conn);
                String    response3 = listFiles.ListFilesOnRemoteServer();
                if (response3 == "success")
                {
                    Console.Write("Success: These are the files in the directory: \n");
                    MyLogFile.WriteLog(username + "Listed files in remote directory");
                }
                else
                {
                    Console.Write("Error: Can not list files in current directory. \n" + response3 + "\n");
                    MyLogFile.WriteLog(username + "Could not list files in remote directory");
                }

                MyAnswer = false;
                break;

            case "2":
                Console.Clear();
                Console.WriteLine(" You chose: Upload file to Remote server  \n");
                //File upload
                FileUpload     uploadfile   = new FileUpload(conn);
                FtpTestWrapper wrapper_file = new FtpTestWrapper();
                Console.WriteLine(" ** Specify file to be uploaded \n (Mention absolute path in this format, for ex: C:/xyz/rst/abc.filetype. Filetypes accepted: .txt, .jpg, .png ** \n");
                String filetobeuploaded = uploadfile.getFileName();
                Console.WriteLine(" \n ** Specify valid directory on server where file is to be uploaded (for ex: Enter TEST for ftp://localhost/TEST) \n");
                String locationonserver = uploadfile.getFileName();
                String response_file    = uploadfile.setup(filetobeuploaded, locationonserver);

                if (response_file == "success")
                {
                    Console.Write("** File successfully uploaded **\n \n");
                    MyLogFile.WriteLog(username + "File successfully uploaded " + filetobeuploaded);
                }
                else
                {
                    Console.Write("Could not Upload file.\n" + response_file + "\n");
                    MyLogFile.WriteLog(username + " could not upload file " + filetobeuploaded + " - " + response_file);
                    MyAnswer = true;
                    break;
                }
                MyAnswer = false;
                break;

            case "1":
                //File download
                Console.WriteLine(" You choose 1, download File\n");

                Console.WriteLine("Please Enter the file to download:");
                string f = Console.ReadLine();
                if (String.IsNullOrEmpty(f))
                {
                    Console.WriteLine("File cannot be empty\n");
                    break;
                }

                Console.WriteLine("Please Enter The Local Directory to Download the file to: ");
                string l = Console.ReadLine();
                if (String.IsNullOrEmpty(l))
                {
                    Console.WriteLine("Download Location cannot be empty\n");
                    break;
                }

                FileDownload RemoteFileDownload = new FileDownload(conn);
                String       response4          = RemoteFileDownload.FileDownloadFromRemote(conn, f, l);
                if (response4 == "success")
                {
                    Console.Write("File downloaded!\n");
                    MyLogFile.WriteLog(username + "downloaded file");
                }
                else
                {
                    Console.Write("Error: Could not download file.\n" + response4 + "\n");
                    MyLogFile.WriteLog(username + " download file failed - " + response4);
                }

                MyAnswer = false;
                //File upload
                break;

            default:
                Console.WriteLine("\n That was not a valid input, Please try again \n");
                MyAnswer = false;
                //File download
                break;
            }
            return(MyAnswer);
        } // end getResponce()