private async Task runTsc()
        {
            var projectDir   = getProjectDir();
            var tsConfigPath = Path.Combine
                               (
                projectDir,
                "Scripts",
                getAppName(appKey),
                "tsconfig.json"
                               );

            Console.WriteLine($"Compiling Typescript '{tsConfigPath}'");
            if (File.Exists(tsConfigPath))
            {
                var tscProcess = new WinProcess("tsc")
                                 .UseArgumentNameDelimiter("-")
                                 .AddArgument("p", new Quoted(tsConfigPath));
                var result = await new CmdProcess(tscProcess)
                             .WriteOutputToConsole()
                             .Run();
                result.EnsureExitCodeIsZero();
            }
            else
            {
                Console.WriteLine($"tsconfig file not found '{tsConfigPath}'");
            }
        }
示例#2
0
    public async Task Run()
    {
        var process = new WinProcess("robocopy");

        if (outputToConsole)
        {
            process.WriteOutputToConsole();
        }
        process
        .UseArgumentNameDelimiter("")
        .AddArgument(new Quoted(source))
        .AddArgument(new Quoted(target))
        .AddArgument(pattern)
        .UseArgumentNameDelimiter("/")
        .UseArgumentValueDelimiter(":")
        .SetWorkingDirectory(workingDirectory);
        foreach (var arg in options)
        {
            process.AddArgument(arg);
        }
        if (attributesToAdd.Any())
        {
            process.AddArgument("a+", string.Join("", attributesToAdd));
        }
        var result = await process.Run();

        if (result.ExitCode >= 8)
        {
            throw new Exception($"robocopy failed with exit code {result.ExitCode}");
        }
    }
示例#3
0
        private void MouseCoord_Load(object sender, EventArgs e)
        {
            int initialStyle = WinProcess.GetWindowLong(this.Handle, -20);

            WinProcess.SetWindowLong(this.Handle, -20, (uint)(initialStyle | 0x80000 | 0x20 | 0x00000080));
            this.Size     = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
            this.Location = new Point(0, 0);
            xLine.Size    = new Size(Screen.PrimaryScreen.Bounds.Width, 1);
            yLine.Size    = new Size(1, Screen.PrimaryScreen.Bounds.Height);
        }
        private async Task runWebpack()
        {
            var projectDir        = getProjectDir();
            var webpackConfigPath = Path.Combine(projectDir, "webpack.config.js");
            var webpackProcess    = new WinProcess("webpack")
                                    .UseArgumentNameDelimiter("--")
                                    .AddArgument("config", new Quoted(webpackConfigPath));
            var result = await new CmdProcess(webpackProcess)
                         .WriteOutputToConsole()
                         .Run();

            result.EnsureExitCodeIsZero();
        }
示例#5
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            IsEnabled = false;
            await Task.Run(() => Dispatcher?.InvokeAsync(() =>
            {
                var username = _users[UsersBox.SelectedIndex].AccountName;
                SteamClientHelper.SetAutoLoginUser(username);
                SteamClientHelper.SetRememberPassword(true);
                WinProcess.Restart(_steamExePath, LaunchOptionsTextBox.Text);
            }));

            IsEnabled = true;
        }
示例#6
0
    private WinProcess createProcess()
    {
        var process = new WinProcess("psexec");

        if (outputToConsole)
        {
            process.WriteOutputToConsole();
        }
        process.UseArgumentNameDelimiter("");
        process.AddArgument(server);
        process.AddArgument(remoteProcess.CommandText());
        return(process);
    }
