Ejemplo n.º 1
0
        public static Command Deserialize(string value)
        {
            Contract.Requires(value != null);

            using (var stream = new MemoryStream(Convert.FromBase64String(value)))
                using (var reader = new BinaryReader(stream))
                {
                    var typeName = reader.ReadString();
                    switch (typeName)
                    {
                    case nameof(MaterializeFileCommand):
                        return(MaterializeFileCommand.InternalDeserialize(reader));

                    case nameof(ReportStatisticsCommand):
                        return(ReportStatisticsCommand.InternalDeserialize(reader));

                    case nameof(GetSealedDirectoryContentCommand):
                        return(GetSealedDirectoryContentCommand.InternalDeserialize(reader));

                    default:
                        Contract.Assert(false, "unrecognized command type name: " + typeName);
                        return(null);
                    }
                }
        }
Ejemplo n.º 2
0
        public static Command Deserialize(string value)
        {
            Contract.Requires(value != null);

            using (var stream = new MemoryStream(Convert.FromBase64String(value)))
                using (var reader = new BinaryReader(stream))
                {
                    var typeName = reader.ReadString();
                    switch (typeName)
                    {
                    case nameof(MaterializeFileCommand):
                        return(MaterializeFileCommand.InternalDeserialize(reader));

                    case nameof(ReportStatisticsCommand):
                        return(ReportStatisticsCommand.InternalDeserialize(reader));

                    case nameof(GetSealedDirectoryContentCommand):
                        return(GetSealedDirectoryContentCommand.InternalDeserialize(reader));

                    case nameof(LogMessageCommand):
                        return(LogMessageCommand.InternalDeserialize(reader));

                    case nameof(RegisterFilesForBuildManifestCommand):
                        return(RegisterFilesForBuildManifestCommand.InternalDeserialize(reader));

                    case nameof(GenerateBuildManifestDataCommand):
                        return(GenerateBuildManifestDataCommand.InternalDeserialize(reader));

                    default:
                        throw new ArgumentException("unrecognized command type name: " + typeName);
                    }
                }
        }