Ejemplo n.º 1
0
        public void LoadLibaray()
        {
            int index = comboBox1.SelectedIndex;

            comboBox1.Items.Clear();
            Libaray lib = null;

            for (int i = 0; i < ConfigStore.libarays.Count; i++)
            {
                lib = (Libaray)ConfigStore.libarays[i];
                if (lib.status != 999)
                {
                    comboBox1.Items.Add(lib.name);
                    if (lib.status == 1)
                    {
                        comboBox1.SelectedIndex = i;
                        libId = lib.id;
                    }
                }
            }
            if (index > 0 && index < comboBox1.Items.Count)
            {
                comboBox1.SelectedIndex = index;
            }
            allcount.Text = "当前总特征数:" + ConfigStore.codeTable.Count;
            SetZhunQuelv(ConfigStore.codeTable.Count);
        }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            // 导入
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = "c:\\";//注意这里写路径时要用c:\\而不是c:\
            openFileDialog.Filter           = "特征库文件(*.yar)|*.yar";
            openFileDialog.RestoreDirectory = true;
            openFileDialog.FilterIndex      = 1;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                String fName = openFileDialog.FileName;

                Libaray lib = new Libaray();
                lib.id = ConfigStore.libarays.Count < 10 ? "lib_0" + ConfigStore.libarays.Count : "lib_" + ConfigStore.libarays.Count;
                //lib.name = name;
                lib.status = 0;
                String undir = dir + "\\data\\" + lib.id + "\\";
                CommonUtil.CreateDir(undir);

                CommonUtil.unZipFile(fName, undir);

                String title   = fName.Substring(fName.LastIndexOf("\\") + 1);
                String xmlFile = undir + "data.xml";
                if (File.Exists(xmlFile))
                {
                    XmlDocument xmlDoc = new XmlDocument();
                    xmlDoc.Load(xmlFile);
                    // root节点
                    XmlNode root = xmlDoc.SelectSingleNode("datas");
                    //获取到所有<datas>的子节点
                    XmlNodeList nodeList = root.ChildNodes;
                    XmlElement  xe       = null;
                    //遍历所有子节点
                    foreach (XmlNode xn in nodeList)
                    {
                        xe = (XmlElement)xn;
                        if (xe.Name.Equals("title"))
                        {
                            title = xe.InnerText;
                            break;
                        }
                    }
                }

                lib.name = title;
                ConfigStore.libarays.Add(lib);
                XmlUtils.loadLibarayXml(xmlFile, lib.id);

                LoadLibaray();
                ConfigStore.SaveConfig();
                MessageBox.Show("导入完成!");
            }
        }
Ejemplo n.º 3
0
        public void LoadLibaray()
        {
            checkedListBox.Items.Clear();
            Libaray lib = null;

            for (int i = 0; i < ConfigStore.libarays.Count; i++)
            {
                lib = (Libaray)ConfigStore.libarays[i];
                checkedListBox.Items.Add(lib.name);
                if (lib.status == 1)
                {
                    //checkedListBox.SelectedIndex = i;
                    checkedListBox.SetItemChecked(i, true);
                }
            }
        }
Ejemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            String name = textBox1.Text;
            if(String.IsNullOrEmpty(name)){
                MessageBox.Show("请输入特征库名称!例如“12306验证码2014年版”");
            }
            else
            {
                Libaray lib = new Libaray();
                lib.id = ConfigStore.libarays.Count < 10 ? "lib_0" + ConfigStore.libarays.Count : "lib_" + ConfigStore.libarays.Count;
                lib.name = name;
                lib.status = 0;
                ConfigStore.libarays.Add(lib);
                CommonUtil.CreateDir(System.Environment.CurrentDirectory + "\\data\\" + lib.id + "\\");
                XmlUtils.CreateEmptyXml(System.Environment.CurrentDirectory + "\\data\\" + lib.id + "\\data.xml", "datas");

                this.Dispose();
            }
        }
Ejemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            String name = textBox1.Text;

            if (String.IsNullOrEmpty(name))
            {
                MessageBox.Show("请输入特征库名称!例如“12306验证码2014年版”");
            }
            else
            {
                Libaray lib = new Libaray();
                lib.id     = ConfigStore.libarays.Count < 10 ? "lib_0" + ConfigStore.libarays.Count : "lib_" + ConfigStore.libarays.Count;
                lib.name   = name;
                lib.status = 0;
                ConfigStore.libarays.Add(lib);
                CommonUtil.CreateDir(System.Environment.CurrentDirectory + "\\data\\" + lib.id + "\\");
                XmlUtils.CreateEmptyXml(System.Environment.CurrentDirectory + "\\data\\" + lib.id + "\\data.xml", "datas");

                this.Dispose();
            }
        }
