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


C# JsonObject.GetNamedString方法代码示例

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


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

示例1: MediaItem

        public MediaItem(JsonObject item)
        {
            Type = item.GetNamedString("type");
            Url = item.GetNamedString("link");

            Primary = !string.IsNullOrEmpty(item.GetNamedString("primary"));
        }
开发者ID:beaugunderson,项目名称:EasyReader,代码行数:7,代码来源:MediaItem.cs

示例2: SlackTeam

 public SlackTeam(JsonObject source, string token)
 {
     Name = source.GetNamedString("name");
     Domain = source.GetNamedString("domain");
     Id = source.GetNamedString("id");
     Token = token;
 }
开发者ID:kureuil,项目名称:Taper,代码行数:7,代码来源:SlackTeam.cs

示例3: mapAssessmentJsonToAssessment

        public static Assessment mapAssessmentJsonToAssessment(JsonObject assessmentJson)
        {
            Assessment assessment = new Assessment();
            assessment.id = assessmentJson.GetNamedString("id");
            assessment.title = assessmentJson.GetNamedString("assessmentTitle");
            assessment.subject = assessmentJson.GetNamedString("academicSubject");
            assessment.category = assessmentJson.GetNamedString("assessmentCategory");

            var studentAssessmentArray = assessmentJson.GetNamedArray("studentAssessmentAssociation");
            var studentAssessment = studentAssessmentArray[0].GetObject();

            try
            {
                var startDate = studentAssessment.GetNamedString("administrationDate");
                if (startDate != null) assessment.startDate = DateTime.Parse(startDate);

                var endDate = studentAssessment.GetNamedString("administrationEndDate");
                if (endDate != null) assessment.endDate = DateTime.Parse(endDate);

                var scoreResults = studentAssessment.GetNamedArray("scoreResults");
                var firstScore = scoreResults[0];
                assessment.score = firstScore.GetObject().GetNamedString("result") + "/" + assessmentJson.GetNamedNumber("maxRawScore");
            }
            catch (Exception e)
            {

            }
            assessment.description = "Bacon ipsum dolor sit amet meatloaf tail doner, sausage pig jowl flank chicken beef ribs drumstick leberkas ham rump ball tip prosciutto. Boudin pig prosciutto, leberkas ball tip meatloaf ham hock hamburger ribeye salami beef jerky. Pork belly pork chop tongue pancetta salami biltong capicola meatloaf prosciutto pastrami sirloin spare ribs. Tri-tip filet mignon tail beef ribs. Biltong flank ribeye short ribs, cow ground round brisket jerky pork.\n\n Turkey frankfurter meatball, shank fatback ball tip boudin shankle chuck. Shankle shoulder shank pig ham turkey brisket pork chop filet mignon. Strip steak sausage turkey, shank fatback filet mignon hamburger jowl. Pig bacon drumstick, swine chicken sausage prosciutto brisket strip steak doner ham pork loin bresaola shank. Doner beef capicola fatback pork belly, pork chop t-bone shank turducken andouille corned beef. Tail turducken sausage andouille chuck kielbasa pig bacon corned beef t-bone flank beef. Tenderloin chicken sirloin, tail swine turkey short ribs tongue meatball capicola ham spare ribs filet mignon kielbasa meatloaf.";
            return assessment;
        }
开发者ID:mikeng13,项目名称:slcCampNYC_teamMnM_mobile,代码行数:30,代码来源:Mapper.cs

示例4: MediaItem

        public MediaItem(JsonObject json) : this()
        {
            ItemId = json.GetNamedString("id", Guid.NewGuid().ToString());
            Title = json.GetNamedString("title", string.Empty);

            if (json.Keys.Contains("mediaUri"))
                MediaUri = new Uri(json.GetNamedString("mediaUri"));
        }
开发者ID:huoxudong125,项目名称:Windows-universal-samples,代码行数:8,代码来源:MediaItem.cs

示例5: mapEventJsonToEvent

 public static Event mapEventJsonToEvent(JsonObject eventJson)
 {
     Event eventObj = new Event();
     eventObj.id = eventJson.GetNamedString("id");
     eventObj.title = eventJson.GetNamedString("title");
     eventObj.description = eventJson.GetNamedString("description");
     eventObj.date = DateTime.Parse(eventJson.GetNamedString("dueDate"));
     eventObj.type = eventJson.GetNamedString("type");
     eventObj.description = "Bacon ipsum dolor sit amet meatloaf tail doner, sausage pig jowl flank chicken beef ribs drumstick leberkas ham rump ball tip prosciutto. Boudin pig prosciutto, leberkas ball tip meatloaf ham hock hamburger ribeye salami beef jerky.";
     return eventObj;
 }
