public DictionaryCommandHandler(IPEndPoint clientSocketLocalEndPoint, String rootDirectoryServerSystemFormat) { this.dictionary = new Dictionary <String, CommandHandler>(); this.dictionary.Add("ABOR", ABOR); this.dictionary.Add("ACCT", ACCT); this.dictionary.Add("ADAT", ADAT); this.dictionary.Add("ALLO", ALLO); this.dictionary.Add("APPE", APPE); this.dictionary.Add("AUTH", AUTH); this.dictionary.Add("CCC", CCC); this.dictionary.Add("CDUP", CDUP); this.dictionary.Add("CONF", CONF); this.dictionary.Add("CWD", CWD); this.dictionary.Add("DELE", DELE); this.dictionary.Add("ENC", ENC); this.dictionary.Add("EPRT", EPRT); this.dictionary.Add("EPSV", EPSV); this.dictionary.Add("FEAT", FEAT); this.dictionary.Add("HELP", HELP); this.dictionary.Add("LANG", LANG); this.dictionary.Add("LIST", LIST); this.dictionary.Add("LPRT", LPRT); this.dictionary.Add("LPSV", LPSV); this.dictionary.Add("MDTM", MDTM); this.dictionary.Add("MIC", MIC); this.dictionary.Add("MKD", MKD); this.dictionary.Add("MLSD", MLSD); this.dictionary.Add("MLST", MLST); this.dictionary.Add("MODE", MODE); this.dictionary.Add("NLST", NLST); this.dictionary.Add("NOOP", NOOP); this.dictionary.Add("OPTS", OPTS); this.dictionary.Add("PASS", PASS); this.dictionary.Add("PASV", PASV); this.dictionary.Add("PBSZ", PBSZ); this.dictionary.Add("PORT", PORT); this.dictionary.Add("PROT", PROT); this.dictionary.Add("PWD", PWD); this.dictionary.Add("QUIT", QUIT); this.dictionary.Add("REIN", REIN); this.dictionary.Add("REST", REST); this.dictionary.Add("RETR", RETR); this.dictionary.Add("RMD", RMD); this.dictionary.Add("RNFR", RNFR); this.dictionary.Add("RNTO", RNTO); this.dictionary.Add("SITE", SITE); this.dictionary.Add("SIZE", SIZE); this.dictionary.Add("SMNT", SMNT); this.dictionary.Add("STAT", STAT); this.dictionary.Add("STOR", STOR); this.dictionary.Add("STOU", STOU); this.dictionary.Add("STRU", STRU); this.dictionary.Add("SYST", SYST); this.dictionary.Add("TYPE", TYPE); this.dictionary.Add("USER", USER); this.dictionary.Add("XCUP", XCUP); this.dictionary.Add("XMKD", XMKD); this.dictionary.Add("XPWD", XPWD); this.dictionary.Add("XRCP", XRCP); this.dictionary.Add("XRMD", XRMD); this.dictionary.Add("XRSQ", XRSQ); this.dictionary.Add("XSEM", XSEM); this.dictionary.Add("XSEN", XSEN); this.clientSocketLocalEndPoint = clientSocketLocalEndPoint; Byte [] clientSocketLocalAddressBytes = clientSocketLocalEndPoint.Address.GetAddressBytes(); this.passiveAddressString = String.Format("{0},{1},{2},{3}", clientSocketLocalAddressBytes[0], clientSocketLocalAddressBytes[1], clientSocketLocalAddressBytes[2], clientSocketLocalAddressBytes[3]); this.rootDirectoryServerSystemFormat = rootDirectoryServerSystemFormat; this.rootDirectoryFtpFormat = PathExtensions.SystemPathToUrlPath(rootDirectoryServerSystemFormat); this.currentSubdirectoryFromRootSystemFormat = null; this.receivedTypeCommand = false; // // Passive State Variables // this.currentPassiveListenSocket = null; this.passiveWaitHandle = null; this.passiveDataHandler = null; }
void PWD(StringBuilder responseBuilder, String args) { responseBuilder.Append(String.Format("200 \"{0}\" is current directory.\r\n", (currentSubdirectoryFromRootSystemFormat == null) ? rootDirectoryFtpFormat : PathExtensions.SystemPathToUrlPath(Path.Combine(rootDirectoryServerSystemFormat, currentSubdirectoryFromRootSystemFormat)))); }