コード例 #1
0
        public static void AddGame(GameModel gameModel)
        {
            try
            {
                string timeAuth = DateTime.Now.Millisecond.ToString();
                string cryptStr = Encryption.Encrypt("addgames" + timeAuth);

                gameModel.GameType = HttpUtility.UrlEncode(gameModel.GameType);
                gameModel.GameName = HttpUtility.UrlEncode(HttpUtility.HtmlEncode(gameModel.GameName));
                gameModel.GameDetails = HttpUtility.UrlEncode(HttpUtility.HtmlEncode(gameModel.GameDetails));
                gameModel.LogoPath = HttpUtility.UrlEncode(gameModel.LogoPath);
                gameModel.HeadImage = HttpUtility.UrlEncode(gameModel.HeadImage);

                gameModel.Images1 = HttpUtility.UrlEncode(gameModel.Images1);
                gameModel.Images2 = HttpUtility.UrlEncode(gameModel.Images2);
                gameModel.Images3 = HttpUtility.UrlEncode(gameModel.Images3);
                gameModel.Images4 = HttpUtility.UrlEncode(gameModel.Images4);
                gameModel.Images5 = HttpUtility.UrlEncode(gameModel.Images5);
                gameModel.Images6 = HttpUtility.UrlEncode(gameModel.Images6);
                gameModel.Images7 = HttpUtility.UrlEncode(gameModel.Images7);
                gameModel.Images8 = HttpUtility.UrlEncode(gameModel.Images8);

                string dataStr = string.Format("action={0}&gametype={1}&gamename={2}&version={3}&gameid={4}&pushername={5}&updatetime={6}&gamedetails={7}&logopath={8}&sourcetype={9}&downloadcount={10}"
                                               + "&price={11}&filesize={12}&starts={13}&headimage={14}&rating={15}&images1={16}&images2={17}&images3={18}&images4={19}&images5={20}&images6={21}&images7={22}&images8={23}&phoneversion={24}&rd={25}&auth={26}",
                                               "addgames", gameModel.GameType, gameModel.GameName, gameModel.Version, gameModel.GameID, gameModel.PusherName, gameModel.UpdateTime, gameModel.GameDetails, gameModel.LogoPath, gameModel.SourceType, gameModel.DownloadCount,
                                               gameModel.Price, gameModel.FileSize, gameModel.Starts, gameModel.HeadImage, gameModel.Rating, gameModel.Images1, gameModel.Images2, gameModel.Images3, gameModel.Images4, gameModel.Images5, gameModel.Images6, gameModel.Images7, gameModel.Images8, gameModel.PhoneVersion,
                                               timeAuth,cryptStr);

                string result = HttpHelper.HTTP_POST("http://recommendgames.pettostudio.net/RecommendGames.aspx", dataStr);
                //string result = HttpHelper.HTTP_POST("http://localhost:21422/RecommendGames.aspx", dataStr);
                if (result.ToLower() != "200:ok")
                {
                    throw new Exception(result);
                }
            }
            catch (Exception)
            {

                throw;
            }
        }
