private AppController() { Config = new ClientConfig(); client = new Client(Config); client.ConnectionStateChanged += ClientConnectionStateChanged; client.UserMessage += OnMessage; ftMgr = new FileTransferManager(client, 8 * 1024); ftMgr.TransferRequestReceived += FileTransferRequestReceived; ftMgr.TransferStateChanged += FileTransferStateChanged; ftMgr.DataSent += FileTransferDataSent; ftMgr.DataReceived += FileTransferDataReceived; logDialog = new LogDialog(); logAdapter = new LogAdapter(logDialog.Console); mainDialog = new MainDialog(); loginDialog = new LoginDialog(); fileDialog = new FileTransferDialog(); uiProxies = new Dictionary <IFileTransfer, FileTransferUiProxy>(); MainForm = mainDialog; evUpdaterThread = new ManualResetEvent(false); updaterThread = new Thread(UpdateProc) { Name = "AppController updater", IsBackground = true, }; updaterThread.Start(); }
public IncomingFileTransfer(FileTransferManager owner, IncomingFileTransferInfo info) : base(owner) { id = info.Id; State = FileTransferState.Waiting; Sender = info.Sender; Name = info.Name; BytesTotal = info.Size; Hash = info.Hash; BlockSize = info.InitBlockSize; }
public OutcomingFileTransfer(FileTransferManager owner, OutcomingFileTransferInfo info) : base(owner) { id = FileTransferId.InvalidId; State = FileTransferState.Waiting; Name = info.Name; Hash = info.Hash; BytesTotal = info.Size; BlockSize = info.InitBlockSize; Receiver = info.Receiver; Token = info.Token; }
protected FileTransferBase(FileTransferManager owner) { // all file transfer instances are unique => assign random number to each instance as hash hashCode = new Random().Next(); Owner = owner; }