ServParam2ClientModelEngine/CodeShowWeb/Index.aspx.cs
2018-10-18 23:06:30 +08:00

72 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CoderEngine;
namespace CodeShowWeb
{
public partial class Index : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string GetCode()
{
string CodeLang = GetLang();
if (CodeLang == "Java")
{
return GetJavaCode();
}
else if (CodeLang == "swift")
{
return GetSwiftCode();
}
return "代码语言尚未支持";
}
public string GetLang()
{
var lang = Request.QueryString["Lang"];
if (lang != null && lang != "")
{
return lang;
}
else
return "Java";
}
public string GetCodeStyle()
{
string CodeLang = GetLang();
if (CodeLang == "Java")
{
return "androidstudio.css";
}
else if (CodeLang == "swift")
{
return "xcode.css";
}
return "代码语言尚未支持";
}
public string GetJavaCode()
{
string JavaCode = new JavaCodeWrite().ModelToJavaCode("CoderEngine", "A");
return JavaCode;
}
public string GetSwiftCode()
{
string SwiftCode = new SwiftCodeWrite().ModelToSwiftCode("CoderEngine", "A");
return SwiftCode;
}
}
}