Ejemplo n.º 1
0
        public void AppendDatabaseConnection()
        {
            var args = new UoeProcessArgs().Append(new List <UoeDatabaseConnection> {
                UoeDatabaseConnection.NewMultiUserConnection(new UoeDatabaseLocation("data")), UoeDatabaseConnection.NewSingleUserConnection(new UoeDatabaseLocation("data"))
            });

            Assert.AreEqual(5, args.Count(), "should have -db data -db data -1");
        }
Ejemplo n.º 2
0
        public void AppendFromPfFilePath(string pfFileContent, string expected)
        {
            var pfPath = Path.Combine(TestFolder, "test.pf");

            File.WriteAllText(pfPath, pfFileContent);

            var args = new UoeProcessArgs().AppendFromPfFilePath(pfPath);

            if (File.Exists(pfPath))
            {
                File.Delete(pfPath);
            }

            Assert.AreEqual(expected, args.ToString());
        }
Ejemplo n.º 3
0
        protected override int ExecuteCommand(CommandLineApplication app, IConsole console)
        {
            var dlcPath = GetDlcPath();

            var args = new UoeProcessArgs();

            args.Append(ToolArguments(), GetDatabaseConnections(true, false));
            if (UoeUtilities.CanProVersionUseNoSplashParameter(UoeUtilities.GetProVersionFromDlc(dlcPath)))
            {
                args.Append("-nosplash");
            }
            args.Append(RemainingArgs);

            var executable = UoeUtilities.GetProExecutableFromDlc(dlcPath);

            var argsString = args.ToCliArgs();

            Log?.Debug($"Executing command:\n{ProcessArgs.ToCliArg(executable)} {argsString}");

            var process = new Process {
                StartInfo = new ProcessStartInfo {
                    FileName         = executable,
                    Arguments        = argsString,
                    WorkingDirectory = ExecutionWorkingDirectory ?? Directory.GetCurrentDirectory()
                }
            };

            process.Start();

            if (!DetachedMode)
            {
                var detach = SpinUntilConditionOrDetachedOrExited(() => process.HasExited, "exit the program");
                if (!detach && !process.HasExited)
                {
                    process.Kill();
                }
            }

            return(0);
        }
        /// <summary>
        /// Get the process arguments for the database connection
        /// </summary>
        /// <returns></returns>
        public UoeProcessArgs ToArgs()
        {
            var args = new UoeProcessArgs();

            args.Append("-db", string.IsNullOrEmpty(Service) ? DatabaseLocation.FullPath : DatabaseLocation.PhysicalName);
            if (!string.IsNullOrEmpty(LogicalName))
            {
                args.Append("-ld", LogicalName);
            }
            if (!string.IsNullOrEmpty(Service))
            {
                if (!string.IsNullOrEmpty(HostName))
                {
                    args.Append("-H", HostName);
                }
                args.Append("-S", Service);
            }
            if (SingleUser)
            {
                args.Append("-1");
            }
            if (!string.IsNullOrEmpty(UserId))
            {
                args.Append("-U", UserId);
                if (!string.IsNullOrEmpty(Password))
                {
                    args.Append("-P", Password);
                }
            }
            if (MaxConnectionTry.HasValue)
            {
                args.Append("-ct", MaxConnectionTry.Value.ToString());
            }
            args.Append(ExtraOptions);
            return(args);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Returns the codepage used by a progress session for all file/console I/O.
 /// </summary>
 /// <remarks>
 /// Summary of the different codepage usage:
 /// https://documentation.progress.com/output/ua/OpenEdge_latest/index.html#page/dvint/determining-the-code-page.html
 /// </remarks>
 /// <param name="args"></param>
 /// <returns></returns>
 public static string GetProcessIoCodePageFromArgs(UoeProcessArgs args)
 {
     return(args.GetValueForOption("-cpstream") ?? args.GetValueForOption("-stream"));
 }