예제 #1
0
        private static void CrmCli(CommandLineArgs arguments)
        {
#if DEBUG
            CliLog.WriteLine(CliLog.ColorRed, new string('█', CliLog.StarLength + 2));
            CliLog.WriteLine(CliLog.ColorRed, " DEBUG MODE");
            CliLog.WriteLine(CliLog.ColorRed, new string('█', CliLog.StarLength + 2));
#endif
            CliLog.WriteLine(CliLog.ColorGreen, " ____                              _           ____                  ____             _  ___ _     ____ _ _ ");
            CliLog.WriteLine(CliLog.ColorGreen, "|  _ \\ _   _ _ __   __ _ _ __ ___ (_) ___ ___ / ___|_ __ _ __ ___   |  _ \\  _____   _| |/ (_) |_  / ___| (_)");
            CliLog.WriteLine(CliLog.ColorGreen, "| | | | | | | '_ \\ / _` | '_ ` _ \\| |/ __/ __| |   | '__| '_ ` _ \\  | | | |/ _ \\ \\ / / ' /| | __|| |   | | |");
            CliLog.WriteLine(CliLog.ColorGreen, "| |_| | |_| | | | | (_| | | | | | | | (__\\__ \\ |___| |  | | | | | |_| |_| |  __/\\ V /| . \\| | |_ | |___| | |");
            CliLog.WriteLine(CliLog.ColorGreen, "|____/ \\__, |_| |_|\\__,_|_| |_| |_|_|\\___|___/\\____|_|  |_| |_| |_(_)____/ \\___| \\_/ |_|\\_\\_|\\__(_)____|_|_|");
            CliLog.WriteLine(CliLog.ColorGreen, "       |___/                                          ", CliLog.ColorWhite, "https://github.com/phuocle/Dynamics-Crm-DevKit", CliLog.ColorBlue, $" {Const.Version}");
            CliLog.WriteLine();
            CliLog.WriteLine(CliLog.ColorWhite, "|", CliLog.ColorGreen, "Current Directory path: ", CliLog.ColorWhite, CurrentDirectory);
            CliLog.WriteLine(CliLog.ColorWhite, "|", CliLog.ColorGreen, "DynamicsCrm.DevKit.Cli.exe path: ", CliLog.ColorWhite, Assembly.GetExecutingAssembly().Location);
#if !DEBUG
            try
            {
#endif
            var jsonFile     = Path.Combine(CurrentDirectory, arguments.Json);
            var jsonFileInfo = new FileInfo(jsonFile);
            CliLog.WriteLine(CliLog.ColorWhite, "|", CliLog.ColorGreen, "DynamicsCrm.DevKit.Cli.json path: ", CliLog.ColorWhite, jsonFileInfo.FullName);
            if (arguments.SdkLogin.Length > 0 && arguments.SdkLogin.ToLower() == "yes")
            {
                CliLog.WriteLine(CliLog.ColorWhite, "|", CliLog.ColorGreen, "Arguments: ",
                                 CliLog.ColorMagenta, "/sdklogin:"******"yes", " ",
                                 CliLog.ColorMagenta, "/json:", CliLog.ColorWhite, arguments.Json, " ",
                                 CliLog.ColorMagenta, "/type:", CliLog.ColorWhite, arguments.Type, " ",
                                 CliLog.ColorMagenta, "/profile:", CliLog.ColorWhite, arguments.Profile
                                 );
            }
            else
            {
                CliLog.WriteLine(CliLog.ColorWhite, "|", CliLog.ColorGreen, "Arguments: ",
                                 CliLog.ColorMagenta, "/conn:", CliLog.ColorWhite, XrmHelper.BuildConnectionStringLog(arguments.Connection), " ",
                                 CliLog.ColorMagenta, "/json:", CliLog.ColorWhite, arguments.Json, " ",
                                 CliLog.ColorMagenta, "/type:", CliLog.ColorWhite, arguments.Type, " ",
                                 CliLog.ColorMagenta, "/profile:", CliLog.ColorWhite, arguments.Profile
                                 );
            }

            Run(arguments);
#if DEBUG
            CliLog.WriteLine(CliLog.ColorRed, "!!! FINISHED !!!");
            Console.ReadKey();
#endif
#if !DEBUG
        }

        catch (Exception e)
        {
            CliLog.WriteLine(CliLog.ColorError, $"{e.Message}");
            Console.ReadKey();
        }
#endif
        }
