Exemple #1
0
        private static readonly byte[] MscfSignature = new byte[] { 0x4d, 0x53, 0x43, 0x46 };  // M, S, C, F

        private static UpdatePackageType DetectUpdatePackageType(string updatePackageFilePath)
        {
            var signature = FileSignatureHelper.ReadFileSignature(updatePackageFilePath);

            if (FileSignatureHelper.CompareFileSignature(MscfSignature, signature.AsSpan(0, MscfSignature.Length)))
            {
                return(UpdatePackageType.MSCF);
            }
            return(UpdatePackageType.Unknown);
        }
Exemple #2
0
        private static readonly byte[] XmlFileSignature        = new byte[] { 0x3c, 0x3f, 0x78, 0x6d, 0x6c, 0x20 }; // <?xml

        private static UpdateModuleFileType DetectUpdateModuleFileType(string updateModuleFilePath)
        {
            var signature = FileSignatureHelper.ReadFileSignature(updateModuleFilePath);

            if (FileSignatureHelper.CompareFileSignature(ExecutableFileSignature, signature.AsSpan(0, ExecutableFileSignature.Length)))
            {
                return(UpdateModuleFileType.Executable);
            }
            else if (FileSignatureHelper.CompareFileSignature(XmlFileSignature, signature.AsSpan(0, XmlFileSignature.Length)))
            {
                return(UpdateModuleFileType.Xml);
            }
            return(UpdateModuleFileType.Other);
        }