Пример #1
0
 public ControllerGenerator(string currentPath)
 {
     this.actions = new List<ActionDefinition>();
     this.className = string.Empty;
     this.currentPath = currentPath;
     parseproj = new Parsercsproj(currentPath);
 }
Пример #2
0
 public ControllerGenerator(string currentPath, List<ActionDefinition> actions, string className)
 {
     this.actions = actions;
     this.className = className;
     this.currentPath = currentPath;
     parseproj = new Parsercsproj(currentPath);
 }
Пример #3
0
 internal void GenerateClass(string currentPath)
 {
     ModelHost host1 = new ModelHost();
     Parsercsproj parseproj = new Parsercsproj(currentPath);
     host1.ClassName = className;
     host1.ClassFields = fields;
     host1.IdField= fields.FirstOrDefault(x => x.Name.Equals("id", StringComparison.InvariantCultureIgnoreCase));
     host1.NameSpace = parseproj.RootNameSpace + ".Models";
     string output = host1.ProcessTemplate();
     string filePath=Path.Combine(currentPath, "Models", className + ".cs");
     File.WriteAllText(filePath, output,Encoding.UTF8);
     parseproj.AddCompileFile("Models\\" + className + ".cs");
     parseproj.Save();
 }
Пример #4
0
 private void GenerateMigrationClass(string currentPath)
 {
     MigrationHost host = new MigrationHost();
     Parsercsproj parseproj = new Parsercsproj(currentPath);
     host.ClassName = className;
     host.ClassFields = fields;
     host.MigrationSet=DateTime.Now.ToString("yyyyMMddHHmmss");
     host.IdField = fields.FirstOrDefault(x => x.Name.Equals("id", StringComparison.InvariantCultureIgnoreCase));
     host.NameSpace = parseproj.RootNameSpace + ".Migrations";
     string output = host.ProcessTemplate();
     string filePath = Path.Combine(currentPath, "Migrations", "create"+className + ".cs");
     File.WriteAllText(filePath, output, Encoding.UTF8);
     parseproj.AddCompileFile("Migrations\\create" + className + ".cs");
     parseproj.Save();
 }
Пример #5
0
        private static void VerifyAndCheckAssets(string currentPath, string assetFolder, string[] files)
        {
            string AssetsPath = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "Templates", "Assets", assetFolder);

            Parsercsproj parserProj = new Parsercsproj(currentPath);
            foreach (string asset in files)
            {
                if (!File.Exists(Path.Combine(currentPath, "Assets", assetFolder, asset)))
                {
                    File.Copy(Path.Combine(AssetsPath, asset), Path.Combine(currentPath, "Assets", assetFolder, asset));
                    parserProj.AddContentFile("Assets\\" + assetFolder + "\\" + asset, CopyOutPutOptions.PreserveNewest);
                }
            }
            parserProj.Save();
        }
Пример #6
0
 public ViewsGenerator(string currentPath)
 {
     this.currentPath = currentPath;
     parseproj = new Parsercsproj(currentPath);
 }