コード例 #2
0
        private async void button_OK_Click(object sender, EventArgs e)
        {
            string info = CheckControlState();
            if (info != "200")
            {
                SetInfo(info);
                return;
            }

            SetInfo(string.Format("{0},开始提交", this.textBox_GameName.Text));
            await Task.Delay(TimeSpan.FromSeconds(0.1));

            GameModel gameModel_t = new GameModel
            {
                DownloadCount = this.textBox_DownloadCount.Text,
                FileSize = this.textBox_FileSize.Text,
                GameDetails = this.textBox_GameDetails.Text,
                GameID = this.textBox_GameID.Text,
                GameName = this.textBox_GameName.Text,
                GameType = this.comboBox_GameType.Text,
                PhoneVersion = this.comboBox_PhoneVersion.Text,
                Price = this.comboBox_Price.Text,
                PusherName = this.textBox_PusherName.Text,
                SourceType = this.checkBox_SourceType.Checked ? "header" : (this.checkBox_IsConner.Checked ? "conner" : "list"),
                Version = this.textBox_Version.Text,
                UpdateTime = this.dateTimePicker_UpdateTime.Value.ToString("yyyy-MM-dd HH:mm:ss"),
                IsTopmost = this.checkBox_IsTopmost.Checked
            };

            if (!checkBox_LogoPath.Checked)
            {
                gameModel_t.LogoPath = this.textBox_LogoPath.Text;
            }
            else
            {
                ImageHelper.GetPicThumbnail(pictureBox_LogoPath.ImageLocation, Path.Combine(_tempDir, this.textBox_GameName.Text + "_logo.png"),
                    pictureBox_LogoPath.Image.Width, pictureBox_LogoPath.Image.Height, 80);

                HttpDataHelper.UploadImage(Path.Combine(_tempDir, this.textBox_GameName.Text + "_logo.png"));
                gameModel_t.LogoPath = string.Format("http://recommendgames.pettostudio.net/resoures/wp/images/{0}_logo.png",
                    this.textBox_GameName.Text);
            }

            if (checkBox_SourceType.Checked)
            {
                ImageHelper.GetPicThumbnail(this.pictureBox_Header.ImageLocation, Path.Combine(_tempDir, this.textBox_GameName.Text + "_header.png"),
                   pictureBox_Header.Image.Width, pictureBox_Header.Image.Height, 80);

                HttpDataHelper.UploadImage(Path.Combine(_tempDir, this.textBox_GameName.Text + "_header.png"));
                gameModel_t.HeadImage = string.Format("http://recommendgames.pettostudio.net/resoures/wp/images/{0}_header.png",
                    this.textBox_GameName.Text);
            }

            if (checkBox_IsConner.Checked)
            {
                ImageHelper.GetPicThumbnail(this.pictureBox_Header.ImageLocation, Path.Combine(_tempDir, this.textBox_GameName.Text + "_conner.png"),
                   pictureBox_Header.Image.Width, pictureBox_Header.Image.Height, 80);

                HttpDataHelper.UploadImage(Path.Combine(_tempDir, this.textBox_GameName.Text + "_conner.png"));
                gameModel_t.HeadImage = string.Format("http://recommendgames.pettostudio.net/resoures/wp/images/{0}_conner.png",
                    this.textBox_GameName.Text);
            }

            if (!checkBox_UploadImages.Checked)
            {
                gameModel_t.Images1 = this.textBox_Images1.Text;
                gameModel_t.Images2 = this.textBox_Images2.Text;
                gameModel_t.Images3 = this.textBox_Images3.Text;
                gameModel_t.Images4 = this.textBox_Images4.Text;
                gameModel_t.Images5 = this.textBox_Images5.Text;
                gameModel_t.Images6 = this.textBox_Images6.Text;
                gameModel_t.Images7 = this.textBox_Images7.Text;
                gameModel_t.Images8 = this.textBox_Images8.Text;
            }
            else
            {
                for (int i = 0; i < _screenShotPictureList.Count; i++)
                {
                    if (_screenShotPictureList[i].Image != null)
                    {
                        ImageHelper.GetPicThumbnail(_screenShotPictureList[i].ImageLocation, Path.Combine(_tempDir, this.textBox_GameName.Text + "_image" + (i + 1).ToString() + ".png"),
                            _screenShotPictureList[i].Image.Width, _screenShotPictureList[i].Image.Height, 80);

                        HttpDataHelper.UploadImage(Path.Combine(_tempDir, this.textBox_GameName.Text + "_image" + (i + 1).ToString() + ".png"));
                    }
                }

                gameModel_t.Images1 = string.IsNullOrWhiteSpace(pictureBox_Images1.ImageLocation) ? string.Empty :
                    string.Format("http://recommendgames.pettostudio.net/resoures/wp/images/{0}_image1.png", this.textBox_GameName.Text);

                gameModel_t.Images2 = string.IsNullOrWhiteSpace(pictureBox_Images2.ImageLocation) ? string.Empty :
                    string.Format("http://recommendgames.pettostudio.net/resoures/wp/images/{0}_image2.png", this.textBox_GameName.Text);

                gameModel_t.Images3 = string.IsNullOrWhiteSpace(pictureBox_Images3.ImageLocation) ? string.Empty :
                    string.Format("http://recommendgames.pettostudio.net/resoures/wp/images/{0}_image3.png", this.textBox_GameName.Text);

                gameModel_t.Images4 = string.IsNullOrWhiteSpace(pictureBox_Images4.ImageLocation) ? string.Empty :
                    string.Format("http://recommendgames.pettostudio.net/resoures/wp/images/{0}_image4.png", this.textBox_GameName.Text);

                gameModel_t.Images5 = string.IsNullOrWhiteSpace(pictureBox_Images5.ImageLocation) ? string.Empty :
                    string.Format("http://recommendgames.pettostudio.net/resoures/wp/images/{0}_image5.png", this.textBox_GameName.Text);

                gameModel_t.Images6 = string.IsNullOrWhiteSpace(pictureBox_Images6.ImageLocation) ? string.Empty :
                    string.Format("http://recommendgames.pettostudio.net/resoures/wp/images/{0}_image6.png", this.textBox_GameName.Text);

                gameModel_t.Images7 = string.IsNullOrWhiteSpace(pictureBox_Images7.ImageLocation) ? string.Empty :
                    string.Format("http://recommendgames.pettostudio.net/resoures/wp/images/{0}_image7.png", this.textBox_GameName.Text);

                gameModel_t.Images8 = string.IsNullOrWhiteSpace(pictureBox_Images8.ImageLocation) ? string.Empty :
                    string.Format("http://recommendgames.pettostudio.net/resoures/wp/images/{0}_image8.png", this.textBox_GameName.Text);

            }

            HttpDataHelper.AddGame(gameModel_t);

            SetInfo(string.Format("{0},提交成功", this.textBox_GameName.Text));
            ClearAll();
        }