Exemple #1
0
        static string GetBuildNumberFromMainOSCbs(string filepath)
        {
            if (File.Exists("update.mum"))
            {
                File.Delete("update.mum");
            }

            var proc = new Process();

            proc.StartInfo = new ProcessStartInfo("7za.exe", "x \"" + filepath + "\" update.mum")
            {
                WindowStyle = ProcessWindowStyle.Hidden
            };
            proc.Start();
            proc.WaitForExit();

            if (File.Exists("update.mum"))
            {
                string buildstr = null;

                Stream stream = File.OpenRead("update.mum");

                XmlSerializer   serializer = new XmlSerializer(typeof(XmlMum.Assembly));
                XmlMum.Assembly package    = (XmlMum.Assembly)serializer.Deserialize(stream);

                if (package.Package.CustomInformation.File.Any(x => x.Name.Contains(@"\ntoskrnl.exe")))
                {
                    var entry = package.Package.CustomInformation.File.First(x => x.Name.Contains(@"\ntoskrnl.exe"));

                    if (File.Exists(entry.Cabpath))
                    {
                        File.Delete(entry.Cabpath);
                    }

                    proc           = new Process();
                    proc.StartInfo = new ProcessStartInfo("7za.exe", "x \"" + filepath + "\" " + entry.Cabpath)
                    {
                        WindowStyle = ProcessWindowStyle.Hidden
                    };
                    proc.Start();
                    proc.WaitForExit();

                    buildstr = FileVersionInfo.GetVersionInfo(entry.Cabpath).FileVersion;

                    File.Delete(entry.Cabpath);
                }

                stream.Close();

                File.Delete("update.mum");

                return(buildstr);
            }
            else
            {
                return(null);
            }
        }
Exemple #2
0
        static string GetVersionInfoCbs(string filepath)
        {
            if (File.Exists("update.mum"))
            {
                File.Delete("update.mum");
            }

            var proc = new Process();

            proc.StartInfo = new ProcessStartInfo("7za.exe", "x \"" + filepath + "\" update.mum")
            {
                WindowStyle = ProcessWindowStyle.Hidden
            };
            proc.Start();
            proc.WaitForExit();

            if (File.Exists("update.mum"))
            {
                Stream stream = File.OpenRead("update.mum");

                XmlSerializer   serializer = new XmlSerializer(typeof(XmlMum.Assembly));
                XmlMum.Assembly package    = (XmlMum.Assembly)serializer.Deserialize(stream);

                string ver = package.AssemblyIdentity.Version;

                stream.Close();

                File.Delete("update.mum");

                return(ver);
            }
            else
            {
                return(null);
            }
        }
Exemple #3
0
        static BuildInfo.Buildinformation GetBuildInfoFromMainOSProdCbs(string filepath)
        {
            if (File.Exists("update.mum"))
            {
                File.Delete("update.mum");
            }

            var proc = new Process();

            proc.StartInfo = new ProcessStartInfo("7za.exe", "x \"" + filepath + "\" update.mum")
            {
                WindowStyle = ProcessWindowStyle.Hidden
            };
            proc.Start();
            proc.WaitForExit();

            if (File.Exists("update.mum"))
            {
                BuildInfo.Buildinformation buildstr = null;

                Stream stream = File.OpenRead("update.mum");

                XmlSerializer   serializer = new XmlSerializer(typeof(XmlMum.Assembly));
                XmlMum.Assembly package    = (XmlMum.Assembly)serializer.Deserialize(stream);

                if (package.Package.CustomInformation.File.Any(x => x.Name.Contains(@"\buildinfo.xml")))
                {
                    var entry = package.Package.CustomInformation.File.First(x => x.Name.Contains(@"\buildinfo.xml"));

                    if (File.Exists(entry.Cabpath))
                    {
                        File.Delete(entry.Cabpath);
                    }

                    proc           = new Process();
                    proc.StartInfo = new ProcessStartInfo("7za.exe", "x \"" + filepath + "\" " + entry.Cabpath)
                    {
                        WindowStyle = ProcessWindowStyle.Hidden
                    };
                    proc.Start();
                    proc.WaitForExit();

                    Stream stream2 = File.OpenRead(entry.Cabpath);

                    XmlSerializer serializer2           = new XmlSerializer(typeof(BuildInfo.Buildinformation));
                    BuildInfo.Buildinformation package2 = (BuildInfo.Buildinformation)serializer2.Deserialize(stream2);

                    buildstr = package2;

                    stream2.Close();

                    try
                    {
                        File.Delete(entry.Cabpath);
                    }
                    catch
                    {
                    }
                }

                stream.Close();

                File.Delete("update.mum");

                return(buildstr);
            }
            else
            {
                return(null);
            }
        }