📄 codeexport.cs
字号:
if (str7 == "Oracle")
{
this.txtDbHelper.Text = "DbHelperOra";
}
else if (str7 == "MySQL")
{
this.txtDbHelper.Text = "DbHelperMySQL";
}
else if (str7 == "OleDb")
{
this.txtDbHelper.Text = "DbHelperOleDb";
}
}
else
{
this.txtDbHelper.Text = "DbHelperSQL";
}
}
this.txtFolder.Text = this.setting.Folder;
this.txtNamespace.Text = this.setting.Namepace;
if (File.Exists(this.cmcfgfile))
{
this.cfgfile = new INIFile(this.cmcfgfile);
string str4 = this.cfgfile.IniReadValue("Project", "lastpath");
if (str4.Trim() != "")
{
this.txtTargetFolder.Text = str4;
}
}
}
private void CreatCS()
{
if (this.radBtn_One.Checked)
{
this.CreatCsOne();
}
if (this.radBtn_S3.Checked)
{
this.CreatCsS3();
}
if (this.radBtn_F3.Checked)
{
this.CreatCsF3();
}
}
private void CreatCsF3()
{
string text = this.txtTargetFolder.Text;
this.FolderCheck(text);
string folder = text + @"\Model";
if (this.cb.Folder != "")
{
folder = folder + @"\" + this.cb.Folder;
}
this.FolderCheck(folder);
string filename = folder + @"\" + this.cb.ModelName + ".cs";
string strCode = this.cb.GetCodeFrameS3Model();
this.WriteFile(filename, strCode);
this.AddClassFile(folder + @"\Model.csproj", this.cb.ModelName + ".cs", "");
string dbType = this.dbobj.DbType;
if ((this.dbobj.DbType == "SQL2000") || (this.dbobj.DbType == "SQL2005"))
{
dbType = "SQLServer";
}
string str6 = text + @"\" + dbType + "DAL";
if (this.cb.Folder != "")
{
str6 = str6 + @"\" + this.cb.Folder;
}
this.FolderCheck(str6);
string str7 = str6 + @"\" + this.cb.DALName + ".cs";
string str8 = this.cb.GetCodeFrameF3DAL(this.GetDALType(), true, true, true, true, true, true, true);
this.WriteFile(str7, str8);
this.AddClassFile(str6 + @"\" + dbType + "DAL.csproj", this.cb.DALName + ".cs", "");
string str9 = text + @"\DALFactory";
this.FolderCheck(str9);
string path = str9 + @"\DataAccess.cs";
string strContent = this.cb.GetCodeFrameF3DALFactory();
if (File.Exists(path))
{
if (File.ReadAllText(path).IndexOf("class DataAccess") > 0)
{
strContent = this.cb.GetCodeFrameF3DALFactoryMethod();
this.vsp.AddMethodToClass(path, strContent);
}
else
{
strContent = this.cb.GetCodeFrameF3DALFactory();
StreamWriter writer = new StreamWriter(path, true, Encoding.Default);
writer.Write(strContent);
writer.Flush();
writer.Close();
}
}
else
{
strContent = this.cb.GetCodeFrameF3DALFactory();
this.WriteFile(path, strContent);
}
string str13 = text + @"\IDAL";
if (this.cb.Folder != "")
{
str13 = str13 + @"\" + this.cb.Folder;
}
this.FolderCheck(str13);
string str14 = str13 + @"\I" + this.cb.DALName + ".cs";
string str15 = this.cb.GetCodeFrameF3IDAL(true, true, true, true, true, true, true, true);
this.WriteFile(str14, str15);
this.AddClassFile(str13 + @"\IDAL.csproj", "I" + this.cb.DALName + ".cs", "");
string str16 = text + @"\BLL";
if (this.cb.Folder != "")
{
str16 = str16 + @"\" + this.cb.Folder;
}
this.FolderCheck(str16);
string str17 = str16 + @"\" + this.cb.BLLName + ".cs";
string bLLType = this.GetBLLType();
string str19 = this.cb.GetCodeFrameF3BLL(bLLType, true, true, true, true, true, true, true, true);
this.WriteFile(str17, str19);
this.AddClassFile(str16 + @"\BLL.csproj", this.cb.BLLName + ".cs", "");
string str20 = text + @"\Web";
if (this.cb.Folder != "")
{
str20 = str20 + @"\" + this.cb.Folder;
}
this.FolderCheck(str20);
this.FolderCheck(str20 + @"\" + this.cb.ModelName);
string str21 = "";
string str22 = str20 + @"\" + this.cb.ModelName + @"\Add.aspx";
string str23 = str20 + @"\" + this.cb.ModelName + @"\Add.aspx.cs";
string str24 = str20 + @"\" + this.cb.ModelName + @"\Add.aspx.designer.cs";
string str25 = Application.StartupPath + @"\Template\web\Add.aspx";
string str26 = Application.StartupPath + @"\Template\web\Add.aspx.cs";
string str27 = Application.StartupPath + @"\Template\web\Add.aspx.designer.cs";
if (File.Exists(str25))
{
using (StreamReader reader = new StreamReader(str25, Encoding.Default))
{
string addAspx = this.cb.GetAddAspx();
str21 = reader.ReadToEnd().Replace(".Demo.Add", "." + this.cb.ModelName + ".Add").Replace("<$$AddAspx$$>", addAspx);
reader.Close();
}
this.WriteFile(str22, str21);
}
if (File.Exists(str26))
{
using (StreamReader reader2 = new StreamReader(str26, Encoding.Default))
{
string addAspxCs = this.cb.GetAddAspxCs();
str21 = reader2.ReadToEnd().Replace(".Demo", "." + this.cb.ModelName).Replace("<$$AddAspxCs$$>", addAspxCs);
reader2.Close();
}
this.WriteFile(str23, str21);
}
if (File.Exists(str27))
{
using (StreamReader reader3 = new StreamReader(str27, Encoding.Default))
{
string addDesigner = this.cb.GetAddDesigner();
str21 = reader3.ReadToEnd().Replace(".Demo", "." + this.cb.ModelName).Replace("<$$AddDesigner$$>", addDesigner);
reader3.Close();
}
this.WriteFile(str24, str21);
}
str22 = str20 + @"\" + this.cb.ModelName + @"\Modify.aspx";
str23 = str20 + @"\" + this.cb.ModelName + @"\Modify.aspx.cs";
str24 = str20 + @"\" + this.cb.ModelName + @"\Modify.aspx.designer.cs";
str25 = Application.StartupPath + @"\Template\web\Modify.aspx";
str26 = Application.StartupPath + @"\Template\web\Modify.aspx.cs";
str27 = Application.StartupPath + @"\Template\web\Modify.aspx.designer.cs";
if (File.Exists(str25))
{
using (StreamReader reader4 = new StreamReader(str25, Encoding.Default))
{
string updateAspx = this.cb.GetUpdateAspx();
str21 = reader4.ReadToEnd().Replace(".Demo.Modify", "." + this.cb.ModelName + ".Modify").Replace("<$$ModifyAspx$$>", updateAspx);
reader4.Close();
}
this.WriteFile(str22, str21);
}
if (File.Exists(str26))
{
using (StreamReader reader5 = new StreamReader(str26, Encoding.Default))
{
string updateAspxCs = this.cb.GetUpdateAspxCs();
str21 = reader5.ReadToEnd().Replace(".Demo", "." + this.cb.ModelName).Replace("<$$ModifyAspxCs$$>", updateAspxCs);
reader5.Close();
}
this.WriteFile(str23, str21);
}
if (File.Exists(str27))
{
using (StreamReader reader6 = new StreamReader(str27, Encoding.Default))
{
string updateDesigner = this.cb.GetUpdateDesigner();
str21 = reader6.ReadToEnd().Replace(".Demo", "." + this.cb.ModelName).Replace("<$$ModifyDesigner$$>", updateDesigner);
reader6.Close();
}
this.WriteFile(str24, str21);
}
str22 = str20 + @"\" + this.cb.ModelName + @"\Show.aspx";
str23 = str20 + @"\" + this.cb.ModelName + @"\Show.aspx.cs";
str24 = str20 + @"\" + this.cb.ModelName + @"\Show.aspx.designer.cs";
str25 = Application.StartupPath + @"\Template\web\Show.aspx";
str26 = Application.StartupPath + @"\Template\web\Show.aspx.cs";
str27 = Application.StartupPath + @"\Template\web\Show.aspx.designer.cs";
if (File.Exists(str25))
{
using (StreamReader reader7 = new StreamReader(str25, Encoding.Default))
{
string showAspx = this.cb.GetShowAspx();
str21 = reader7.ReadToEnd().Replace(".Demo.Show", "." + this.cb.ModelName + ".Show").Replace("<$$ShowAspx$$>", showAspx);
reader7.Close();
}
this.WriteFile(str22, str21);
}
if (File.Exists(str26))
{
using (StreamReader reader8 = new StreamReader(str26, Encoding.Default))
{
string showAspxCs = this.cb.GetShowAspxCs();
str21 = reader8.ReadToEnd().Replace(".Demo", "." + this.cb.ModelName).Replace("<$$ShowAspxCs$$>", showAspxCs);
reader8.Close();
}
this.WriteFile(str23, str21);
}
if (File.Exists(str27))
{
using (StreamReader reader9 = new StreamReader(str27, Encoding.Default))
{
string showDesigner = this.cb.GetShowDesigner();
str21 = reader9.ReadToEnd().Replace(".Demo", "." + this.cb.ModelName).Replace("<$$ShowDesigner$$>", showDesigner);
reader9.Close();
}
this.WriteFile(str24, str21);
}
this.CheckDirectory(text);
}
private void CreatCsOne()
{
string str = this.txtNamespace.Text.Trim();
string str2 = this.txtFolder.Text.Trim();
if (str2.Trim() != "")
{
this.cb.NameSpace = str + "." + str2;
this.cb.Folder = str2;
}
string strCode = this.cb.GetCodeFrameOne(this.GetDALType(), true, true, true, true, true, true, true);
string text = this.txtTargetFolder.Text;
this.FolderCheck(text);
string folder = text + @"\Class";
this.FolderCheck(folder);
string filename = folder + @"\" + this.cb.ModelName + ".cs";
this.WriteFile(filename, strCode);
}
private void CreatCsS3()
{
string text = this.txtTargetFolder.Text;
this.FolderCheck(text);
string folder = text + @"\Model";
if (this.cb.Folder != "")
{
folder = folder + @"\" + this.cb.Folder;
}
this.FolderCheck(folder);
string filename = folder + @"\" + this.cb.ModelName + ".cs";
string strCode = this.cb.GetCodeFrameS3Model();
this.WriteFile(filename, strCode);
this.AddClassFile(folder + @"\Model.csproj", this.cb.ModelName + ".cs", "");
string str5 = text + @"\DAL";
if (this.cb.Folder != "")
{
str5 = str5 + @"\" + this.cb.Folder;
}
this.FolderCheck(str5);
string str6 = str5 + @"\" + this.cb.DALName + ".cs";
string str7 = this.cb.GetCodeFrameS3DAL(this.GetDALType(), true, true, true, true, true, true, true);
this.WriteFile(str6, str7);
this.AddClassFile(str5 + @"\DAL.csproj", this.cb.DALName + ".cs", "");
string str8 = text + @"\BLL";
if (this.cb.Folder != "")
{
str8 = str8 + @"\" + this.cb.Folder;
}
this.FolderCheck(str8);
string str9 = str8 + @"\" + this.cb.BLLName + ".cs";
string bLLType = this.GetBLLType();
string str11 = this.cb.GetCodeFrameS3BLL(bLLType, true, true, true, true, true, true, true, true);
this.WriteFile(str9, str11);
this.AddClassFile(str8 + @"\BLL.csproj", this.cb.BLLName + ".cs", "");
string str12 = text + @"\Web";
if (this.cb.Folder != "")
{
str12 = str12 + @"\" + this.cb.Folder;
}
this.FolderCheck(str12);
this.FolderCheck(str12 + @"\" + this.cb.ModelName);
string str13 = "";
string str14 = str12 + @"\" + this.cb.ModelName + @"\Add.aspx";
string str15 = str12 + @"\" + this.cb.ModelName + @"\Add.aspx.cs";
string str16 = str12 + @"\" + this.cb.ModelName + @"\Add.aspx.designer.cs";
string path = Application.StartupPath + @"\Template\web\Add.aspx";
string str18 = Application.StartupPath + @"\Template\web\Add.aspx.cs";
string str19 = Application.StartupPath + @"\Template\web\Add.aspx.designer.cs";
if (File.Exists(path))
{
using (StreamReader reader = new StreamReader(path, Encoding.Default))
{
string addAspx = this.cb.GetAddAspx();
str13 = reader.ReadToEnd().Replace(".Demo.Add", "." + this.cb.ModelName + ".Add").Replace("<$$AddAspx$$>", addAspx);
reader.Close();
}
this.WriteFile(str14, str13);
}
if (File.Exists(str18))
{
using (StreamReader reader2 = new StreamReader(str18, Encoding.Default))
{
string addAspxCs = this.cb.GetAddAspxCs();
str13 = reader2.ReadToEnd().Replace(".Demo", "." + this.cb.ModelName).Replace("<$$AddAspxCs$$>", addAspxCs);
reader2.Close();
}
this.WriteFile(str15, str13);
}
if (File.Exists(str19))
{
using (StreamReader reader3 = new StreamReader(str19, Encoding.Default))
{
string addDesigner = this.cb.GetAddDesigner();
str13 = reader3.ReadToEnd().Replace(".Demo", "." + this.cb.ModelName).Replace("<$$AddDesigner$$>", addDesigner);
reader3.Close();
}
this.WriteFile(str16, str13);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -