protected override bool _Run()
        {
            try
            {
                switch (TargetContainer)
                {
                case ContainerType.InstructionSetContainer:
                    InstructionSet.InstructionSetContainer[ContainerDataKey] = ContainerData;
                    break;

                case ContainerType.Session:
                    STEM.Sys.State.Containers.Session[ContainerDataKey] = ContainerData;
                    break;

                case ContainerType.Cache:
                    STEM.Sys.State.Containers.Cache[ContainerDataKey] = ContainerData;
                    break;
                }
            }
            catch (Exception ex)
            {
                AppendToMessage(ex.Message);
                Exceptions.Add(ex);
            }

            return(Exceptions.Count == 0);
        }
Example #2
0
        /// <summary>
        /// Configure event handler when command executed or exception happens
        /// </summary>
        private static void ConfigureCommandAndCommandExceptionHandler()
        {
            EventRouter.Instance.GetEventChannel <EventPattern <EventCommandEventArgs> >()
            .ObserveOnDispatcher()
            .Subscribe(
                e =>
            {
                //Command Fired Messages
            }
                );

            EventRouter.Instance.GetEventChannel <Exception>()
            .ObserveOnDispatcher()
            .Subscribe(
                e =>
            {
                //Exceptions Messages
                if (Exceptions.Count >= 20)
                {
                    Exceptions.RemoveAt(0);
                }
                Exceptions.Add(Tuple.Create(DateTime.Now, e.EventData));
                Debug.WriteLine(e.EventData);
            }
                );
        }
Example #3
0
        public async Task <byte[]> GetEncryptFile(string name, string type)
        {
            string url = HttpService.Url;

            try
            {
                var result = await HttpService.Instance.GetAsync(url + "File/GetEncryptFile/" + name);


                if (result.IsSuccessStatusCode)
                {
                    return(await result.Content.ReadAsByteArrayAsync());
                }
                else
                {
                    Exceptions.Add(new Exception(await result.Content.ReadAsStringAsync()));
                    return(null);
                }
            }
            catch (Exception ex)
            {
                Exceptions.Add(ex);
                return(null);
            }
        }
Example #4
0
        protected override void _Rollback()
        {
            try
            {
                foreach (string file in _Files)
                {
                    try
                    {
                        if (File.Exists(file))
                        {
                            File.Delete(file);
                        }
                    }
                    catch (Exception ex)
                    {
                        AppendToMessage(ex.ToString());
                        Exceptions.Add(ex);
                    }
                }

                foreach (string dir in _Directories)
                {
                    try
                    {
                        Directory.Delete(dir, true);
                    }
                    catch { }
                }
            }
            catch (Exception ex)
            {
                AppendToMessage(ex.ToString());
                Exceptions.Add(ex);
            }
        }
        public async Task <bool> ChangeEmail(string email)
        {
            string url = HttpService.Url;

            try
            {
                var model = new EmailViewModel()
                {
                    Username         = "",
                    Email            = email,
                    IsEmailConfirmed = true,
                    StatusMessage    = ""
                };

                string      json    = JsonConvert.SerializeObject(model);
                HttpContent content = new StringContent(json, Encoding.UTF8, "application/json");
                var         result  = await HttpService.Instance.PostAsync(url + "Manage/ChangeEmail", content);

                if (result.IsSuccessStatusCode)
                {
                    return(true);
                }

                Exceptions.Add(new Exception(await result.Content.ReadAsStringAsync()));
                return(false);
            }
            catch (Exception ex)
            {
                Exceptions.Add(ex);
                return(false);
            }
        }
Example #6
0
        /// <summary>
        /// Clears Exceptions and all HashSets.
        /// </summary>
        public void Clear()
        {
            try
            {
                Exceptions.Clear();

                if (AlteredServer != null)
                {
                    Server.Clear(AlteredServer);
                }

                if (CreatedServer != null)
                {
                    Server.Clear(CreatedServer);
                }

                if (DroppedServer != null)
                {
                    Server.Clear(DroppedServer);
                }

                if (MatchedServer != null)
                {
                    Server.Clear(MatchedServer);
                }
            }
            catch (Exception ex)
            {
                Exceptions.Add(ex);
            }
        }
        public async Task <bool> Create(string name, string address, string login, string password)
        {
            string url = HttpService.Url;

            try
            {
                var model = new AccountModel()
                {
                    Name     = name,
                    Url      = address,
                    Login    = login,
                    Password = password
                };
                string      json    = JsonConvert.SerializeObject(model);
                HttpContent content = new StringContent(json, Encoding.UTF8, "application/json");
                var         result  = await HttpService.Instance.PostAsync(url + "Account/Create", content);

                if (result.IsSuccessStatusCode)
                {
                    return(true);
                }

                Exceptions.Add(new Exception(result.Content.ReadAsStringAsync().Result));
                return(false);
            }
            catch (Exception ex)
            {
                Exceptions.Add(ex);
                return(false);
            }
        }
