Update VAR.Json and usage.

This commit is contained in:
2021-06-13 12:24:12 +02:00
parent 4deae439af
commit 98e0685560
9 changed files with 17 additions and 23 deletions

View File

@@ -155,10 +155,9 @@ namespace VAR.Focus.Web.Controls
{"ConfirmDelete", MultiLang.GetLiteral("ConfirmDelete")},
} },
};
JsonWriter jsonWriter = new JsonWriter();
StringBuilder sbCfg = new StringBuilder();
sbCfg.AppendFormat("<script>\n");
sbCfg.AppendFormat("var {0} = {1};\n", strCfgName, jsonWriter.Write(cfg));
sbCfg.AppendFormat("var {0} = {1};\n", strCfgName, JsonWriter.WriteObject(cfg));
sbCfg.AppendFormat("RunCardBoard({0});\n", strCfgName);
sbCfg.AppendFormat("</script>\n");
LiteralControl liScript = new LiteralControl(sbCfg.ToString());

View File

@@ -157,10 +157,9 @@ namespace VAR.Focus.Web.Controls
{"Disconnected", MultiLang.GetLiteral("Disconnected")},
} },
};
JsonWriter jsonWriter = new JsonWriter();
StringBuilder sbCfg = new StringBuilder();
sbCfg.AppendFormat("<script>\n");
sbCfg.AppendFormat("var {0} = {1};\n", strCfgName, jsonWriter.Write(cfg));
sbCfg.AppendFormat("var {0} = {1};\n", strCfgName, JsonWriter.WriteObject(cfg));
sbCfg.AppendFormat("RunChat({0});\n", strCfgName);
sbCfg.AppendFormat("</script>\n");
LiteralControl liScript = new LiteralControl(sbCfg.ToString());

View File

@@ -45,8 +45,8 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Web" />
<Reference Include="VAR.Json, Version=1.1.1.36534, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\VAR.Json.1.1.1.36534\lib\net461\VAR.Json.dll</HintPath>
<Reference Include="VAR.Json, Version=1.2.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\VAR.Json.1.2.2\lib\netstandard2.0\VAR.Json.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="VAR.Json" version="1.1.1.36534" targetFramework="net461" />
<package id="VAR.Json" version="1.2.2" targetFramework="net461" />
</packages>

View File

@@ -22,9 +22,8 @@ namespace VAR.WebForms.Common.Code
public static void ResponseObject(this HttpContext context, object obj)
{
var jsonWritter = new JsonWriter();
context.Response.ContentType = "text/json";
string strObject = jsonWritter.Write(obj);
string strObject = JsonWriter.WriteObject(obj);
context.Response.Write(strObject);
}

View File

@@ -109,10 +109,9 @@ namespace VAR.WebForms.Common.Controls
{"hidSize", _hidSize.ClientID},
{"keepSize", _keepSize },
};
JsonWriter jsonWriter = new JsonWriter();
StringBuilder sbCfg = new StringBuilder();
sbCfg.AppendFormat("<script>\n");
sbCfg.AppendFormat("var {0} = {1};\n", strCfgName, jsonWriter.Write(cfg));
sbCfg.AppendFormat("var {0} = {1};\n", strCfgName, JsonWriter.WriteObject(cfg));
sbCfg.AppendFormat("CTextBox_Multiline_Init({0});\n", strCfgName);
sbCfg.AppendFormat("</script>\n");
LiteralControl liScript = new LiteralControl(sbCfg.ToString());
@@ -182,7 +181,7 @@ namespace VAR.WebForms.Common.Controls
public void SetClientsideHeight(int? height)
{
if(height == null)
if (height == null)
{
_hidSize.Value = string.Empty;
return;
@@ -201,10 +200,9 @@ namespace VAR.WebForms.Common.Controls
{ "scrollTop", null },
};
}
JsonWriter jsonWriter = new JsonWriter();
_hidSize.Value = jsonWriter.Write(sizeObj);
_hidSize.Value = JsonWriter.WriteObject(sizeObj);
}
#endregion Public methods
}
}

View File

@@ -14,9 +14,8 @@ namespace VAR.WebForms.Common.Pages
public void ProcessRequest(HttpContext context)
{
var jsonWritter = new JsonWriter(new JsonWriterConfiguration(indent: true));
context.Response.Write("<pre><code>");
context.Response.Write(jsonWritter.Write(context.Request));
context.Response.Write(JsonWriter.WriteObject(context.Request, indent: true));
context.Response.Write("</code></pre>");
}

View File

@@ -40,8 +40,8 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="VAR.Json, Version=1.1.1.36534, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\VAR.Json.1.1.1.36534\lib\net461\VAR.Json.dll</HintPath>
<Reference Include="VAR.Json, Version=1.2.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\VAR.Json.1.2.2\lib\netstandard2.0\VAR.Json.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -71,9 +71,6 @@
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Scripts\01. Base.js" />
<EmbeddedResource Include="Scripts\02. Ajax.js" />
@@ -81,5 +78,8 @@
<EmbeddedResource Include="Styles\00. Reset.css" />
<EmbeddedResource Include="Styles\01. base.css" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="VAR.Json" version="1.1.1.36534" targetFramework="net461" />
<package id="VAR.Json" version="1.2.2" targetFramework="net461" />
</packages>