コード例 #1
0
        public void Save(string path)
        {
            JObject obj   = new JObject();
            JArray  array = new JArray();

            for (int i = 0; i < members.Count; i++)
            {
                JObject jMember = new JObject();
                jMember["id"]           = members.Keys[i];
                jMember["pr2_accounts"] = JArray.FromObject(members.Values[i]);
                array.Add(jMember);
            }
            for (int i = 0; i < pendingVerification.Count; i++)
            {
                if (members.ContainsKey(pendingVerification.Keys[i]))
                {
                    array.First((t) => (ulong)t["id"] == pendingVerification.Keys[i])["verification_code"] = pendingVerification.Values[i];
                }
                else
                {
                    JObject jMember = new JObject();
                    jMember["id"] = pendingVerification.Keys[i];
                    jMember["verification_code"] = pendingVerification.Values[i];
                    array.Add(jMember);
                }
            }
            obj["discord_users"] = array;

            File.WriteAllText(path, obj.ToString());
        }
コード例 #2
0
ファイル: MainCloudService.cs プロジェクト: lsYinyue/Z17
        /// <summary>
        /// 根据用户Id
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public JArray GetUserCompany(UserInfo UserInfo)
        {
            var     userId   = UserInfo.UserName;
            var     Token    = UserInfo.Token;
            var     requests = new List <Object>();
            JObject param    = new JObject
            {
                { "include", "companyPointer" },
                { "where", new JObject {
                      { "status", "1" }, { "user", userId }
                  } },
                { "fields", new JArray {
                      "id", "company"
                  } },
                { "includeFilter", new JObject {
                      { "company", new JObject {
                            { "fields", new JArray {
                                                         "id", "name"
                                                     } }
                        } }
                  } }
            };

            requests.Add(new
            {
                method = "GET",
                path   = "/mcm/api/comStaff?filter=" + JsonConvert.SerializeObject(param)
            });
            JArray ret = ComCloud.ajaxRequest(requests, Token);

            return(JArray.Parse(ret.First().ToString()));
        }
コード例 #3
0
        private Dictionary <string, string> GetRank()
        {
            Dictionary <string, string> dictionary = new Dictionary <string, string>();
            Dictionary <string, string> result;

            try
            {
                JArray jarray = JArray.Parse(this.lcuRequest("/lol-ranked/v2/tiers?summonerIds=[" + this.userData["id"].ToString() + "]&queueTypes=[1,2]", "GET", null));
                if (jarray.Count == 0)
                {
                    throw new Exception();
                }
                foreach (JToken jtoken in ((JArray)jarray.First <JToken>()["achievedTiers"]))
                {
                    JObject jobject = (JObject)jtoken;
                    dictionary.Add(jobject["queueType"].ToString(), jobject["tier"].ToString() + " " + jobject["division"].ToString());
                }
                result = dictionary;
            }
            catch
            {
                result = new Dictionary <string, string>
                {
                    {
                        "RANKED_SOLO_5x5",
                        "unrank"
                    },
                    {
                        "RANKED_FLEX_SR",
                        "unrank"
                    }
                };
            }
            return(result);
        }
コード例 #4
0
ファイル: WxAPI.cs プロジェクト: linrb/CMS-Source-code
        /// <summary>
        /// 删除存储在本地微信素材
        /// </summary>
        private void DelWxMaterialByLocal(string media_id, string type)
        {
            JArray jarry = JsonConvert.DeserializeObject <JArray>(GetWxConfig(type));

            jarry.Remove(jarry.First(d => d["media_id"].ToString().Equals(media_id)));
            GetWxConfig(type, JsonConvert.SerializeObject(jarry));
        }
