Esempio n. 1
0
 private static void CreateMvcCode(string target)
 {
     Performances.Record(MethodBase.GetCurrentMethod().Name);
     Functions.AspNetMvc.CSharp.MvcCreator.Create(target);
     Consoles.Write(
         DisplayAccessor.Displays.Get("CodeDefinerMvcCompleted"),
         Consoles.Types.Success);
     Performances.Record(MethodBase.GetCurrentMethod().Name);
 }
Esempio n. 2
0
 private static void CreateSolutionBackup()
 {
     Performances.Record(MethodBase.GetCurrentMethod().Name);
     Functions.CodeDefiner.BackupCreater.BackupSolutionFiles();
     Consoles.Write(
         DisplayAccessor.Displays.Get("CodeDefinerBackupCompleted"),
         Consoles.Types.Success);
     Performances.Record(MethodBase.GetCurrentMethod().Name);
 }
Esempio n. 3
0
 private static void CreateCssCode()
 {
     Performances.Record(MethodBase.GetCurrentMethod().Name);
     Functions.Web.Styles.CssCreator.Create();
     Consoles.Write(
         DisplayAccessor.Displays.Get("CodeDefinerCssCompleted"),
         Consoles.Types.Success);
     Performances.Record(MethodBase.GetCurrentMethod().Name);
 }
Esempio n. 4
0
 private static void ConfigureDatabase()
 {
     TryOpenConnections();
     Performances.Record(MethodBase.GetCurrentMethod().Name);
     Functions.SqlServer.Configurator.Configure();
     Consoles.Write(
         DisplayAccessor.Displays.Get("CodeDefinerRdsCompleted"),
         Consoles.Types.Success);
     Performances.Record(MethodBase.GetCurrentMethod().Name);
 }
Esempio n. 5
0
 private static void TestPerformance(int loopCount, params Action[] actionCollection)
 {
     actionCollection
     .Select((o, i) => new { Count = i + 1, Action = o })
     .ForEach(data =>
     {
         Performances.Record("Action:" + data.Count);
         for (int count = 1; count <= loopCount; count++)
         {
             data.Action();
         }
         Performances.Record("Action:" + data.Count);
     });
 }
Esempio n. 6
0
        static void Main(string[] args)
        {
            // エンコードプロバイダーの登録が必要
            System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);

            var argList = args.Select(o => o.Trim());

            ValidateArgs(argList);
            var argHash = new TextData(argList.Skip(1).Join(string.Empty), '/', 1);
            var action  = args[0];
            var path    = argHash.Get("p");
            var target  = argHash.Get("t");

            Initializer.Initialize(
                path,
                assemblyVersion: Assembly.GetExecutingAssembly().GetName().Version.ToString(),
                codeDefiner: true,
                setSaPassword: argHash.ContainsKey("s"),
                setRandomPassword: argHash.ContainsKey("r"));
            Performances.Record(MethodBase.GetCurrentMethod().Name);
            DeleteTemporaryFiles();
            switch (action)
            {
            case "_rds":
                ConfigureDatabase();
                break;

            case "rds":
                ConfigureDatabase();
                CreateDefinitionAccessorCode();
                CreateMvcCode(target);
                break;

            case "_def":
                CreateDefinitionAccessorCode();
                break;

            case "def":
                CreateDefinitionAccessorCode();
                CreateMvcCode(target);
                break;

            case "mvc":
                CreateMvcCode(target);
                break;

            case "css":
                CreateCssCode();
                break;

            case "backup":
                CreateSolutionBackup();
                break;

            default:
                WriteErrorToConsole(args);
                break;
            }
            Performances.Record(MethodBase.GetCurrentMethod().Name);
            Performances.PerformanceCollection.Save(Directories.Logs());
            Consoles.Write(
                DisplayAccessor.Displays.Get("CodeDefinerCompleted"),
                Consoles.Types.Success);
            WaitConsole(args);
        }
        public static void Main(string[] args)
        {
            Directory.CreateDirectory(".\\logs");
            var logName = $".\\logs\\Implem.CodeDefiner_{DateTime.Now.ToString("yyyyMMdd_HHmmss")}.log";

            Trace.Listeners.Add(new TextWriterTraceListener(logName));
            Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
            AppDomain.CurrentDomain.UnhandledException += (_, e) =>
            {
                if (e.ExceptionObject is SqlException sqlException)
                {
                    Consoles.Write($"UnhandledException: [{sqlException.Number}] {sqlException.Message}", Consoles.Types.Error, true);
                }
                else
                {
                    Consoles.Write("UnhandledException: " + e.ExceptionObject, Consoles.Types.Error, true);
                }
            };
            var argList = args.Select(o => o.Trim());

            ValidateArgs(argList);
            var argHash = new TextData(argList.Skip(1).Join(string.Empty), '/', 1);
            var action  = args[0];
            var path    = argHash.Get("p")?.Replace('\\', System.IO.Path.DirectorySeparatorChar);
            var target  = argHash.Get("t");

            Initializer.Initialize(
                path,
                assemblyVersion: Assembly.GetExecutingAssembly().GetName().Version.ToString(),
                codeDefiner: true,
                setSaPassword: argHash.ContainsKey("s"),
                setRandomPassword: argHash.ContainsKey("r"));
            Performances.Record(MethodBase.GetCurrentMethod().Name);
            DeleteTemporaryFiles();
            switch (action)
            {
            case "_rds":
                ConfigureDatabase();
                break;

            case "rds":
                ConfigureDatabase();
                CreateDefinitionAccessorCode();
                CreateMvcCode(target);
                break;

            case "_def":
                CreateDefinitionAccessorCode();
                break;

            case "def":
                CreateDefinitionAccessorCode();
                CreateMvcCode(target);
                break;

            case "mvc":
                CreateMvcCode(target);
                break;

            case "css":
                CreateCssCode();
                break;

            case "backup":
                CreateSolutionBackup();
                break;

            default:
                WriteErrorToConsole(args);
                break;
            }
            Performances.Record(MethodBase.GetCurrentMethod().Name);
            Performances.PerformanceCollection.Save(Directories.Logs());
            if (Consoles.ErrorCount > 0)
            {
                Consoles.Write(
                    string.Format(DisplayAccessor.Displays.Get("CodeDefinerErrorCount"),
                                  Consoles.ErrorCount,
                                  Path.GetFullPath(logName)),
                    Consoles.Types.Error);
            }
            else
            {
                Consoles.Write(
                    DisplayAccessor.Displays.Get("CodeDefinerCompleted"),
                    Consoles.Types.Success);
            }
            WaitConsole(args);
        }