顺带把C#支持上吧 233333
This commit is contained in:
parent
c49c14c771
commit
df0116e2d8
@ -3,7 +3,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>highlight</title>
|
<title>服务端参数跨语言代码转换引擎</title>
|
||||||
<meta http-equiv="content-type" content="text/html;charset=utf-8">
|
<meta http-equiv="content-type" content="text/html;charset=utf-8">
|
||||||
<link rel="stylesheet" href="styles/default.css">
|
<link rel="stylesheet" href="styles/default.css">
|
||||||
<script src="highlight.pack.js"></script>
|
<script src="highlight.pack.js"></script>
|
||||||
@ -13,15 +13,28 @@
|
|||||||
|
|
||||||
<h2>服务端参数跨语言代码转换引擎 Ver 0.1.0 -- 皓月</h2>
|
<h2>服务端参数跨语言代码转换引擎 Ver 0.1.0 -- 皓月</h2>
|
||||||
<h4>是一个C#服务端API参数实体类、转换成于各类语言客户端解析参数代码,减少客户端开发人员重复工作量</h4>
|
<h4>是一个C#服务端API参数实体类、转换成于各类语言客户端解析参数代码,减少客户端开发人员重复工作量</h4>
|
||||||
|
<font size="0.5">PS:文档引用本页调用方法 {http://引擎url}?lang={要转换到的目标语言类型}&Assembly={程序集命名空间}&ReqM={请求参数在服务端的实体类名}&ReqM={请求参数在服务端的实体类名}</font>
|
||||||
<h4>请选择目前支持转换到的目标语言:</h4>
|
<h4>请选择目前支持转换到的目标语言:</h4>
|
||||||
<h3><a href="/Index.aspx?lang=Java">Java/Android</a>、<a href="/Index.aspx?lang=Swift">Swift/iOS</a>、<a href="/Index.aspx?lang=JavaScript">Ajax/Javascript</a>、<a href="/Index.aspx?lang=PHP">PHP</a>、<a href="/Index.aspx?lang=Golang">Golang</a>、...</h3>
|
<h3><a href="/Index.aspx?lang=Java">Java/Android</a>、<a href="/Index.aspx?lang=Swift">Swift/iOS</a>、<a href="/Index.aspx?lang=JavaScript">Ajax/Javascript</a>、<a href="/Index.aspx?lang=PHP">PHP</a>、<a href="/Index.aspx?lang=Golang">Golang</a>、</h3>
|
||||||
|
<h3><a href="/Index.aspx?lang=CSharp">C#</a>、<a href="/Index.aspx?lang=MarkDown">MarkDown参数表格编码</a>、<a href="/Index.aspx?lang=HYJson">皓月转换引擎实体类转译Json</a>、</h3>
|
||||||
|
|
||||||
|
|
||||||
<h4>选择你喜欢的代码配色方案<div id="changeStyleSelect"></div></h4>
|
<h4>选择你喜欢的代码配色方案<div id="changeStyleSelect"></div></h4>
|
||||||
<h2>已转换为目标语种为"<%=GetLang() %>"代码结果:</h2>
|
<h2>已转换为目标语种为"<%=GetLangCodeShowName() %>"代码结果:</h2>
|
||||||
|
|
||||||
|
<p></p>
|
||||||
|
<h3>请求参数代码:</h3>
|
||||||
|
<div ><pre>
|
||||||
|
<code class="<%=GetLangCodeShowName() %>"">
|
||||||
|
<%=GetCode() %>
|
||||||
|
</code>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
<p></p>
|
||||||
|
<h3>返回参数代码:</h3>
|
||||||
|
|
||||||
<div ><pre>
|
<div ><pre>
|
||||||
<code class="<%=GetLang() %>"">
|
<code class="<%=GetLangCodeShowName() %>"">
|
||||||
<%=GetCode() %>
|
<%=GetCode() %>
|
||||||
</code>
|
</code>
|
||||||
</pre>
|
</pre>
|
||||||
|
@ -17,25 +17,36 @@ namespace CodeShowWeb
|
|||||||
|
|
||||||
public string GetCode()
|
public string GetCode()
|
||||||
{
|
{
|
||||||
string CodeLang = GetLang();
|
string CodeLang = GetLangParam();
|
||||||
|
|
||||||
|
string CodeStr = "";
|
||||||
if (CodeLang == "Java")
|
if (CodeLang == "Java")
|
||||||
{
|
{
|
||||||
return new JavaCodeWrite().ModelToJavaCode("CoderEngine", "A");
|
CodeStr = new JavaCodeWrite().ModelToJavaCode("CoderEngine", "A");
|
||||||
}
|
}
|
||||||
else if (CodeLang == "Swift")
|
else if (CodeLang == "Swift")
|
||||||
{
|
{
|
||||||
return new SwiftCodeWrite().ModelToSwiftCode("CoderEngine", "A");
|
CodeStr = new SwiftCodeWrite().ModelToSwiftCode("CoderEngine", "A");
|
||||||
}
|
}
|
||||||
else if (CodeLang == "JavaScript")
|
else if (CodeLang == "JavaScript")
|
||||||
{
|
{
|
||||||
return new AjaxCodeWrite().ModelToAjaxCode("CoderEngine", "A");
|
CodeStr = new AjaxCodeWrite().ModelToAjaxCode("CoderEngine", "A");
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (CodeLang == "CSharp")
|
||||||
|
{
|
||||||
|
CodeStr = new CSharpCodeWrite().ModelToCSCode("CoderEngine", "A");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return "代码语言尚未支持";
|
//避免类似 List<XXX> 这类的< >被识别为html标签显示异常
|
||||||
|
CodeStr = CodeStr.Replace("<", "<");
|
||||||
|
CodeStr = CodeStr.Replace(">", ">");
|
||||||
|
|
||||||
|
return CodeStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetLang()
|
public string GetLangParam()
|
||||||
{
|
{
|
||||||
var lang = Request.QueryString["Lang"];
|
var lang = Request.QueryString["Lang"];
|
||||||
if (lang != null && lang != "")
|
if (lang != null && lang != "")
|
||||||
@ -46,9 +57,20 @@ namespace CodeShowWeb
|
|||||||
return "Java";
|
return "Java";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetLangCodeShowName()
|
||||||
|
{
|
||||||
|
string str = GetLangParam();
|
||||||
|
switch (str)
|
||||||
|
{
|
||||||
|
case "Java": return "java";
|
||||||
|
case "C#": return "C#";
|
||||||
|
default:return str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string GetCodeStyle()
|
public string GetCodeStyle()
|
||||||
{
|
{
|
||||||
string CodeLang = GetLang();
|
string CodeLang = GetLangParam();
|
||||||
if (CodeLang == "Java")
|
if (CodeLang == "Java")
|
||||||
{
|
{
|
||||||
return "androidstudio.css";
|
return "androidstudio.css";
|
||||||
@ -61,6 +83,10 @@ namespace CodeShowWeb
|
|||||||
{
|
{
|
||||||
return "codepen-embed.css";
|
return "codepen-embed.css";
|
||||||
}
|
}
|
||||||
|
else if (CodeLang == "CSharp")
|
||||||
|
{
|
||||||
|
return "atelier-plateau-dark.css";
|
||||||
|
}
|
||||||
|
|
||||||
return "代码语言尚未支持";
|
return "代码语言尚未支持";
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ namespace CoderEngine
|
|||||||
CodeStr += CodeLine + "\n";
|
CodeStr += CodeLine + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ModelToJavaCode(string _AssemblyName, string _TypeName)
|
public string ModelToCSCode(string _AssemblyName, string _TypeName)
|
||||||
{
|
{
|
||||||
TypeMode tm = new _ModleReader().ModelCheck(_AssemblyName, _TypeName);
|
TypeMode tm = new _ModleReader().ModelCheck(_AssemblyName, _TypeName);
|
||||||
ModelToCSCodeWriter(tm);
|
ModelToCSCodeWriter(tm);
|
||||||
|
Loading…
Reference in New Issue
Block a user