コード例 #5
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            if (!PasswordCheck())
            {
                return;
            }
            int i = SelectedServer.SelectedIndex;

            switch (SSH.Servers[i].name)
            {
            case "生存服":
                if (((ListBoxItem)operationSelection.SelectedItem).Content.ToString() == "Announcement")
                {
                    string localpath = dataPath + SSH.Servers[i].name + "\\cmd.json";
                    DoBgTask("保存中\n请稍候...", () =>
                    {
                        JArray json = JArray.Parse(File.ReadAllText(localpath));
                        Dispatcher.Invoke(new Action(() => json.First(lambda => FindJToken((JObject)lambda, "name", "announcement"))["text"] = EditTextbox.Text.Replace("\r", null)));
                        File.WriteAllText(localpath, json.ToString());
                        DoBgTask("正在上传到服务器\n请稍候...", () =>
                        {
                            SSH.UploadFile(ref SSH.Servers[i], localpath, $"/mc/{SSH.Servers[i].dirPath}/config/", "cmd.json");
                        });
                    });
                }
                break;

            default:
                break;
            }
        }
コード例 #6
0
        public SpotifySongModel(JObject data)
            : base(data)
        {
            if (data != null)
            {
                this.Duration = long.Parse(data["duration_ms"].ToString());
                if (data["is_local"] != null)
                {
                    this.IsLocal = bool.Parse(data["is_local"].ToString());
                }
                if (data["explicit"] != null)
                {
                    this.Explicit = bool.Parse(data["explicit"].ToString());
                }

                if (data["uri"] != null)
                {
                    this.Uri = data["uri"].ToString();
                }

                if (data["artists"] != null)
                {
                    JArray artists = (JArray)data["artists"];
                    this.Artist = new SpotifyArtistModel((JObject)artists.First());
                }
                if (data["album"] != null)
                {
                    this.Album = new SpotifyAlbumModel((JObject)data["album"]);
                }
            }
        }
コード例 #7
0
        public void Run(APIGatewayProxyRequest request, APIGatewayProxyResponse response, FinanceUser user)
        {
            var itemJson         = new JArray();
            var institutionsJson = new JArray();
            var institutions     = new HashSet <string>();
            var bankClient       = Configuration.BankClient;

            foreach (var bankLink in user.BankLinks ?? new List <BankLink>())
            {
                var item = bankClient.GetItem(bankLink.AccessToken)["item"];
                institutions.Add(item["institution_id"].Value <string>());
                itemJson.Add(item);
            }
            foreach (var institution in institutions)
            {
                institutionsJson.Add(bankClient.GetInstitution(institution)["institution"]);
            }
            foreach (var item in itemJson)
            {
                var institutionId = item["institution_id"].Value <string>();
                item["institution"] = institutionsJson.First(x =>
                                                             string.Equals(x["institution_id"].Value <string>(), institutionId, StringComparison.OrdinalIgnoreCase));
            }
            response.Body = itemJson.ToString();
        }
コード例 #8
0
ファイル: ModelXml.cs プロジェクト: lenkasetGitHub/SlimDX-v2
        static void CalculateIndices(JObject item, JArray interfaces, Dictionary <string, int> indices)
        {
            var key = (string)item["key"];

            if (indices.ContainsKey((string)item["key"]))
            {
                return;
            }

            var parent = (string)item["type"];

            if (!indices.ContainsKey(parent))
            {
                CalculateIndices(interfaces.First(i => (string)i["key"] == parent) as JObject, interfaces, indices);
            }

            int offset = indices[parent];
            int count  = 0;

            foreach (var method in item["methods"])
            {
                int index = (int)method["index"];
                method["index"] = index + offset;
                count++;
            }

            indices.Add(key, count + offset);
        }