Example #8
0
        internal void Process(CombinedWorkerThreadResult wtResult)
        {
            Seconds = wtResult.Seconds;
            var items = wtResult.Seconds.Select(r => r.Value).DefaultIfEmpty(new Second(0)).ToList();

            Count             = items.Sum(s => s.Count);
            RequestsPerSecond = Count / (Elapsed.TotalMilliseconds / 1000);

            foreach (var exception in items.SelectMany(s => s.Exceptions))
            {
                if (Exceptions.ContainsKey(exception.Key))
                {
                    Exceptions[exception.Key] += exception.Value;
                }
                else
                {
                    Exceptions.Add(exception.Key, exception.Value);
                }
            }

            Errors = Exceptions.Sum(e => e.Value);

            var responseTimes = GetResponseTimes(wtResult.ResponseTimes);

            if (!responseTimes.Any())
            {
                return;
            }

            Median    = responseTimes.GetMedian();
            StdDev    = responseTimes.GetStdDev();
            Min       = responseTimes.First();
            Max       = responseTimes.Last();
            Histogram = GenerateHistogram(responseTimes);
        }
Example #9
0
        protected override bool _Run()
        {
            foreach (string ip in STEM.Sys.IO.Path.ExpandRangedIP(MachineIP))
            {
                foreach (Process p in Process.GetProcessesByName(ProcessName, ip))
                {
                    int retry = 0;
                    while (retry++ <= Retry && !Stop)
                    {
                        try
                        {
                            p.Kill();
                            Message += ProcessName + " on " + ip + " killed.\r\n";
                            break;
                        }
                        catch (Exception ex)
                        {
                            if (retry >= Retry)
                            {
                                Exceptions.Add(ex);
                                Message += ex.Message + "\r\n";
                                break;
                            }
                            else
                            {
                                Thread.Sleep(TimeSpan.FromSeconds(RetryDelaySeconds));
                            }
                        }
                    }
                }
            }

            return(Exceptions.Count == 0);
        }
Example #10
0
        protected override bool _Run()
        {
            List <Exception> exceptions = null;

            try
            {
                if (InstructionSet.InstructionSetContainer.ContainsKey(EventName))
                {
                    Guid eventID = (Guid)InstructionSet.InstructionSetContainer[EventName];

                    if (!ILogger.GetLogger(LoggerName).LogEventMetadata(eventID, Metadata, out exceptions))
                    {
                        throw new Exception("Failed to record event metadata.");
                    }
                }
                else
                {
                    throw new Exception("The eventID wasn't present in the InstructionSetContainer.");
                }
            }
            catch (Exception ex)
            {
                Exceptions.Add(ex);

                if (exceptions != null)
                {
                    Exceptions.AddRange(exceptions);
                }
            }

            return(Exceptions.Count == 0);
        }
        /// <summary>
        /// Renders score on canvas.
        /// </summary>
        /// <param name="score">Score</param>
        public override sealed void Render(Score score)
        {
            CurrentScore = score;
            scoreService.BeginNewScore(score);
            foreach (Staff staff in score.Staves)
            {
                try
                {
                    RenderStaff(staff);
                }
                catch (Exception ex)
                {
                    Exceptions.Add(ex);
                }
            }

            //Set height of current system in Panorama mode. This is used for determining the size of the control:
            if (Settings.RenderingMode == ScoreRenderingModes.Panorama && scoreService.CurrentSystem != null && scoreService.CurrentSystem.Height == 0)
            {
                scoreService.CurrentSystem.Height = (scoreService.CurrentStaffHeight + Settings.LineSpacing) * scoreService.CurrentScore.Staves.Count;
            }

            foreach (var finishingTouch in FinishingTouches)
            {
                finishingTouch.PerformOnScore(score, this);
            }
        }
