Exemple #1
0
    public ItemUpgradeData(WOApiWebPage in_form)
    {
        for (int i = 0; i < MAX_CATEGORIES; i++)
        {
            categories_[i] = new CategoryUpgrades();
        }

        // get all upgrade items
        SqlCommand sqcmd = new SqlCommand();

        sqcmd.CommandType = CommandType.StoredProcedure;
        sqcmd.CommandText = "WO_ItemUpgradeGetUpgrades";
        if (!in_form.CallWOApi(sqcmd))
        {
            throw new ApiExitException("UpgradeGetUpgrades failed");
        }

        SqlDataReader reader = in_form.reader;

        while (reader.Read())
        {
            UpgradeData ud = new UpgradeData(Convert.ToInt32(reader["ItemID"]));
            ud.Value    = Convert.ToDouble(reader["Value"]);
            ud.GPPrice  = Convert.ToInt32(reader["PriceP"]);
            ud.GPChance = Convert.ToDouble(reader["GPChance"]) / 100.0;
            ud.GDPrice  = Convert.ToInt32(reader["GPriceP"]);
            ud.GDChance = Convert.ToDouble(reader["GDChance"]) / 100.0;

            // decode and put it
            categories_[ud.uid.Category].types[ud.uid.Type].levels[ud.uid.Level] = ud;
            items_.Add(ud.uid.ItemID, ud);
        }
        reader = null;
    }
        public CAttachedFile(WOApiWebPage page, string file, bool compressed)
        {
            string str1 = file + "File";
            string str2 = file + "Size";

            HttpPostedFile httpFile = page.Request.Files[str1];

            if (httpFile == null)
            {
                return;
            }

            FileName = httpFile.FileName;

            int httpSize = Convert.ToInt32(page.web.Param(str2));

            data = new Byte[httpSize];

            if (compressed)
            {
                GZipStream GZip = new GZipStream(httpFile.InputStream, CompressionMode.Decompress);
                GZip.Read(data, 0, httpSize);
                GZip.Close();
            }
            else
            {
                using (BinaryReader br = new BinaryReader(httpFile.InputStream))
                {
                    data = br.ReadBytes(httpSize);
                }
            }
        }