Ejemplo n.º 1
0
        protected override void run()
        {
            var codeGenerator = CodeGeneratorUtil.CodeGeneratorFromPreferences(_preferences);

            codeGenerator.OnProgress += (title, info, progress) => {
                var p = (int)(progress * 100);
                fabl.Debug(string.Format("{0}: {1} ({2}%)", title, info, p));
            };
            codeGenerator.DryRun();
        }
Ejemplo n.º 2
0
        protected override void run()
        {
            fabl.Debug("Entitas Code Generator version " + EntitasResources.GetVersion());
            new Status().Run(_rawArgs);
            fabl.Debug("Dry Run");
            CodeGeneratorUtil
            .CodeGeneratorFromPreferences(_preferences)
            .DryRun();

            fabl.Info("👨‍🔬  No problems detected. Happy coding :)");
        }
Ejemplo n.º 3
0
 public override void Run(string[] args)
 {
     if (assertPreferences(args))
     {
         var codeGenerator = CodeGeneratorUtil.CodeGeneratorFromPreferences(loadPreferences(args));
         codeGenerator.OnProgress += (title, info, progress) => {
             var p = (int)(progress * 100);
             fabl.Debug(string.Format("{0}: {1} ({2}%)", title, info, p));
         };
         codeGenerator.DryRun();
     }
 }
Ejemplo n.º 4
0
 public override void Run(string[] args)
 {
     if (base.assertProperties())
     {
         CodeGenerator codeGenerator = CodeGeneratorUtil.CodeGeneratorFromPreferences(Preferences.sharedInstance);
         codeGenerator.OnProgress += delegate(string title, string info, float progress)
         {
             int num = (int)(progress * 100f);
             fabl.Debug(string.Format("{0}: {1} ({2}%)", title, info, num));
         };
         codeGenerator.DryRun();
     }
 }
Ejemplo n.º 5
0
        public override void Run(string[] args)
        {
            fabl.Debug("Entitas Code Generator version " + EntitasResources.GetVersion());
            if (assertPreferences(args))
            {
                new Status().Run(args);
                fabl.Debug("Dry Run");
                CodeGeneratorUtil
                .CodeGeneratorFromPreferences(loadPreferences(args))
                .DryRun();

                fabl.Info("👨‍🔬  No problems detected. Happy coding :)");
            }
        }
Ejemplo n.º 6
0
        public static void Generate()
        {
            checkCanGenerate();

            Debug.Log("Generating...");

            Preferences.sharedInstance.Refresh();
            var codeGenerator = CodeGeneratorUtil.CodeGeneratorFromPreferences();

            var progressOffset = 0f;

            codeGenerator.OnProgress += (title, info, progress) => {
                var cancel = EditorUtility.DisplayCancelableProgressBar(title, info, progressOffset + progress / 2);
                if (cancel)
                {
                    codeGenerator.Cancel();
                }
            };

            CodeGenFile[] dryFiles = null;
            CodeGenFile[] files    = null;

            try {
                dryFiles       = codeGenerator.DryRun();
                progressOffset = 0.5f;
                files          = codeGenerator.Generate();
            } catch (Exception ex) {
                dryFiles = new CodeGenFile[0];
                files    = new CodeGenFile[0];

                EditorUtility.DisplayDialog("Error", ex.Message, "Ok");
            }

            EditorUtility.ClearProgressBar();

            var totalGeneratedFiles = files.Select(file => file.fileName).Distinct().Count();

            var sloc = dryFiles
                       .Select(file => file.fileContent.ToUnixLineEndings())
                       .Sum(content => content.Split(new [] { '\n' }, StringSplitOptions.RemoveEmptyEntries).Length);

            var loc = files
                      .Select(file => file.fileContent.ToUnixLineEndings())
                      .Sum(content => content.Split(new [] { '\n' }).Length);

            Debug.Log("Generated " + totalGeneratedFiles + " files (" + sloc + " sloc, " + loc + " loc)");

            AssetDatabase.Refresh();
        }
        protected override void GenerateCodes()
        {
            Log((object)"Generating...");
            var recordpath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "../Jenny.properties");

            LogError("recordpath " + recordpath);
            var text       = File.ReadAllText(recordpath);
            var preference = new Preferences(recordpath, recordpath);

            DesperateDevs.CodeGeneration.CodeGenerator.CodeGenerator codeGenerator =
                CodeGeneratorUtil.CodeGeneratorFromPreferences(preference);

            codeGenerator.OnProgress += (GeneratorProgress)((title, info, progress) => {
                Log("progress " + (progress));
            });

            CodeGenFile[] codeGenFileArray1 = new CodeGenFile[0];
            CodeGenFile[] codeGenFileArray2;
            try {
                codeGenFileArray2 = codeGenerator.Generate();
            }
            catch (Exception ex) {
                codeGenFileArray1 = new CodeGenFile[0];
                codeGenFileArray2 = new CodeGenFile[0];
                //LogError("Error" + ex.Message + ex.StackTrace);
            }

            Log((object)("Done Generated " + (object)((IEnumerable <CodeGenFile>)codeGenFileArray2)
                         .Select <CodeGenFile, string>((
                                                           Func <CodeGenFile, string>)(file => file.fileName)).Distinct <string>()
                         .Count <string>() +
                         " files (" + (object)((
                                                   IEnumerable <CodeGenFile>)codeGenFileArray1)
                         .Select <CodeGenFile, string>(
                             (Func <CodeGenFile, string>)(file => file.fileContent.ToUnixLineEndings()))
                         .Sum <string>(
                             (Func <string, int>)(content => content.Split(new char[1] {
                '\n'
            }, StringSplitOptions.RemoveEmptyEntries).Length)) + " sloc, " +
                         (object)((IEnumerable <CodeGenFile>)codeGenFileArray2)
                         .Select <CodeGenFile, string>(
                             (Func <CodeGenFile, string>)(file => file.fileContent.ToUnixLineEndings()))
                         .Sum <string>(
                             (
                                 Func <string, int>)(content => content.Split('\n').Length)) + " loc)"));
        }
Ejemplo n.º 8
0
 public static CodeGenerator GetCodeGenerator(Preferences preferences)
 {
     return(CodeGeneratorUtil.CodeGeneratorFromPreferences(preferences));
 }