Ejemplo n.º 6
0
        public void LoadLibaray()
        {
            int index = cb_lib.SelectedIndex;

            cb_lib.Items.Clear();
            Libaray lib = null;

            for (int i = 0; i < ConfigStore.libarays.Count; i++)
            {
                lib = (Libaray)ConfigStore.libarays[i];
                if (lib.status != 999)
                {
                    cb_lib.Items.Add(lib.name);
                    if (lib.status == 1)
                    {
                        cb_lib.SelectedIndex = i;
                    }
                }
            }
            if (index > 0 && index < cb_lib.Items.Count)
            {
                cb_lib.SelectedIndex = index;
            }
        }
Ejemplo n.º 7
0
        public static void loadConfig()
        {
            Program.mainForm.ShowMessage("加载系统配置...", false);
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(xmlPath);
            //查找<users>
            XmlNode root = xmlDoc.SelectSingleNode("config");
            //获取到所有<users>的子节点
            XmlNodeList nodeList = root.ChildNodes;
            //遍历所有子节点
            XmlElement xe = null, ce = null;
            Libaray lib = null;
            XmlNodeList xnl = null;
            foreach (XmlNode xn in nodeList)
            {
                xe = (XmlElement)xn;
                if (xe.Name.Equals("library"))
                {
                    xnl = xe.ChildNodes;
                    foreach (XmlNode cn in xnl)
                    {
                        ce = (XmlElement)cn;
                        lib = new Libaray();
                        lib.status = Convert.ToInt32(ce.GetAttribute("status"));
                        lib.id = ce.GetAttribute("id");
                        if(lib.status != 999){
                            lib.name = ce.InnerText;
                            libarays.Add(lib);
                        }
                        else
                        {
                            try
                            {
                                CommonUtil.DeleteDir(ConfigStore.appDir + "\\data\\" + lib.id);
                            }
                            catch {}
                        }
                    }
                }
                else if (xe.Name.Equals("users"))
                {
                    User user = null;
                    xnl = xe.ChildNodes;
                    foreach (XmlNode cn in xnl)
                    {
                        ce = (XmlElement)cn;
                        user = new User();
                        user.Acc = ce.GetAttribute("acc");
                        user.Pwd = MyEncrypt.DecryptB(ce.GetAttribute("pwd"));
                        user.Status = Convert.ToInt32(ce.GetAttribute("status"));
                        user.Name = ce.InnerText;
                        userTable.Add(user.Acc, user);
                    }
                }
                else if (xe.Name.Equals("skin"))
                {
                    skin = xe.InnerText;
                }
                else if (xe.Name.Equals("start"))
                {
                    startType = xe.InnerText;
                }
                else if (xe.Name.Equals("update"))
                {
                    updateType = xe.InnerText;
                }
                else if (xe.Name.Equals("algorithm"))
                {
                    algorithm = xe.InnerText;
                }
                else if (xe.Name.Equals("islocalhost"))
                {
                    islocalhost = Convert.ToBoolean(xe.InnerText);
                }
                else if (xe.Name.Equals("isAutoBaojing"))
                {
                    isAutoBaojing = Convert.ToBoolean(xe.InnerText);
                }
                else if (xe.Name.Equals("isAutoWriterVerify"))
                {
                    isAutoWriterVerify = Convert.ToBoolean(xe.InnerText);
                }
                else if (xe.Name.Equals("failedTimes"))
                {
                    failedTimes = Convert.ToInt32(xe.InnerText);
                }
                else if (xe.Name.Equals("fromCity"))
                {
                    fromCity = xe.InnerText;
                }
                else if (xe.Name.Equals("toCity"))
                {
                    toCity = xe.InnerText;
                }
                else if (xe.Name.Equals("bbsUser"))
                {
                    bbsUser = xe.InnerText;
                }
                else if (xe.Name.Equals("bbsPwd"))
                {
                    bbsPwd = MyEncrypt.DecryptB(xe.InnerText);
                }

            }
            Program.mainForm.ShowMessage("完成");
            SaveConfig();
        }
Ejemplo n.º 8
0
        public String GetLibId()
        {
            Libaray lib = (Libaray)ConfigStore.libarays[comboBox1.SelectedIndex];

            return(lib.id);
        }
