public void EmptyValueExceptionReferenceType()
 {
     var value = new ParsedValue<String>();
     // Trying to cast to String
     // ReSharper disable once UnusedVariable
     var s = (String)value;
 }
 public void EmptyValueExceptionValueType()
 {
     var value = new ParsedValue<Int32>();
     // Trying to cast to Int32
     // ReSharper disable once UnusedVariable
     var i = (Int32)value;
 }
        protected override void Fill(Match match, Span originalSpan)
        {
            base.Fill(match, originalSpan);

            if (ErrorCode.HasValue) {
                Type = new ParsedValue<MessageType>(MessageType.Error, ErrorCode.Span);
            }
        }
Exemple #4
0
        }         // AddMarketplace

        private void AddSectionItem(string sFieldName, ParsedValue oValue)
        {
            int nPos = sFieldName.IndexOf('_');

            string sSectionName = sFieldName.Substring(0, nPos);

            string sFieldInSection = sFieldName.Substring(nPos + 1);

            if (!Data.ContainsKey(sSectionName))
            {
                Data[sSectionName] = new Dictionary <string, ParsedValue>();
            }

            Data[sSectionName][sFieldInSection] = oValue;
        }         // AddSectionItem
Exemple #5
0
 public BuildFileRelatedMessageData(
     ParsedValue <Int32> buildTaskId,
     ParsedValue <MessageType> type,
     ParsedValue <String> code,
     ParsedValue <String> message,
     ParsedValue <String> fullMessage,
     ParsedValue <String> filePath)
 {
     BuildTaskId = buildTaskId;
     Type        = type;
     Code        = code;
     Message     = message;
     FullMessage = fullMessage;
     FilePath    = filePath;
 }
Exemple #6
0
        protected ParsedValue Parse(string s)
        {
            ParsedValue parsedValue = new ParsedValue();

            int intValue;

            if (int.TryParse(s, out intValue))
            {
                parsedValue.IntValue = intValue;
            }
            else
            {
                parsedValue.StringValue = s;
            }

            return(parsedValue);
        }
Exemple #7
0
        public CustomerData(SafeReader sr)
        {
            Data           = new Dictionary <string, Dictionary <string, ParsedValue> >();
            CustomerID     = 0;
            CustomerRefNum = string.Empty;
            AlibabaID      = string.Empty;

            m_oMarketplaces = new SortedSet <string>();

            for (int nIdx = 0; nIdx < sr.Count; nIdx++)
            {
                string sFieldName = sr.GetName(nIdx);

                if (sFieldName == RowType)
                {
                    continue;
                }

                ParsedValue oValue = sr[nIdx];

                if (sFieldName == CustomerIDField)
                {
                    CustomerID = oValue;
                }
                else if (sFieldName == AlibabaIDField)
                {
                    AlibabaID = oValue;
                }
                else if (sFieldName == CustomerRefNumField)
                {
                    CustomerRefNum = oValue;
                }
                else
                {
                    if ((sFieldName == ApprovedAmountField) && (oValue != null) && (oValue.Raw != null))
                    {
                        TotalApprovedAmount += (decimal)oValue;
                    }

                    AddSectionItem(sFieldName, oValue);
                }         // if
            }             // for

            m_oLoans        = new SortedDictionary <int, LoanData>();
            m_oCashRequests = new SortedDictionary <int, CashRequestData>();
        }         // constructor
Exemple #8
0
        public ProjectBlock(ParsedValue <Guid> projectTypeGuid, ParsedValue <string> projectName, ParsedValue <string> projectPath, ParsedValue <Guid> projectGuid, IEnumerable <SectionBlock> projectSections)
        {
            if (string.IsNullOrEmpty(projectName.Value))
            {
                throw new ArgumentException(string.Format(WorkspacesResources.StringIsNullOrEmpty, "projectName"));
            }

            if (string.IsNullOrEmpty(projectPath.Value))
            {
                throw new ArgumentException(string.Format(WorkspacesResources.StringIsNullOrEmpty, "projectPath"));
            }

            ParsedProjectTypeGuid = projectTypeGuid;
            ParsedProjectName     = projectName;
            ParsedProjectPath     = projectPath;
            ParsedProjectGuid     = projectGuid;
            _projectSections      = projectSections.ToList().AsReadOnly();
        }
        protected override void Fill(Match match, Span originalSpan)
        {
            base.Fill(match, originalSpan);

            var npmMessageTypeGroup = match.Groups["NpmMessageType"];
            if (npmMessageTypeGroup.Success) {
                var span = new Span(originalSpan.Start + npmMessageTypeGroup.Index, npmMessageTypeGroup.Length);
                switch (npmMessageTypeGroup.Value) {
                        case "WARN":
                        Type = new ParsedValue<MessageType>(MessageType.Warning, span);
                        break;
                    case "ERR!":
                        Type = new ParsedValue<MessageType>(MessageType.Error, span);
                        break;
                    default:
                        throw new ArgumentOutOfRangeException();
                }
            }
        }
