示例#1
0
        /// <summary>
        ///     Parse
        /// </summary>
        /// <returns></returns>
        public List<HookData> Parse()
        {
            //get all hook files with extension *.hook
            var files = Directory.GetFiles(
                Path.Combine(AppDomain.CurrentDomain.BaseDirectory, hookLocation), "*.hook"
                );

            var data = new List<HookData>();

            foreach (var hookFile in files)
            {
                var doc = XDocument.Load(hookFile);
                var query = from d in doc.Root.Descendants("Command") select d;

                foreach (var q in query)
                {
                    var hook = new HookData();

                    var exe = q.Element("Executable").Value;
                    var path = q.Element("Path").Value;
                    var arg = q.Element("Arguments").Value;
                    var hookid = q.FirstAttribute.Value;
                    var mode = q.LastAttribute.Value;

                    hook.HookId = hookid;
                    hook.WorkingDir = path;
                    hook.Executable = exe;
                    hook.Arguments = arg;
                    hook.Mode = mode;

                    data.Add(hook);
                }
            }

            return data;
        }
示例#2
0
        /// <summary>
        ///     Parse
        /// </summary>
        /// <returns></returns>
        public List <HookData> Parse()
        {
            //get all hook files with extension *.hook
            var files = Directory.GetFiles(
                Path.Combine(AppDomain.CurrentDomain.BaseDirectory, hookLocation), "*.hook"
                );

            var data = new List <HookData>();

            foreach (var hookFile in files)
            {
                var doc   = XDocument.Load(hookFile);
                var query = from d in doc.Root.Descendants("Command") select d;

                foreach (var q in query)
                {
                    var hook = new HookData();

                    var exe    = q.Element("Executable").Value;
                    var path   = q.Element("Path").Value;
                    var arg    = q.Element("Arguments").Value;
                    var hookid = q.FirstAttribute.Value;
                    var mode   = q.LastAttribute.Value;

                    hook.HookId     = hookid;
                    hook.WorkingDir = path;
                    hook.Executable = exe;
                    hook.Arguments  = arg;
                    hook.Mode       = mode;

                    data.Add(hook);
                }
            }

            return(data);
        }