public static void Run() { // ExStart:1 WordsApi wordsApi = new WordsApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH); string fileName = "SampleWordDocument.docx"; int index = 1; int runIndex = 0; string storage = null; string folder = null; try { // Upload the file storageApi.PutCreate(fileName, "", storage, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName)); // Invoke Aspose.Words Cloud SDK API to get specific run of paragraph RunResponse apiResponse = wordsApi.GetDocumentParagraphRun(fileName, index, runIndex, storage, folder); if (apiResponse != null && apiResponse.Status.Equals("OK")) { Run docParagraphRun = apiResponse.Run; Console.WriteLine("NoteId : " + docParagraphRun.NodeId); Console.WriteLine("Link : " + docParagraphRun.link.Href); Console.ReadKey(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace); } // ExEnd:1 }
public SbError Run(SbPlatformShellCommand command) { var grpcSbPlatformShellCommand = new GrpcSbPlatformShellCommand { Command = command.GetCommand() }; var request = new RunRequest { ShellCommand = grpcSbPlatformShellCommand }; RunResponse response = null; if (connection.InvokeRpc(() => { response = client.Run(request); })) { command.SetOutput(response.Output); command.SetSignal(response.Signal); command.SetStatus(response.Status); return(sbErrorFactory.Create(response.Error)); } var grpcSbError = new GrpcSbError { Success = false, Error = "Rpc error while calling Run. Inspect the logs for more information." }; return(sbErrorFactory.Create(grpcSbError)); }
public RunResponse GetRunResponse(Response response) { RunResponse res = new RunResponse(); res.Initialize(response); return(res); }
public void Run() { object input = (RunMode == RunModes.Solution) ? SolutionInput : TestInput; object response = Run(RunMode, input, Logging); object solution = (RunMode == RunModes.Solution) ? SolutionResponse : TestResponse; RunResponse = new RunResponse(input, response, solution); //Console.WriteLine(String.Format("{0}", response)); //return new RunResponse(input, response, solution); }
// Run the specified command. public override Task <RunResponse> Run(RunRequest request, ServerCallContext context) { PreconditionCheck(); var shellCommand = sbPlatformShellCommandFactory.Create(request.ShellCommand.Command); var error = sbPlatform.Run(shellCommand); var grpcError = new GrpcSbError { Success = error.Success(), Error = error.GetCString() }; var response = new RunResponse { Error = grpcError, Output = shellCommand.GetOutput(), Signal = shellCommand.GetSignal(), Status = shellCommand.GetStatus() }; return(Task.FromResult(response)); }
public IResponse Process(RunRequest input) { var evaluator = Resolve(CSScript.Evaluator, "System", "System.Core", "System.IO", "System.Linq", "System.Data.ComponentModel", "System.Data.DataSetExtensions", "System.Xml", "System.Xml.Linq"); var code = input.Code?.Trim(); var args = new object[0]; var start = DateTime.Now; object res; switch (input.Kind) { case ScriptKind.Class: var obj = evaluator.LoadCodeRemotely <IRunnable>(code); res = obj.Run(args); break; case ScriptKind.Method: var meth = evaluator.LoadMethodRemotely <IRunnable>(code); res = meth.Run(args); break; case ScriptKind.Expression: default: var txt = string.Format("object Run(params object[] args) => {0};", code); var dlgt = evaluator.CreateDelegateRemotely <object>(txt); res = dlgt(new[] { args }); break; } var rsp = new RunResponse { Duration = DateTime.Now - start, Result = res }; res.UnloadOwnerDomain(); return(rsp); }
/// <summary> /// Initializes a new instance of the <see cref="InsertRunOnlineResponse"/> class. /// </summary> /// <param name="model">The response model.</param> /// <param name="document">The document after modification.</param> public InsertRunOnlineResponse(RunResponse model, System.IO.Stream document) { this.Model = model; this.Document = document; }