コード例 #9
0
        private void DropVertexSingleProperty(VertexSinglePropertyField vp)
        {
            // Update DocDB
            VertexField vertexField  = vp.VertexProperty.Vertex;
            JObject     vertexObject = this.connection.RetrieveDocumentById(vertexField.VertexId);

            Debug.Assert(vertexObject[vp.PropertyName] != null);

            JArray vertexProperty = (JArray)vertexObject[vp.PropertyName];

            vertexProperty
            .First(singleProperty => (string)singleProperty["_propId"] == vp.PropertyId)
            .Remove();
            if (vertexObject.Count == 0)
            {
                vertexProperty.Remove();
            }

            this.connection.ReplaceOrDeleteDocumentAsync(vertexField.VertexId, vertexObject, (string)vertexObject["_partition"]).Wait();

            // Update vertex field
            VertexPropertyField vertexPropertyField = vertexField.VertexProperties[vp.PropertyName];
            bool found = vertexPropertyField.Multiples.Remove(vp.PropertyId);

            Debug.Assert(found);
            if (!vertexPropertyField.Multiples.Any())
            {
                vertexField.VertexProperties.Remove(vp.PropertyName);
            }
        }
コード例 #10
0
        /// <summary>
        /// Makes device connect to specified network. Host who runs the application needs to be connected to the open configuration network! (TP-Link_Smart Plug_XXXX or similar)
        /// </summary>
        public async Task Associate(string ssid, string password, int type = 3)
        {
            dynamic scan = await new SmartHomeProtocolMessage("netif", "get_scaninfo", "refresh", "1").Execute("192.168.0.1", 9999).ConfigureAwait(false);

            if (scan == null || !scan.ToString().Contains(ssid))
            {
                throw new Exception("Couldn't find network!");
            }

            JArray networks = JArray.Parse(Convert.ToString(scan.ap_list));
            JToken network  = networks.First(n => n["ssid"].ToString() == ssid);

            type = (int)network["key_type"];

            dynamic result = await new SmartHomeProtocolMessage("netif", "set_stainfo", new JObject
            {
                new JProperty("ssid", ssid),
                new JProperty("password", password),
                new JProperty("key_type", type)
            }, null).Execute("192.168.0.1", 9999).ConfigureAwait(false);

            if (result == null)
            {
                throw new Exception("Couldn't connect to network. Check password");
            }
            else if (result["err_code"] != null && result.err_code != 0)
            {
                throw new Exception($"Protocol error {result.err_code} ({result.err_msg})");
            }
        }
コード例 #11
0
ファイル: DBHelper.cs プロジェクト: KoKoBoom/Util
        /// <summary>
        /// JArrayToDataTable
        /// </summary>
        /// <param name="values"></param>
        /// <param name="ignoreProperties"></param>
        /// <returns></returns>
        public static DataTable JArrayToDataTable(JArray values, string[] ignoreProperties)
        {
            DataTable dt      = new DataTable();
            var       columns = GetSqlParameter(values.First(), ignoreProperties);

            // 表头
            foreach (var item in columns)
            {
                dt.Columns.Add(item.ParameterName);
            }
            // 填充数据
            DataRow row;

            foreach (JToken item in values)
            {
                row = dt.NewRow();
                foreach (JProperty property in item)
                {
                    if (columns.Any(x => x.ParameterName == property.Name))
                    {
                        row[property.Name] = property.Value.ToString();
                    }
                }

                dt.Rows.Add(row);
            }

            return(dt);
        }
コード例 #12
0
        private static string GetTranslation(string resJson)
        {
            JArray data = (JArray)JsonConvert.DeserializeObject(resJson);
            var    res  = data.First().First().First().ToString();

            return(res);
        }
