コード例 #1
0
        void VerifyMacroAssembly()
        {
            var path = ProjectInfo.GetAssemblyReferencesString(this);

            if (!File.Exists(path))
            {
                //var message = "A macro project reference can't be verified as the project has not been compiled yet.";
                //OLEMSGICON icon = OLEMSGICON.OLEMSGICON_QUERY;
                //OLEMSGBUTTON buttons = OLEMSGBUTTON.OLEMSGBUTTON_YESNO;
                //OLEMSGDEFBUTTON defaultButton = OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_SECOND;
                //var res = VsShellUtilities.ShowMessageBox(ProjectMgr.Site,
                //  message, NemerleConstants.ProductName, icon, buttons, defaultButton);

                //if (res == VSConstants.S_OK)
                //  return;

                //throw new FileNotFoundException("Macro assembly not found", path);
                return;
            }

            var assembly  = Assembly.Load(File.ReadAllBytes(path));
            var macroDefs = assembly.GetCustomAttributes(false).Where(t => t.GetType().FullName == "Nemerle.Internal.ContainsMacroAttribute");

            if (macroDefs.Count() == 0)
            {
                var operDefs = assembly.GetCustomAttributes(false).Where(t => t.GetType().FullName == "Nemerle.Internal.OperatorAttribute");

                if (operDefs.Count() == 0)
                {
                    throw new InvalidOperationException("This assembly not contains macros.");
                }
            }
        }
コード例 #2
0
        void VerifyMacroAssembly()
        {
            var path = ProjectInfo.GetAssemblyReferencesString(this);

            if (!File.Exists(path))
            {
                throw new FileNotFoundException("Macro assembly not found", path);
            }

            var assembly  = Assembly.Load(File.ReadAllBytes(path));
            var macroDefs = assembly.GetCustomAttributes(false).Where(t => t.GetType().FullName == "Nemerle.Internal.ContainsMacroAttribute");

            if (macroDefs.Count() == 0)
            {
                var operDefs = assembly.GetCustomAttributes(false).Where(t => t.GetType().FullName == "Nemerle.Internal.OperatorAttribute");

                if (operDefs.Count() == 0)
                {
                    throw new InvalidOperationException("This assembly not contains macros.");
                }
            }
        }