protected void AppFile(PacketHeader header, Connection connection, AppFileData file) { if (AppFileEvent != null) { AppFileEvent.Invoke(file, EventArgs.Empty); } }
protected void ReceiveRequestAppFile(PacketHeader header, Connection connection, long moduleId) { // ######################################################################## // This method requires authentication. // If user is not authorized then send UnAuthorized and end method. if (!accountManager.Authorized(connection)) { TCPConnection.GetConnection(connection.ConnectionInfo).SendObject( PacketName.ReUnauthorized.ToString(), 1); return; } // ######################################################################## Module module = moduleRepository.Get(moduleId); string filePath = module.path; byte[] fileData = File.ReadAllBytes(filePath); AppFileData appData = new AppFileData(module.id, filePath, fileData); TCPConnection.GetConnection(connection.ConnectionInfo).SendObject( PacketName.ReAppFile.ToString(), appData); }
private void Networking_AppFileEvent(object sender, EventArgs e) { AppFileData fileData = (AppFileData)sender; File.WriteAllBytes(Path.Combine(Local.Folder, fileData.path), fileData.data); LoadApp(fileData.id, fileData.path); }