void Add(string fullName, IncludeItemType type, Source src, string cond) { var name = fullName.ToRelativePath(_root, true).NativeToUnix(); if (type == IncludeItemType.Glob) { type = GetIncludeItemType(name); } _log.Event(IOEvent.Include, name, "type: " + type); var item = new IncludeItem(src, type, name, cond); _result.Add(item); // Ignore added files to avoid duplicates if (item.Type != IncludeItemType.Folder) { SkipFile(fullName); } // Ignore unpacked stuff directories if (type == IncludeItemType.Stuff && File.Exists(fullName)) { SkipStuff(fullName); } }
void Add(string fullName, IncludeItem item) { _result.Add(item); // Ignore added files to avoid duplicates if (item.Type != IncludeItemType.Folder) { SkipFile(fullName); } // Ignore unpacked stuff directories if (item.Type == IncludeItemType.Stuff && File.Exists(fullName)) { SkipStuff(fullName); } }
void ParseProperty(string name) { var tmp = ReadToken(); switch (tmp) { case JsonToken.Null: case JsonToken.Boolean: case JsonToken.Float: case JsonToken.Integer: case JsonToken.String: { _document.Properties[name] = GetValue(); break; } case JsonToken.StartObject: { ParseObject(name + "."); break; } case JsonToken.StartArray: { switch (name) { case "InternalsVisibleTo": { _document.OptionalInternalsVisibleTo = new List <SourceValue>(); foreach (var e in ReadArray()) { _document.OptionalInternalsVisibleTo.Add(new SourceValue(GetSource(), e)); } break; } case "Packages": { _document.OptionalPackages = new List <PackageReference>(); foreach (var e in ReadArray()) { try { _document.OptionalPackages.Add(PackageReference.FromString(GetSource(), e)); } catch (Exception x) { _log.Error(GetSource(), null, "Invalid 'Packages' element (" + e + "): " + x.Message); } } break; } case "Projects": { _document.OptionalProjects = new List <ProjectReference>(); foreach (var e in ReadArray()) { try { _document.OptionalProjects.Add(ProjectReference.FromString(GetSource(), e)); } catch (Exception x) { _log.Error(GetSource(), null, "Invalid 'Projects' element (" + e + "): " + x.Message); } } break; } case "Includes": { foreach (var e in ReadArray()) { try { _document.Includes.Add(IncludeItem.FromString(GetSource(), e)); } catch (Exception x) { _log.Error(GetSource(), null, "Invalid 'Includes' element (" + e + "): " + x.Message); } } break; } case "Excludes": { _document.OptionalExcludes = new List <SourceValue>(); foreach (var e in ReadArray()) { _document.OptionalExcludes.Add(new SourceValue(GetSource(), e)); } break; } default: { // Don't allow arrays in the root object if (name.IndexOf('.') == -1) { throw new FormatException("Invalid array " + name.Quote()); } _document.Properties[name] = GetArray(); break; } } break; } default: { throw new FormatException("Invalid property " + name.Quote() + " (" + Value + ")"); } } }