Наследование: Newtonsoft.Json.Linq.JValue
Пример #1
0
        public void RawClone()
        {
            JRaw r1 = new JRaw("raw1");
            JToken r2 = r1.CloneToken();

            CustomAssert.IsInstanceOfType(typeof(JRaw), r2);
        }
Пример #2
0
        public void RawToObject()
        {
            JRaw r1 = new JRaw("1");
            int i = r1.ToObject<int>();

            Assert.AreEqual(1, i);
        }
Пример #3
0
 private void setAutoComplite()
 {
     JObject joContextKey = new JObject();
     joContextKey["SearchCode"] = "1";
     this.AutoComplit(ref joContextKey, "~/Tools/LandUse.asmx/GetCompletionList", this.txtFirst);
     joContextKey.Remove("SearchCode");
     joContextKey["SearchParams"] = new JRaw("function () {return UpdateContext();}");
     this.AutoComplit(ref joContextKey, "~/Tools/LandUse.asmx/GetCompletionList2", this.txtSecond);
 }
Пример #4
0
        public void RawEquals()
        {
            JRaw r1 = new JRaw("raw1");
            JRaw r2 = new JRaw("raw1");
            JRaw r3 = new JRaw("raw2");

            Assert.IsTrue(JToken.DeepEquals(r1, r2));
            Assert.IsFalse(JToken.DeepEquals(r1, r3));
        }
Пример #5
0
		// Token: 0x060005D8 RID: 1496
		// RVA: 0x00035994 File Offset: 0x00033B94
		public static JRaw Create(JsonReader reader)
		{
			JRaw result;
			using (StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture))
			{
				using (JsonTextWriter jsonTextWriter = new JsonTextWriter(stringWriter))
				{
					jsonTextWriter.WriteToken(reader);
					result = new JRaw(stringWriter.ToString());
				}
			}
			return result;
		}
Пример #6
0
        public override void ExecuteResult(ControllerContext context)
        {
            JObject result = new JObject();
            JObject response = new JObject();

            result["actionSuccess"] = this.Accept;
            
            if (this.RefusalMessage.IsNotEmpty())
            {
                result["message"] = this.RefusalMessage;
            }

            if (this.Attributes != null)
            {
                response["attributes"] = new JRaw(JSON.Serialize(this.Attributes));
            }

            if (this.Value != null)
            {
                if (this.Value is string) 
                {
                    response["value"] = this.Value.ToString();
                }
                else
                {
                    response["value"] = new JRaw(JSON.Serialize(this.Value));
                }
                
            }

            if (this.NodeID != null)
            {
                response["id"] = this.NodeID;
            }

            if (response.Count > 0)
            {
                result["response"] = response;
            }

            CompressionUtils.GZipAndSend(result.ToString(Newtonsoft.Json.Formatting.None));
        }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="JRaw"/> class from another <see cref="JRaw"/> object.
 /// </summary>
 /// <param name="other">A <see cref="JRaw"/> object to copy from.</param>
 public JRaw(JRaw other)
     : base(other)
 {
 }
        /// <summary>
        /// Returns the definition of the column (or columns) corresponding
        /// to the drop down list.
        /// </summary>
        private IEnumerable<JObject> GetDropDownListColumnDefinitions(
            ModelMetadata propMetadata,
            DropDownList dropDownList)
        {
            JObject groupColumnInfo = null;
            JObject objectColumnInfo = new JObject();

            objectColumnInfo["name"] = propMetadata.PropertyName;
            objectColumnInfo["display"] = propMetadata.DisplayName;
            objectColumnInfo["type"] = "select";

            if (propMetadata.IsRequired)
            {
                objectColumnInfo["ctrlClass"] = "required";
            }

            if (dropDownList.GroupFilter == null)
            {
                objectColumnInfo["ctrlOptions"] = "0:Select;" + string.Join
                (
                    ";",
                    dropDownList.Choices
                        .Select(dropDownList.ItemAccessor)
                        .OrderBy(i => i.Name, new NaturalComparer())
                        .Select(item => $"{item.Value}:{item.Name}")
                );

                yield return objectColumnInfo;
                yield break;
            }
            else
            {
                objectColumnInfo["ctrlAttr"] = new JObject()
                {
                    ["disabled"] = "disabled"
                };

                groupColumnInfo = new JObject();

                groupColumnInfo["name"] = dropDownList.GroupColumnName;
                groupColumnInfo["display"] = dropDownList.GroupColumnDisplayName;
                groupColumnInfo["type"] = "select";
                groupColumnInfo["ctrlOptions"] = "0:Select;" + string.Join
                (
                    ";",
                    dropDownList.Choices
                        .Select(dropDownList.GroupFilter)
                        .Distinct()
                        .OrderBy(i => i.Name, new NaturalComparer())
                        .Select(item => $"{item.Value}:{item.Name}")
                );

                groupColumnInfo["onChange"] = new JRaw
                (
                    $"handle{dropDownList.GroupColumnName}Changed"
                );

                yield return groupColumnInfo;
                yield return objectColumnInfo;
            }
        }
Пример #9
0
 public JRawValue(JRaw value)
 {
     _value = value.ToString();
 }
Пример #10
0
 public JRaw EchoJRaw(JRaw input)
 {
     return input;
 }
Пример #11
0
 public JRaw(JRaw other)
   : base((JValue) other)
 {
 }
Пример #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Newtonsoft.Json.Linq.JRaw" /> class from another <see cref="T:Newtonsoft.Json.Linq.JRaw" /> object.
 /// </summary>
 /// <param name="other">A <see cref="T:Newtonsoft.Json.Linq.JRaw" /> object to copy from.</param>
 public JRaw(JRaw other)
     : base((JValue)other)
 {
 }
 public JRaw(JRaw other) : base(other)
 {
 }
Пример #14
0
 public JRaw(JRaw other)
 {
     Class6.yDnXvgqzyB5jw();
     base(other);
 }