Exemple #10
0
        public SectionBlock(ParsedValue <string> type, ParsedValue <string> parenthesizedName, ParsedValue <string> value, IEnumerable <KeyValuePair <ParsedValue <string>, ParsedValue <string> > > keyValuePairs)
        {
            if (string.IsNullOrEmpty(type.Value))
            {
                throw new ArgumentException(string.Format(WorkspacesResources.StringIsNullOrEmpty, "type"));
            }

            if (string.IsNullOrEmpty(parenthesizedName.Value))
            {
                throw new ArgumentException(string.Format(WorkspacesResources.StringIsNullOrEmpty, "parenthesizedName"));
            }

            if (string.IsNullOrEmpty(value.Value))
            {
                throw new ArgumentException(string.Format(WorkspacesResources.StringIsNullOrEmpty, "value"));
            }

            _type = type;
            _parenthesizedName = parenthesizedName;
            _value             = value;
            _keyValuePairs     = keyValuePairs.ToList().AsReadOnly();
        }
        protected override void Fill(Match match, Span originalSpan)
        {
            base.Fill(match, originalSpan);

            var npmMessageTypeGroup = match.Groups["NpmMessageType"];

            if (npmMessageTypeGroup.Success)
            {
                var span = new Span(originalSpan.Start + npmMessageTypeGroup.Index, npmMessageTypeGroup.Length);
                switch (npmMessageTypeGroup.Value)
                {
                case "WARN":
                    Type = new ParsedValue <MessageType>(MessageType.Warning, span);
                    break;

                case "ERR!":
                    Type = new ParsedValue <MessageType>(MessageType.Error, span);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
        }
 bool parseValues()
 {
     Match m = rowRegex.Match(buffer.ToString());
     if (m.Success)
     {
         result = new Dictionary<string, ParsedValue>(columns.Count);
         for (int i = 0; i < columns.Count; i++)
         {
             result[columns[i]] = new ParsedValue(m.Groups[i + 1].Value);
         }
         buffer.Remove(0, m.Length);
     }
     return m.Success;
 }
Exemple #13
0
 public PublishResultData(ParsedValue <Int32> succeeded, ParsedValue <Int32> failed, ParsedValue <Int32> skipped)
 {
     Succeeded = succeeded;
     Failed    = failed;
     Skipped   = skipped;
 }
 public Limit(ParsedValue low, ParsedValue high)
 {
     Low  = low;
     High = high;
 }
 public NpmResultData(ParsedValue <Int32> exitCode)
 {
     ExitCode = exitCode;
 }
 public DebugExceptionData(ParsedValue <String> exception, ParsedValue <String> assembly)
 {
     Exception = exception;
     Assembly  = assembly;
 }
Exemple #17
0
 public DebugTraceMessageData(ParsedValue <String> source, ParsedValue <TraceEventType> type, ParsedValue <Int32> id, ParsedValue <String> message, ParsedValue <String> prettyMessage)
 {
     Source        = source;
     Type          = type;
     Id            = id;
     Message       = message;
     PrettyMessage = prettyMessage;
 }
Exemple #18
0
 public NpmMessageData(ParsedValue <MessageType> type, ParsedValue <String> message)
 {
     Type    = type;
     Message = message;
 }
Exemple #19
0
 public ParsedDataStub(ParsedValue <String> message, ParsedValue <TraceEventType> type)
 {
     Message = message;
     Type    = type;
 }
Exemple #20
0
 public ValueModel(DeclarationSymbol symbol, ParsedValue <string> value) : this(symbol.GetSource(), value)
 {
 }