Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

[ANY] tDownloadCache v0.0.1 (2012-06-08)


  • Nie możesz napisać tematu
  • Zaloguj się, aby dodać odpowiedź
Brak odpowiedzi do tego tematu

#1 Adminek AMXX.PL

    Admin :)

  • Bot

Reputacja: 156
Profesjonalista

  • Postów:7 489
  • Lokalizacja:AMXX.PL
Offline

Napisano 08.06.2012 12:47

This is a tiny abstraction layer for HTTP downloads.It allows plugin developers to easily write plugins that either use cURL, SteamTools or Socket to download files via http.Files can also have a maximum age, so download only happen if the file is older than that. This allows to cache remote files and update them on a regular basis. PHP Code:

/** * Callback for DC_UpdateFile * * @param bSuccess True if no error occured and the file is ready to be read. * @param hSocketData Is a trie containing the data used when calling DC_UpdateFile * Available fields are: 'host', 'port', 'url', 'path' (of the * local file) and furl (concatenated url). * @param data any:data that has been passed when calling DC_UpdateFile */functag DCCallback public(bool:bSuccess, Handle:hSocketData, any:data);/** * Downloads a file if it's older than iMaxAge. * * @param sFilePath Path to local file. It will be overwritten. * @param sHost Host to receive data from * @param iPort Port to connect to on the host * @param sWebPath Remote path * @param iMaxAge Maximum age of the local file in seconds * @param cbSuccess Callback to call on success/fail * @param data any:data to be passed to the callback * @param sProtocol Use this to specify any other protocol than 'http', e.g. 'https'. * This forces usage of curl! * * @return True if the file is younger than iMaxAge and the callback has * already been called. */native bool:DC_UpdateFile(const String:sFilePath[], const String:sHost[], iPort, const String:sWebPath[], iMaxAge, DCCallback:cbSuccess, any:data = 0, const String:sProtocol[] = "http");

Attached Files Dołączona grafika Get Plugin or Get Source (tDownloadCache.sp - 9.9 KB) Dołączona grafika tDownloadCache.inc (1.5 KB) Dołączona grafika tDownloadCache.smx (7.7 KB)

Wyświetl pełny artykuł




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych