コード例 #1
0
        public void SaveStreamSettings()
        {
            lock (loginLock)
            {
                if (ChannelId == 0)
                {
                    return;
                }



                Debug.Print(ChannelTitle);
                Debug.Print(ChannelType);
                Debug.Print(ChannelName);
                Debug.Print(ChannelGame);
                Debug.Print(ChannelShortInfo);

                var postData = new PostData();
                postData.Params.Add(new PostDataParam("title", UTF8(ChannelTitle), PostDataParamType.Field));
                postData.Params.Add(new PostDataParam("field_channel_type[value]", ChannelType, PostDataParamType.Field));
                postData.Params.Add(new PostDataParam("field_channel_name[0][value]", ChannelName, PostDataParamType.Field));
                postData.Params.Add(new PostDataParam("field_channel_status[value]", _channelIsLive ? "1" : "0", PostDataParamType.Field));
                postData.Params.Add(new PostDataParam("field_channel_id[0]", "", PostDataParamType.Field));
                //            postData.Params.Add(new PostDataParam("field_cbg_image[0][fid]", "0", PostDataParamType.Field));
                //            postData.Params.Add(new PostDataParam("field_cbg_image[0][list]", "1", PostDataParamType.Field));
                //            postData.Params.Add(new PostDataParam("files[field_cbg_image_0]", "", PostDataParamType.File));
                postData.Params.Add(new PostDataParam("taxonomy[1][]", ChannelGame, PostDataParamType.Field));
                postData.Params.Add(new PostDataParam("changed", ChannelChanged, PostDataParamType.Field));
                postData.Params.Add(new PostDataParam("form_build_id", ChannelFormBuildId, PostDataParamType.Field));
                postData.Params.Add(new PostDataParam("form_token", ChannelFormToken, PostDataParamType.Field));
                postData.Params.Add(new PostDataParam("form_id", ChannelFormId, PostDataParamType.Field));
                postData.Params.Add(new PostDataParam("body", HttpUtility.HtmlDecode(UTF8(ChannelLongInfo)), PostDataParamType.Field));
                postData.Params.Add(new PostDataParam("teaser", HttpUtility.HtmlDecode(UTF8(ChannelShortInfo)), PostDataParamType.Field));
                postData.Params.Add(new PostDataParam("path", ChannelURLPath, PostDataParamType.Field));
                postData.Params.Add(new PostDataParam("op", UTF8("Сохранить"), PostDataParamType.Field));
                if (ChannelAutoUpdate)
                {
                    postData.Params.Add(new PostDataParam("field_channel_autoupdate[value]", "1", PostDataParamType.Field));
                }
                if (ChannelWithoutComments)
                {
                    postData.Params.Add(new PostDataParam("field_channel_without_comments[value]", "1", PostDataParamType.Field));
                }
                if (ChannelURLAlias)
                {
                    postData.Params.Add(new PostDataParam("pathauto_perform_alias", "1", PostDataParamType.Field));
                }
                loginWC.PostMultipart(String.Format(channelEditUrl2, ChannelId), postData.GetPostData(), postData.Boundary);

                Debug.Print("Sc2tv: Settings saved");
            }
            ThreadPool.QueueUserWorkItem(f => LoadStreamSettings());
        }