public void AddTo(IResourceWriter writer)
        {
            if (writer is PreserializedResourceWriter preserializedResourceWriter)
            {
                FileStream fileStream = new FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.Read);

                preserializedResourceWriter.AddActivatorResource(Name, fileStream, TypeName, closeAfterWrite: true);
            }
            else
            {
                ErrorUtilities.ThrowInternalError($"{nameof(FileStreamResource)} was asked to serialize to a {writer.GetType().ToString()}");
            }
        }
Beispiel #2
0
 public void AddTo(IResourceWriter writer)
 {
     if (writer is PreserializedResourceWriter preserializedResourceWriter)
     {
         preserializedResourceWriter.AddTypeConverterResource(Name, Bytes, TypeName);
     }
     else
     {
         ErrorUtilities.ThrowInternalError($"{nameof(TypeConverterByteArrayResource)} was asked to serialize to a {writer.GetType().ToString()}");
     }
 }