Example #12
0
        /// <summary>
        /// Records exception with stacktrace and custom info
        /// </summary>
        /// <param name="error">exception title</param>
        /// <param name="stackTrace">exception stacktrace</param>
        /// <param name="customInfo">exception custom info</param>
        /// <param name="unhandled">bool indicates is exception is fatal or not</param>
        /// <returns>True if exception successfully uploaded, False - queued for delayed upload</returns>
        public static async Task <bool> RecordException(string error, string stackTrace, Dictionary <string, string> customInfo, bool unhandled)
        {
            if (String.IsNullOrWhiteSpace(ServerUrl))
            {
                return(false);
            }
            TimeSpan run = (startTime != DateTime.MinValue) ? DateTime.Now.Subtract(startTime) : TimeSpan.FromSeconds(0);

            ExceptionEvent eEvent = new ExceptionEvent(error, stackTrace ?? string.Empty, unhandled, breadcrumb, run, customInfo);

            if (!unhandled)
            {
                lock (sync)
                {
                    Exceptions.Add(eEvent);
                }

                SaveExceptions();

                return(await Upload());
            }
            else
            {
                SaveUnhandledException(eEvent);
                return(false);
            }
        }
        protected override void _Rollback()
        {
            if (ExecutionMode == ExecuteOn.Rollback)
            {
                try
                {
                    if (ExceptionFilter.Count == 0)
                    {
                        return;
                    }

                    foreach (string exception in ExceptionFilter)
                    {
                        if (!Exceptions.Exists(i => i.ToString().ToUpper().Contains(exception.ToUpper())))
                        {
                            SkipPrevious();
                            return;
                        }
                    }
                }
                catch (Exception ex)
                {
                    AppendToMessage(ex.Message);
                    Exceptions.Add(ex);
                }
            }
        }
        protected override bool _Run()
        {
            if (ExecutionMode == ExecuteOn.ForwardExecution)
            {
                try
                {
                    if (ExceptionFilter.Count == 0)
                    {
                        return(true);
                    }

                    foreach (string exception in ExceptionFilter)
                    {
                        if (!Exceptions.Exists(i => i.ToString().ToUpper().Contains(exception.ToUpper())))
                        {
                            SkipNext();
                            return(true);
                        }
                    }
                }
                catch (Exception ex)
                {
                    AppendToMessage(ex.Message);
                    Exceptions.Add(ex);
                }

                return(Exceptions.Count == 0);
            }

            return(true);
        }
Example #15
0
        public ASMethodBody(ABCFile abc, FlashReader reader)
            : this(abc)
        {
            MethodIndex       = reader.Read7BitEncodedInt();
            MaxStack          = reader.Read7BitEncodedInt();
            LocalCount        = reader.Read7BitEncodedInt();
            InitialScopeDepth = reader.Read7BitEncodedInt();
            MaxScopeDepth     = reader.Read7BitEncodedInt();

            int bytecodeLength = reader.Read7BitEncodedInt();
            Bytecode = reader.ReadBytes(bytecodeLength);

            Exceptions.Capacity = reader.Read7BitEncodedInt();
            for (int i = 0; i < Exceptions.Capacity; i++)
            {
                Exceptions.Add(new ASException(abc, reader));
            }

            Traits.Capacity = reader.Read7BitEncodedInt();
            for (int i = 0; i < Traits.Capacity; i++)
            {
                Traits.Add(new ASTrait(abc, reader));
            }

            Method.Body = this;
        }
        bool Execute()
        {
            SourcePath = STEM.Sys.IO.Path.AdjustPath(SourcePath);
            try
            {
                foreach (string dir in STEM.Sys.IO.Directory.STEM_GetDirectories(SourcePath, DirectoryFilter, RecurseSource ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly, ExpandSource))
                {
                    try
                    {
                        if (!DeleteEmptyDirectoriesOnly || Directory.GetFiles(dir, "*", SearchOption.AllDirectories).Length == 0)
                        {
                            STEM.Sys.IO.Directory.STEM_Delete(dir, false);
                            AppendToMessage(dir + " deleted");
                        }
                    }
                    catch (Exception ex)
                    {
                        AppendToMessage(ex.ToString());
                        Exceptions.Add(ex);
                    }
                }
            }
            catch (Exception ex)
            {
                AppendToMessage(ex.ToString());
                Exceptions.Add(ex);
            }

            return(Exceptions.Count == 0);
        }
