//----< fetch files >------ private void fetchFiles() { PathTextBlock.Text = "ServerStorage"; pathStack_.Push(storagePath); CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(endPoint_)); msg.add("command", "getDirs"); msg.add("path", pathStack_.Peek()); msg.add("type", "CheckOut"); translater.postMessage(msg); msg.remove("command"); msg.add("command", "getFiles"); translater.postMessage(msg); PathTextBlock3.Text = "ServerStorage"; pathBrowse_.Push(storagePath); CsMessage msg2 = new CsMessage(); msg2.add("to", CsEndPoint.toString(serverEndPoint)); msg2.add("from", CsEndPoint.toString(endPoint_)); msg2.add("command", "getDirs"); msg2.add("path", pathBrowse_.Peek()); msg2.add("type", "Browse"); translater.postMessage(msg2); msg2.remove("command"); msg2.add("command", "getFiles"); translater.postMessage(msg2); PathTextBlock2.Text = "ClientStorage"; pathClient_.Push(clientPath); CsMessage msg1 = new CsMessage(); msg1.add("to", CsEndPoint.toString(serverEndPoint)); msg1.add("from", CsEndPoint.toString(endPoint_)); msg1.add("command", "getDirs"); msg1.add("path", pathClient_.Peek()); msg1.add("type", "CheckIn"); translater.postMessage(msg1); msg1.remove("command"); msg1.add("command", "getFiles"); translater.postMessage(msg1); }
//----< start Comm, fill window display with dirs and files >------ private void Window_Loaded(object sender, RoutedEventArgs e) { // start Comm string[] commandPara = System.Environment.GetCommandLineArgs(); endPoint_ = new CsEndPoint(); if (commandPara.Length == 3) { endPoint_.machineAddress = commandPara[1]; endPoint_.port = int.Parse(commandPara[2]); } translater = new Translater(); translater.listen(endPoint_); // start processing messages processMessages(); // load dispatcher loadDispatcher(); CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = machineAddress; serverEndPoint.port = machinePort; //PathTextBlock.Text = "Storage"; pathStack_.Push("../Storage"); CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(endPoint_)); msg.add("command", "getDirs"); msg.add("path", pathStack_.Peek()); translater.postMessage(msg); msg.remove("command"); msg.add("command", "getFiles"); translater.postMessage(msg); /// test case executes only when port number is 8083 if (endPoint_.port == 8083) { ThreadStart ts = test; Thread a = new Thread(ts); a.IsBackground = true; a.Start(); } }
//----< start Comm, fill window display with dirs and files >------ private void Window_Loaded(object sender, RoutedEventArgs e) { Console.Write("\n\nREQUIREMENT 2 --------- Using WPF and C# to implement the Client GUI ---------\n"); Console.Write("\n\nREQUIREMENT 3 --------- Assembled working parts from Projects #1, #2, and #3 into a Client-Server configuration ---------\n"); Console.Write("\n\nREQUIREMENT 4 --------- Shall provide a Graphical User Interface(GUI) for the client that\n"); Console.Write("supports navigating remote directories to find a project for conversion, and supports ---------\n"); Console.Write("displaying the conversion results in a way that meets Project #3 requirements. ---------\n"); Console.Write("\n\nREQUIREMENT 7 --------- Demonstrating correct operations for two or more concurrent clients. ---------\n"); load(); if (serverPort == clientPort) { MessageBox.Show("Server Port and Client Port cannot be equal", "Error"); } else { endPoint_ = new CsEndPoint(); endPoint_.machineAddress = "localhost"; endPoint_.port = clientPort; translater = new Translater(); translater.listen(endPoint_); processMessages(); // start processing messages loadDispatcher(); // load dispatcher init(); CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = url; serverEndPoint.port = serverPort; textPath.Text = removeFirstDir(serverRootDirectory); pathStack_.Push(serverRootDirectory); Console.Write("\n\nREQUIREMENT 5 : --------- Providing message design for getting files and directories ---------\n"); CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(endPoint_)); msg.add("command", "getDirs"); msg.add("path", pathStack_.Peek()); translater.postMessage(msg); msg.remove("command"); msg.add("command", "getFiles"); translater.postMessage(msg); } }
//<----------------- event to trigger when the listbox item id double clicked in the nav display >----------------- private void DirList_MouseDoubleClick(object sender, MouseButtonEventArgs e) { listboxItem ListboxInstance = ((listboxItem)lstBoxFilesForCheckin.SelectedItem); string selectedDir = ListboxInstance.Str; if (ListboxInstance.selectionType == 1) { { if (selectedDir == "• •") { if (pathStack_.Count > 1) // don't pop off "Storage" { pathStack_.Pop(); } else { return; } } else { path = pathStack_.Peek() + "/" + selectedDir; pathStack_.Push(path); } // display path in Dir TextBlcok Path.Text = removeFirstDir(pathStack_.Peek()); // build message to get dirs and post it CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = "localhost"; serverEndPoint.port = 8080; CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(endPoint_)); msg.add("command", "getDirs"); msg.add("path", pathStack_.Peek()); translater.postMessage(msg); // build message to get files and post it msg.remove("command"); msg.add("command", "getFiles"); translater.postMessage(msg); statusBarText.Text = @"Sending Message from Client" + @"(" + msg.attributes["from"] + ") to Server : " + @"( " + msg.attributes["to"] + ")" + @" with Command : " + "getDirs " + msg.attributes["command"]; } } }
public void commandGetDirsAndFiles() { CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint_)); msg.add("from", CsEndPoint.toString(endPoint_)); msg.add("command", "getDirs"); msg.add("path", pathStack_.Peek()); Console.Write("\nClient sending "); msg.show(); translater.postMessage(msg); msg.remove("command"); msg.add("command", "getFiles"); Console.Write("\nClient sending "); msg.show(); translater.postMessage(msg); }
void test6() { Console.WriteLine("===============Demo 6 view metadata================"); CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = machineAddress; serverEndPoint.port = machinePort; CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(endPoint_)); msg.add("command", "view metadata"); msg.add("package name", "package1"); msg.add("file name", "file1.c"); translater.postMessage(msg); //statusBarText.Text = "View meta data"; }
private void Refresh_Click(object sender, RoutedEventArgs e) { MainWindow win = (MainWindow)Window.GetWindow(this); //CsEndPoint serverEndPoint = new CsEndPoint(); //serverEndPoint.machineAddress = "localhost"; //serverEndPoint.port = 8080; CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint_)); msg.add("from", CsEndPoint.toString(navEndPoint_)); msg.add("command", "getDirs"); msg.add("path", pathStack_.Peek()); win.translater.postMessage(msg); msg.remove("command"); msg.add("command", "getFiles"); win.translater.postMessage(msg); }
//----< Helper function for view file button click>------------------------- private void viewFile(string filename) { CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = "localhost"; serverEndPoint.port = 8080; fileShowed = true; CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(endPoint_)); msg.add("command", "viewFile"); msg.add("ViewFileName", filename); msg.add("location", @"..\codeRepository\localClientFiles\ViewFile"); Console.WriteLine("sending message to server"); translater.postMessage(msg); }
//----< move into double-clicked directory, display contents >--- private void Dirs_MouseDoubleClick(object sender, MouseButtonEventArgs e) { // build path for selected dir string selectedDir = (string)Dirs.SelectedItem; if (selectedDir == null) { return; } string path; if (selectedDir == "..") { if (pathStack_.Count > 1) // don't pop off "Storage" { pathStack_.Pop(); } else { return; } } else { path = pathStack_.Peek() + "/" + selectedDir; pathStack_.Push(path); } CurrPath.Text = removeFirstDir(pathStack_.Peek()); // display path in Dir TextBlcok CsEndPoint serverEndPoint = new CsEndPoint(); // build message to get dirs and post it serverEndPoint.machineAddress = "localhost"; serverEndPoint.port = 8080; CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(endPoint_)); msg.add("command", "getDirs"); msg.add("path", pathStack_.Peek()); translater.postMessage(msg); // build message to get files and post it msg.remove("command"); msg.add("command", "getFiles"); msg.add("suffix1", suffix1); msg.add("suffix2", suffix2); translater.postMessage(msg); }
//----< search repo for a given file >---------------------------------- private void SearchForFile_Click(object sender, RoutedEventArgs e) { CsEndPoint userEndPoint = new CsEndPoint(); userEndPoint.machineAddress = "localhost"; userEndPoint.port = 9000; CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(userEndPoint)); msg.add("from", CsEndPoint.toString(endPoint_)); msg.add("command", "Search_For_File"); msg.add("searchFile", SearchInputBox.Text); translater.postMessage(msg); CsMessage replyMsg = translater.getMessage(); SearchInputBox.Text = replyMsg.value("fileSearchResult"); }
//----< view metadata function >---------------- private void view_Click(object sender, RoutedEventArgs e) { try { string filename = checkoutfiles.SelectedItem.ToString(); CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(endPoint_)); msg.add("command", "viewmetadata"); msg.add("key", filename); client.postMessage(msg); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Analyze_Click(object sender, RoutedEventArgs e) { MainWindow win = (MainWindow)Window.GetWindow(this); // build message to analyze code on current server path CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = "localhost"; serverEndPoint.port = 8080; CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(navEndPoint_)); msg.add("command", "codeAnalyze"); msg.add("path", pathStack_.Peek()); win.translater.postMessage(msg); //pathStack_.Pop(); }
//test stub to view metadata void getMetatdataTestStub() { Console.WriteLine("\n---------- Viewing metadata on UI -----------\n"); CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = "localhost"; serverEndPoint.port = 8080; CsMessage msg = new CsMessage(); Console.WriteLine("\nRequesting metadata details for DbCore.h of version 2 in namespace Test5\n"); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(endPoint_)); msg.add("package", "Test5"); msg.add("fileName", "DbCore.h"); msg.add("version", "1"); msg.add("command", "viewMetadata"); translater.postMessage(msg); }
// test stub for checkout void checkOutTestStub() { Console.WriteLine("\n\n---------Demonstrating checking out file---------\n\n"); CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = "localhost"; serverEndPoint.port = 8080; CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(endPoint_)); Console.WriteLine("Requesting checkout for file Message.cpp.1 in package Test1 of the repository\n\n"); msg.add("command", "performCheckOut"); msg.add("package", "Test1"); msg.add("fileName", "Message.cpp.1"); translater.postMessage(msg); }
//----< show file text on MouseDoubleClick >----------------------- private void FileList_MouseDoubleClick(object sender, MouseButtonEventArgs e) { MainWindow win = (MainWindow)Window.GetWindow(this); string fileName = (string)FileList.SelectedItem; CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = "localhost"; serverEndPoint.port = 8080; CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(navEndPoint_)); msg.add("command", "sendFile"); msg.add("path", pathStack_.Peek()); msg.add("fileName", fileName); win.translater.postMessage(msg); }
//---< get all the file names matches> private void PatIt(object sender, RoutedEventArgs e) { //clearFiles(); CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = "localhost"; serverEndPoint.port = 8080; CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(endPoint_)); msg.add("command", "getMatchedFiles"); msg.add("path", pathStack_.Peek()); msg.add("regEx", FileNamePatten.Text); translater.postMessage(msg); //DispatcherLoadGetFiles(); }
//----<click request button to send query>------- private void Request_Click(object sender, RoutedEventArgs e) { MainWindow win = (MainWindow)Window.GetWindow(this); CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = "localhost"; serverEndPoint.port = 8080; CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(navEndPoint_)); msg.add("command", "queryrequest"); msg.add("hasName", hasname.Text); msg.add("hasCategory", hascategory.Text); //msg.add("path", pathStack_.Peek()); win.translater.postMessage(msg); }
private void showrepo_Click(object sender, RoutedEventArgs e) { checkoutfiles.Items.Clear(); CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = "localhost"; serverEndPoint.port = 8080; CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(endPoint_)); msg.add("path", "../Storage"); msg.add("command", "getFiles"); Console.WriteLine("\n---------------send a message to get the file list,command is getFiles---------------------"); Console.WriteLine("\n send getFiles message from " + msg.value("from") + " to " + msg.value("to")); translater.postMessage(msg); }
//----< To set command line arguments >------ public void setCmdArgs() { wDirectory = Path.GetFullPath("../../../../Project4_OOD_ADP"); Patterns = "*.h *.cpp"; Regex = "[U](.*)"; CsMessage argsMsg = new CsMessage(); argsMsg.add("args", "convFile"); argsMsg.add("to", CsEndPoint.toString(serverEndPoint)); argsMsg.add("from", CsEndPoint.toString(endPoint_)); argsMsg.add("command", "publishFiles"); argsMsg.add("wDirectory", wDirectory); argsMsg.add("Patterns", Patterns); argsMsg.add("Regex", Regex); argsMsg.add("hasOption", hasOption.ToString()); translater.postMessage(argsMsg); }
//----< sets command line arguments and fetches converted file list on clicking convert button >---------------------- private void btnConvert_Click(object sender, RoutedEventArgs e) { wDirectory = Path.GetFullPath("../../../../Project4_OOD_ADP"); Patterns = txtPatterns.Text; Regex = txtRegex.Text; CsMessage cMsg = new CsMessage(); cMsg.add("args", "convFile"); cMsg.add("to", CsEndPoint.toString(serverEndPoint)); cMsg.add("from", CsEndPoint.toString(endPoint_)); cMsg.add("command", "publishFiles"); cMsg.add("wDirectory", wDirectory); cMsg.add("Patterns", Patterns); cMsg.add("Regex", Regex); cMsg.add("hasOption", hasOption.ToString()); translater.postMessage(cMsg); }
private void remote_OpenBrowser(object sender, RoutedEventArgs e) { if (selectedHtmlFile == "") { MessageBox.Show("Please select file"); } else { CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint_)); msg.add("from", CsEndPoint.toString(clientEndPoint)); msg.add("command", "browserFile"); msg.add("file", selectedHtmlFile); translater.postMessage(msg); //System.Diagnostics.Process.Start(selectedHtmlFile); } }
//----< function for browse>---------------- void Browse() { MainWindow win = (MainWindow)Window.GetWindow(this); try { win.txtStatusBar.Text = "Sending browseFiles request to server..."; // prepare message to send as a request to server and send it CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = "localhost"; serverEndPoint.port = 8080; CsMessage msg = new CsMessage(); string qFileName = txtFname.Text; string qDep = txtDep.Text; string qVer = txtVer.Text; string qParent = ""; if ((bool)qChkParent.IsChecked) { qParent = "Yes"; } string category = ""; foreach (ListBoxItem item in qCatList.SelectedItems) { category = category + item.Content.ToString(); } msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(win.endPoint_)); msg.add("command", "browseFiles"); msg.add("verbose", "browse files by queries"); msg.add("qFileName", qFileName); msg.add("qCategory", category); msg.add("qDependency", qDep); msg.add("qVersion", qVer); msg.add("qParent", qParent); msg.show(); win.translater.postMessage(msg); } catch (Exception ex) { win.txtStatusBar.Text = "Something is wrong..." + ex; } }
//----< respond to mouse double-click on dir name >---------------- private void DirListRemote_MouseDoubleClick(object sender, MouseButtonEventArgs e) { MainWindow win = (MainWindow)Window.GetWindow(this); // build path for selected dir string selectedDir = (string)DirListRemote.SelectedItem; string path; if (selectedDir == "..") { if (pathStackRemote_.Count > 1) // don't pop off "Storage" { pathStackRemote_.Pop(); } else { return; } } else { path = pathStackRemote_.Peek() + "/" + selectedDir; pathStackRemote_.Push(path); } // display path in Dir TextBlcok PathTextBlock.Text = win.removeFirstDir(pathStackRemote_.Peek()); // build message to get dirs and post it CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = "localhost"; serverEndPoint.port = 8080; CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(navEndPoint_)); msg.add("command", "getDirs"); msg.add("path", pathStackRemote_.Peek()); win.translater.postMessage(msg); // build message to get files and post it msg.remove("command"); msg.add("command", "getFiles"); win.translater.postMessage(msg); }
//----< respond to mouse double-click on PopDirs >--------- private void PopDirs_MouseDoubleClick(object sender, MouseButtonEventArgs e) { // build path for selected dir string selectedDir = (string)PopDirs.SelectedItem; if (selectedDir == null) { return; } string path; if (selectedDir == "..") { if (popPathStack_.Count > 1) // don't pop off "Storage" { popPathStack_.Pop(); } else { return; } } else { path = popPathStack_.Peek() + "/" + selectedDir; popPathStack_.Push(path); } CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = "localhost"; serverEndPoint.port = serverPortNum; CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(endPoint_)); msg.add("command", "getPopDirs"); msg.add("path", popPathStack_.Peek()); translater.postMessage(msg); // build message to get files and post it msg.remove("command"); msg.add("command", "getPopFiles"); translater.postMessage(msg); }
//----< respond to mouse click on CheckIn Button >---------------- private void CheckInClick(object sender, RoutedEventArgs e) { MainWindow win = (MainWindow)Window.GetWindow(this); if (FileList.SelectedItem != null) { string fileName = (string)FileList.SelectedItem; string srcFile = localStorageRoot_ + "/" + pathStack_.Peek() + "/" + fileName; srcFile = System.IO.Path.GetFullPath(srcFile); string dstFile = win.sendFilesPath + "/" + fileName; //sendFilesPath = translater.setSendFilePath("../../../SendFiles"); System.IO.File.Copy(srcFile, dstFile, true); string des; des = ChkInDescriptiontxtbox.Text; string child; child = ChkInChildtxtbox.Text; CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = "localhost"; serverEndPoint.port = 8080; CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(win.endPoint_)); msg.add("sendingFile", fileName); msg.add("command", "CheckIn"); msg.add("description", des); msg.add("path", srcFile); // previous :- msg.add("path", pathStack_.Peek()); msg.add("dstFileName", dstFile); msg.add("fileName", fileName); if (child != "") { List <string> children = child.Split(',').ToList(); for (int i = 0; i < children.Count; i++) { string myString = "child" + (i + 1).ToString(); msg.add(myString, children[i]); } } win.translater.postMessage(msg); } else { win.statusBarText.Text = "Please SELECT a file to CheckIn"; } }
private void closestatus_Click(object sender, RoutedEventArgs e) { if (notclosedfiles.SelectedItem != null) { CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = "localhost"; serverEndPoint.port = 8080; CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(endPoint_)); msg.add("operatefile", notclosedfiles.SelectedItem.ToString()); msg.add("author", authorname.Text); msg.add("command", "close"); Console.WriteLine("\n---------------send a message to close a check in status,command is close---------------------"); Console.WriteLine("\n send close message from " + msg.value("from") + " to " + msg.value("to")); translater.postMessage(msg); } }
private void search_Click(object sender, RoutedEventArgs e) { Console.WriteLine("\n------------------you click the search button-----------------------"); CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = "localhost"; serverEndPoint.port = 8080; CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(endPoint_)); msg.add("command", "getQLists"); msg.add("wanted", query.Text); Console.WriteLine("\n send search message from " + msg.value("from") + " to " + msg.value("to")); Console.WriteLine("\n text you want to view is:"); Console.WriteLine(query.Text); translater.postMessage(msg); }
//----< function for refresh display>---------------- internal void refreshDisplayRemote() { MainWindow win = (MainWindow)Window.GetWindow(this); CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = "localhost"; serverEndPoint.port = 8080; CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(navEndPoint_)); msg.add("command", "getDirs"); msg.add("path", pathStackRemote_.Peek()); win.translater.postMessage(msg); msg.remove("command"); msg.add("command", "getFiles"); win.translater.postMessage(msg); }
//----< Requests server for the content of the specified file >------ private void view_Content_of_file_Click(object sender, MouseButtonEventArgs e) { fileShown = false; CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = "localhost"; serverEndPoint.port = 8080; CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(endPoint_)); msg.add("command", "viewfile"); msg.add("filename", fileList.SelectedItem.ToString()); msg.add("receivePath", "../../../../ClientStorage"); msg.add("fileShown", "false"); Console.Write("\n\n Requesting the server with Command :" + msg.value("command")); translater.postMessage(msg); }
private void showfilesnotclosed_Click(object sender, RoutedEventArgs e) { CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = "localhost"; serverEndPoint.port = 8080; CsMessage msg = new CsMessage(); msg.add("to", CsEndPoint.toString(serverEndPoint)); msg.add("from", CsEndPoint.toString(endPoint_)); msg.add("command", "showopen"); translater.postMessage(msg); msg.remove("command"); msg.add("command", "getFiles"); Console.WriteLine("\n---------------send a message to get the file list,command is getFiles---------------------"); Console.WriteLine("\n send getFiles message from " + msg.value("from") + " to " + msg.value("to")); translater.postMessage(msg); }