开发者ID:mikeng13,项目名称:slcCampNYC_teamMnM_mobile,代码行数:11,代码来源:Mapper.cs

示例6: SetupEventHubSender

        private void SetupEventHubSender(JsonObject settings)
        {
            // TODO: Use Options-Class
            _eventHubSender = new EventHubSender(
                settings.GetNamedString("NamespaceName"),
                settings.GetNamedString("EventHubName"),
                settings.GetNamedString("PublisherName"),
                settings.GetNamedString("Authorization"));

            _eventHubSender.Enable();
        }
开发者ID:chkr1011,项目名称:CK.HomeAutomation,代码行数:11,代码来源:AzureCloudApiDispatcherEndpointService.cs

示例7: SlackChannel

 public SlackChannel(JsonObject source)
 {
     Id = source.GetNamedString("id");
     Name = source.GetNamedString("name");
     var timestampCreation = (int)source.GetNamedNumber("created");
     var offset = DateTimeOffset.FromUnixTimeSeconds(timestampCreation);
     Created = offset.DateTime;
     IsArchived = source.GetNamedBoolean("is_archived", false);
     IsMember = source.GetNamedBoolean("is_member");
     MembersCount = (int)source.GetNamedNumber("num_members");
     var topicObject = source.GetNamedObject("topic");
     Topic = topicObject.GetNamedString("value");
     var purposeObject = source.GetNamedObject("purpose");
     Purpose = purposeObject.GetNamedString("value");
 }
开发者ID:kureuil,项目名称:Taper,代码行数:15,代码来源:SlackChannel.cs

示例8: Rfid

 public Rfid()
 {
     //ucitavanje json konfiguracija radi laksih izmjena
     rfidConfig = JsonValue.Parse(File.ReadAllText("RfidConfig.json")).GetObject();
     //port bitan cesto ce se mijenjati ovisno o racunaru COM 1 - 4 najcesce a moze i vise
     port = rfidConfig.GetNamedString("port");
 }
开发者ID:ooad-2015-2016,项目名称:Obavijesti,代码行数:7,代码来源:Rfid.cs

示例9: GetJosnObjectStringValue

        internal static string GetJosnObjectStringValue(JsonObject jsonObject, string key)
        {
            string reValue = "";
            if ((jsonObject == null) || string.IsNullOrEmpty(key) || string.IsNullOrWhiteSpace(key))
            {
                return reValue;
            }

            if (jsonObject.ContainsKey(key))
            {
                string value = jsonObject.GetNamedString(key); ;
                if ((string.IsNullOrEmpty(value)) || (value.Equals("null")))
                {
                    return reValue;
                }
                else
                {
                    value.TrimStart();
                    value.TrimEnd();

                    reValue = value;
                }
            }
            return reValue;
        }
开发者ID:RaulVan,项目名称:Recommender,代码行数:25,代码来源:Helpers.cs

示例10: read

        public override Data read(JsonObject obj)
        {
            Facet facet = new Facet();
            try
            {
                facet.Key = obj.GetNamedString("key");
                facet.DisplayName = obj.GetNamedString("displayName");
                facet.Count = (uint)obj.GetNamedNumber("count");
            }
            catch (Exception e)
            {
                //TODO: log exception
                System.Diagnostics.Debug.WriteLine(e.Message);
            }

            return facet;
        }
开发者ID:shalabi67,项目名称:Search,代码行数:17,代码来源:Facet.cs

示例11: mapJsonToStudent

 public static Student mapJsonToStudent(JsonObject studentJson)
 {
     JsonObject name = studentJson.GetNamedObject("name");
     Student s = new Student();
     s.name = string.Format("{0} {1}", name.GetNamedString("firstName"),name.GetNamedString("lastSurname"));
     s.id = studentJson.GetNamedString("id");
     return s;
 }
开发者ID:mikeng13,项目名称:slcCampNYC_teamMnM_mobile,代码行数:8,代码来源:Mapper.cs