コード例 #13
0
ファイル: Portal.cs プロジェクト: windygu/RingsModuleJxc
        public Object AddCalendarEventSave(string parameters)
        {
            ParameterHelper ph      = new ParameterHelper(parameters);
            string          start   = ph.GetParameterValue <string>("start");
            string          end     = ph.GetParameterValue <string>("end");
            string          title   = ph.GetParameterValue <string>("title");
            string          comment = ph.GetParameterValue <string>("comment");
            string          id      = ph.GetParameterValue <string>("id");
            string          eventid = ph.GetParameterValue <string>("eventid");

            DBHelper db = new DBHelper();

            var employeeconfig = db.FirstOrDefault("select * from employeeconfig where (content->>'employeeid')::int=" + PluginContext.Current.Account.Id);

            var homepagecomponents = new JArray();

            homepagecomponents = employeeconfig.content.Value <JArray>("homepagecomponents");

            var events   = new JArray();
            var instance = homepagecomponents.FirstOrDefault(c => c.Value <string>("guid") == id);

            if (instance != null && instance["storage"] != null)
            {
                events = JsonConvert.DeserializeObject <JArray>(instance.Value <string>("storage"));
            }

            var newevents = new JArray();

            if (string.IsNullOrEmpty(eventid))
            {
                JObject eventobj = new JObject();
                eventobj.Add("id", Guid.NewGuid().ToString("N"));
                eventobj.Add("title", title);
                eventobj.Add("start", start);
                eventobj.Add("end", end);
                eventobj.Add("comment", comment);
                events.Add(eventobj);
                newevents.Add(eventobj);
            }
            else
            {
                var eventobj = events.First(c => c.Value <string>("id") == eventid);
                eventobj["title"]   = title;
                eventobj["start"]   = start;
                eventobj["end"]     = end;
                eventobj["comment"] = comment;
                newevents.Add(eventobj);
            }

            instance["storage"] = JsonConvert.SerializeObject(events);
            //employeeconfig.content["homepagecomponents"] = homepagecomponents;

            db.Edit("employeeconfig", employeeconfig);

            db.SaveChanges();


            return(new { message = "ok", events = newevents });
        }
コード例 #14
0
        public void MyBind()
        {
            WxAPI  wxBll    = WxAPI.Code_Get(AppID);
            JArray newslist = JsonConvert.DeserializeObject <JArray>(wxBll.GetWxConfig("newsmaterial"));
            JToken news     = newslist.First(j => j["media_id"].ToString().Equals(MediaID));

            News_Hid.Value = JsonConvert.SerializeObject(news);
        }
コード例 #15
0
        private string[] RetrievePublishedVersion(string package)
        {
            try
            {
                using (var client = new HttpClient(new HttpClientHandler {
                    AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
                }))
                {
                    client.BaseAddress = new Uri("https://api.github.com/");
                    HttpRequestMessage request =
                        new HttpRequestMessage(HttpMethod.Post, "/graphql");
                    request.Headers.Add("User-Agent", "USM.Launcher");
                    request.Headers.Add("Authorization", "bearer " + nugetTokenP1 + nugetTokenP2);
                    request.Headers.Add("Accept", "application/vnd.github.packages-preview+json");
                    string graphqlRequest = @"
                     { ""query"": 
                       ""query {
                          repository(owner:\""Tibec\"", name:\""UltimateStreamManager\"") {
                            name
                            packages(last: 3)
                            {
                              nodes {
                                name
                                versions(last:100) {
                                  nodes {
                                    version
                                  }
                                }
                              }
                            }
                           }
                        }""
                     }";
                    request.Content = new StringContent(graphqlRequest.Replace("\r\n", "").Replace("\t", ""));

                    HttpResponseMessage response = client.SendAsync(request).Result;
                    string        result         = response.Content.ReadAsStringAsync().Result;
                    dynamic       json           = JsonConvert.DeserializeObject(result);
                    JArray        repo           = json.data.repository.packages.nodes;
                    JObject       repoVersion    = repo.First(e => (e as JObject)["name"].ToString() == package).ToObject <JObject>();
                    List <string> releases       = new List <string>();

                    foreach (var release in repoVersion["versions"]["nodes"])
                    {
                        string n = release["version"].ToString();
                        Console.WriteLine($"Found published version : {n}");
                        releases.Add(n);
                    }

                    return(releases.ToArray());
                }
            }
            catch
            {
                return(new string[0]);
            }
        }
