Ejemplo n.º 1
0
 /// <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;
 }
Ejemplo n.º 2
0
 /// <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;
 }
Ejemplo n.º 3
0
 /// <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;
 }
Ejemplo n.º 4
0
 /// <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;
 }
Ejemplo n.º 5
0
        // 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.");
        }
Ejemplo n.º 6
0
        // 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.");
            }
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        /// <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;
        }
Ejemplo n.º 9
0
        private static ConsoleColor ColorFromProduct(ClassicProduct product)
        {
            ConsoleColor result;

            if (!_colors.TryGetValue(product, out result))
            {
                result = ConsoleColor.DarkCyan;
            }

            return(result);
        }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
        /// <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;
        }
Ejemplo n.º 12
0
        /// <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;
        }
Ejemplo n.º 13
0
        /// <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;
        }
Ejemplo n.º 14
0
 /// <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)));
 }
Ejemplo n.º 15
0
 /// <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));
 }
Ejemplo n.º 16
0
        private static ConsoleColor ColorFromProduct(ClassicProduct product)
        {
            ConsoleColor result;
            if (!_colors.TryGetValue(product, out result))
                result = ConsoleColor.DarkCyan;

            return result;
        }