示例12: ParseRawChannelData

        public static ChannelInfo ParseRawChannelData(JsonObject channelRawData)
        {
            string channelName = null;
            string channelId = null;
            var minorNumber = 0;
            var majorNumber = 0;

            var channelInfo = new ChannelInfo {RawData = channelRawData};

            try
            {
                if (!channelRawData.ContainsKey("channelName"))
                    channelName = channelRawData.GetNamedString("channelName");

                if (!channelRawData.ContainsKey("channelId"))
                    channelId = channelRawData.GetNamedString("channelId");

                if (!channelRawData.ContainsKey("majorNumber"))
                    majorNumber = (int)channelRawData.GetNamedNumber("majorNumber");

                if (!channelRawData.ContainsKey("minorNumber"))
                    minorNumber = (int)channelRawData.GetNamedNumber("minorNumber");

                var channelNumber = !channelRawData.ContainsKey("channelNumber")
                    ? channelRawData.GetNamedString("channelNumber")
                    : string.Format("{0}-{1}", majorNumber, minorNumber);

                channelInfo.Name = channelName;
                channelInfo.Id = channelId;
                channelInfo.Number = channelNumber;
                channelInfo.MajorNumber = majorNumber;
                channelInfo.MinorNumber = minorNumber;

            }
            catch (Exception e)
            {
                //TODO: get some analysis here
                throw new Exception("There was an error parsin the channel information", e);
            }

            return channelInfo;
        }
开发者ID:DmitrySigaev,项目名称:Connect-SDK-Windows,代码行数:42,代码来源:NetcastChannelParser.cs

示例13: ServiceDescription

 public ServiceDescription(JsonObject json)
 {
     LastDetection = double.MaxValue;
     ServiceFilter = json.GetNamedString(KeyFilter);
     IpAddress = json.GetNamedString(KeyIpAddress);
     Uuid = json.GetNamedString(KeyUuid);
     FriendlyName = json.GetNamedString(KeyFriendly);
     ModelName = json.GetNamedString(KeyModelName);
     ModelNumber = json.GetNamedString(KeyModelNumber);
     Port = (int)json.GetNamedNumber(KeyPort);
     Version = json.GetNamedString(KeyVersion,"");
     ServiceId = json.GetNamedString(KeyServiceId,"");
 }
开发者ID:DmitrySigaev,项目名称:Connect-SDK-Windows,代码行数:13,代码来源:ServiceDescription.cs

示例14: ShopDataItem

 public ShopDataItem(JsonObject shopDataObject)
 {
     this.Id = shopDataObject.GetNamedString("id");
     this.Name = shopDataObject.GetNamedString("name");
     if (shopDataObject.Keys.Contains("businessLogo"))
     {
         var urlObj = shopDataObject.GetNamedObject("businessLogo");
         if (urlObj.Keys.Contains("url"))
             this.Logo = urlObj.GetNamedString("url");
     }
     var addressObj = shopDataObject.GetNamedObject("primaryAddress");
     if (addressObj.Keys.Contains("addressLine"))
         this.Address = addressObj.GetNamedString("addressLine");
     if (addressObj.Keys.Contains("latitude"))
         this.Latitiude = addressObj.GetNamedString("latitude");
     if (addressObj.Keys.Contains("longitude"))
         this.Longitude = addressObj.GetNamedString("longitude");
     this.Suburb = addressObj.GetNamedString("suburb");
     this.Categories = new List<ShopCategory>();
     var categoriesObj = shopDataObject.GetNamedArray("categories");
     var catCount = categoriesObj.Count;
     for (uint i = 0; i < catCount; i++)
     {
         var cat = categoriesObj.GetObjectAt(i);
         var catstr = cat.GetNamedString("id");
         if (catstr.Equals("24414"))
             this.Categories.Add(ShopCategory.Handbags);
         else if (catstr.Equals("13927"))
             this.Categories.Add(ShopCategory.Jewellery);
         else if (catstr.Equals("27022"))
             this.Categories.Add(ShopCategory.Shoes);
         else if (catstr.Equals("27642"))
             this.Categories.Add(ShopCategory.Sleepwear);
         else if (catstr.Equals("16373"))
             this.Categories.Add(ShopCategory.Watches);
         else if (catstr.Equals("31917"))
             this.Categories.Add(ShopCategory.Womenswear);
     }
     if (String.IsNullOrEmpty(this.FirstCategory))
         this.FirstCategory = this.Categories.First().ToString();
 }
开发者ID:sugendran,项目名称:clothe-win8,代码行数:41,代码来源:Shop.cs

示例15: NameValue

        /// <summary>
        /// Create obvject from JSON obkect
        /// </summary>
        /// <param name="oJsn">The JSON obkect</param>
        public NameValue(JsonObject oJsn)
        {
            string name;
            name = oJsn.Keys.ToArray<string>()[0];
            IJsonValue val;
            bool res = oJsn.TryGetValue(name, out val);
            Name = name;
            String Type = oJsn.GetNamedString("Type");
            Value = val.ToString();

            NameValues.Add(this);
        }
开发者ID:djaus2,项目名称:IoTSysInfo,代码行数:16,代码来源:SysInfo.cs


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