Пример #1
0
        public override void Run(string[] args)
        {
            if (assertProperties())
            {
                var codeGenerator = CodeGeneratorUtil.CodeGeneratorFromProperties();

                codeGenerator.OnProgress += (title, info, progress) => {
                    var p = (int)(progress * 100);
                    fabl.Debug(string.Format("{0}: {1} ({2}%)", title, info, p));
                };

                codeGenerator.DryRun();
            }
        }
Пример #2
0
        public override void Execute(string[] args)
        {
            Log.I("QFramework Code Generator version " + EntitasResources.GetVersion());
            if (AssertProperties())
            {
                new Status().Execute(args);

                Log.I("Dry Run");

                CodeGeneratorUtil
                .CodeGeneratorFromProperties()
                .DryRun();
            }
        }
Пример #3
0
        public override void Execute(string[] args)
        {
            if (AssertProperties())
            {
                var codeGenerator = CodeGeneratorUtil.CodeGeneratorFromProperties();

                codeGenerator.OnProgress += (title, info, progress) =>
                {
                    var p = (int)(progress * 100);
                    Log.I("{0}: {1} ({2}%)", title, info, p);
                };

                codeGenerator.DryRun();
            }
        }
Пример #4
0
        public override void Run(string[] args)
        {
            fabl.Debug("Entitas Code Generator version " + EntitasResources.GetVersion());

            if (assertProperties())
            {
                new Status().Run(args);

                fabl.Debug("Dry Run");

                CodeGeneratorUtil
                .CodeGeneratorFromProperties()
                .DryRun();
            }
        }
Пример #5
0
        public static void Generate()
        {
            checkCanGenerate();

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

            var codeGenerator = CodeGeneratorUtil.CodeGeneratorFromProperties();

            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();
        }