using Newtonsoft.Json; using Newtonsoft.Json.Linq; using PDF_Master.Properties; using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Management; using System.Net; using System.Runtime.InteropServices; using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; namespace PDF_Master.Helper { //本辅助类不使用viewmodel,因为同时在PDFreaderPro上使用 public static class ADServiceHelper { #if DEBUG public static string RequestHost = "http://test-store.kdan.cn:3019"; #else public static string RequestHost = "https://store.filmagepro.com:3018"; #endif public static string AdUrl = "/api/advertise-new"; public static String GetAD(string appname) { string FileNameMac = App.CachePath.ADFilePath + "\\" + "Mac" + ".png"; string FileNameiPad = App.CachePath.ADFilePath + "\\" + "iPad" + ".png"; string FileNameAndroid = App.CachePath.ADFilePath + "\\" + "Android" + ".png"; string FileNameComPDFKit = App.CachePath.ADFilePath + "\\" + "ComPDFKit" + ".png"; string FileNameComVideoKit = App.CachePath.ADFilePath + "\\" + "ComVideoKit" + ".png"; string FileNameSignFlow = App.CachePath.ADFilePath + "\\" + "SignFlow" + ".png"; string FileNameFilmageEditor = App.CachePath.ADFilePath + "\\" + "FilmageEditor" + ".png"; string FileNameFilmageScreen = App.CachePath.ADFilePath + "\\" + "FilmageScreen" + ".png"; string FileNameFreePDFTemplates = App.CachePath.ADFilePath + "\\" + "FreePDFTemplates" + ".png"; string FileNameBlackFriday = App.CachePath.ADFilePath + "\\" + "advertisement" + ".png"; HttpWebResponse response = null; ServicePointManager.DefaultConnectionLimit = 200; string post = $"?app_name={appname}"; HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(RequestHost + AdUrl+post); request.Method = "Get"; request.ContentType = "text/html;charset=UTF-8"; //request.Accept = "application/vnd.api+json;version=1"; request.Timeout = 20000; request.ServicePoint.Expect100Continue = false; try { response = (HttpWebResponse)request.GetResponse(); using (StreamReader reader = new StreamReader(response.GetResponseStream())) { string responseData = reader.ReadToEnd(); Console.WriteLine(responseData); reader.Close(); JObject jobject = (JObject)JsonConvert.DeserializeObject(responseData); if (response != null) { response.Close(); } if (request != null) { request.Abort(); } Console.WriteLine(responseData); if (jobject["code"].ToObject().ToLower() == "200") { // 从 JObject 获取 list 数组 JArray list = (JArray)jobject["list"]; JObject RecommondContentPDFPro = (JObject)JObject.Parse(list[0]["detail"].ToString())["recommondContent"][0]["RecommondContentPDFPro"]; JObject RecommondContentOther = (JObject)JObject.Parse(list[0]["detail"].ToString())["recommondContent"][0]["RecommondContentOther"]; JArray advertisement = (JArray)JObject.Parse(list[0]["detail"].ToString())["advertisement"]; #region RecommondContentPDFPro参数配置 Settings.Default.ADDate.RecommondContentPDFPro_nameen = RecommondContentPDFPro["name"]["en"].ToString(); Settings.Default.ADDate.RecommondContentPDFPro_namezh_CN = RecommondContentPDFPro["name"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondContentPDFPro_namezh_TW = RecommondContentPDFPro["name"]["zh_TW"].ToString(); //RecommondPDFPro JArray RecommondPDFPro = (JArray)RecommondContentPDFPro["content"]; //recommondPDF - Mac Settings.Default.ADDate.RecommondPDFPro_Macshow = RecommondPDFPro[0]["show"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Mactype = RecommondPDFPro[0]["type"].ToString(); Settings.Default.ADDate.RecommondPDFPro_MacsubscriptionType = RecommondPDFPro[0]["subscriptionType"].ToString(); Settings.Default.ADDate.RecommondPDFPro_MacstartTime = RecommondPDFPro[0]["startTime"].ToObject(); Settings.Default.ADDate.RecommondPDFPro_MacendTime = RecommondPDFPro[0]["endTime"].ToObject(); Settings.Default.ADDate.RecommondPDFPro_Macnameen = RecommondPDFPro[0]["name"]["en"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Macnamezh_CN = RecommondPDFPro[0]["name"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Macnamezh_TW = RecommondPDFPro[0]["name"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Mactooltipen = RecommondPDFPro[0]["tooltip"]["en"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Mactooltipzh_CN = RecommondPDFPro[0]["tooltip"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Mactooltipzh_TW = RecommondPDFPro[0]["tooltip"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondPDFPro_MaclinkURLen = RecommondPDFPro[0]["linkURL"]["en"].ToString(); Settings.Default.ADDate.RecommondPDFPro_MaclinkURLzh_CN = RecommondPDFPro[0]["linkURL"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondPDFPro_MaclinkURLzh_TW = RecommondPDFPro[0]["linkURL"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Macimagenormal = RecommondPDFPro[0]["image"]["normal_Light"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Macimagehover = RecommondPDFPro[0]["image"]["hover_Light"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Macimageen = RecommondPDFPro[0]["image"]["en"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Macimagezh_CN = RecommondPDFPro[0]["image"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Macimagezh_TW = RecommondPDFPro[0]["image"]["zh_TW"].ToString(); if (RecommondPDFPro[0]["version"].ToString() != Settings.Default.ADDate.RecommondPDFPro_Macversion|| File.Exists(FileNameMac) == false) { Settings.Default.ADDate.RecommondPDFPro_Macversion = RecommondPDFPro[0]["version"].ToString(); if (File.Exists(FileNameMac) == true) { File.Delete(FileNameMac); } WebClient client = new WebClient(); client.DownloadFile(Settings.Default.ADDate.RecommondPDFPro_Macimageen, FileNameMac); } //recommondPDF - iPad Settings.Default.ADDate.RecommondPDFPro_iPadshow = RecommondPDFPro[1]["show"].ToString(); Settings.Default.ADDate.RecommondPDFPro_iPadtype = RecommondPDFPro[1]["type"].ToString(); Settings.Default.ADDate.RecommondPDFPro_iPadsubscriptionType = RecommondPDFPro[1]["subscriptionType"].ToString(); Settings.Default.ADDate.RecommondPDFPro_iPadstartTime = RecommondPDFPro[1]["startTime"].ToObject(); Settings.Default.ADDate.RecommondPDFPro_iPadendTime = RecommondPDFPro[1]["endTime"].ToObject(); Settings.Default.ADDate.RecommondPDFPro_iPadnameen = RecommondPDFPro[1]["name"]["en"].ToString(); Settings.Default.ADDate.RecommondPDFPro_iPadnamezh_CN = RecommondPDFPro[1]["name"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondPDFPro_iPadnamezh_TW = RecommondPDFPro[1]["name"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondPDFPro_iPadtooltipen = RecommondPDFPro[1]["tooltip"]["en"].ToString(); Settings.Default.ADDate.RecommondPDFPro_iPadtooltipzh_CN = RecommondPDFPro[1]["tooltip"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondPDFPro_iPadtooltipzh_TW = RecommondPDFPro[1]["tooltip"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondPDFPro_iPadlinkURLen = RecommondPDFPro[1]["linkURL"]["en"].ToString(); Settings.Default.ADDate.RecommondPDFPro_iPadlinkURLzh_CN = RecommondPDFPro[1]["linkURL"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondPDFPro_iPadlinkURLzh_TW = RecommondPDFPro[1]["linkURL"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondPDFPro_iPadimagenormal = RecommondPDFPro[1]["image"]["normal_Light"].ToString(); Settings.Default.ADDate.RecommondPDFPro_iPadimagehover = RecommondPDFPro[1]["image"]["hover_Light"].ToString(); Settings.Default.ADDate.RecommondPDFPro_iPadimageen = RecommondPDFPro[1]["image"]["en"].ToString(); Settings.Default.ADDate.RecommondPDFPro_iPadimagezh_CN = RecommondPDFPro[1]["image"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondPDFPro_iPadimagezh_TW = RecommondPDFPro[1]["image"]["zh_TW"].ToString(); if (RecommondPDFPro[1]["version"].ToString() != Settings.Default.ADDate.RecommondPDFPro_iPadversion|| File.Exists(FileNameiPad) == false) { Settings.Default.ADDate.RecommondPDFPro_iPadversion = RecommondPDFPro[1]["version"].ToString(); if (File.Exists(FileNameiPad) == true) { File.Delete(FileNameiPad); } WebClient client = new WebClient(); client.DownloadFile(Settings.Default.ADDate.RecommondPDFPro_iPadimageen, FileNameiPad); } //recommondPDF - Android Settings.Default.ADDate.RecommondPDFPro_Androidshow = RecommondPDFPro[2]["show"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Androidtype = RecommondPDFPro[2]["type"].ToString(); Settings.Default.ADDate.RecommondPDFPro_AndroidsubscriptionType = RecommondPDFPro[2]["subscriptionType"].ToString(); Settings.Default.ADDate.RecommondPDFPro_AndroidstartTime = RecommondPDFPro[2]["startTime"].ToObject(); Settings.Default.ADDate.RecommondPDFPro_AndroidendTime = RecommondPDFPro[2]["endTime"].ToObject(); Settings.Default.ADDate.RecommondPDFPro_Androidnameen = RecommondPDFPro[2]["name"]["en"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Androidnamezh_CN = RecommondPDFPro[2]["name"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Androidnamezh_TW = RecommondPDFPro[2]["name"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Androidtooltipen = RecommondPDFPro[2]["tooltip"]["en"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Androidtooltipzh_CN = RecommondPDFPro[2]["tooltip"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Androidtooltipzh_TW = RecommondPDFPro[2]["tooltip"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondPDFPro_AndroidlinkURLen = RecommondPDFPro[2]["linkURL"]["en"].ToString(); Settings.Default.ADDate.RecommondPDFPro_AndroidlinkURLzh_CN = RecommondPDFPro[2]["linkURL"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondPDFPro_AndroidlinkURLzh_TW = RecommondPDFPro[2]["linkURL"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Androidimagenormal = RecommondPDFPro[2]["image"]["normal_Light"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Androidimagehover = RecommondPDFPro[2]["image"]["hover_Light"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Androidimageen = RecommondPDFPro[2]["image"]["en"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Androidimagezh_CN = RecommondPDFPro[2]["image"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondPDFPro_Androidimagezh_TW = RecommondPDFPro[2]["image"]["zh_TW"].ToString(); if (RecommondPDFPro[2]["version"].ToString() != Settings.Default.ADDate.RecommondPDFPro_Androidversion|| File.Exists(FileNameAndroid) == false) { Settings.Default.ADDate.RecommondPDFPro_Androidversion = RecommondPDFPro[2]["version"].ToString(); if (File.Exists(FileNameAndroid) == true) { File.Delete(FileNameAndroid); } WebClient client = new WebClient(); client.DownloadFile(Settings.Default.ADDate.RecommondPDFPro_Androidimageen, FileNameAndroid); } #endregion #region RecommondContentOther参数配置 Settings.Default.ADDate.RecommondContentOther_version = RecommondContentOther["version"].ToString(); Settings.Default.ADDate.RecommondContentOther_nameen = RecommondContentOther["name"]["en"].ToString(); Settings.Default.ADDate.RecommondContentOther_namezh_CN = RecommondContentOther["name"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondContentOther_namezh_TW = RecommondContentOther["name"]["zh_TW"].ToString(); //RecommondOther JArray RecommondOther = (JArray)RecommondContentOther["content"]; //recommondPDF-ComPDFKit Settings.Default.ADDate.RecommondOther_ComPDFKitshow = RecommondOther[0]["show"].ToString(); Settings.Default.ADDate.RecommondOther_ComPDFKittype = RecommondOther[0]["type"].ToString(); Settings.Default.ADDate.RecommondOther_ComPDFKitsubscriptionType = RecommondOther[0]["subscriptionType"].ToString(); Settings.Default.ADDate.RecommondOther_ComPDFKitstartTime = RecommondOther[0]["startTime"].ToObject(); Settings.Default.ADDate.RecommondOther_ComPDFKitendTime = RecommondOther[0]["endTime"].ToObject(); Settings.Default.ADDate.RecommondOther_ComPDFKitnameen = RecommondOther[0]["name"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_ComPDFKitnamezh_CN = RecommondOther[0]["name"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_ComPDFKitnamezh_TW = RecommondOther[0]["name"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondOther_ComPDFKittooltipen = RecommondOther[0]["tooltip"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_ComPDFKittooltipzh_CN = RecommondOther[0]["tooltip"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_ComPDFKittooltipzh_TW = RecommondOther[0]["tooltip"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondOther_ComPDFKitlinkURLen = RecommondOther[0]["linkURL"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_ComPDFKitlinkURLzh_CN = RecommondOther[0]["linkURL"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_ComPDFKitlinkURLzh_TW = RecommondOther[0]["linkURL"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondOther_ComPDFKitimagenormal = RecommondOther[0]["image"]["normal_Light"].ToString(); Settings.Default.ADDate.RecommondOther_ComPDFKitimagehover = RecommondOther[0]["image"]["hover_Light"].ToString(); Settings.Default.ADDate.RecommondOther_ComPDFKitimageen = RecommondOther[0]["image"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_ComPDFKitimagezh_CN = RecommondOther[0]["image"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_ComPDFKitimagezh_TW = RecommondOther[0]["image"]["zh_TW"].ToString(); if (RecommondOther[0]["version"].ToString() != Settings.Default.ADDate.RecommondOther_ComPDFKitversion|| File.Exists(FileNameComPDFKit) ==false) { Settings.Default.ADDate.RecommondOther_ComPDFKitversion = RecommondOther[0]["version"].ToString(); if (File.Exists(FileNameComPDFKit) == true) { File.Delete(FileNameComPDFKit); } WebClient client = new WebClient(); client.DownloadFile(Settings.Default.ADDate.RecommondOther_ComPDFKitimageen, FileNameComPDFKit); } //recommondPDF-ComVideoKit Settings.Default.ADDate.RecommondOther_ComVideoKitshow = RecommondOther[1]["show"].ToString(); Settings.Default.ADDate.RecommondOther_ComVideoKittype = RecommondOther[1]["type"].ToString(); Settings.Default.ADDate.RecommondOther_ComVideoKitsubscriptionType = RecommondOther[1]["subscriptionType"].ToString(); Settings.Default.ADDate.RecommondOther_ComVideoKitstartTime = RecommondOther[1]["startTime"].ToObject(); Settings.Default.ADDate.RecommondOther_ComVideoKitendTime = RecommondOther[1]["endTime"].ToObject(); Settings.Default.ADDate.RecommondOther_ComVideoKitnameen = RecommondOther[1]["name"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_ComVideoKitnamezh_CN = RecommondOther[1]["name"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_ComVideoKitnamezh_TW = RecommondOther[1]["name"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondOther_ComVideoKittooltipen = RecommondOther[1]["tooltip"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_ComVideoKittooltipzh_CN = RecommondOther[1]["tooltip"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_ComVideoKittooltipzh_TW = RecommondOther[1]["tooltip"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondOther_ComVideoKitlinkURLen = RecommondOther[1]["linkURL"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_ComVideoKitlinkURLzh_CN = RecommondOther[1]["linkURL"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_ComVideoKitlinkURLzh_TW = RecommondOther[1]["linkURL"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondOther_ComVideoKitimagenormal = RecommondOther[1]["image"]["normal_Light"].ToString(); Settings.Default.ADDate.RecommondOther_ComVideoKitimagehover = RecommondOther[1]["image"]["hover_Light"].ToString(); Settings.Default.ADDate.RecommondOther_ComVideoKitimageen = RecommondOther[1]["image"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_ComVideoKitimagezh_CN = RecommondOther[1]["image"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_ComVideoKitimagezh_TW = RecommondOther[1]["image"]["zh_TW"].ToString(); if (RecommondOther[1]["version"].ToString() != Settings.Default.ADDate.RecommondOther_ComVideoKitversion|| File.Exists(FileNameComVideoKit) == false) { Settings.Default.ADDate.RecommondOther_ComVideoKitversion = RecommondOther[1]["version"].ToString(); if (File.Exists(FileNameComVideoKit) == true) { File.Delete(FileNameComVideoKit); } WebClient client = new WebClient(); client.DownloadFile(Settings.Default.ADDate.RecommondOther_ComVideoKitimageen, FileNameComVideoKit); } //recommondPDF-SignFlow Settings.Default.ADDate.RecommondOther_SignFlowshow = RecommondOther[2]["show"].ToString(); Settings.Default.ADDate.RecommondOther_SignFlowtype = RecommondOther[2]["type"].ToString(); Settings.Default.ADDate.RecommondOther_SignFlowsubscriptionType = RecommondOther[2]["subscriptionType"].ToString(); Settings.Default.ADDate.RecommondOther_SignFlowstartTime = RecommondOther[2]["startTime"].ToObject(); Settings.Default.ADDate.RecommondOther_SignFlowendTime = RecommondOther[2]["endTime"].ToObject(); Settings.Default.ADDate.RecommondOther_SignFlownameen = RecommondOther[2]["name"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_SignFlownamezh_CN = RecommondOther[2]["name"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_SignFlownamezh_TW = RecommondOther[2]["name"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondOther_SignFlowtooltipen = RecommondOther[2]["tooltip"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_SignFlowtooltipzh_CN = RecommondOther[2]["tooltip"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_SignFlowtooltipzh_TW = RecommondOther[2]["tooltip"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondOther_SignFlowlinkURLen = RecommondOther[2]["linkURL"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_SignFlowlinkURLzh_CN = RecommondOther[2]["linkURL"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_SignFlowlinkURLzh_TW = RecommondOther[2]["linkURL"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondOther_SignFlowimagenormal = RecommondOther[2]["image"]["normal_Light"].ToString(); Settings.Default.ADDate.RecommondOther_SignFlowimagehover = RecommondOther[2]["image"]["hover_Light"].ToString(); Settings.Default.ADDate.RecommondOther_SignFlowimageen = RecommondOther[2]["image"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_SignFlowimagezh_CN = RecommondOther[2]["image"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_SignFlowimagezh_TW = RecommondOther[2]["image"]["zh_TW"].ToString(); if (RecommondOther[2]["version"].ToString() != Settings.Default.ADDate.RecommondOther_SignFlowversion|| File.Exists(FileNameSignFlow) == false) { Settings.Default.ADDate.RecommondOther_SignFlowversion = RecommondOther[2]["version"].ToString(); if (File.Exists(FileNameSignFlow) == true) { File.Delete(FileNameSignFlow); } WebClient client = new WebClient(); client.DownloadFile(Settings.Default.ADDate.RecommondOther_SignFlowimageen, FileNameSignFlow); } //recommondPDF-FilmageEditor Settings.Default.ADDate.RecommondOther_FilmageEditorshow = RecommondOther[3]["show"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageEditortype = RecommondOther[3]["type"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageEditorsubscriptionType = RecommondOther[3]["subscriptionType"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageEditorstartTime = RecommondOther[3]["startTime"].ToObject(); Settings.Default.ADDate.RecommondOther_FilmageEditorendTime = RecommondOther[3]["endTime"].ToObject(); Settings.Default.ADDate.RecommondOther_FilmageEditornameen = RecommondOther[3]["name"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageEditornamezh_CN = RecommondOther[3]["name"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageEditornamezh_TW = RecommondOther[3]["name"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageEditortooltipen = RecommondOther[3]["tooltip"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageEditortooltipzh_CN = RecommondOther[3]["tooltip"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageEditortooltipzh_TW = RecommondOther[3]["tooltip"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageEditorlinkURLen = RecommondOther[3]["linkURL"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageEditorlinkURLzh_CN = RecommondOther[3]["linkURL"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageEditorlinkURLzh_TW = RecommondOther[3]["linkURL"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageEditorimagenormal = RecommondOther[3]["image"]["normal_Light"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageEditorimagehover = RecommondOther[3]["image"]["hover_Light"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageEditorimageen = RecommondOther[3]["image"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageEditorimagezh_CN = RecommondOther[3]["image"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageEditorimagezh_TW = RecommondOther[3]["image"]["zh_TW"].ToString(); if (RecommondOther[3]["version"].ToString() != Settings.Default.ADDate.RecommondOther_FilmageEditorversion|| File.Exists(FileNameFilmageEditor) == false) { Settings.Default.ADDate.RecommondOther_FilmageEditorversion = RecommondOther[3]["version"].ToString(); if (File.Exists(FileNameFilmageEditor) == true) { File.Delete(FileNameFilmageEditor); } WebClient client = new WebClient(); client.DownloadFile(Settings.Default.ADDate.RecommondOther_FilmageEditorimageen, FileNameFilmageEditor); } //recommondPDF-FilmageScreen Settings.Default.ADDate.RecommondOther_FilmageScreenshow = RecommondOther[4]["show"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageScreentype = RecommondOther[4]["type"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageScreensubscriptionType = RecommondOther[4]["subscriptionType"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageScreenstartTime = RecommondOther[4]["startTime"].ToObject(); Settings.Default.ADDate.RecommondOther_FilmageScreenendTime = RecommondOther[4]["endTime"].ToObject(); Settings.Default.ADDate.RecommondOther_FilmageScreennameen = RecommondOther[4]["name"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageScreennamezh_CN = RecommondOther[4]["name"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageScreennamezh_TW = RecommondOther[4]["name"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageScreentooltipen = RecommondOther[4]["tooltip"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageScreentooltipzh_CN = RecommondOther[4]["tooltip"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageScreentooltipzh_TW = RecommondOther[4]["tooltip"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageScreenlinkURLen = RecommondOther[4]["linkURL"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageScreenlinkURLzh_CN = RecommondOther[4]["linkURL"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageScreenlinkURLzh_TW = RecommondOther[4]["linkURL"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageScreenimagenormal = RecommondOther[4]["image"]["normal_Light"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageScreenimagehover = RecommondOther[4]["image"]["hover_Light"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageScreenimageen = RecommondOther[4]["image"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageScreenimagezh_CN = RecommondOther[4]["image"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_FilmageScreenimagezh_TW = RecommondOther[4]["image"]["zh_TW"].ToString(); if (RecommondOther[4]["version"].ToString() != Settings.Default.ADDate.RecommondOther_FilmageScreenversion|| File.Exists(FileNameFilmageScreen) == false) { Settings.Default.ADDate.RecommondOther_FilmageScreenversion = RecommondOther[4]["version"].ToString(); if (File.Exists(FileNameFilmageScreen) == true) { File.Delete(FileNameFilmageScreen); } WebClient client = new WebClient(); client.DownloadFile(Settings.Default.ADDate.RecommondOther_FilmageScreenimageen, FileNameFilmageScreen); } //recommondPDF-FreePDFTemplates Settings.Default.ADDate.RecommondOther_FreePDFTemplatesshow = RecommondOther[5]["show"].ToString(); Settings.Default.ADDate.RecommondOther_FreePDFTemplatestype = RecommondOther[5]["type"].ToString(); Settings.Default.ADDate.RecommondOther_FreePDFTemplatessubscriptionType = RecommondOther[5]["subscriptionType"].ToString(); Settings.Default.ADDate.RecommondOther_FreePDFTemplatesstartTime = RecommondOther[5]["startTime"].ToObject(); Settings.Default.ADDate.RecommondOther_FreePDFTemplatesendTime = RecommondOther[5]["endTime"].ToObject(); Settings.Default.ADDate.RecommondOther_FreePDFTemplatesnameen = RecommondOther[5]["name"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_FreePDFTemplatesnamezh_CN = RecommondOther[5]["name"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_FreePDFTemplatesnamezh_TW = RecommondOther[5]["name"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondOther_FreePDFTemplatestooltipen = RecommondOther[5]["tooltip"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_FreePDFTemplatestooltipzh_CN = RecommondOther[5]["tooltip"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_FreePDFTemplatestooltipzh_TW = RecommondOther[5]["tooltip"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondOther_FreePDFTemplateslinkURLen = RecommondOther[5]["linkURL"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_FreePDFTemplateslinkURLzh_CN = RecommondOther[5]["linkURL"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_FreePDFTemplateslinkURLzh_TW = RecommondOther[5]["linkURL"]["zh_TW"].ToString(); Settings.Default.ADDate.RecommondOther_FreePDFTemplatesimagenormal = RecommondOther[5]["image"]["normal_Light"].ToString(); Settings.Default.ADDate.RecommondOther_FreePDFTemplatesimagehover = RecommondOther[5]["image"]["hover_Light"].ToString(); Settings.Default.ADDate.RecommondOther_FreePDFTemplatesimageen = RecommondOther[5]["image"]["en"].ToString(); Settings.Default.ADDate.RecommondOther_FreePDFTemplatesimagezh_CN = RecommondOther[5]["image"]["zh_CN"].ToString(); Settings.Default.ADDate.RecommondOther_FreePDFTemplatesimagezh_TW = RecommondOther[5]["image"]["zh_TW"].ToString(); if (RecommondOther[5]["version"].ToString() != Settings.Default.ADDate.RecommondOther_FreePDFTemplatesversion|| File.Exists(FileNameFreePDFTemplates) == false) { Settings.Default.ADDate.RecommondOther_FreePDFTemplatesversion = RecommondOther[5]["version"].ToString(); if (File.Exists(FileNameFreePDFTemplates) == true) { File.Delete(FileNameFreePDFTemplates); } WebClient client = new WebClient(); client.DownloadFile(Settings.Default.ADDate.RecommondOther_FreePDFTemplatesimageen, FileNameFreePDFTemplates); } #endregion #region advertisement参数配置 Settings.Default.ADDate.advertisement_BlackFridayshow = advertisement[0]["show"].ToString(); Settings.Default.ADDate.advertisement_BlackFridaytype = advertisement[0]["type"].ToString(); Settings.Default.ADDate.advertisement_BlackFridaysubscriptionType = advertisement[0]["subscriptionType"].ToString(); Settings.Default.ADDate.advertisement_BlackFridaystartTime = advertisement[0]["startTime"].ToObject(); Settings.Default.ADDate.advertisement_BlackFridayendTime = advertisement[0]["endTime"].ToObject(); Settings.Default.ADDate.advertisement_BlackFridayshowCloseBtn = advertisement[0]["showCloseBtn"].ToString(); Settings.Default.ADDate.advertisement_BlackFridaynameen = advertisement[0]["name"]["en"].ToString(); Settings.Default.ADDate.advertisement_BlackFridaynamezh_CN = advertisement[0]["name"]["zh_CN"].ToString(); Settings.Default.ADDate.advertisement_BlackFridaynamezh_TW = advertisement[0]["name"]["zh_TW"].ToString(); Settings.Default.ADDate.advertisement_BlackFridaytooltipen = advertisement[0]["tooltip"]["en"].ToString(); Settings.Default.ADDate.advertisement_BlackFridaytooltipzh_CN = advertisement[0]["tooltip"]["zh_CN"].ToString(); Settings.Default.ADDate.advertisement_BlackFridaytooltipzh_TW = advertisement[0]["tooltip"]["zh_TW"].ToString(); Settings.Default.ADDate.advertisement_BlackFridaylinkURLen = advertisement[0]["linkURL"]["en"].ToString(); Settings.Default.ADDate.advertisement_BlackFridaylinkURLzh_CN = advertisement[0]["linkURL"]["zh_CN"].ToString(); Settings.Default.ADDate.advertisement_BlackFridaylinkURLzh_TW = advertisement[0]["linkURL"]["zh_TW"].ToString(); Settings.Default.ADDate.advertisement_BlackFridayimagenormal = advertisement[0]["image"]["normal_Light"].ToString(); Settings.Default.ADDate.advertisement_BlackFridayimagehover = advertisement[0]["image"]["hover_Light"].ToString(); Settings.Default.ADDate.advertisement_BlackFridayimageen = advertisement[0]["image"]["en"].ToString(); Settings.Default.ADDate.advertisement_BlackFridayimagezh_CN = advertisement[0]["image"]["zh_CN"].ToString(); Settings.Default.ADDate.advertisement_BlackFridayimagezh_TW = advertisement[0]["image"]["zh_TW"].ToString(); if (advertisement[0]["version"].ToString() != Settings.Default.ADDate.advertisement_BlackFridayversion|| File.Exists(FileNameBlackFriday) == false) { if (File.Exists(FileNameBlackFriday) == true) { File.Delete(FileNameBlackFriday); } WebClient client = new WebClient(); client.DownloadFile(Settings.Default.ADDate.advertisement_BlackFridayimageen, FileNameBlackFriday); } #endregion Settings.Default.Save(); } return jobject["code"].ToObject().ToLower(); } } catch (System.Net.WebException) { return "404"; } catch(Exception) { return "0000"; } } public static void Down(string url, string dtnow) { WebRequest wreq = WebRequest.Create(url); HttpWebResponse wresp = (HttpWebResponse)wreq.GetResponse(); Stream s = wresp.GetResponseStream(); System.Drawing.Image img; img = System.Drawing.Image.FromStream(s); img.Save("E:\\" + dtnow, ImageFormat.Jpeg); MemoryStream ms = new MemoryStream(); img.Save(ms, ImageFormat.Jpeg); img.Dispose(); } } }