Ejemplo n.º 1
0
 protected void AppFile(PacketHeader header, Connection connection, AppFileData file)
 {
     if (AppFileEvent != null)
     {
         AppFileEvent.Invoke(file, EventArgs.Empty);
     }
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
Archivo: Main.cs Proyecto: j0nat/JCIW
        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);
        }