BSky.Statistics.R.RService.SyntaxEditorEvaluateToObject C# (CSharp) Method

SyntaxEditorEvaluateToObject() public method

public SyntaxEditorEvaluateToObject ( string commandString, bool hasReturn, bool hasUAReturn ) : object
commandString string
hasReturn bool
hasUAReturn bool
return object
        public object SyntaxEditorEvaluateToObject(string commandString, bool hasReturn, bool hasUAReturn)// read.spss("", "" )
        {
            object returnValue = null;
            dynamic dy = null;
            CharacterVector cvec;
            try
            {
                if (hasReturn)
                {
                    cvec = this._RServer.Evaluate(commandString).AsCharacter();
                    if (cvec != null)
                    {
                        if (cvec.Length > 1)
                        {
                            returnValue = cvec.ToArray();
                        }
                        if (cvec.Length == 1)
                        {
                            returnValue = cvec[0];
                        }
                        
                    }
                }
                else if (hasUAReturn)
                {
                    returnValue = this.EvaluateToUAReturn(commandString);
                }
                else//no return
                {
                    string serr = "R.Net Error not imple";// this._RServer.GetErrorText();
                    if (serr != null && serr.Length > 0)
                    { }
                    this._RServer.Evaluate(commandString);
                }

            }
            catch (Exception e)
            {
                if (AdvancedLogging) logService.WriteToLogLevel("ExtraLogs: Exception Executing : " + commandString, LogLevelEnum.Info);
                if (AdvancedLogging) logService.WriteToLogLevel("ExtraLogs: Exception : " + e.Message, LogLevelEnum.Info);
                if (e != null)
                {
                    string msg = e.Message.Replace("\"", "'");
                    returnValue = "Error:" + msg;
                }
                if (commandString.Contains("readLines("))
                {
                    returnValue = "EOF";// to show the end of file.
                }
                else if (false)
                {
                    returnValue = "Error: " + "No Err impl, R.net";// this._RServer.GetErrorText();
                }
            }

            return returnValue;
        }