コード例 #16
0
        private static void AddBookmarkToImageDetails(IDBService dbProxy, JArray data, string fileHash, UserModel user)
        {
            data.First()[ImageProcessor.IS_BOOKMARKED] = false;
            if (user != null)
            {
                var filter = new JObject();
                filter[CommonConst.CommonField.USER_ID] = user.user_id;
                var bookmark = dbProxy.FirstOrDefault(ImageProcessor.MYPHOTO_IMAGE_BOOKMARK_COLLECTION, filter.ToString());

                if (bookmark != null)
                {
                    if ((bookmark[ImageProcessor.IMAGES] as JArray).FirstOrDefault(f => f[ImageProcessor.FILE_HASH].ToString() == fileHash) != null)
                    {
                        data.First()[ImageProcessor.IS_BOOKMARKED] = true;
                    }
                }
            }
        }
コード例 #17
0
        // POST api/data
        //public HttpResponseMessage Post([FromBody]string value)
        public HttpResponseMessage Post(postData value)
        {
            bool updated = false;

            if (value == null)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
            if (value.password != password)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Invalid Password"));
            }

            try
            {
                var     fullPath       = System.Web.Hosting.HostingEnvironment.MapPath(filePath);
                string  fileDataString = System.IO.File.ReadAllText(fullPath + fileName);
                dynamic fileData       = JsonConvert.DeserializeObject(fileDataString);
                JArray  games          = fileData.Games;

                // override last saved game if submitted twice
                dynamic lastGame = games.First();
                if (lastGame.GameDate == value.gameData.GameDate)
                {
                    games.Remove(lastGame);
                    updated = true;
                }

                // backup
                string newFileName = fileName + ".backup_" + DateTime.Now.ToString("dd-MM-yyyy_hhmm");
                System.IO.File.WriteAllText(fullPath + newFileName, JsonConvert.SerializeObject(fileData));

                // save new game
                games.AddFirst(value.gameData);
                System.IO.File.WriteAllText(fullPath + fileName, JsonConvert.SerializeObject(fileData));
            }
            catch (Exception e)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, e.ToString()));
            }

            string text;

            if (updated)
            {
                text = "Game updated successfully";
            }
            else
            {
                text = "Game saved successfully";
            }

            return(Request.CreateResponse(HttpStatusCode.OK, text));
        }
コード例 #18
0
ファイル: Currency.cs プロジェクト: SolidBrainGit/investor
        public async Task <double> GetRate(string currencyAbbreviation)
        {
            HttpClient   web        = new HttpClient();
            const string urlPattern = "https://bank.gov.ua/NBUStatService/v1/statdirectory/exchange?json";
            string       response   = await web.GetStringAsync(urlPattern);

            JArray jObject = JArray.Parse(response);
            JToken rate    = jObject.First(c => (string)c["cc"] == currencyAbbreviation);

            return(double.Parse((string)rate["rate"], CultureInfo.InvariantCulture));
        }
コード例 #19
0
        private static string GetStringFromCache(Translation translation)
        {
            Translation t = Translations.Where(x => x.Key == translation.Key && x.FromLang == translation.FromLang && x.ToLang == translation.ToLang).FirstOrDefault();

            if (t != null)
            {
                return(t.Value);
            }
            else
            {
                // Process to get the string from google api
                string url = @"https://translate.googleapis.com/translate_a/single?client=gtx&sl=" + translation.FromLang.ToString() + "&tl=" + translation.ToLang.ToString() + "&dt=t&q=" + WebUtility.UrlEncode(translation.Key);

                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                request.AutomaticDecompression = DecompressionMethods.GZip;
                string jsonResponse = "";

                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                    using (Stream stream = response.GetResponseStream())
                        using (StreamReader reader = new StreamReader(stream))
                        {
                            jsonResponse = reader.ReadToEnd();
                        }

                string TextParsed = translation.Key;
                JArray objResult  = JsonConvert.DeserializeObject <JArray>(jsonResponse);
                if (objResult.First() != null)
                {
                    TextParsed = "";
                }
                foreach (var item in objResult.First().Children())
                {
                    TextParsed += item.First().ToString();
                }
                translation.Value = TextParsed;
                Translations.Add(translation);
                SaveCache();

                return(translation.Value);
            }
        }
