Exemple #1
0
 private static int AddModels(ItemOptions opts)
 {
     try {
         SetupAppConnection(opts);
         var models  = GetClassModels(opts.ItemName, opts.Fields);
         var project = new VSProject(opts.DestinationPath, opts.Namespace);
         foreach (var model in models)
         {
             project.AddFile(model.Key, model.Value);
         }
         project.Reload();
         Console.WriteLine("Done");
         return(0);
     } catch (Exception e) {
         Console.WriteLine(e);
         return(1);
     }
 }
Exemple #2
0
 private static int AddItemFromTemplate(ItemOptions options)
 {
     try {
         var    project    = new VSProject(options.DestinationPath, options.Namespace);
         var    creatioEnv = new CreatioEnvironment();
         string tplPath    = $"tpl{Path.DirectorySeparatorChar}{options.ItemType}-template.tpl";
         if (!File.Exists(tplPath))
         {
             var envPath = creatioEnv.GetAssemblyFolderPath();
             if (!string.IsNullOrEmpty(envPath))
             {
                 tplPath = Path.Combine(envPath, tplPath);
             }
         }
         string templateBody = File.ReadAllText(tplPath);
         project.AddFile(options.ItemName, templateBody.Replace("<Name>", options.ItemName));
         project.Reload();
         return(0);
     } catch (Exception e) {
         Console.WriteLine(e);
         return(1);
     }
 }