示例#7
0
        private async Task packLibProjects(AppKey appKey, string versionNumber)
        {
            Console.WriteLine("Packing Lib Projects");
            var libDir = Path.Combine(Environment.CurrentDirectory, "Lib");

            if (Directory.Exists(libDir))
            {
                string packageVersion;
                string outputPath;
                var    envName = hostEnv.IsProduction()
                    ? "Production"
                    : "Development";
                if (hostEnv.IsProduction())
                {
                    packageVersion = versionNumber;
                }
                else
                {
                    packageVersion = await retrieveDevPackageVersion(appKey);
                }
                outputPath = Path.Combine
                             (
                    getXtiDir(),
                    "Packages",
                    envName
                             );
                foreach (var dir in Directory.GetDirectories(libDir))
                {
                    var packProcess = new WinProcess("dotnet")
                                      .WriteOutputToConsole()
                                      .UseArgumentNameDelimiter("")
                                      .AddArgument("pack")
                                      .AddArgument(dir)
                                      .UseArgumentNameDelimiter("-")
                                      .AddArgument("c", getConfiguration())
                                      .AddArgument("o", new Quoted(outputPath))
                                      .UseArgumentValueDelimiter("=")
                                      .AddArgument("p:PackageVersion", packageVersion);
                    if (!hostEnv.IsProduction())
                    {
                        packProcess
                        .UseArgumentNameDelimiter("--")
                        .AddArgument("include-source")
                        .AddArgument("include-symbols");
                    }
                    var result = await packProcess.Run();

                    result.EnsureExitCodeIsZero();
                }
            }
        }
示例#8
0
    private WinProcess createProcess()
    {
        var process = new WinProcess("cmd");

        process.SetWorkingDirectory(workingDirectory);
        if (outputToConsole)
        {
            process.WriteOutputToConsole();
        }
        process.UseArgumentNameDelimiter("/");
        process.AddArgument("C");
        process.UseArgumentNameDelimiter("");
        process.AddArgument(otherProcess.CommandText());
        return(process);
    }
示例#9
0
        private async Task runDotNetPublish(AppKey appKey, AppVersionKey versionKey)
        {
            var publishDir    = getPublishDir(appKey, versionKey);
            var publishAppDir = Path.Combine(publishDir, "App");

            Console.WriteLine($"Publishing web app to '{publishAppDir}'");
            var publishProcess = new WinProcess("dotnet")
                                 .WriteOutputToConsole()
                                 .UseArgumentNameDelimiter("")
                                 .AddArgument("publish")
                                 .AddArgument(new Quoted(getProjectDir(appKey)))
                                 .UseArgumentNameDelimiter("-")
                                 .AddArgument("c", getConfiguration())
                                 .UseArgumentValueDelimiter("=")
                                 .AddArgument("p:PublishProfile", "Default")
                                 .AddArgument("p:PublishDir", publishAppDir);
            var result = await publishProcess.Run();

            result.EnsureExitCodeIsZero();
        }
示例#10
0
    private WinProcess createWinProcess()
    {
        var process = new WinProcess(fileName);

        if (outputToConsole)
        {
            process.WriteOutputToConsole();
        }
        process.UseArgumentNameDelimiter("--");
        process.UseArgumentValueDelimiter(" ");
        process.AddArgument("environment", environment.Value);
        process.SetWorkingDirectory(workingDirectory);
        var dict = config.ToDictionary();

        foreach (var key in dict.Keys)
        {
            process.AddArgument(key, new Quoted(dict[key]));
        }
        return(process);
    }
示例#11
0
        private async Task publishSetup(AppKey appKey, AppVersionKey versionKey)
        {
            Console.WriteLine("Publishing setup");
            var setupAppDir = Path.Combine
                              (
                Environment.CurrentDirectory,
                "Apps",
                $"{getAppName(appKey)}SetupApp"
                              );

            if (Directory.Exists(setupAppDir))
            {
                var publishDir        = getPublishDir(appKey, versionKey);
                var versionsPath      = Path.Combine(publishDir, "versions.json");
                var persistedVersions = new PersistedVersions(hubApi, appKey, versionsPath);
                await persistedVersions.Store();

                var publishSetupDir = Path.Combine(publishDir, "Setup");
                Console.WriteLine($"Publishing setup to '{publishSetupDir}'");
                var publishProcess = new WinProcess("dotnet")
                                     .WriteOutputToConsole()
                                     .UseArgumentNameDelimiter("")
                                     .AddArgument("publish")
                                     .AddArgument(new Quoted(setupAppDir))
                                     .UseArgumentNameDelimiter("-")
                                     .AddArgument("c", getConfiguration())
                                     .UseArgumentValueDelimiter("=")
                                     .AddArgument("p:PublishProfile", "Default")
                                     .AddArgument("p:PublishDir", publishSetupDir);
                var result = await publishProcess.Run();

                result.EnsureExitCodeIsZero();
            }
            else
            {
                Console.WriteLine($"Setup App Not Found at '{setupAppDir}'");
            }
        }
