/// <summary>
        /// 判断是否为WIN7 以及32或64位
        /// </summary>
        /// <param name="imagex">imagex文件名,默认传imagex字段</param>
        /// <param name="wimfile">WIM文件路径</param>
        /// <returns>不是WIN7系统:0,Windows 7 STARTER(表示为32位系统镜像):1,Windows 7 HOMEBASIC(表示为64位系统镜像):2</returns>
        public static int Iswin7(string imagex, string wimfile)
        {
            ProcessManager.SyncCMD("\"" + WTGModel.applicationFilesPath + "\\" + imagex + "\"" + " /info \"" + wimfile + "\" /xml > " + "\"" + WTGModel.logPath + "\\wiminfo.xml\"");
            XmlDocument xml = new XmlDocument();

            System.Xml.XmlDocument   doc    = new System.Xml.XmlDocument();
            System.Xml.XmlNodeReader reader = null;

            string strFilename = WTGModel.logPath + "\\wiminfo.xml";

            if (!File.Exists(strFilename))
            {
                //MsgManager.getResString("Msg_wiminfoerror")
                //WIM文件信息获取失败\n将按WIN8系统安装
                Log.WriteLog("Iswin7.log", strFilename + "文件不存在");
                //MessageBox.Show(strFilename + MsgManager.getResString("Msg_wiminfoerror", MsgManager.ci));
                return(0);
            }
            try
            {
                doc.Load(strFilename);
                reader = new System.Xml.XmlNodeReader(doc);
                while (reader.Read())
                {
                    if (reader.IsStartElement("NAME"))
                    {
                        //从找到的这个依次往下读取节点
                        System.Xml.XmlNode aa = doc.ReadNode(reader);
                        if (aa.InnerText == "Windows 7 STARTER")
                        {
                            return(1);
                        }
                        else if (aa.InnerText == "Windows 7 HOMEBASIC")
                        {
                            return(2);
                        }
                        else
                        {
                            return(0);
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                Log.WriteLog("Iswin7.log", strFilename + "\n" + ex.ToString());
                //MessageBox.Show(strFilename + MsgManager.getResString("Msg_wiminfoerror", MsgManager.ci) + ex.ToString());
                return(0);
            }



            return(0);
        }
        /// <summary>
        /// Loads the image editors into the application from the editors.xml file.
        /// </summary>
        public static void Load()
        {
            if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + XML_FILE))
            {
                XmlDocument xdoc = new XmlDocument();
                xdoc.Load(AppDomain.CurrentDomain.BaseDirectory + XML_FILE);

                XmlNodeList xeditors = xdoc.SelectNodes(EDITOR_XPATH);

                foreach (XmlNode xeditor in xeditors)
                {
                    Editor editor = new Editor();
                    XmlNodeReader xreader = new XmlNodeReader(xeditor);

                    while (xreader.Read())
                    {
                        if (xreader.IsStartElement())
                        {
                            switch (xreader.Name)
                            {
                                case EDITOR_NAME:
                                    xreader.Read();
                                    editor.Name = xreader.Value;
                                    break;

                                case EDITOR_APPLICATION:
                                    xreader.Read();
                                    editor.Application = xreader.Value;
                                    break;

                                case EDITOR_ARGUMENTS:
                                    xreader.Read();
                                    editor.Arguments = xreader.Value;
                                    break;
                            }
                        }
                    }

                    xreader.Close();

                    if (!string.IsNullOrEmpty(editor.Name) &&
                        !string.IsNullOrEmpty(editor.Application) &&
                        !string.IsNullOrEmpty(editor.Arguments))
                    {
                        EditorCollection.Add(editor);
                    }
                }
            }
        }
示例#3
0
        /// <summary>
        /// 判断是否为WIN7 以及32或64位
        /// </summary>
        /// <param name="imagex">imagex文件名,默认传imagex字段</param>
        /// <param name="wimfile">WIM文件路径</param>
        /// <returns>不是WIN7系统:0,Windows 7 STARTER(表示为32位系统镜像):1,Windows 7 HOMEBASIC(表示为64位系统镜像):2</returns>
        public static int Iswin7(string imagex, string wimfile)
        {
            ProcessManager.SyncCMD("\"" + WTGModel.applicationFilesPath + "\\" + imagex + "\"" + " /info \"" + wimfile + "\" /xml > " + "\"" + WTGModel.logPath + "\\wiminfo.xml\"");
            XmlDocument xml = new XmlDocument();

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            System.Xml.XmlNodeReader reader = null;

            string strFilename = WTGModel.logPath + "\\wiminfo.xml";
            if (!File.Exists(strFilename))
            {
                //MsgManager.getResString("Msg_wiminfoerror")
                //WIM文件信息获取失败\n将按WIN8系统安装
                Log.WriteLog("Iswin7.log", strFilename + "文件不存在");
                //MessageBox.Show(strFilename + MsgManager.getResString("Msg_wiminfoerror", MsgManager.ci));
                return 0;
            }
            try
            {
                doc.Load(strFilename);
                reader = new System.Xml.XmlNodeReader(doc);
                while (reader.Read())
                {
                    if (reader.IsStartElement("NAME"))
                    {

                        //从找到的这个依次往下读取节点
                        System.Xml.XmlNode aa = doc.ReadNode(reader);
                        if (aa.InnerText == "Windows 7 STARTER")
                        {
                            return 1;
                        }
                        else if (aa.InnerText == "Windows 7 HOMEBASIC")
                        {
                            return 2;
                        }
                        else { return 0; }
                    }
                }
            }

            catch (Exception ex)
            {
                Log.WriteLog("Iswin7.log", strFilename + "\n" + ex.ToString());
                //MessageBox.Show(strFilename + MsgManager.getResString("Msg_wiminfoerror", MsgManager.ci) + ex.ToString());
                return 0;
            }



            return 0;
        }