/// <summary> /// Creates a Version 2 Battle.net FTP request specifically for banner ad downloads. /// </summary> /// <param name="product">The product being emulated by this request.</param> /// <param name="fileName">The full or relative path to the file as it is to be stored on the local /// machine. The name portion of the file must be the filename being requested from the service.</param> /// <param name="fileTime">The last-write time of the file. If the file is not available, this parameter /// can be <b>null</b> (<b>Nothing</b> in Visual Basic).</param> /// <param name="cdKey">The CD key of the client being emulated.</param> /// <param name="adId">The banner ID provided by Battle.net's ad notice message.</param> /// <param name="adFileExtension">The banner filename extension provided by Battle.net's ad notice message.</param> /// <remarks> /// <para>Although it is not specifically required to download banner ads, it is recommended for forward-compatibility /// with the Battle.net protocol that this constructor is used.</para> /// </remarks> public BnFtpVersion2Request(string fileName, ClassicProduct product, DateTime fileTime, CdKey cdKey, int adId, string adFileExtension) : this(fileName, product, fileTime, cdKey) { _ad = true; _adId = adId; _adExt = adFileExtension; }
/// <summary> /// Creates a Version 1 Battle.net FTP request specifically for banner ad downloads. /// </summary> /// <param name="productId">The four-character identifier for the product being emulated by this request.</param> /// <param name="fileName">The full or relative path to the file as it is to be stored on the local /// machine. The name portion of the file must be the filename being requested from the service.</param> /// <param name="fileTime">The last-write time of the file. If the file is not available, this parameter /// can be <b>null</b> (<b>Nothing</b> in Visual Basic).</param> /// <param name="adBannerId">The banner ID provided by Battle.net's ad notice message.</param> /// <param name="adBannerExtension">The banner filename extension provided by Battle.net's ad notice message.</param> /// <remarks> /// <para>Although it is not specifically required to download banner ads, it is recommended for forward-compatibility /// with the Battle.net protocol that this constructor is used.</para> /// </remarks> public BnFtpVersion1Request(ClassicProduct product, string fileName, DateTime fileTime, int adBannerId, string adBannerExtension) : this(product, fileName, fileTime) { _adExt = adBannerExtension; _adId = adBannerId; _ad = true; }
/// <summary> /// Creates a Version 2 Battle.net FTP request specifically for banner ad downloads. /// </summary> /// <param name="product">The product being emulated by this request.</param> /// <param name="fileName">The full or relative path to the file as it is to be stored on the local /// machine. The name portion of the file must be the filename being requested from the service.</param> /// <param name="fileTime">The last-write time of the file. If the file is not available, this parameter /// can be <b>null</b> (<b>Nothing</b> in Visual Basic).</param> /// <param name="cdKey">The CD key of the client being emulated.</param> /// <param name="adId">The banner ID provided by Battle.net's ad notice message.</param> /// <param name="adFileExtension">The banner filename extension provided by Battle.net's ad notice message.</param> /// <remarks> /// <para>Although it is not specifically required to download banner ads, it is recommended for forward-compatibility /// with the Battle.net protocol that this constructor is used.</para> /// </remarks> public BnFtpVersion2Request(string fileName, ClassicProduct product, DateTime fileTime, CdKey cdKey, int adId, string adFileExtension) : this(fileName, product, fileTime, cdKey) { _ad = true; _adId = adId; _adExt = adFileExtension; }
/// <summary> /// Creates a Version 1 Battle.net FTP request specifically for banner ad downloads. /// </summary> /// <param name="productId">The four-character identifier for the product being emulated by this request.</param> /// <param name="fileName">The full or relative path to the file as it is to be stored on the local /// machine. The name portion of the file must be the filename being requested from the service.</param> /// <param name="fileTime">The last-write time of the file. If the file is not available, this parameter /// can be <b>null</b> (<b>Nothing</b> in Visual Basic).</param> /// <param name="adBannerId">The banner ID provided by Battle.net's ad notice message.</param> /// <param name="adBannerExtension">The banner filename extension provided by Battle.net's ad notice message.</param> /// <remarks> /// <para>Although it is not specifically required to download banner ads, it is recommended for forward-compatibility /// with the Battle.net protocol that this constructor is used.</para> /// </remarks> public BnFtpVersion1Request(ClassicProduct product, string fileName, DateTime fileTime, int adBannerId, string adBannerExtension) : this(product, fileName, fileTime) { _adExt = adBannerExtension; _adId = adBannerId; _ad = true; }
// 33 + fileName.Length /// <summary> /// Creates a standard Version 1 Battle.net FTP request. /// </summary> /// <param name="productId">The four-character identifier for the product being emulated by this request.</param> /// <param name="fileName">The full or relative path to the file as it is to be stored on the local /// machine. The name portion of the file must be the filename being requested from the service.</param> /// <param name="fileTime">The last-write time of the file. If the file is not available, this parameter /// can be <b>null</b> (<b>Nothing</b> in Visual Basic).</param> public BnFtpVersion1Request(ClassicProduct product, string fileName, DateTime? fileTime) : base(fileName, product, fileTime) { string prod = this.Product.ProductCode; if (prod == "WAR3" || prod == "W3XP") throw new ArgumentOutOfRangeException("product", product, "Cannot make a BnFtp version 1 request with Warcraft III: The Reign of Chaos or Warcraft III: The Frozen Throne."); }
// 33 + fileName.Length /// <summary> /// Creates a standard Version 1 Battle.net FTP request. /// </summary> /// <param name="productId">The four-character identifier for the product being emulated by this request.</param> /// <param name="fileName">The full or relative path to the file as it is to be stored on the local /// machine. The name portion of the file must be the filename being requested from the service.</param> /// <param name="fileTime">The last-write time of the file. If the file is not available, this parameter /// can be <b>null</b> (<b>Nothing</b> in Visual Basic).</param> public BnFtpVersion1Request(ClassicProduct product, string fileName, DateTime?fileTime) : base(fileName, product, fileTime) { string prod = this.Product.ProductCode; if (prod == "WAR3" || prod == "W3XP") { throw new ArgumentOutOfRangeException("product", product, "Cannot make a BnFtp version 1 request with Warcraft III: The Reign of Chaos or Warcraft III: The Frozen Throne."); } }
internal DefaultStats(string productID, byte[] literal) { Debug.Assert(literal != null); _prod = ClassicProduct.GetByProductCode(productID); if (_prod == null) _prod = ClassicProduct.UnknownProduct; _lit = Encoding.ASCII.GetString(literal); }
/// <summary> /// Creates a standard Version 2 Battle.net FTP request. /// </summary> /// <param name="product">The product being emulated by this request.</param> /// <param name="fileName">The full or relative path to the file as it is to be stored on the local /// machine. The name portion of the file must be the filename being requested from the service.</param> /// <param name="fileTime">The last-write time of the file. If the file is not available, this parameter /// can be <b>null</b> (<b>Nothing</b> in Visual Basic).</param> /// <param name="cdKey">The CD key of the client being emulated.</param> public BnFtpVersion2Request(string fileName, ClassicProduct product, DateTime fileTime, CdKey cdKey) : base(fileName, product, fileTime) { string prod = Product.ProductCode; if (prod != "WAR3" && prod != "W3XP") throw new ArgumentOutOfRangeException("product", product, "Only Warcraft III clients are valid for Battle.net version 2 FTP requests."); if (!cdKey.IsValid) throw new ArgumentException("The specified CD key is not valid.", "cdKey"); _key = cdKey; }
private static ConsoleColor ColorFromProduct(ClassicProduct product) { ConsoleColor result; if (!_colors.TryGetValue(product, out result)) { result = ConsoleColor.DarkCyan; } return(result); }
internal DefaultStats(string productID, byte[] literal) { Debug.Assert(literal != null); _prod = ClassicProduct.GetByProductCode(productID); if (_prod == null) { _prod = ClassicProduct.UnknownProduct; } _lit = Encoding.ASCII.GetString(literal); }
/// <summary> /// Creates a standard Version 2 Battle.net FTP request. /// </summary> /// <param name="product">The product being emulated by this request.</param> /// <param name="fileName">The full or relative path to the file as it is to be stored on the local /// machine. The name portion of the file must be the filename being requested from the service.</param> /// <param name="fileTime">The last-write time of the file. If the file is not available, this parameter /// can be <b>null</b> (<b>Nothing</b> in Visual Basic).</param> /// <param name="cdKey">The CD key of the client being emulated.</param> public BnFtpVersion2Request(string fileName, ClassicProduct product, DateTime fileTime, CdKey cdKey) : base(fileName, product, fileTime) { string prod = Product.ProductCode; if (prod != "WAR3" && prod != "W3XP") { throw new ArgumentOutOfRangeException("product", product, "Only Warcraft III clients are valid for Battle.net version 2 FTP requests."); } if (!cdKey.IsValid) { throw new ArgumentException("The specified CD key is not valid.", "cdKey"); } _key = cdKey; }
/// <summary> /// Creates a new generic Battle.net FTP request. /// </summary> /// <param name="fileName">The name of the file to be downloaded.</param> /// <param name="product">The client being emulated.</param> /// <param name="fileTime">The timestamp of the file's last write in UTC. /// You may specify <b>null</b> (<b>Nothing</b> in Visual Basic) if the /// time is unavailable.</param> /// <remarks> /// <para>Valid emulation clients include: /// <list type="bullet"> /// <item>Starcraft Retail</item> /// <item>Starcraft: Brood War</item> /// <item>Warcraft II: Battle.net Edition</item> /// <item>Diablo II Retail</item> /// <item>Diablo II: Lord of Destruction</item> /// <item>Warcraft III: The Reign of Chaos</item> /// <item>Warcraft III: The Frozen Throne</item> /// </list> /// </para> /// </remarks> protected BnFtpRequestBase(string fileName, ClassicProduct product, DateTime? fileTime) { if (!product.CanConnect) throw new ArgumentException("The requested product cannot be used for BnFtp requests.", "product"); _fileName = fileName; if (fileName.IndexOf('\\') != -1) { _fileName = fileName.Substring(fileName.LastIndexOf('\\') + 1); } _product = product; _time = fileTime; this.LocalFileName = fileName; }
/// <summary> /// Creates a new generic Battle.net FTP request. /// </summary> /// <param name="fileName">The name of the file to be downloaded.</param> /// <param name="product">The client being emulated.</param> /// <param name="fileTime">The timestamp of the file's last write in UTC. /// You may specify <b>null</b> (<b>Nothing</b> in Visual Basic) if the /// time is unavailable.</param> /// <remarks> /// <para>Valid emulation clients include: /// <list type="bullet"> /// <item>Starcraft Retail</item> /// <item>Starcraft: Brood War</item> /// <item>Warcraft II: Battle.net Edition</item> /// <item>Diablo II Retail</item> /// <item>Diablo II: Lord of Destruction</item> /// <item>Warcraft III: The Reign of Chaos</item> /// <item>Warcraft III: The Frozen Throne</item> /// </list> /// </para> /// </remarks> protected BnFtpRequestBase(string fileName, ClassicProduct product, DateTime?fileTime) { if (!product.CanConnect) { throw new ArgumentException("The requested product cannot be used for BnFtp requests.", "product"); } _fileName = fileName; if (fileName.IndexOf('\\') != -1) { _fileName = fileName.Substring(fileName.LastIndexOf('\\') + 1); } _product = product; _time = fileTime; this.LocalFileName = fileName; }
/// <summary> /// Creates a default statistics object with information only about the product. /// </summary> /// <param name="product">The product for which to create information.</param> /// <returns>An instance of <see>UserStats</see> with only product information.</returns> public static UserStats CreateDefault(ClassicProduct product) { return(new DefaultStats(product.ProductCode, Encoding.ASCII.GetBytes(product.ProductCode))); }
/// <summary> /// Creates a default statistics object with information only about the product. /// </summary> /// <param name="product">The product for which to create information.</param> /// <returns>An instance of <see>UserStats</see> with only product information.</returns> public static UserStats CreateDefault(ClassicProduct product) { return new DefaultStats(product.ProductCode, Encoding.ASCII.GetBytes(product.ProductCode)); }
private static ConsoleColor ColorFromProduct(ClassicProduct product) { ConsoleColor result; if (!_colors.TryGetValue(product, out result)) result = ConsoleColor.DarkCyan; return result; }