Example #17
0
        protected override bool _Run()
        {
            try
            {
                string address = Authentication.NextAddress(ServerAddress);

                if (address == null)
                {
                    Exception ex = new Exception("No valid address. (" + ServerAddress + ")");
                    Exceptions.Add(ex);
                    AppendToMessage(ex.Message);
                    return(false);
                }

                Surge.FailureAction tgtAction = DirectoryNotExistsAction;

                FtpClient conn = Authentication.OpenClient(address, Int32.Parse(Port));

                try
                {
                    if (conn.DirectoryExists(Authentication.AdjustPath(address, DirectoryName)))
                    {
                        tgtAction = DirectoryExistsAction;
                    }

                    switch (tgtAction)
                    {
                    case Surge.FailureAction.SkipRemaining:

                        SkipRemaining();
                        break;

                    case Surge.FailureAction.Rollback:

                        RollbackAllPreceedingAndSkipRemaining();
                        break;

                    case Surge.FailureAction.Continue:

                        break;

                    case Surge.FailureAction.SkipToLabel:

                        SkipForwardToFlowControlLabel(TargetLabel);
                        break;
                    }
                }
                finally
                {
                    Authentication.RecycleClient(conn);
                }
            }
            catch (Exception ex)
            {
                AppendToMessage(ex.Message);
                Exceptions.Add(ex);
            }

            return(Exceptions.Count == 0);
        }
