コード例 #1
0
ファイル: PythonAction.cs プロジェクト: anyjobs/anyjob.engine
        private ProcessExecInput CreateDockerInputInfo(IActionContext context, string exchangePath, string inputFile, string outputFile)
        {
            string RootDirInDocker      = "/anyjob";
            string PackageDirInDocker   = System.IO.Path.Combine(RootDirInDocker, "packs", context.Name.Pack).ToUnixPath();
            string wrapperPathInDocker  = System.IO.Path.Combine(RootDirInDocker, "python_wrapper.py").ToUnixPath();
            string globalLibDirInLocal  = System.IO.Path.GetFullPath(pythonOption.GlobalPythonLibPath);
            string globalLibDirInDocker = System.IO.Path.Combine(RootDirInDocker, pythonOption.GlobalPythonLibPath).ToUnixPath();
            string exchangePathInDocker = System.IO.Path.Combine(RootDirInDocker, "exchange").ToUnixPath();
            string inputFileInDocker    = System.IO.Path.Combine(exchangePathInDocker, Path.GetFileName(inputFile)).ToUnixPath();
            string outputFileInDocker   = System.IO.Path.Combine(exchangePathInDocker, Path.GetFileName(outputFile)).ToUnixPath();

            string wrapperPathInLocal          = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, pythonOption.WrapperPath));
            string packNodeModulesPathInDocker = System.IO.Path.Combine(PackageDirInDocker, pythonOption.PackPythonLibPath).ToUnixPath();

            return(ProcessExecuter.BuildDockerProcess(
                       pythonOption.DockerImage,
                       new string[] { pythonOption.PythonPath, wrapperPathInDocker, pythonEntryInfo.Module, pythonEntryInfo.Method, inputFileInDocker, outputFileInDocker },
                       PackageDirInDocker,
                       new Dictionary <string, string>
            {
                [context.RuntimeInfo.WorkingDirectory] = PackageDirInDocker,
                [wrapperPathInLocal] = wrapperPathInDocker,
                [exchangePath] = exchangePathInDocker,
                [globalLibDirInLocal] = globalLibDirInDocker
            },
                       new Dictionary <string, string>
            {
                ["PYTHONPATH"] = JoinEnvironmentPaths(true, PackageDirInDocker, packNodeModulesPathInDocker, globalLibDirInDocker)
            },
                       string.Empty));
        }
コード例 #2
0
        private async Task Decode_Manifest()
        {
            ProcessStartInfo psi = new ProcessStartInfo()
            {
                FileName  = pathProvider.GetBundleToolPath(),
                Arguments = "dump manifest --bundle=\"" + targetFilePath.OriginalString + "\""
            };

            Debug.WriteLine("DefaultAABDecoder.Decode_Manifest(), path=" + targetFilePath.OriginalString);
            string processResult = await ProcessExecuter.ExecuteProcess(psi);

            while (!processResult.StartsWith("<"))
            {
                if (string.IsNullOrEmpty(processResult))
                {
                    break;
                }
                var lines = processResult.Split(new string[] { "\r\n" }, StringSplitOptions.None).Skip(1);
                processResult = string.Join(Environment.NewLine, lines.ToArray());
            }
            processResult = processResult.Trim();
            Debug.WriteLine("DefaultAABDecoder.Decode_Manifest(), result=" + processResult);

            dataModel.RawDumpBadging = processResult;
            Debug.WriteLine("DefaultAABDecoder.Decode_Manifest(), start read manifest");
            DesktopCMDAABUtil.ReadManifest(dataModel, dataModel.RawDumpBadging);
            Debug.WriteLine("DefaultAABDecoder.Decode_Manifest(), end read manifest");
        }
コード例 #3
0
        private async Task Decode_AppIconEntry()
        {
            ProcessStartInfo psi = new ProcessStartInfo()
            {
                FileName  = pathProvider.GetBundleToolPath(),
                Arguments = "dump resources --bundle=\"" + targetFilePath.OriginalString
                            + "\" --resource=\"" + dataModel.AppIconResourceEntry + "\" --values=true"
            };

            Debug.WriteLine("DefaultAABDecoder.Decode_AppIconEntry(), path=" + targetFilePath.OriginalString);
            string processResult = await ProcessExecuter.ExecuteProcess(psi);

            while (!processResult.StartsWith("Package"))
            {
                if (string.IsNullOrEmpty(processResult))
                {
                    break;
                }
                var lines = processResult.Split(new[] { "\r\n" }, StringSplitOptions.None).Skip(1);
                processResult = string.Join(Environment.NewLine, lines.ToArray());
            }
            processResult = processResult.Trim();
            Debug.WriteLine("DefaultAABDecoder.Decode_AppIconEntry(), result=" + processResult);

            DesktopCMDAABUtil.ReadAppIconEntry(dataModel, processResult);
        }