예제 #2
0
        private string CreateCommandArgsLog()
        {
            var command = new StringBuilder();

            command.Append($"/connectionstring:\"{XrmHelper.BuildConnectionStringLog(arguments.Connection)}\" ");
            if (json.entities != null && json.entities.Length > 0)
            {
                command.Append($"/codewriterfilter:DynamicsCrm.DevKit.CrmSvcUtilExtensions.CodeWriterFilter,DynamicsCrm.DevKit.CrmSvcUtilExtensions ");
            }
            command.Append($"/nologo ");
            command.Append($"/namespace:{json.@namespace} ");
            command.Append($"/out:{json.output}");
            return(command.ToString());
        }
예제 #3
0
        private string CreateCommandArgsLog()
        {
            var command = new StringBuilder();

            if (arguments.SdkLogin.Length > 0 && arguments.SdkLogin.ToLower() == "yes")
            {
                command.Append("/interactivelogin ");
            }
            else
            {
                command.Append($"/connectionstring:\"{XrmHelper.BuildConnectionStringLog(arguments.Connection)}\" ");
            }
            if (json.entities != null && json.entities.Length > 0)
            {
                command.Append($"/codewriterfilter:\"DynamicsCrm.DevKit.CrmSvcUtilExtensions.CodeWriterFilter,DynamicsCrm.DevKit.CrmSvcUtilExtensions\" ");
            }
            command.Append($"/nologo ");
            command.Append($"/namespace:\"{json.@namespace}\" ");
            command.Append($"/out:\"{json.output}\"");
            return(command.ToString());
        }
예제 #4
0
        private static void CrmCli(CommandLineArgs arguments)
        {
            CliLog.WriteLine(CliLog.ColorGreen, "╔", new string('═', CliLog.StarLength), "╗");
            CliLog.WriteLine(CliLog.ColorGreen, "║", new string(' ', CliLog.StarLength), "║");
            CliLog.WriteLine(CliLog.ColorGreen, "║", CliLog.ColorCyan, $"              DynamicsCrm.DevKit.Cli - {Const.Version}               ", CliLog.ColorGreen, "║");
            CliLog.WriteLine(CliLog.ColorGreen, "║", new string(' ', CliLog.StarLength), "║");
            CliLog.WriteLine(CliLog.ColorGreen, "╚", new string('═', CliLog.StarLength), "╝");
            CliLog.WriteLine(CliLog.ColorWhite, "|", CliLog.ColorGreen, "Path: ", CliLog.ColorWhite, Assembly.GetExecutingAssembly().Location);
#if DEBUG
            CliLog.WriteLine(CliLog.ColorRed, new string('█', CliLog.StarLength + 2));
            CliLog.WriteLine(CliLog.ColorRed, " DEBUG MODE");
            CliLog.WriteLine(CliLog.ColorRed, new string('█', CliLog.StarLength + 2));
#endif
#if !DEBUG
            try
            {
#endif
            var jsonFile = Path.Combine(CurrentDirectory, arguments.Json);
            CliLog.WriteLine(CliLog.ColorWhite, "|", CliLog.ColorGreen, "DynamicsCrm.DevKit.Cli.json path: ", CliLog.ColorWhite, jsonFile);
            CliLog.WriteLine(CliLog.ColorWhite, "|", CliLog.ColorGreen, "Arguments: ",
                             CliLog.ColorMagenta, "/conn:", CliLog.ColorWhite, XrmHelper.BuildConnectionStringLog(arguments.Connection), " ",
                             CliLog.ColorMagenta, "/json:", CliLog.ColorWhite, arguments.Json, " ",
                             CliLog.ColorMagenta, "/type:", CliLog.ColorWhite, arguments.Type, " ",
                             CliLog.ColorMagenta, "/profile:", CliLog.ColorWhite, arguments.Profile
                             );
            Run(arguments);
#if DEBUG
            CliLog.WriteLine(CliLog.ColorRed, "!!! FINISHED !!!");
            Console.ReadKey();
#endif
#if !DEBUG
        }
        catch (Exception e)
        {
            CliLog.WriteLine(CliLog.ColorError, $"{e.Message}");
            Console.ReadKey();
        }
#endif
        }