/// <summary> /// Deserializes /// </summary> public static ExecutablePathAllowlistEntry Deserialize(BuildXLReader reader) { Contract.Requires(reader != null); var state = ReadState(reader); var isAbsolutePath = reader.ReadBoolean(); ExecutablePathAllowlistEntry listEntry; if (isAbsolutePath) { AbsolutePath path = reader.ReadAbsolutePath(); listEntry = new ExecutablePathAllowlistEntry( new DiscriminatingUnion <AbsolutePath, PathAtom>(path), state.PathRegex, state.AllowsCaching, state.Name); } else { PathAtom path = reader.ReadPathAtom(); listEntry = new ExecutablePathAllowlistEntry( new DiscriminatingUnion <AbsolutePath, PathAtom>(path), state.PathRegex, state.AllowsCaching, state.Name); } return(listEntry); }
/// <summary> /// Add a single allowlist entry to the list. /// </summary> public void Add(ExecutablePathAllowlistEntry entry) { Contract.Requires(entry != null); m_executablePathEntries.Add(entry.ExecutablePath, entry); m_counts.AddOrUpdate(entry.Name, 0, (k, v) => v); HasEntries = true; }
private static void DeserializeCore(BuildXLReader reader, FileAccessAllowlist allowlist) { var valuePathEntryCount = reader.ReadInt32Compact(); for (int i = 0; i < valuePathEntryCount; i++) { allowlist.Add(ValuePathFileAccessAllowlistEntry.Deserialize(reader)); } var executablePathEntryCount = reader.ReadInt32Compact(); for (int i = 0; i < executablePathEntryCount; i++) { allowlist.Add(ExecutablePathAllowlistEntry.Deserialize(reader)); } }
private static void DeserializeCore(BuildXLReader reader, FileAccessAllowlist allowlist) { var valuePathEntryCount = reader.ReadInt32Compact(); for (int i = 0; i < valuePathEntryCount; i++) { allowlist.Add(ValuePathFileAccessAllowlistEntry.Deserialize(reader)); } // Execute this part twice, first time for m_executablePathEntries (Absolute Path) and a second time for m_executablePathAtomEntries (Path Atom) var executablePathEntryCount = reader.ReadInt32Compact(); for (int j = 0; j < executablePathEntryCount; j++) { allowlist.Add(ExecutablePathAllowlistEntry.Deserialize(reader)); } }
/// <summary> /// Add a single allowlist entry to the list. /// </summary> public void Add(ExecutablePathAllowlistEntry entry) { Contract.Requires(entry != null); var toolPath = entry.Executable.GetValue(); if (toolPath is AbsolutePath absolutePath) { m_executablePathEntries.Add(absolutePath, entry); } else if (toolPath is PathAtom pathAtom) { m_executableToolExeEntries.Add(pathAtom.StringId, entry); } m_counts.AddOrUpdate(entry.Name, 0, (k, v) => v); HasEntries = true; }