当前位置: 首页>>代码示例>>C#>>正文


C# GlobusHttpHelper.SetProfilePic方法代码示例

本文整理汇总了C#中BaseLib.GlobusHttpHelper.SetProfilePic方法的典型用法代码示例。如果您正苦于以下问题:C# GlobusHttpHelper.SetProfilePic方法的具体用法?C# GlobusHttpHelper.SetProfilePic怎么用?C# GlobusHttpHelper.SetProfilePic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BaseLib.GlobusHttpHelper的用法示例。


在下文中一共展示了GlobusHttpHelper.SetProfilePic方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UploadPic

        private void UploadPic(ref GlobusHttpHelper httpHelper, string loggedinPageSource, string referer)
        {
            try
            {
                string localImagePath = "";
                string imagePath = string.Empty;

                try
                {
                    Interlocked.Increment(ref counter_PicSelected);
                    if (counter_PicSelected >= lstpicfile.Count)
                    {
                        counter_PicSelected = 0;
                    }
                    //localImagePath = lstpicfile[new Random().Next(0, lstpicfile.Count)];
                    localImagePath = lstpicfile[counter_PicSelected];
                }
                catch { }

                Log("[ " + DateTime.Now + " ] => [ Images : " + localImagePath + " Select For UserName : " + userName + " ]");

                string status = string.Empty;
                string profileId = GetProfileId(ref httpHelper, loggedinPageSource);

                string postUrl = "http://www.linkedin.com/mupld/upload?goback=%2Enpv_" + profileId + "_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1%2Enpe_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1_*1";

                string[] upload_infoArr = Regex.Split(loggedinPageSource, " name=\"upload_info");  // name="upload_info"
                string upload_info = string.Empty;
                if (upload_infoArr.Count() > 1)
                {
                    try
                    {
                        upload_info = upload_infoArr[1].Substring(upload_infoArr[1].IndexOf("value="), upload_infoArr[1].IndexOf("id=") - upload_infoArr[1].IndexOf("value=")).Replace("value=", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Trim();
                    }
                    catch { }
                }
                else
                {
                    try
                    {
                        string[] upload_infoArr1 = Regex.Split(loggedinPageSource, "id\":\"upload_info");
                        upload_info = upload_infoArr1[1].Substring(upload_infoArr1[1].IndexOf("value\":"), upload_infoArr1[1].IndexOf("type") - upload_infoArr1[1].IndexOf("value\":")).Replace("value\":", string.Empty).Replace("\"", string.Empty).Replace("\\", string.Empty).Replace(",", string.Empty).Trim();
                    }
                    catch { }
                }
                try
                {
                    bool PostStatus = false;
                    try
                    {
                        PostStatus = httpHelper.SetProfilePic(ref httpHelper, profileId, userName, password, localImagePath, proxyAddress, proxyPort, proxyUsername, proxyPassword, ref status, upload_info);
                    }
                    catch { }
                    if (PostStatus)
                    {
                        GlobusFileHelper.AppendStringToTextfileNewLine("Profile Picture Changed Successfully To UserName : " + userName + " In Image Path : " + localImagePath, Globals.path_ProfPicSuccess);
                        Log("[ " + DateTime.Now + " ] => [ Profile Picture Changed Successfully To UserName : " + userName + " In Image Path : " + localImagePath + " ]");
                    }
                    else
                    {
                        GlobusFileHelper.AppendStringToTextfileNewLine("Profile Picture Not Changed Successfully To UserName : " + userName + " In Image Path : " + localImagePath, Globals.path_ProfPicFail);
                        Log("[ " + DateTime.Now + " ] => [ Profile Picture Not Changed Successfully To UserName : " + userName + " In Image Path : " + localImagePath + " ]");
                    }

                }
                catch { }
            }
            catch
            {
            }
        }
开发者ID:brentscheidt,项目名称:inboard,代码行数:71,代码来源:LinkedinProfileImgUploader.cs


注:本文中的BaseLib.GlobusHttpHelper.SetProfilePic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。