private static void PrintDllInfo(DLL deserializedDll) { Console.WriteLine( string.Format("FileName: {0}", deserializedDll.FileName)); Console.WriteLine( string.Format("HashCode: {0}", deserializedDll.hashCode)); Console.WriteLine( string.Format("Product Name: {0}", deserializedDll.ProductName)); Console.WriteLine( string.Format("Version: {0}", deserializedDll.Version)); Console.WriteLine( string.Format("Size: {0} bytes", deserializedDll.Size)); }
public static DLL DeSerializeObject(string filename) { FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(filename); DLL dll = new DLL(); dll.ProductName = versionInfo.ProductName; dll.CompanyName = versionInfo.CompanyName; dll.FileName = versionInfo.InternalName; dll.comments = versionInfo.Comments; dll.productVersion = versionInfo.ProductVersion; dll.Version = versionInfo.FileVersion.ToString(); dll.DllImage = WindowsThumbnailProvider.GetThumbnail(filename, 256, 256, ThumbnailOptions.BiggerSizeOk); FileInfo f = new FileInfo(filename); dll.Size = f.Length; dll.hashCode = GetMD5HashFromFile(filename); return(dll); }
private static void ProcessInfo(string[] args) { DLL dll = GetDLLObjectFromFile(args); switch (args.Length) { case 1: PrintDllInfo(dll); break; case 2: DLLImageWriter.WriteFullImage(dll, args[1]); PrintDllInfo(dll); break; case 3: DLLImageWriter.WriteThumbnail(dll, args[2]); break; } }
public static void WriteFullImage(DLL deserialDll, string dstFile) { deserialDll.DllImage.Save(dstFile); }