コード例 #20
0
        public JObject GetImage()
        {
            var    imageid = _httpContextProxy.GetQueryString("id");
            string filter  = "{" + CommonConst.CommonField.DISPLAY_ID + ":'" + imageid + "'}";
            JArray data    = _dBService.Get(collection, new RawQuery(filter));

            if (data.Count == 0)
            {
                return(_responseBuilder.NotFound());
            }
            return(_responseBuilder.Success(data.First() as JObject));
        }
コード例 #21
0
        public string translateCity(string city)
        {
            using (StreamReader sr = new StreamReader("Positions.json"))
            {
                JArray a = JArray.Parse(sr.ReadToEnd());

                var icaoJToken = a.First(x => String.Equals(x["city"].ToString(), city,
                                                            StringComparison.InvariantCultureIgnoreCase) &&
                                         !string.IsNullOrWhiteSpace(x["icao"].ToString()))["icao"];

                return(String.Format(icaoJToken.ToString()));
            }
        }
コード例 #22
0
        private static async Task <NugetSourceResult> GetNugetSource(NugetRegistration registration)
        {
            HttpResponseMessage response = await _client.GetAsync(registration.ServiceUri);

            JObject responseData = await response.Content.ReadAsAsync <JObject>();

            JArray apis      = responseData["resources"] as JArray;
            JToken searchApi = apis.First(p => p["@type"].ToString() == "SearchQueryService");
            JToken packageDetailsUriTemplateJson = apis.FirstOrDefault(p => p["@type"].ToString().StartsWith("PackageDetailsUriTemplate"));
            string packageDetailsUriTemplate     = packageDetailsUriTemplateJson == null ? registration.FallbackPackageDetailsUriTemplate : packageDetailsUriTemplateJson["@id"].ToString();

            return(new NugetSourceResult(registration.FriendlyName, registration.ServiceUri, searchApi["@id"].ToString(), packageDetailsUriTemplate));
        }
コード例 #23
0
 private List <Type> GetQuickerVarTypes(string varName)
 {
     varName = varName.Trim('{', '}');
     try
     {
         var varInfo = quickerVarInfo.First(x => x["Key"].ToString() == varName);
         return(GetTypeWithString(quickerVarMetaData[varInfo["Type"].ToString()]["type"].ToString()));
     }
     catch
     {
         return(new List <Type>());
     }
 }
コード例 #24
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string  method    = (string)comboBox1.SelectedItem;
            JArray  functions = (JArray)abi["functions"];
            JObject function  = functions.First(p => p["name"].AsString() == method);
            JArray  _params   = (JArray)function["parameters"];

            parameters_abi  = _params.Select(p => new ContractParameter(p["type"].AsEnum <ContractParameterType>())).ToArray();
            textBox9.Text   = string.Join(", ", _params.Select(p => p["name"].AsString()));
            button8.Enabled = parameters_abi.Length > 0;
            UpdateParameters();
            UpdateScript();
        }
コード例 #25
0
        public async Task <Player> GetPlayerAsync(string name)
        {
            HttpResponseMessage response = await client.GetAsync(Api("players?name=" + Uri.EscapeUriString(name)));

            JObject json = JObject.Parse(await response.Content.ReadAsStringAsync());

            JArray results = json.Value <JArray>("results");

            if (results.Count <= 0)
            {
                return(null);
            }
            return(Player.BuildFromJson(results.First() as JObject));
        }
