Beispiel #1
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);
            }
        }
Beispiel #2
0
        static BuildInfo.Buildinformation GetBuildInfoFromMainOSProdSpkg(string filepath)
        {
            if (File.Exists("man.dsm.xml"))
            {
                File.Delete("man.dsm.xml");
            }

            var proc = new Process();

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

            if (File.Exists("man.dsm.xml"))
            {
                BuildInfo.Buildinformation buildstr = null;

                Stream stream = File.OpenRead("man.dsm.xml");

                XmlSerializer  serializer = new XmlSerializer(typeof(XmlDsm.Package));
                XmlDsm.Package package    = (XmlDsm.Package)serializer.Deserialize(stream);

                if (package.Files.FileEntry.Any(x => x.DevicePath.Contains(@"\buildinfo.xml")))
                {
                    var entry = package.Files.FileEntry.First(x => x.DevicePath.Contains(@"\buildinfo.xml"));

                    if (File.Exists(entry.CabPath))
                    {
                        try
                        {
                            File.Delete(entry.CabPath);
                        }
                        catch
                        {
                            File.Move(entry.CabPath, Path.GetTempFileName());
                            //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("man.dsm.xml");

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