コード例 #1
0
        public static void Load()
        {
            _programList = new List <PolicyProgram>();
            _xmlDoc      = new XmlDocument();

            if (!File.Exists(ConfigFileName.PolicyProgramFileName))
            {
                StreamWriter sw = new StreamWriter(ConfigFileName.PolicyProgramFileName, true, Encoding.UTF8);
                sw.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
                sw.WriteLine("<PolicyProgram>");
                sw.WriteLine("<Items>");
                sw.WriteLine("</Items>");
                sw.WriteLine("</PolicyProgram>");
                sw.Close();
            }
            _xmlDoc.Load(ConfigFileName.PolicyProgramFileName);
            XmlNode     root     = _xmlDoc.SelectSingleNode("PolicyProgram");
            XmlNode     item     = root.SelectSingleNode("Items");
            XmlNodeList programs = item.SelectNodes("Program");

            foreach (XmlNode program in programs)
            {
                string        name       = program.Attributes["name"].Value;
                string        desc       = program.SelectSingleNode("Desc").FirstChild.Value;
                string        codestring = program.SelectSingleNode("Code").InnerText;
                PolicyProgram pp         = new PolicyProgram();
                pp._name    = name;
                pp._desc    = desc;
                pp._program = Convert.FromBase64String(codestring);
                _programList.Add(pp);
            }
        }
コード例 #2
0
        public static void InsertDLL(string dllname, byte[] program, string desc)
        {
            PolicyProgram pp = new PolicyProgram();

            pp._name    = dllname;
            pp._program = program;
            pp._desc    = desc;
            _programList.Add(pp);
            InsertXML(dllname, program, desc);
        }