コード例 #26
0
        public virtual async Task <FocalPoint> GetFacePoint(JArray faceArray, int imageWidth, int imageHeight)
        {
            //TODO: get face with highest ["faceattributes"]["smile"] score

            var        face   = faceArray.First();
            int        top    = int.Parse(face["faceRectangle"]["top"].ToString());
            int        left   = int.Parse(face["faceRectangle"]["left"].ToString());
            int        width  = int.Parse(face["faceRectangle"]["width"].ToString());
            int        height = int.Parse(face["faceRectangle"]["height"].ToString());
            FocalPoint point  = new FocalPoint();

            point.Populate(left, top, width, height, imageWidth, imageHeight);
            return(point);
        }
コード例 #27
0
        public HttpResponseMessage RFIDScanReciever([FromBody] JArray postBody)
        {
            long studentID = postBody.First().SelectToken("studentID").Value <long>();

            if (StudentDatabaseContext.Student.Any(e => e.StudentID == studentID))
            {
                Student student = CheckIn(studentID);
                AttendanceHubContext.Clients.All.SendAsync("ReceiveCheckIn", studentID, student.InClass, student.TimeLastCheckedIn.Value.ToShortTimeString(), student.TimeLastCheckedOut.Value.ToShortTimeString(), student.AttendaceStatus);
                return(new HttpResponseMessage(HttpStatusCode.OK));
            }
            else
            {
                return(new HttpResponseMessage(HttpStatusCode.BadRequest));
            }
        }
コード例 #28
0
        public static IActionResult Run(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
            [CosmosDB(
                 databaseName: "FreeCosmosDB",
                 collectionName: "TelemetryData",
                 ConnectionStringSetting = "CosmosDBConnection",
                 SqlQuery = "SELECT TOP 1 c.AllWiFiDevices FROM c WHERE c.status = 'WiFi Devices' ORDER BY c._ts DESC"
                 )]
            JArray output,
            ILogger log)
        {
            //{Date} = 2021-04-23

            return(new OkObjectResult(output.First()["AllWiFiDevices"]));
        }
コード例 #29
0
ファイル: WxAPI.cs プロジェクト: linrb/CMS-Source-code
        /// <summary>
        /// 更新本地素材
        /// </summary>
        public void UpdateMaterByLocal(string media_id, int index, string curdata)
        {
            JArray  newslist = JsonConvert.DeserializeObject <JArray>(GetWxConfig("newsmaterial"));
            JToken  news     = newslist.First(j => j["media_id"].ToString().Equals(media_id));
            JObject jcurdata = JsonConvert.DeserializeObject <JObject>(curdata);
            JArray  contents = JsonConvert.DeserializeObject <JArray>(news["content"].ToString());

            contents[index]["title"]              = jcurdata["title"];
            contents[index]["thumb_media_id"]     = jcurdata["thumb_media_id"];
            contents[index]["content_source_url"] = jcurdata["content_source_url"];
            contents[index]["content"]            = jcurdata["content"];
            news["content"] = JsonConvert.SerializeObject(contents);
            news["saveimg"] = "0";
            GetWxConfig("newsmaterial", JsonConvert.SerializeObject(newslist));
        }
コード例 #30
0
        public void MyBind()
        {
            JArray newslist = JsonConvert.DeserializeObject <JArray>(api.GetWxConfig("newsmaterial"));
            JToken news     = newslist.First(j => j["media_id"].ToString().Equals(MediaID));

            News_Hid.Value = JsonConvert.SerializeObject(news);
            if (string.IsNullOrEmpty(Action))
            {
                Update_Btn.Visible = true;
                SaveNew_B.Visible  = true;
                SaveNew_B.Text     = "添加为新素材";
                Save_Btn.Visible   = false;
            }
            Return_Li.Visible = true;
            Return_Li.Text    = "<a href='WxMaterial.aspx?type=news&appid=" + AppID + "' class='btn btn-primary'>返回列表</a>";
        }