public virtual void Dispose()
 {
     Params.Dispose();
     Stdin.Dispose();
     Stdout.Dispose();
     Stderr.Dispose();
 }
Beispiel #2
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)
                if (StartTime != null)
                {
                    hashCode = hashCode * 59 + StartTime.GetHashCode();
                }

                if (EndTime != null)
                {
                    hashCode = hashCode * 59 + EndTime.GetHashCode();
                }

                if (Stdout != null)
                {
                    hashCode = hashCode * 59 + Stdout.GetHashCode();
                }

                if (Stderr != null)
                {
                    hashCode = hashCode * 59 + Stderr.GetHashCode();
                }

                if (ExitCode != null)
                {
                    hashCode = hashCode * 59 + ExitCode.GetHashCode();
                }

                return(hashCode);
            }
        }
Beispiel #3
0
        public void Dispose()
        {
            Stdin.Dispose();
            Stdout.Dispose();
            Stderr.Dispose();

            CloseCore();
        }
Beispiel #4
0
 public virtual void Dispose()
 {
     Params.Dispose();
     Stdin.Dispose();
     Stdout.Dispose();
     Stderr.Dispose();
     RecordFactory.Dispose();
 }
        private void SendEmptyResponsePage()
        {
            var emptyResponsePage = new Fos.CustomPages.EmptyResponsePage();

            OwinContext.SetResponseHeader("Content-Type", "text/html");
            OwinContext.ResponseStatusCodeAndReason = "500 Internal Server Error";

            using (var sw = new StreamWriter(Stdout))
            {
                sw.Write(emptyResponsePage.Contents);
            }

            Stdout.Flush();
        }
        private void SendErrorPage(Exception applicationEx)
        {
            var errorPage = new Fos.CustomPages.ApplicationErrorPage(applicationEx);

            OwinContext.SetResponseHeader("Content-Type", "text/html");
            OwinContext.ResponseStatusCodeAndReason = "500 Internal Server Error";

            using (var sw = new StreamWriter(Stdout))
            {
                sw.Write(errorPage.Contents);
            }

            Stdout.Flush();
        }
Beispiel #7
0
        /// <summary>
        /// Returns true if TesExecutor instances are equal
        /// </summary>
        /// <param name="other">Instance of TesExecutor to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(TesExecutor other)
        {
            if (other is null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Image == other.Image ||
                     Image != null &&
                     Image.Equals(other.Image)
                     ) &&
                 (
                     Command == other.Command ||
                     Command != null &&
                     Command.SequenceEqual(other.Command)
                 ) &&
                 (
                     Workdir == other.Workdir ||
                     Workdir != null &&
                     Workdir.Equals(other.Workdir)
                 ) &&
                 (
                     Stdin == other.Stdin ||
                     Stdin != null &&
                     Stdin.Equals(other.Stdin)
                 ) &&
                 (
                     Stdout == other.Stdout ||
                     Stdout != null &&
                     Stdout.Equals(other.Stdout)
                 ) &&
                 (
                     Stderr == other.Stderr ||
                     Stderr != null &&
                     Stderr.Equals(other.Stderr)
                 ) &&
                 (
                     Env == other.Env ||
                     Env != null &&
                     Env.SequenceEqual(other.Env)
                 ));
        }