コード例 #4
0
        protected override ProcessExecInput OnCreateExecInputInfo(IActionContext context, string exchangePath, string inputFile, string outputFile)
        {
            _ = context ?? throw new ArgumentNullException(nameof(context));
            string RootDirInDocker    = "/anyjob";
            string PackageDirInDocker = System.IO.Path.Combine(RootDirInDocker, "packs", context.Name.Pack).ToUnixPath();

            string globalJarDirInLocal  = Path.GetFullPath(Path.GetDirectoryName(javaOptions.GlobalJarLibsPath));
            string globalJarDirInDocker = Path.Combine(RootDirInDocker, "global/java/").ToUnixPath();


            string exchangePathInDocker = Path.Combine(RootDirInDocker, "exchange").ToUnixPath();
            string inputFileInDocker    = Path.Combine(exchangePathInDocker, Path.GetFileName(inputFile)).ToUnixPath();
            string outputFileInDocker   = Path.Combine(exchangePathInDocker, Path.GetFileName(outputFile)).ToUnixPath();

            String classPathsInDocker = CombinClassPathInDocker(context.RuntimeInfo.WorkingDirectory, PackageDirInDocker, globalJarDirInLocal, globalJarDirInDocker);

            return(ProcessExecuter.BuildDockerProcess(javaOptions.DockerImage,
                                                      new[] { javaOptions.JavaPath, "-cp", classPathsInDocker, javaOptions.EntryClass, javaEntryInfo.ClassFullName, javaEntryInfo.MethodName, inputFileInDocker, outputFileInDocker },
                                                      PackageDirInDocker,
                                                      new Dictionary <string, string>
            {
                [context.RuntimeInfo.WorkingDirectory] = PackageDirInDocker,
                [globalJarDirInLocal] = globalJarDirInDocker,
                [exchangePath] = exchangePathInDocker
            },
                                                      new Dictionary <string, string>
            {
            },
                                                      string.Empty
                                                      ));
        }
コード例 #5
0
        protected override ProcessExecInput OnCreateExecInputInfo(IActionContext context, string exchangePath, string inputFile, string outputFile)
        {
            _ = context ?? throw new ArgumentNullException(nameof(context));
            string RootDirInDocker    = "/anyjob";
            string PackageDirInDocker = System.IO.Path.Combine(RootDirInDocker, "packs", context.Name.Pack).ToUnixPath();

            string wrapperDirInLocal   = Path.GetFullPath(Path.GetDirectoryName(netCoreOptions.WrapperPath));
            string wrapperDirInDocker  = Path.Combine(RootDirInDocker, "global/netcore/").ToUnixPath();
            string wrapperPathInDocker = Path.Combine(wrapperDirInDocker, Path.GetFileName(netCoreOptions.WrapperPath)).ToUnixPath();


            string exchangePathInDocker = Path.Combine(RootDirInDocker, "exchange").ToUnixPath();
            string inputFileInDocker    = Path.Combine(exchangePathInDocker, Path.GetFileName(inputFile)).ToUnixPath();
            string outputFileInDocker   = Path.Combine(exchangePathInDocker, Path.GetFileName(outputFile)).ToUnixPath();

            return(ProcessExecuter.BuildDockerProcess(netCoreOptions.DockerImage,
                                                      new[] { netCoreOptions.DotnetPath, wrapperPathInDocker, entryInfo.Assembly, entryInfo.Type, entryInfo.Method, inputFileInDocker, outputFileInDocker },
                                                      PackageDirInDocker,
                                                      new Dictionary <string, string>
            {
                [context.RuntimeInfo.WorkingDirectory] = PackageDirInDocker,
                [wrapperDirInLocal] = wrapperDirInDocker,
                [exchangePath] = exchangePathInDocker
            },
                                                      new Dictionary <string, string>
            {
            },
                                                      string.Empty
                                                      ));
        }
