Forex_Strategy_Builder.Data_Parser.Parse C# (CSharp) Method

Parse() public method

Parses the input string
public Parse ( ) : int
return int
        public int Parse()
        {
            int respond = 0;

            try
            {
                respond = AnaliseInput();
            }
            catch (Exception e)
            {
                respond = -1;
                System.Windows.Forms.MessageBox.Show(
                    ParsingErrorMessage + Environment.NewLine + e.Message,
                    Language.T("Data File Loading"),
                    System.Windows.Forms.MessageBoxButtons.OK,
                    System.Windows.Forms.MessageBoxIcon.Error);
            }

            if (respond != 0)
            {
                System.Windows.Forms.MessageBox.Show(
                    ParsingErrorMessage,
                    Language.T("Data File Loading"),
                    System.Windows.Forms.MessageBoxButtons.OK,
                    System.Windows.Forms.MessageBoxIcon.Exclamation);
                return respond;
            }

            try
            {
                respond = ParseInput();
            }
            catch (Exception e)
            {
                respond = -1;
                System.Windows.Forms.MessageBox.Show(
                    ParsingErrorMessage + Environment.NewLine + e.Message,
                    Language.T("Data File Loading"),
                    System.Windows.Forms.MessageBoxButtons.OK,
                    System.Windows.Forms.MessageBoxIcon.Error);
                return respond;
            }

            if (respond != 0)
            {
                System.Windows.Forms.MessageBox.Show(
                    ParsingErrorMessage,
                    Language.T("Data File Loading"),
                    System.Windows.Forms.MessageBoxButtons.OK,
                    System.Windows.Forms.MessageBoxIcon.Exclamation);
                return respond;
            }

            return respond;
        }

Usage Example

Esempio n. 1
0
        /// <summary>
        /// Loads the data file
        /// </summary>
        /// <returns>0 - success</returns>
        public int LoadData()
        {
            // The source data file full name
            string sourceDataFile = pathDataDir + instrProperties.BaseFileName + period.ToString() + ".csv";

            // Checks the access to the file
            if (!File.Exists(sourceDataFile))
            {
                return(1);
            }

            StreamReader sr    = new StreamReader(sourceDataFile);
            string       sData = sr.ReadToEnd();

            sr.Close();

            Data_Parser dp = new Data_Parser();

            int respond    = -1;
            int parsedBars = dp.Parse(sData);

            if (parsedBars > 0)
            {
                aBar = dp.Bar;
                bars = parsedBars;
                RefineData();
                DataHorizon();
                CheckMarketData();
                SetDataStats();
                timeUpdate = aBar[bars - 1].Time;
                respond    = 0;
            }

            return(respond);
        }
All Usage Examples Of Forex_Strategy_Builder.Data_Parser::Parse