示例#1
0
 public TestData(string compressedFilePath, string assemblyPath, string expectedAssemblyPath)
 {
     CompressedFilePath   = Path.Combine(RootPath, compressedFilePath);
     AssemblyPath         = Path.Combine(RootPath, assemblyPath);
     ExpectedAssemblyPath = expectedAssemblyPath;
     RecordInfo           = FileRecordInfo.Create(compressedFilePath);
 }
        public void RecordFileValidation_ShortFile_IsValidFalse()
        {
            var fileInfo       = new FileInfo(@"TestRecordFiles\ShortFile.csv");
            var fileRecordInfo = FileRecordInfo.Create(fileInfo);

            Assert.IsFalse(fileRecordInfo.IsValid);
            Assert.IsFalse(fileRecordInfo.HasInfoHeader);
        }
示例#3
0
        public void RecordFileValidation_OCATCustomFilenameWithoutMetaDataInFilename_IsValidTrue()
        {
            var fileInfo       = new FileInfo(@"TestRecordFiles\CustomFilenameWithoutMetaDataInFilename.csv");
            var fileRecordInfo = FileRecordInfo.Create(fileInfo, "testHash");

            Assert.IsTrue(fileRecordInfo.IsValid);
            Assert.IsFalse(fileRecordInfo.HasInfoHeader);
        }
示例#4
0
        public void RecordFileValidation_InvalidColumnFile_IsValidFalse()
        {
            var fileInfo       = new FileInfo(@"TestRecordFiles\InvalidColumnFile.csv");
            var fileRecordInfo = FileRecordInfo.Create(fileInfo, "testHash");

            Assert.IsFalse(fileRecordInfo.IsValid);
            Assert.IsFalse(fileRecordInfo.HasInfoHeader);
        }
示例#5
0
        public void RecordFileValidation_OCATStandardFile_IsValidTrue()
        {
            var fileInfo       = new FileInfo(@"TestRecordFiles\OCAT-MetroExodus.exe-2019-02-20T101522.csv");
            var fileRecordInfo = FileRecordInfo.Create(fileInfo, "testHash");

            Assert.IsTrue(fileRecordInfo.IsValid);
            Assert.IsFalse(fileRecordInfo.HasInfoHeader);
        }
示例#6
0
        public void RecordFileValidation_OCATCustomFilenameWithoutComment_IsValidTrue()
        {
            var fileInfo       = new FileInfo(@"TestRecordFiles\CustomFilenameWithoutComment.csv");
            var fileRecordInfo = FileRecordInfo.Create(fileInfo, "testHash");

            Assert.IsTrue(fileRecordInfo.IsValid);
            Assert.IsFalse(fileRecordInfo.HasInfoHeader);
            Assert.AreEqual(null, fileRecordInfo.Comment);
        }
 public void TestRecordCreationResourceNames()
 {
     foreach (var item in ResourceNames)
     {
         var filename = $"0f74af948a58a66a96f4fc282a01ebf1.{item.Key}.v9a8d4bbd19b4cd55.payload.v0.noVariants";
         var info     = FileRecordInfo.Create(filename);
         Assert.AreEqual(info.Resource, item.Value);
         Assert.IsFalse(info.IsRawImage);
     }
 }
示例#8
0
        public void RecordFileValidation_PresentMonTestOutputFile_IsValidTrue()
        {
            var fileInfo       = new FileInfo(@"TestRecordFiles\PresentMonTestOutputFilename.csv");
            var fileRecordInfo = FileRecordInfo.Create(fileInfo, "testHash");

            Assert.IsTrue(fileRecordInfo.IsValid);
            Assert.IsFalse(fileRecordInfo.HasInfoHeader);

            Assert.AreEqual("FarCryNewDawn.exe", fileRecordInfo.GameName);
            Assert.AreEqual("FarCryNewDawn.exe", fileRecordInfo.ProcessName);
        }
示例#9
0
        public void InitFromPath(string filePath)
        {
            Name = Path.GetFileName(filePath);

            var fileInfo = FileRecordInfo.Create(Name);

            Version = fileInfo?.VersionHash ?? string.Empty;
            Hash    = fileInfo?.Hash ?? string.Empty;

            using (var fileStream = File.OpenRead(filePath))
            {
                LoadFromStream(fileStream, Hash);
            }
        }
