src/DCC/DCC.cs
/// <summary>
/// Send a request to send a file to a user.
/// </summary>
/// <param name="Nickname">The nick name of the user to receive the file.</param>
/// <param name="Filename">The filename of the file to send.</param>
/// <returns>A DCC transfer.</returns>
Send a request to send a file to a user.
Send a request to send a file to a user .
public DCCTransfer SendFile(string Nickname, string Filename)
		{
			if (parent.Channels.IsOnChannel(Nickname))
				throw(new Exception("Cannot DCC request channels."));
			if (File.Exists(Filename))
			{
				int Port = FreePort();
				string strRemote = Filename;
				if (Filename.IndexOf("\\")>-1)
					strRemote = Filename.Substring(Filename.LastIndexOf("\\") + 1, Filename.Length - (Filename.LastIndexOf("\\") + 1));
				strRemote.Replace(" ", "_");
				FileInfo fileInfo = new FileInfo(Filename);
				DCCTransfer newTransfer = new DCCTransfer(base.CurrentConnection, Nickname, Port, Filename, strRemote, transfer);
				transfer.AddDcc(newTransfer);
				base.CurrentConnection.SendData("NOTICE " + Nickname + " :DCC Send " + strRemote + " (" + parent.LocalIP.ToString() + ")");
				base.CurrentConnection.SendData("PRIVMSG " + Nickname + " :\x01" + "DCC SEND " + strRemote + " " + IRCHost(parent.LocalIP.ToString()) + " " + Port.ToString() + " " + fileInfo.Length.ToString() + "\x01");
				return newTransfer;
			}
			else
				throw(new FileNotFoundException("The file was not found.", Filename));
		}
public DCCTransfer SendFile ( string Nickname , string Filename ) { if ( parent . Channels . IsOnChannel ( Nickname ) ) throw ( new Exception ( " " ) ) ; if ( File . Exists ( Filename ) ) { int Port = FreePort ( ) ; string strRemote = Filename ; if ( Filename . IndexOf ( " \\ " ) > - 1 ) strRemote = Filename . Substring ( Filename . LastIndexOf ( " \\ " ) + 1 , Filename . Length - ( Filename . LastIndexOf ( " \\ " ) + 1 ) ) ; strRemote . Replace ( " " , " " ) ; FileInfo fileInfo = new FileInfo ( Filename ) ; DCCTransfer newTransfer = new DCCTransfer ( base . CurrentConnection , Nickname , Port , Filename , strRemote , transfer ) ; transfer . AddDcc ( newTransfer ) ; base . CurrentConnection . SendData ( " " + Nickname + " " + strRemote + " " + parent . LocalIP . ToString ( ) + " " ) ; base . CurrentConnection . SendData ( " " + Nickname + " \x01 " + " " + strRemote + " " + IRCHost ( parent . LocalIP . ToString ( ) ) + " " + Port . ToString ( ) + " " + fileInfo . Length . ToString ( ) + " \x01 " ) ; return newTransfer ; } else throw ( new FileNotFoundException ( " " , Filename ) ) ; }
Send a request to send a file to a user.
Send a request to send a file to a user .
A DCC transfer.
A DCC transfer .
Nickname
string
The nick name of the user to receive the file.
The nick name of the user to receive the file .
Filename
string
The filename of the file to send.
The filename of the file to send .