ServParam2ClientModelEngine/CodeShowWeb/Index.aspx.cs

69 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 new JavaCodeWrite().ModelToJavaCode("CoderEngine", "A");
}
else if (CodeLang == "Swift")
{
return new SwiftCodeWrite().ModelToSwiftCode("CoderEngine", "A");
}
else if (CodeLang == "JavaScript")
{
return new AjaxCodeWrite().ModelToAjaxCode("CoderEngine", "A");
}
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";
}
else if (CodeLang == "JavaScript")
{
return "codepen-embed.css";
}
return "代码语言尚未支持";
}
}
}