示例#10
0
        public void FileRecordInfo_OCATStandardFile_CorrectSystemInfo()
        {
            var fileInfo       = new FileInfo(@"TestRecordFiles\OCAT-MetroExodus.exe-2019-02-20T101522.csv");
            var fileRecordInfo = FileRecordInfo.Create(fileInfo, "testHash");

            Assert.AreEqual("MetroExodus.exe", fileRecordInfo.GameName);
            Assert.AreEqual("MetroExodus.exe", fileRecordInfo.ProcessName);

            Assert.AreEqual("Micro-Star International Co. Ltd. MPG Z390 GAMING PRO CARBON (MS-7B17)", fileRecordInfo.MotherboardName);
            Assert.AreEqual("Windows 10 Pro 1809 (OS Build 17763.1.amd64fre.rs5_release.180914-1434)", fileRecordInfo.OsVersion);

            Assert.AreEqual("Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz", fileRecordInfo.ProcessorName);
            Assert.AreEqual("GeForce RTX 2080 Ti", fileRecordInfo.GraphicCardName);
            Assert.AreEqual("32 GB DDR4 3200 MT/s", fileRecordInfo.SystemRamInfo);
            Assert.AreEqual("Test", fileRecordInfo.Comment);
        }
示例#11
0
        public void TestRecordCreationVariantTypes()
        {
            var resourceNames = new Dictionary <string, VariantType>
            {
                ["noVariants"] = VariantType.NoVariants,
                ["server"]     = VariantType.Server,
                ["pcClient"]   = VariantType.PcClient,
                ["unknown"]    = VariantType.Unknown
            };

            foreach (var item in resourceNames)
            {
                var filename = $"0f74af948a58a66a96f4fc282a01ebf1.Texture-Resource.v9a8d4bbd19b4cd55.payload.v0.{item.Key}";
                var info     = FileRecordInfo.Create(filename);
                Assert.AreEqual(info.Variant, item.Value);
                Assert.IsFalse(info.IsRawImage);
            }
        }
示例#12
0
        public void TestRecordCreationPayloadTypes()
        {
            var resourceNames = new Dictionary <string, PayloadType>
            {
                ["payload"]      = PayloadType.Payload,
                ["manifest"]     = PayloadType.Manifest,
                ["debug"]        = PayloadType.Debug,
                ["capabilities"] = PayloadType.Capabilities,
                ["null"]         = PayloadType.Null,
                ["unknown"]      = PayloadType.Unknown,
            };

            foreach (var item in resourceNames)
            {
                var filename = $"0f74af948a58a66a96f4fc282a01ebf1.Texture-Resource.v9a8d4bbd19b4cd55.{item.Key}.v0.noVariants";
                var info     = FileRecordInfo.Create(filename);
                Assert.AreEqual(info.Payload, item.Value);
                Assert.IsFalse(info.IsRawImage);
            }
        }
示例#13
0
        public void TestResourceFilename_Versionhash()
        {
            var hash                 = "0f74af948a58a66a96f4fc282a01ebf1";
            var resourceType         = "Texture-Resource";
            var versionHash          = "9a8d4bbd19b4cd55";
            var payloadType          = "payload";
            var unknownVersionNumber = 0;
            var variants             = "noVariants";

            var info = FileRecordInfo.Create($"{hash}.{resourceType}.v{versionHash}.{payloadType}.v{unknownVersionNumber}.{variants}");

            Assert.NotNull(info);
            Assert.AreEqual(info.Hash, hash);
            Assert.AreEqual(info.ImagePath, null);
            Assert.AreEqual(info.IsRawImage, false);
            Assert.AreEqual(info.Resource, ResourceType.TextureResource);
            Assert.AreEqual(info.Variant, VariantType.NoVariants);
            Assert.AreEqual(info.Payload, PayloadType.Payload);
            Assert.AreEqual(info.VersionHash, versionHash);
            Assert.AreEqual(info.UnknownVersionNumber, unknownVersionNumber);
        }