Ejemplo n.º 9
0
        public static void loadConfig()
        {
            Program.mainForm.ShowMessage("加载系统配置...", false);
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(xmlPath);
            //查找<users>
            XmlNode root = xmlDoc.SelectSingleNode("config");
            //获取到所有<users>的子节点
            XmlNodeList nodeList = root.ChildNodes;
            //遍历所有子节点
            XmlElement  xe = null, ce = null;
            Libaray     lib = null;
            XmlNodeList xnl = null;

            foreach (XmlNode xn in nodeList)
            {
                xe = (XmlElement)xn;
                if (xe.Name.Equals("library"))
                {
                    xnl = xe.ChildNodes;
                    foreach (XmlNode cn in xnl)
                    {
                        ce         = (XmlElement)cn;
                        lib        = new Libaray();
                        lib.status = Convert.ToInt32(ce.GetAttribute("status"));
                        lib.id     = ce.GetAttribute("id");
                        if (lib.status != 999)
                        {
                            lib.name = ce.InnerText;
                            libarays.Add(lib);
                        }
                        else
                        {
                            try
                            {
                                CommonUtil.DeleteDir(ConfigStore.appDir + "\\data\\" + lib.id);
                            }
                            catch {}
                        }
                    }
                }
                else if (xe.Name.Equals("users"))
                {
                    User user = null;
                    xnl = xe.ChildNodes;
                    foreach (XmlNode cn in xnl)
                    {
                        ce          = (XmlElement)cn;
                        user        = new User();
                        user.Acc    = ce.GetAttribute("acc");
                        user.Pwd    = MyEncrypt.DecryptB(ce.GetAttribute("pwd"));
                        user.Status = Convert.ToInt32(ce.GetAttribute("status"));
                        user.Name   = ce.InnerText;
                        userTable.Add(user.Acc, user);
                    }
                }
                else if (xe.Name.Equals("skin"))
                {
                    skin = xe.InnerText;
                }
                else if (xe.Name.Equals("start"))
                {
                    startType = xe.InnerText;
                }
                else if (xe.Name.Equals("update"))
                {
                    updateType = xe.InnerText;
                }
                else if (xe.Name.Equals("algorithm"))
                {
                    algorithm = xe.InnerText;
                }
                else if (xe.Name.Equals("islocalhost"))
                {
                    islocalhost = Convert.ToBoolean(xe.InnerText);
                }
                else if (xe.Name.Equals("isAutoBaojing"))
                {
                    isAutoBaojing = Convert.ToBoolean(xe.InnerText);
                }
                else if (xe.Name.Equals("isAutoWriterVerify"))
                {
                    isAutoWriterVerify = Convert.ToBoolean(xe.InnerText);
                }
                else if (xe.Name.Equals("failedTimes"))
                {
                    failedTimes = Convert.ToInt32(xe.InnerText);
                }
                else if (xe.Name.Equals("fromCity"))
                {
                    fromCity = xe.InnerText;
                }
                else if (xe.Name.Equals("toCity"))
                {
                    toCity = xe.InnerText;
                }
                else if (xe.Name.Equals("bbsUser"))
                {
                    bbsUser = xe.InnerText;
                }
                else if (xe.Name.Equals("bbsPwd"))
                {
                    bbsPwd = MyEncrypt.DecryptB(xe.InnerText);
                }
            }
            Program.mainForm.ShowMessage("完成");
            SaveConfig();
        }
Ejemplo n.º 10
0
        private void button2_Click(object sender, EventArgs e)
        {
            // 导入
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.InitialDirectory = "c:\\";//注意这里写路径时要用c:\\而不是c:\
            openFileDialog.Filter = "特征库文件(*.yar)|*.yar";
            openFileDialog.RestoreDirectory = true;
            openFileDialog.FilterIndex = 1;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                String fName = openFileDialog.FileName;

                Libaray lib = new Libaray();
                lib.id = ConfigStore.libarays.Count < 10 ? "lib_0" + ConfigStore.libarays.Count : "lib_" + ConfigStore.libarays.Count;
                //lib.name = name;
                lib.status = 0;
                String undir = dir + "\\data\\" + lib.id + "\\";
                CommonUtil.CreateDir(undir);

                CommonUtil.unZipFile(fName, undir);

                String title = fName.Substring(fName.LastIndexOf("\\") + 1);
                String xmlFile = undir + "data.xml";
                if (File.Exists(xmlFile))
                {
                    XmlDocument xmlDoc = new XmlDocument();
                    xmlDoc.Load(xmlFile);
                    // root节点
                    XmlNode root = xmlDoc.SelectSingleNode("datas");
                    //获取到所有<datas>的子节点
                    XmlNodeList nodeList = root.ChildNodes;
                    XmlElement xe = null;
                    //遍历所有子节点
                    foreach (XmlNode xn in nodeList)
                    {
                        xe = (XmlElement)xn;
                        if (xe.Name.Equals("title"))
                        {
                            title = xe.InnerText;
                            break;
                        }
                    }
                }

                lib.name = title;
                ConfigStore.libarays.Add(lib);
                XmlUtils.loadLibarayXml(xmlFile, lib.id);

                LoadLibaray();
                ConfigStore.SaveConfig();
                MessageBox.Show("导入完成!");
            }
        }