File tree Expand file tree Collapse file tree
BinaryObjectScanner.Test/FileType
BinaryObjectScanner/FileType Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using System . IO ;
2+ using BinaryObjectScanner . FileType ;
3+ using Xunit ;
4+
5+ namespace BinaryObjectScanner . Test . FileType
6+ {
7+ public class GCFTests
8+ {
9+ private static readonly SabreTools . Serialization . Wrappers . GCF wrapper
10+ = new ( new SabreTools . Data . Models . GCF . File ( ) , new MemoryStream ( new byte [ 1024 ] ) ) ;
11+
12+ [ Fact ]
13+ public void DetectFile_EmptyString_Null ( )
14+ {
15+ string file = string . Empty ;
16+ var detectable = new GCF ( wrapper ) ;
17+
18+ string ? actual = detectable . Detect ( file , includeDebug : false ) ;
19+ Assert . Null ( actual ) ;
20+ }
21+
22+ [ Fact ]
23+ public void DetectStream_EmptyStream_DefaultValue ( )
24+ {
25+ Stream ? stream = new MemoryStream ( ) ;
26+ string file = string . Empty ;
27+ var detectable = new GCF ( wrapper ) ;
28+
29+ string ? actual = detectable . Detect ( stream , file , includeDebug : false ) ;
30+ Assert . Equal ( "AACS (Unknown Version)" , actual ) ;
31+ }
32+ }
33+ }
Original file line number Diff line number Diff line change @@ -21,12 +21,13 @@ public GCF(SabreTools.Serialization.Wrappers.GCF wrapper) : base(wrapper) { }
2121 // At the moment, all samples of GCF files on redump are unencrypted. Combined with being uncertain about
2222 // whether this is the best way to check whether the GCF is encrypted, this block will be left commented
2323 // out until further research is done.
24- /*bool encrypted = false;
25- if (_wrapper.Files != null && _wrapper.Files.Length > 0)
26- encrypted = _wrapper.Files[0].Encrypted;
24+ // bool encrypted = false;
25+ // if (_wrapper.Files != null && _wrapper.Files.Length > 0)
26+ // encrypted = _wrapper.Files[0].Encrypted;
27+
28+ // string encryptedString = encrypted ? "encrypted" : "unencrypted";
29+ // string returnString = $"{fileName} - {depotId} (v{manifestVersion}, {encryptedString})";
2730
28- string encryptedString = encrypted ? "encrypted" : "unencrypted";
29- string returnString = $"{fileName} - {depotId} (v{manifestVersion}, {encryptedString})";*/
3031 string returnString = $ "{ fileName } - { depotId } (v{ manifestVersion } )";
3132 return returnString ;
3233 }
You can’t perform that action at this time.
0 commit comments