Example #18
0
        /// <summary>
        /// Called from within Instructions executing _Run, this affects a rollback of prceeding Instructions executed and a
        /// skip of all remaining Instructions within this InstructionSet without calling _Rollback on this Instruction
        /// </summary>
        protected void RollbackAllPreceedingAndSkipRemaining()
        {
            try
            {
                if (InstructionSet != null)
                {
                    for (int i = OrdinalPosition - 1; i >= 0; i--)
                    {
                        try
                        {
                            InstructionSet.Instructions[i].Rollback();
                        }
                        catch (Exception ex)
                        {
                            Exceptions.Add(ex);
                        }
                    }

                    for (int i = OrdinalPosition + 1; i < InstructionSet.Instructions.Count; i++)
                    {
                        if (InstructionSet.Instructions[i].Stage == Stage.Ready)
                        {
                            InstructionSet.Instructions[i].Stage = Stage.Skip;
                            InstructionSet.Instructions[i].ExecutionStageHistory.Add(Stage.Skip);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Exceptions.Add(ex);
            }
        }
        protected override bool _Run()
        {
            List <Exception> exceptions = null;

            try
            {
                Guid objectID = Guid.Parse(ObjectID);

                InstructionSet.InstructionSetContainer["ObjectID"] = objectID;

                if (!ILogger.GetLogger(LoggerName).SetObjectInfo(objectID, ObjectName, DateTime.Parse(CreationTime), out exceptions))
                {
                    throw new Exception("Failed to record object info.");
                }
            }
            catch (Exception ex)
            {
                Exceptions.Add(ex);

                if (exceptions != null)
                {
                    Exceptions.AddRange(exceptions);
                }
            }

            return(Exceptions.Count == 0);
        }
Example #20
0
        protected override bool _Run()
        {
            try
            {
                DataSet ds = Execute(Authentication, String.Join("\r\n", Sql), Retry);

                switch (TargetContainer)
                {
                case ContainerType.InstructionSetContainer:

                    InstructionSet.InstructionSetContainer[ContainerDataKey] = ds;

                    break;

                case ContainerType.Session:

                    STEM.Sys.State.Containers.Session[ContainerDataKey] = ds;

                    break;

                case ContainerType.Cache:

                    STEM.Sys.State.Containers.Cache[ContainerDataKey] = ds;

                    break;
                }

                return(true);
            }
            catch (Exception ex)
            {
                Exceptions.Add(ex);
                return(false);
            }
        }
Example #21
0
        /// <summary>
        /// Records exception with stacktrace and custom info
        /// </summary>
        /// <param name="error">exception title</param>
        /// <param name="stackTrace">exception stacktrace</param>
        /// <param name="customInfo">exception custom info</param>
        /// <param name="unhandled">bool indicates is exception is fatal or not</param>
        /// <returns>True if exception successfully uploaded, False - queued for delayed upload</returns>
        public static async Task <bool> RecordException(string error, string stackTrace, Dictionary <string, string> customInfo, bool unhandled)
        {
            if (String.IsNullOrWhiteSpace(ServerUrl))
            {
                return(false);
            }

            TimeSpan run = DateTime.Now.Subtract(startTime);

            lock (sync)
            {
                Exceptions.Add(new ExceptionEvent(error, stackTrace ?? string.Empty, unhandled, breadcrumb, run, customInfo));

                SaveExceptions();
            }

            if (!unhandled)
            {
                return(await Upload());
            }
            else
            {
                return(false);
            }
        }
Example #22
0
        private void StreamReaderThreadFunc()
        {
            if (!Process.StartInfo.RedirectStandardOutput)
            {
                return;
            }
            var streamReader = Process.StandardOutput;

            if (streamReader == null)
            {
                return;
            }
            try
            {
                while (!streamReader.EndOfStream)
                {
                    string s = streamReader.ReadLine();
                    if (s == null)
                    {
                        return;
                    }
                    lock (OutputText)
                    {
                        OutputText.Add(s);
                    }
                }
            }
            catch (Exception ex)
            {
                lock (Exceptions)
                {
                    Exceptions.Add(ex);
                }
            }
        }
Example #23
0
        public void AddMerged(Second second)
        {
            Count += second.Count;
            Bytes += second.Bytes;

            foreach (var statusCode in second.StatusCodes)
            {
                if (StatusCodes.ContainsKey(statusCode.Key))
                {
                    StatusCodes[statusCode.Key] += statusCode.Value;
                }
                else
                {
                    StatusCodes.Add(statusCode.Key, statusCode.Value);
                }
            }

            foreach (var exception in second.Exceptions)
            {
                if (Exceptions.ContainsKey(exception.Key))
                {
                    Exceptions[exception.Key] += exception.Value;
                }
                else
                {
                    Exceptions.Add(exception.Key, exception.Value);
                }
            }
        }
Example #24
0
 private void InvokeFunc()
 {
     try
     {
         Process = new Process();
         Process.StartInfo.UseShellExecute        = false;
         Process.StartInfo.FileName               = ExePath;
         Process.StartInfo.WorkingDirectory       = Environment.CurrentDirectory;
         Process.StartInfo.Arguments              = GetCombinedArgumentString();
         Process.StartInfo.RedirectStandardInput  = true;
         Process.StartInfo.RedirectStandardOutput = true;
         Process.StartInfo.WindowStyle            = ProcessWindowStyle.Normal;
         StreamReaderThread = new Thread(new ThreadStart(StreamReaderThreadFunc));
         StreamWriterThread = new Thread(new ThreadStart(StreamWriterThreadFunc));
         Process.Start();
         StreamReaderThread.Start();
         StreamWriterThread.Start();
         Process.WaitForExit();
         StreamReaderThread.Join();
         StreamWriterThread.Join();
     }
     catch (Exception ex)
     {
         lock (Exceptions)
         {
             Exceptions.Add(ex);
         }
     }
 }
        public async Task <bool> ChangePassword(string oldPass, string newPass, string confirmPass)
        {
            string url = HttpService.Url;

            try
            {
                var model = new ChangePasswordViewModel()
                {
                    OldPassword     = oldPass,
                    NewPassword     = newPass,
                    ConfirmPassword = confirmPass
                };

                string      json    = JsonConvert.SerializeObject(model);
                HttpContent content = new StringContent(json, Encoding.UTF8, "application/json");
                var         result  = await HttpService.Instance.PostAsync(url + "Manage/ChangePassword", content);

                if (result.IsSuccessStatusCode)
                {
                    return(true);
                }

                Exceptions.Add(new Exception(await result.Content.ReadAsStringAsync()));
                return(false);
            }
            catch (Exception ex)
            {
                Exceptions.Add(ex);
                return(false);
            }
        }
Example #26
0
        protected override void _Rollback()
        {
            int r = Retry;

            while (r-- >= 0 && !Stop)
            {
                if (_SavedFile != null)
                {
                    try
                    {
                        PostMortemMetaData["LastOperation"] = "DeleteFile";
                        Authentication.DeleteFile(_Address, Int32.Parse(Port), _SavedFile);
                        break;
                    }
                    catch (Exception ex)
                    {
                        if (r < 0)
                        {
                            AppendToMessage(ex.Message);
                            Exceptions.Add(ex);
                        }
                        else
                        {
                            System.Threading.Thread.Sleep(RetryDelaySeconds * 1000);
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Initializing Countly SDK. Must be called before any other calls
        /// </summary>
        /// <param name="config">Provide your configuration with this</param>
        /// <returns></returns>
        public override async Task Init(CountlyConfig config)
        {
            if (IsInitialized())
            {
                return;
            }

            if (config == null)
            {
                throw new InvalidOperationException("Configuration object can not be null while initializing Countly");
            }

            if (config.application != null)
            {
                //add unhandled exception handler
                IsExceptionsLoggingEnabled = true;

                config.application.UnhandledException -= OnApplicationUnhandledException;
                config.application.UnhandledException += OnApplicationUnhandledException;
            }

            await InitBase(config);

            String         unhandledExceptionValue = Storage.Instance.GetValue <string>(unhandledExceptionFilename, "");
            ExceptionEvent unhandledException      = JsonConvert.DeserializeObject <ExceptionEvent>(unhandledExceptionValue);

            if (unhandledException != null)
            {
                //add the saved unhandled exception to the other ones
                UtilityHelper.CountlyLogging("Found a stored unhandled exception, adding it the the other stored exceptions");
                Exceptions.Add(unhandledException);
                SaveExceptions();
                SaveUnhandledException(null);
            }
        }
Example #28
0
        protected override bool _Run()
        {
            if (ExecutionMode == ExecuteOn.ForwardExecution)
            {
                int r = Retry;
                while (r-- >= 0 && !Stop)
                {
                    _Address = Authentication.NextAddress(ServerAddress);

                    if (_Address == null)
                    {
                        Exception ex = new Exception("No valid address. (" + ServerAddress + ")");
                        Exceptions.Add(ex);
                        AppendToMessage(ex.Message);
                        return(false);
                    }

                    Exceptions.Clear();
                    Message = "";
                    bool success = Execute();
                    if (success)
                    {
                        return(true);
                    }

                    System.Threading.Thread.Sleep(RetryDelaySeconds * 1000);
                }

                return(false);
            }

            return(true);
        }
Example #29
0
        /// <summary>
        /// Records exception with stacktrace and custom info
        /// </summary>
        /// <param name="error">exception title</param>
        /// <param name="stackTrace">exception stacktrace</param>
        /// <param name="customInfo">exception custom info</param>
        /// <param name="unhandled">bool indicates is exception is fatal or not</param>
        /// <returns>True if exception successfully uploaded, False - queued for delayed upload</returns>
        private static async Task <bool> RecordException(string error, string stackTrace, Dictionary <string, string> customInfo, bool unhandled)
        {
            if (String.IsNullOrWhiteSpace(ServerUrl))
            {
                throw new InvalidOperationException("session is not active");
            }

            TimeSpan run = DateTime.Now.Subtract(startTime);

            lock (sync)
            {
                Exceptions.Add(new ExceptionEvent(error, stackTrace, unhandled, breadcrumb, run, customInfo));
            }

            SaveExceptions();

            if (!unhandled)
            {
                return(await Upload());
            }
            else
            {
                return(true);
            }
        }
Example #30
0
        /// <summary>
        /// @"Token\Pair\BID\OFFER\HIGH\LOW\STATUS\NOTATION\DECIMALS\CLOSINGBID", @"\");
        /// </summary>
        /// <param name="data"></param>
        /// <param name="dateTimeFormat"></param>
        /// <returns></returns>
        public Rate ToRateOnConnect(string data, ref TickTime origin)
        {
            if (System.String.IsNullOrEmpty(data) || data.Length < 10)
            {
                return(null);
            }

            //Ignore token, might be corrupted
            string[] properties = Asmodat.Abbreviate.String.ToList(data, "\\");
            if (properties.Length != 10)
            {
                return(null);
            }


            string status   = properties[6];
            string notation = properties[7];

            if (status != "D" && status != "R")
            {
                return(null);
            }

            if (notation != "E" && notation != "A")
            {
                return(null);
            }

            Rate rate = new Rate();

            try
            {
                rate.Pair       = properties[1];
                rate.DECIMALS   = ForexConfiguration.GetDecimals(rate.Pair);
                rate.BID        = Doubles.Parse(properties[2], rate.DECIMALS);
                rate.OFFER      = Doubles.Parse(properties[3], rate.DECIMALS);
                rate.HIGH       = Doubles.Parse(properties[4], rate.DECIMALS);
                rate.LOW        = Doubles.Parse(properties[5], rate.DECIMALS);
                rate.STATUS     = status;
                rate.NOTATION   = notation;
                rate.CLOSINGBID = Doubles.Parse(properties[8], rate.DECIMALS);

                rate.ChartData.TickTime = (origin += 1);


                //backtest
                double pchange = RateInfo.ChangePercentage(rate.BID, rate.OFFER, rate.HIGH, rate.LOW);
                if (pchange < 25)
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                Exceptions.Add(e);
                return(null);
            }

            return(rate);
        }