Exemple #1
0
            /*public Export(MethodInfo method)
             * {
             *  //MasterMethod = method;
             *  IList<CustomAttributeNamedArgument> fontExporterAttributes = method.CustomAttributes
             *      .Where(attrib => attrib.AttributeType == typeof(FontExporter))
             *      .First()
             *      .NamedArguments;
             *  FileTypeDescription = (string)(fontExporterAttributes
             *      .Where(member => member.MemberName == "FileTypeDescription")
             *      .First()
             *      .TypedValue
             *      .Value);
             *  FileTypeExtension = (string)(fontExporterAttributes
             *      .Where(member => member.MemberName == "FileTypeExtension")
             *      .First()
             *      .TypedValue
             *      .Value);
             *  HelpText = (string)(fontExporterAttributes
             *      .Where(member => member.MemberName == "HelpText")
             *      .First()
             *      .TypedValue
             *      .Value);
             *  DoExport = (FontExportFunction)Delegate.CreateDelegate(typeof(FontExportFunction), method);
             * }*/
            public Export(MethodInfo method)
            {
                // Thanks to merthsoft from Cemetech for coming up with this
                // code, which is much more concise and removes the .NET 4.5
                // dependancy, and actually reduces the minimum to
                // .NET 3.5 Client Profile.
                FontExporter fontExporter = (FontExporter)method.GetCustomAttributes(typeof(FontExporter), false).First();

                HelpText            = fontExporter.HelpText;
                FileTypeExtension   = fontExporter.FileTypeExtension;
                FileTypeDescription = fontExporter.FileTypeDescription;

                DoExport = (FontExportFunction)Delegate.CreateDelegate(typeof(FontExportFunction), method);
            }
Exemple #2
0
            /*public Export(MethodInfo method)
            {
                //MasterMethod = method;
                IList<CustomAttributeNamedArgument> fontExporterAttributes = method.CustomAttributes
                    .Where(attrib => attrib.AttributeType == typeof(FontExporter))
                    .First()
                    .NamedArguments;
                FileTypeDescription = (string)(fontExporterAttributes
                    .Where(member => member.MemberName == "FileTypeDescription")
                    .First()
                    .TypedValue
                    .Value);
                FileTypeExtension = (string)(fontExporterAttributes
                    .Where(member => member.MemberName == "FileTypeExtension")
                    .First()
                    .TypedValue
                    .Value);
                HelpText = (string)(fontExporterAttributes
                    .Where(member => member.MemberName == "HelpText")
                    .First()
                    .TypedValue
                    .Value);
                DoExport = (FontExportFunction)Delegate.CreateDelegate(typeof(FontExportFunction), method);
            }*/
            public Export(MethodInfo method)
            {
                // Thanks to merthsoft from Cemetech for coming up with this
                // code, which is much more concise and removes the .NET 4.5
                // dependancy, and actually reduces the minimum to
                // .NET 3.5 Client Profile.
                FontExporter fontExporter = (FontExporter)method.GetCustomAttributes(typeof(FontExporter), false).First();

                HelpText = fontExporter.HelpText;
                FileTypeExtension = fontExporter.FileTypeExtension;
                FileTypeDescription = fontExporter.FileTypeDescription;

                DoExport = (FontExportFunction)Delegate.CreateDelegate(typeof(FontExportFunction), method);
            }