コード例 #6
0
        public RedisMessageBus(IServiceProvider serviceProvider, ILogger <RedisMessageBus> logger
                               , RedisMessageBusOptions options
                               , RedisStorage redisStorage)
        {
            _serviceProvider = serviceProvider;
            _logger          = logger;
            _options         = options;
            _redisStorage    = redisStorage;


            _backgroundProcessContext = new BackgroundProcessContext();
            _processExecuter          = new ProcessExecuter(_serviceProvider, _backgroundProcessContext);
        }
コード例 #7
0
        private async Task Decode_Badging()
        {
            ProcessStartInfo psi = new ProcessStartInfo()
            {
                FileName  = pathProvider.GetAAPTPath(),
                Arguments = " d badging \"" + targetFilePath.OriginalString + "\""
            };

            Debug.WriteLine("DefaultAPKDecoder.Decode_Badging(), path=" + targetFilePath.OriginalString);
            string processResult = await ProcessExecuter.ExecuteProcess(psi);

            dataModel.RawDumpBadging = processResult;
            DesktopCMDAAPTUtil.ReadBadging(dataModel, dataModel.RawDumpBadging);
        }
コード例 #8
0
        private static async Task ProcessStdout(string sourceFile, string targetFile)
        {
            var pipe = new Pipe();

            var executer = new ProcessExecuter(sourceFile);

            using (var targetStream = File.Create(targetFile))
            {
                var readerTask = pipe.Reader.CopyToAsync(targetStream);
                var writerTask = executer.ExecuteAsync(string.Empty, s => s.CopyToAsync(pipe.Writer));

                await Task.WhenAll(readerTask, writerTask);
            }
        }
コード例 #9
0
 private void btnPlayVideo_Click(object sender, EventArgs e)
 {
     if (m_Settings != null)
     {
         VideoPlayerSettings processSettings = m_Settings.VideoPlayerSettings;
         processSettings.SetVideoFileName(m_Settings.VideoFileName);
         try
         {
             ProcessExecuter.Execute(processSettings);
         }
         catch (Exception ex)
         {
             string errorMessage = string.Format("Atgadījās kļūda mēģinot atskaņot video: {0}\r\n\r\nAtskaņotājs: {1}\r\nParametri: {2}\r\nVideo fails: {3}",
                                                 ex.Message, processSettings.ProcessName, processSettings.GetParametersString(), m_Settings.VideoFileName);
             MessageBox.Show(errorMessage, "Kļūda", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
コード例 #10
0
        public async Task InstallApk(Uri fileUri)
        {
            ProcessStartInfo psi = new ProcessStartInfo()
            {
                FileName  = pathProvider.GetADBPath(),
                Arguments = " install -r \"" + fileUri.OriginalString + "\""
            };
            string processResult = await ProcessExecuter.ExecuteProcess(psi, true);

            string[] resultArray = processResult?.Split(
                new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

            if (resultArray != null)
            {
                processResult = resultArray[resultArray.Length - 1];
            }

            installFinishedEvent?.Invoke(true, processResult);
        }
コード例 #11
0
ファイル: DesktopJavaUtil.cs プロジェクト: cdytoby/APKViewer
        public static async Task TestJavaExist()
        {
            string processResult = string.Empty;

            if (!javaTested)
            {
                // java -jar apksigner.jar verify --verbose --print-certs FDroid.apk
                // java -version

                ProcessStartInfo psiJavaVersion = new ProcessStartInfo()
                {
                    FileName  = "cmd.exe",
                    Arguments = "/c java -version"
                };
                processResult = await ProcessExecuter.ExecuteProcess(psiJavaVersion, true);

                SetJavaExist(processResult);
            }
        }
コード例 #12
0
        private async Task Decode_Signature()
        {
            await DesktopJavaUtil.TestJavaExist();

            if (!DesktopJavaUtil.javaExist)
            {
                dataModel.Signature = LocalizationCenter.currentDataModel.Msg_JavaNotFound_APKSignFail;
                return;
            }

            ProcessStartInfo psiAPKSigner = new ProcessStartInfo
            {
                FileName  = "java",
                Arguments = "-jar " + pathProvider.GetAPKSignerPath() +
                            " verify --verbose --print-certs" +
                            " \"" + targetFilePath.OriginalString + "\"",
            };
            string processResult = await ProcessExecuter.ExecuteProcess(psiAPKSigner, false, false);

            dataModel.RawDumpSignature = processResult;
            DesktopCMDAPKSignerUtil.ReadAPKSignature(dataModel, processResult);
        }