/// <summary> /// Deserializes an instance of <see cref="SandboxedProcessOutput"/>. /// </summary> public static SandboxedProcessOutput Deserialize(BuildXLReader reader) { long length = reader.ReadInt64(); string value = reader.ReadNullableString(); string fileName = reader.ReadNullableString(); Encoding encoding = reader.ReadEncoding(); SandboxedProcessStandardFiles standardFiles = reader.ReadNullable(r => SandboxedProcessStandardFiles.Deserialize(r)); ISandboxedProcessFileStorage fileStorage = null; if (standardFiles != null) { fileStorage = new StandardFileStorage(standardFiles); } SandboxedProcessFile file = (SandboxedProcessFile)reader.ReadUInt32Compact(); BuildXLException exception = reader.ReadNullable(r => new BuildXLException(r.ReadNullableString(), (ExceptionRootCause)r.ReadUInt32Compact())); return(new SandboxedProcessOutput( length, value, fileName, encoding, fileStorage, file, exception)); }
/// <nodoc /> public static SandboxedProcessInfo Deserialize(Stream stream, LoggingContext loggingContext, IDetoursEventListener detoursEventListener) { using (var reader = new BuildXLReader(false, stream, true)) { string arguments = reader.ReadNullableString(); string commandLine = reader.ReadNullableString(); bool disableConHostSharing = reader.ReadBoolean(); string fileName = reader.ReadNullableString(); Encoding standardInputEncoding = reader.ReadNullable(r => r.ReadEncoding()); Encoding standardOutputEncoding = reader.ReadNullable(r => r.ReadEncoding()); Encoding standardErrorEncoding = reader.ReadNullable(r => r.ReadEncoding()); string workingDirectory = reader.ReadNullableString(); IBuildParameters buildParameters = null; var envVars = reader.ReadNullable(r => r.ReadReadOnlyList(r2 => new KeyValuePair <string, string>(r2.ReadString(), r2.ReadString()))); if (envVars != null) { buildParameters = BuildParameters.GetFactory().PopulateFromDictionary(envVars.ToDictionary(kvp => kvp.Key, kvp => kvp.Value)); } string[] allowedSurvivingChildNames = reader.ReadNullable(r => r.ReadReadOnlyList(r2 => r2.ReadString()))?.ToArray(); int maxLengthInMemory = reader.ReadInt32(); TimeSpan? timeout = reader.ReadNullableStruct(r => r.ReadTimeSpan()); TimeSpan nestedProcessTerminationTimeout = reader.ReadTimeSpan(); long pipSemiStableHash = reader.ReadInt64(); string timeoutDumpDirectory = reader.ReadNullableString(); SandboxKind sandboxKind = (SandboxKind)reader.ReadByte(); string pipDescription = reader.ReadNullableString(); SandboxedProcessStandardFiles sandboxedProcessStandardFiles = SandboxedProcessStandardFiles.Deserialize(reader); StandardInputInfo standardInputSourceInfo = reader.ReadNullable(r => StandardInputInfo.Deserialize(r)); SandboxObserverDescriptor standardObserverDescriptor = reader.ReadNullable(r => SandboxObserverDescriptor.Deserialize(r)); FileAccessManifest fam = reader.ReadNullable(r => FileAccessManifest.Deserialize(stream)); return(new SandboxedProcessInfo( new PathTable(), new StandardFileStorage(sandboxedProcessStandardFiles), fileName, fam, disableConHostSharing, // TODO: serialize/deserialize container configuration. containerConfiguration: ContainerConfiguration.DisabledIsolation, loggingContext: loggingContext, detoursEventListener: detoursEventListener) { m_arguments = arguments, m_commandLine = commandLine, StandardInputEncoding = standardInputEncoding, StandardOutputEncoding = standardOutputEncoding, StandardErrorEncoding = standardErrorEncoding, WorkingDirectory = workingDirectory, EnvironmentVariables = buildParameters, AllowedSurvivingChildProcessNames = allowedSurvivingChildNames, MaxLengthInMemory = maxLengthInMemory, Timeout = timeout, NestedProcessTerminationTimeout = nestedProcessTerminationTimeout, PipSemiStableHash = pipSemiStableHash, TimeoutDumpDirectory = timeoutDumpDirectory, SandboxKind = sandboxKind, PipDescription = pipDescription, SandboxedProcessStandardFiles = sandboxedProcessStandardFiles, StandardInputSourceInfo = standardInputSourceInfo, StandardObserverDescriptor = standardObserverDescriptor }); } }