Exemple #1
0
        public void Save()
        {
            _sb.Replace(Constants.Imports,
                        @"using System;
using System.Collections.Generic;
");
            File.WriteAllText(_fileName, _sb.ToString());
        }
Exemple #2
0
        public void EndFunc()
        {
            if (Env.Instance.isLambda)
            {
                Env.Instance.isLambda = false;
                return;
            }
            if (!Env.Instance.hasFuncReturnedValue && !string.IsNullOrEmpty(Env.Instance.currentFuncSignature))
            {
                _sb.Replace(Env.Instance.currentFuncSignature, $"public void {Env.Instance.currentFuncName}(");
            }

            Env.Instance.currentFuncArgs.Clear();
            Env.Instance.hasFuncReturnedValue = false;
            Env.Instance.currentFuncName      = null;
            Env.Instance.currentFuncSignature = null;
        }
Exemple #3
0
     public void End(string className)
     {
         _sb.Ident--;
         _sb.AppendLineA("}");
         _sb.Replace(Constants.ClassName, className);
         _sb.Replace(Constants.Fields, GetFieldsList());
         _fieldsInit.Remove(className);
         if (!Env.Instance.hasBeenCtor)
         {
             _sb.Replace(Constants.ImplicitCtor,
                         $@"    public {className}()
 {{
 {Constants.Dependencies}
 {Constants.InitCode}
 }}");
         }
         else
         {
             _sb.Replace(Constants.ImplicitCtor, string.Empty);
         }
         _sb.Replace(Constants.FieldsInit, GetFieldsListInit());
         _sb.Replace(Constants.Dependencies, GetDependencyInit());
         _sb.ReplaceB(Constants.InitCode);
     }