- Main Page
- Modules
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# DirectoryDeltaTransfer Class Reference
[DirectoryDeltaTransfer]

Simple class to send changes between directories. In essense, a simple autopatcher that can be used for transmitting levels, skins, etc. More...

`#include <DirectoryDeltaTransfer.h>`

Inheritance diagram for DirectoryDeltaTransfer:

List of all members.

## Public Member Functions
| DirectoryDeltaTransfer ()
| Constructor.
| ~DirectoryDeltaTransfer ()
| Destructor.
void | SetFileListTransferPlugin (FileListTransfer *flt)
void | SetApplicationDirectory (const char *pathToApplication)
void | SetUploadSendParameters (PacketPriority _priority, char _orderingChannel)
void | AddUploadsFromSubdirectory (const char *subdir)
unsigned short | DownloadFromSubdirectory (const char *subdir, const char *outputSubdir, bool prependAppDirToOutputSubdir, PlayerID host, FileListTransferCBInterface *onFileCallback, PacketPriority _priority, char _orderingChannel)
void | ClearUploads (void)
| Clear all allowed uploads previously set with AddUploadsFromSubdirectory.
unsigned | GetNumberOfFilesForUpload (void) const
virtual void | OnAttach (RakPeerInterface *peer)
virtual void | Update (RakPeerInterface *peer)
virtual PluginReceiveResult | OnReceive (RakPeerInterface *peer, Packet *packet)
virtual void | OnDisconnect (RakPeerInterface *peer)
## Protected Member Functions
void | OnDownloadRequest (RakPeerInterface *peer, Packet *packet)
## Protected Attributes
char | applicationDirectory [512]
FileListTransfer * | fileListTransfer
FileList * | availableUploads
RakPeerInterface * | rakPeer
PacketPriority | priority
char | orderingChannel

## Detailed Description

Simple class to send changes between directories. In essense, a simple autopatcher that can be used for transmitting levels, skins, etc.

See also:
  Autopatcher class for database driven patching, including binary deltas and search by date.

To use, first set the path to your application. For example "C:/Games/MyRPG/" To allow other systems to download files, call AddUploadsFromSubdirectory, where the parameter is a path relative to the path to your application. This includes subdirectories. For example: SetApplicationDirectory("C:/Games/MyRPG/"); AddUploadsFromSubdirectory("Mods/Skins/"); would allow downloads from "C:/Games/MyRPG/Mods/Skins/*.*" as well as "C:/Games/MyRPG/Mods/Skins/Level1/*.*" It would NOT allow downloads from C:/Games/MyRPG/Levels, nor would it allow downloads from C:/Windows While pathToApplication can be anything you want, applicationSubdirectory must match either partially or fully between systems.

## Member Function Documentation

void DirectoryDeltaTransfer::AddUploadsFromSubdirectory | ( | const char * | subdir | ) |

  | Add all files in the specified subdirectory recursively subdir is appended to pathToApplication in SetApplicationDirectory(). All files in the resultant directory and subdirectories are then hashed so that users can download them. Precondition: You must call SetFileListTransferPlugin with a valid FileListTransfer plugin Parameters:
  `[in]` | subdir | Concatenated with pathToApplication to form the final path from which to allow uploads.

unsigned short DirectoryDeltaTransfer::DownloadFromSubdirectory | ( | const char * | subdir,
|  | const char * | outputSubdir,
|  | bool | prependAppDirToOutputSubdir,
|  | PlayerID | host,
|  | FileListTransferCBInterface * | onFileCallback,
|  | PacketPriority | _priority,
|  | char | _orderingChannel
| ) |

  | Downloads files from the matching parameter subdir in AddUploadsFromSubdirectory. subdir must contain all starting characters in subdir in AddUploadsFromSubdirectory Therefore, AddUploadsFromSubdirectory("Levels/Level1/"); would allow you to download using DownloadFromSubdirectory("Levels/Level1/Textures/"... but it would NOT allow you to download from DownloadFromSubdirectory("Levels/"... or DownloadFromSubdirectory("Levels/Level2/"... Precondition: You must call SetFileListTransferPlugin with a valid FileListTransfer plugin Parameters:
  `[in]` | subdir | A directory passed to AddUploadsFromSubdirectory on the remote system. The passed dir can be more specific than the remote dir.
  `[in]` | outputSubdir | The directory to write the output to. Usually this will match subdir but it can be different if you want.
  `[in]` | prependAppDirToOutputSubdir | True to prepend outputSubdir with pathToApplication when determining the final output path. Usually you want this to be true.
  `[in]` | host | The address of the remote system to send the message to.
  `[in]` | onFileCallback | Callback to call per-file (optional). When fileIndex+1==setCount in the callback then the download is done
  `[in]` | _priority | See RakPeerInterface::Send()
  `[in]` | _orderingChannel | See RakPeerInterface::Send()
Returns: A set ID, identifying this download set. Returns 65535 on host unreachable.

unsigned DirectoryDeltaTransfer::GetNumberOfFilesForUpload | ( | void |  | ) | const

| Returns how many files are available for upload Returns: How many files are available for upload

void DirectoryDeltaTransfer::OnAttach | ( | RakPeerInterface * | peer | ) | `[virtual]`

  | Called when the interface is attached Parameters:
  `[in]` | peer | the instance of RakPeer that is calling Receive
Reimplemented from PluginInterface.

void DirectoryDeltaTransfer::OnDisconnect | ( | RakPeerInterface * | peer | ) | `[virtual]`

  | Called when RakPeer is shutdown Parameters:
  `[in]` | peer | the instance of RakPeer that is calling Receive
Reimplemented from PluginInterface.

PluginReceiveResult DirectoryDeltaTransfer::OnReceive | ( | RakPeerInterface * | peer,
|  | Packet * | packet
| ) | `[virtual]`

  | OnReceive is called for every packet. Parameters:
  `[in]` | peer | the instance of RakPeer that is calling Receive
  `[in]` | packet | the packet that is being returned to the user
Returns: True to allow the game and other plugins to get this message, false to absorb it Reimplemented from PluginInterface.

void DirectoryDeltaTransfer::SetApplicationDirectory | ( | const char * | pathToApplication | ) |

  | Set the local root directory to base all file uploads and downloads off of. Parameters:
  `[in]` | pathToApplication | This path will be prepended to applicationSubdirectory in AddUploadsFromSubdirectory to find the actual path on disk.

void DirectoryDeltaTransfer::SetFileListTransferPlugin | ( | FileListTransfer * | flt | ) |

  | This plugin has a dependency on the FileListTransfer plugin, which it uses to actually send the files. So you need an instance of that plugin registered with RakPeerInterface, and a pointer to that interface should be passed here. Parameters:
  `[in]` | flt | A pointer to a registered instance of FileListTransfer

void DirectoryDeltaTransfer::SetUploadSendParameters | ( | PacketPriority | _priority,
|  | char | _orderingChannel
| ) |

  | What parameters to use for the RakPeerInterface::Send() call when uploading files. Parameters:
  `[in]` | _priority | See RakPeerInterface::Send()
  `[in]` | _orderingChannel | See RakPeerInterface::Send()

void DirectoryDeltaTransfer::Update | ( | RakPeerInterface * | peer | ) | `[virtual]`

  | Update is called every time a packet is checked for . Parameters:
  `[in]` | peer | - the instance of RakPeer that is calling Receive
Reimplemented from PluginInterface.

The documentation for this class was generated from the following files:

- C:/RakNet 2.518/Include/DirectoryDeltaTransfer.h
- C:/RakNet 2.518/Source/DirectoryDeltaTransfer.cpp