Exemple #1
0
        private List <FilterModuleDescription> GetSubFilter(ModuleDescriptionStructure module)
        {
            var result       = new List <FilterModuleDescription>();
            var filterModule = FilterModuleDescription.GetFilterModuleDescription(module);

            if (filterModule == null)
            {
                return(result);
            }
            result.Add(filterModule);
            if (module.NextModule != IntPtr.Zero)
            {
                ModuleDescriptionStructure nextModule = (ModuleDescriptionStructure)Marshal.PtrToStructure(module.NextModule, typeof(ModuleDescriptionStructure));
                var data = GetSubFilter(nextModule);
                if (data.Count > 0)
                {
                    result.AddRange(data);
                }
            }
            return(result);
        }
        internal static FilterModuleDescription GetFilterModuleDescription(ModuleDescriptionStructure module)
        {
            if (module.Name == IntPtr.Zero)
            {
                return(null);
            }
            var result = new FilterModuleDescription();

#if NET20
            result.Name      = IntPtrExtensions.ToStringAnsi(module.Name);
            result.ShortName = IntPtrExtensions.ToStringAnsi(module.ShortName);
            result.LongName  = IntPtrExtensions.ToStringAnsi(module.LongName);
            result.Help      = IntPtrExtensions.ToStringAnsi(module.Help);
#else
            result.Name      = module.Name.ToStringAnsi();
            result.ShortName = module.ShortName.ToStringAnsi();
            result.LongName  = module.LongName.ToStringAnsi();
            result.Help      = module.Help.ToStringAnsi();
#endif
            return(result);
        }