Пример #1
0
 internal VersionInfo(VersionResource resource, uint languageId, FixedFileInfo fixedInfo, StringFileInfo stringInfo, VarFileInfo varInfo)
 {
     Resource  = resource;
     Language  = languageId;
     Fixed     = fixedInfo;
     Strings   = stringInfo;
     Variables = varInfo;
 }
Пример #2
0
        public async Task <VersionInfo> GetInfoAsync(ResourceLanguage language)
        {
            var buffer = await GetBytesAsync(language).ConfigureAwait(false);

            using (var mem = new MemoryStream(buffer))
            {
                var count = 3 * sizeof(ushort);

                await mem.ReadBytesAsync(count).ConfigureAwait(false);

                var key = await mem.ReadUnicodeStringAsync().ConfigureAwait(false);

                if (key != "VS_VERSION_INFO")
                {
                    throw new Exception("Invalid file version information.");
                }

                await AlignWordBoundaryAsync(mem).ConfigureAwait(false);

                var ffiData = await mem.ReadStructAsync <VS_FIXEDFILEINFO>().ConfigureAwait(false);

                var fixedFileInfo = new FixedFileInfo(ffiData);

                await AlignWordBoundaryAsync(mem).ConfigureAwait(false);

                var stringFileInfo = await StringFileInfo.LoadAsync(mem).ConfigureAwait(false);

                await AlignWordBoundaryAsync(mem).ConfigureAwait(false);

                var varFileInfo = await VarFileInfo.LoadAsync(mem).ConfigureAwait(false);

                var info = new VersionInfo(this, language, fixedFileInfo, stringFileInfo, varFileInfo);

                return(info);
            }
        }