Beispiel #8
0
        /// <summary>
        /// After writing to the output Streams, you have to end the request with a Status Code and a protocol status.
        /// Use this method to do that before disposing this object.
        /// </summary>
        /// <param name="appStatus">The Application status. Use 0 for success and anything else for error.</param>
        public void SendEndRequest(int appStatus, ProtocolStatus protocolStatus)
        {
            // Flush stuff before doing this!
            Data.Dispose();
            Params.Dispose();
            Stdin.Dispose();
            Stdout.Dispose();
            Stderr.Dispose();

            var rec = new EndRequestRecord(RequestId);

            rec.AppStatus      = appStatus;
            rec.ProtocolStatus = protocolStatus;

            Send(rec);
        }
        /// <summary>
        /// This method is called internally when data is received and fed to this Request. It basically sets this request's properties
        /// or appends data to the streams. Override it and call the base method itself to implement your own logics and checking.
        /// </summary>
        protected virtual void AddReceivedRecord(RecordBase rec)
        {
            if (rec == null)
            {
                throw new ArgumentNullException("rec");
            }

            switch (rec.RecordType)
            {
            case RecordType.FCGIBeginRequest:
                // Make sure we are not getting a BeginRequest once again, as this could be serious.
                if (BeginRequestReceived)
                {
                    throw new InvalidOperationException("A BeginRequest Record has already been received by this Request");
                }

                BeginRequestReceived = true;
                RequestId            = ((BeginRequestRecord)rec).RequestId;
                break;

            case RecordType.FCGIEndRequest:
                // Make sure we are not getting a BeginRequest once again, as this could be serious.
                if (EndRequestReceived)
                {
                    throw new InvalidOperationException("An EndRequest Record has already been received by this Request");
                }

                EndRequestReceived = true;
                break;

            case RecordType.FCGIParams:
                Params.AppendStream(((StreamRecordBase)rec).Contents);
                break;

            case RecordType.FCGIStdin:
                Stdin.AppendStream(((StreamRecordBase)rec).Contents);
                break;

            case RecordType.FCGIStdout:
                Stdout.AppendStream(((StreamRecordBase)rec).Contents);
                break;

            case RecordType.FCGIStderr:
                Stderr.AppendStream(((StreamRecordBase)rec).Contents);
                break;
            }
        }
Beispiel #10
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)
                if (Image != null)
                {
                    hashCode = hashCode * 59 + Image.GetHashCode();
                }

                if (Command != null)
                {
                    hashCode = hashCode * 59 + Command.GetHashCode();
                }

                if (Workdir != null)
                {
                    hashCode = hashCode * 59 + Workdir.GetHashCode();
                }

                if (Stdin != null)
                {
                    hashCode = hashCode * 59 + Stdin.GetHashCode();
                }

                if (Stdout != null)
                {
                    hashCode = hashCode * 59 + Stdout.GetHashCode();
                }

                if (Stderr != null)
                {
                    hashCode = hashCode * 59 + Stderr.GetHashCode();
                }

                if (Env != null)
                {
                    hashCode = hashCode * 59 + Env.GetHashCode();
                }

                return(hashCode);
            }
        }
Beispiel #11
0
        static void Main(string[] args)
        {
            List <string> excludeRegexList = new List <string>();

            if (args.Length == 0)
            {
                Usage();
                return;
            }
            if (args.Length >= 2)
            {
                for (int i = 1; i < args.Length; i++)
                {
                    excludeRegexList.Add(args[i]);
                }
            }

            ITranspiler transpiler = new Stdout();

            Executor.Execute(args[0], transpiler, excludeRegexList);
        }
Beispiel #12
0
        public async void ProcessStockAndOptionQuote()
        {
            var controller = new IBController();

            Assert.True(controller.Connect(), "Connection setup failed!");

            var taskHandler = new IBDTaskHandler(controller);

            //try getting data for a VIX option contract
            taskHandler.AddTask(new IBDTaskInstruction("DownloadStockAndOptionHistoricalData")
            {
                ConId = 308395806
            });

            var storage = new Stdout(new DataStorage.Processors.StockOptionQuoteProcessor());

            taskHandler.OnTaskResult += storage.ProcessTaskResult;

            await taskHandler.BeginAsync();

            await storage.FlushAsync();
        }
Beispiel #13
0
        /// <summary>
        /// Returns true if TesExecutorLog instances are equal
        /// </summary>
        /// <param name="other">Instance of TesExecutorLog to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(TesExecutorLog other)
        {
            if (other is null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     StartTime == other.StartTime ||
                     StartTime != null &&
                     StartTime.Equals(other.StartTime)
                     ) &&
                 (
                     EndTime == other.EndTime ||
                     EndTime != null &&
                     EndTime.Equals(other.EndTime)
                 ) &&
                 (
                     Stdout == other.Stdout ||
                     Stdout != null &&
                     Stdout.Equals(other.Stdout)
                 ) &&
                 (
                     Stderr == other.Stderr ||
                     Stderr != null &&
                     Stderr.Equals(other.Stderr)
                 ) &&
                 (
                     ExitCode == other.ExitCode ||
                     ExitCode != null &&
                     ExitCode.Equals(other.ExitCode)
                 ));
        }
Beispiel #14
0
 public void CloseStreams()
 {
     Stdin.Close();
     Stdout.Close();
     Stderr.Close();
 }
Beispiel #15
0
 public void Dispose()
 {
     Stdout?.Dispose();
     Stderr?.Dispose();
 }