示例#14
0
        public void TestToStringWorks()
        {
            using (var inStream = File.OpenRead(SingleFileBagPath))
            {
                var files = Bag.Read(inStream).ToList();
                using (var outStream = new MemoryStream())
                {
                    files[0].Info = null;

                    Assert.DoesNotThrow(() =>
                    {
                        files[0].ToString();
                    });

                    files[0].Info = FileRecordInfo.Create($"0f74af948a58a66a96f4fc282a01ebf1.Texture-Resource.v9a8d4bbd19b4cd55.payload.v0.noVariants");

                    Assert.DoesNotThrow(() =>
                    {
                        files[0].ToString();
                    });
                }
            }
        }
示例#15
0
        public void RecordFileValidation_CapFrameXFileWithHeader_IsValidTrue()
        {
            var fileInfo       = new FileInfo(@"TestRecordFiles\CapFrameXFileWithHeader.csv");
            var fileRecordInfo = FileRecordInfo.Create(fileInfo, "testHash");

            Assert.IsTrue(fileRecordInfo.IsValid);
            Assert.IsTrue(fileRecordInfo.HasInfoHeader);
            Assert.AreEqual("re2.exe", fileRecordInfo.GameName);
            Assert.AreEqual("Resident Evil 2 Remake", fileRecordInfo.ProcessName);
            Assert.AreEqual("2019-03-30", fileRecordInfo.CreationDate);
            Assert.AreEqual("12:01:36", fileRecordInfo.CreationTime);
            Assert.AreEqual("ASUSTeK COMPUTER INC. ROG MAXIMUS XI HERO", fileRecordInfo.MotherboardName);
            Assert.AreEqual("Windows OS", fileRecordInfo.OsVersion);
            Assert.AreEqual("Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz", fileRecordInfo.ProcessorName);
            Assert.AreEqual("NVIDIA GeForce RTX 2080 Ti", fileRecordInfo.GraphicCardName);
            Assert.AreEqual("32 GB 3800 MT/s", fileRecordInfo.SystemRamInfo);
            Assert.AreEqual("bla", fileRecordInfo.BaseDriverVersion);
            Assert.AreEqual("bla", fileRecordInfo.DriverPackage);
            Assert.AreEqual("1", fileRecordInfo.NumberGPUs);
            Assert.AreEqual("1920", fileRecordInfo.GPUCoreClock);
            Assert.AreEqual("7000", fileRecordInfo.GPUMemoryClock);
            Assert.AreEqual("11278", fileRecordInfo.GPUMemory);
            Assert.AreEqual("Test", fileRecordInfo.Comment);
        }
示例#16
0
 public TestData(string compressedFilePath, string jsonFilePath)
 {
     JsonFilePath       = jsonFilePath;
     CompressedFilePath = Path.Combine(RootPath, compressedFilePath);
     RecordInfo         = FileRecordInfo.Create(compressedFilePath);
 }
示例#17
0
        public void TestEmptyFilename()
        {
            var info = FileRecordInfo.Create("");

            Assert.AreEqual(info, null);
        }
示例#18
0
 public TestData(string compressedFilePath, string expectedContentPath)
 {
     CompressedFilePath   = Path.Combine(RootPath, compressedFilePath);
     ExpectedContentBytes = File.ReadAllBytes(Path.Combine(RootPath, expectedContentPath));
     RecordInfo           = FileRecordInfo.Create(compressedFilePath);
 }
示例#19
0
 public TestData(string compressedFilePath, string expectedFileName)
 {
     CompressedFilePath = Path.Combine(RootPath, compressedFilePath);
     RecordInfo         = FileRecordInfo.Create(compressedFilePath);
     ExpectedFileName   = expectedFileName;
 }
示例#20
0
        public void TestUnknownFilename()
        {
            var info = FileRecordInfo.Create("HelloWorld.txt");

            Assert.AreEqual(info, null);
        }
示例#21
0
        public void TestImageFilename()
        {
            var info = FileRecordInfo.Create("0f74af948a58a66a96f4fc282a01ebf1.HelloWorld.png");

            Assert.IsTrue(info.IsRawImage);
        }