示例#12
0
        private async Task copyToWebExports(AppKey appKey, AppVersionKey versionKey)
        {
            Console.WriteLine("Copying to web exports");
            var publishDir    = getPublishDir(appKey, versionKey);
            var exportBaseDir = Path.Combine(publishDir, "Exports");
            var tempExportDir = Path.Combine(getProjectDir(appKey), "Exports");

            if (Directory.Exists(tempExportDir))
            {
                Directory.Delete(tempExportDir, true);
            }
            var sourceScriptPath = Path.Combine
                                   (
                getProjectDir(appKey),
                "Scripts",
                getAppName(appKey)
                                   );

            if (Directory.Exists(sourceScriptPath))
            {
                var tsConfigPath = Path.Combine
                                   (
                    getProjectDir(appKey),
                    "Scripts",
                    getAppName(appKey),
                    "tsConfig.json"
                                   );
                var tscProcess = new WinProcess("tsc")
                                 .UseArgumentNameDelimiter("-")
                                 .AddArgument("p", tsConfigPath)
                                 .UseArgumentNameDelimiter("--")
                                 .AddArgument("outDir", new Quoted(tempExportDir))
                                 .AddArgument("declaration", "true");
                var tscResult = await new CmdProcess(tscProcess).Run();
                tscResult.EnsureExitCodeIsZero();
                await new RobocopyProcess(sourceScriptPath, tempExportDir)
                .Pattern("*.d.ts")
                .CopySubdirectoriesIncludingEmpty()
                .NoFileClassLogging()
                .NoFileLogging()
                .NoDirectoryLogging()
                .NoJobHeader()
                .NoJobSummary()
                .Run();
                await new RobocopyProcess(sourceScriptPath, tempExportDir)
                .Pattern("*.html")
                .CopySubdirectoriesIncludingEmpty()
                .NoFileClassLogging()
                .NoFileLogging()
                .NoDirectoryLogging()
                .NoJobHeader()
                .NoJobSummary()
                .Run();
                await new RobocopyProcess(sourceScriptPath, tempExportDir)
                .Pattern("*.scss")
                .CopySubdirectoriesIncludingEmpty()
                .NoFileClassLogging()
                .NoFileLogging()
                .NoDirectoryLogging()
                .NoJobHeader()
                .NoJobSummary()
                .Run();
                var exportScriptDir = Path.Combine(exportBaseDir, "Scripts");
                await new RobocopyProcess(tempExportDir, exportScriptDir)
                .CopySubdirectoriesIncludingEmpty()
                .Purge()
                .NoFileClassLogging()
                .NoFileLogging()
                .NoDirectoryLogging()
                .NoJobHeader()
                .NoJobSummary()
                .Run();
                Directory.Delete(tempExportDir, true);
            }
            else
            {
                Console.WriteLine($"Source script folder not found '{sourceScriptPath}'");
            }
            var sourceViewDir = Path.Combine
                                (
                getProjectDir(appKey),
                "Views",
                "Exports",
                getAppName(appKey)
                                );

            if (Directory.Exists(sourceViewDir))
            {
                var exportViewDir = Path.Combine(exportBaseDir, "Views");
                await new RobocopyProcess(sourceViewDir, exportViewDir)
                .CopySubdirectoriesIncludingEmpty()
                .Purge()
                .NoFileClassLogging()
                .NoFileLogging()
                .NoDirectoryLogging()
                .NoJobHeader()
                .NoJobSummary()
                .Run();
            }
            else
            {
                Console.WriteLine($"Source view folder not found '{sourceViewDir}'");
            }
        }
示例#13
0
 private void RestartExplorerButton_Click(object sender, RoutedEventArgs e)
 {
     WinProcess.Stop(@"explorer");
 }
示例#14
0
        private void Recording_Load(object sender, EventArgs e)
        {
            int initialStyle = WinProcess.GetWindowLong(this.Handle, -20);

            WinProcess.SetWindowLong(this.Handle, -20, (uint)(initialStyle | 0x80000 | 0x20 | 0x00000080));
        }