Beispiel #1
0
 public DisplayableListViewItem(AssemblyDeclaration ad)
 {
     declaration = ad;
     Header      = ad.Name;
     ToolTip     = ad.Location;
     IsChecked   = ad.Enabled;
 }
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            s_Instance = this;

            Executor executor = null;

            m_Engine = MacroEngine.CreateApplicationInstance(executor);
            m_UI     = MacroUI.CreateApplicationInstance(m_Engine);


            AssemblyDeclaration Interop_Assembly = new AssemblyDeclaration("Microsoft.Office.Interop.Excel", "./", true);

            m_UI.AddAssembly(Interop_Assembly);

            Excel.Application oExcelApp = GetExcel();

            m_UI.SetExecutionValue("HOSTNAME", "Standalone App");
            m_UI.SetExecutionValue("Excel", oExcelApp.Application);
            m_UI.SetExecutionValue("MISSING", Type.Missing);

            m_UI.AddAccent("ExcelAccent", new Uri("pack://application:,,,/Macro Editor;component/Themes/Accents/ExcelAccent.xaml"));
            m_UI.AddAccent("WordAccent", new Uri("pack://application:,,,/Macro Editor;component/Themes/Accents/WordAccent.xaml"));
            m_UI.AddAccent("PowerPointAccent", new Uri("pack://application:,,,/Macro Editor;component/Themes/Accents/PowerPointAccent.xaml"));
            m_UI.AddAccent("OneNoteAccent", new Uri("pack://application:,,,/Macro Editor;component/Themes/Accents/OneNoteAccent.xaml"));
            m_UI.AddAccent("AccessAccent", new Uri("pack://application:,,,/Macro Editor;component/Themes/Accents/AccessAccent.xaml"));
            m_UI.AddAccent("OutlookAccent", new Uri("pack://application:,,,/Macro Editor;component/Themes/Accents/OutlookAccent.xaml"));
            m_UI.AddAccent("PublisherAccent", new Uri("pack://application:,,,/Macro Editor;component/Themes/Accents/PublisherAccent.xaml"));

            m_UI.SetAccent("ExcelAccent");

            Events.InvokeEvent("ApplicationLoaded");

            MainWindow = m_UI.MainWindow;
            MainWindow.Show();
        }
        public void RemoveAssembly(AssemblyDeclaration ad)
        {
            if (m_Assemblies == null)
            {
                return;
            }

            m_Assemblies.Remove(ad);
        }
        public void AddAssembly(AssemblyDeclaration ad)
        {
            if (m_Assemblies == null)
            {
                m_Assemblies = new HashSet <AssemblyDeclaration>();
            }

            m_Assemblies.Add(ad);
        }
        /// <summary>
        /// Removes an assembly from the assembly list
        /// </summary>
        /// <param name="ad">AssemblyDeclaration of the assembly</param>
        public void RemoveAssembly(AssemblyDeclaration ad)
        {
            m_Assemblies.Remove(ad);
            Events.InvokeEvent("OnAssembliesChanged");

            foreach (Lazy <IExecutionEngine, IExecutionEngineData> pair in m_ExecutionEngineImplementations)
            {
                pair.Value?.RemoveAssembly(ad);
            }
        }
Beispiel #6
0
 public override SummaryDocumentationElement GetSummary(AssemblyDeclaration assembly)
 => DocumentationElement.Summary(
     DocumentationElement.Paragraph(
         DocumentationElement.Text(
             assembly
             .Attributes
             .Single(attribute => attribute.Type == typeof(AssemblyDescriptionAttribute))
             .PositionalParameters
             .Single()
             .Value
             .ToString()
             )
         )
     );
        /// <summary>
        /// Adds an assembly to the registry
        /// </summary>
        private void AddLibrary()
        {
            string path = Files.ImportAssembly();

            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            string name = System.Reflection.Assembly.LoadFrom(path).FullName;

            AssemblyDeclaration ad = new AssemblyDeclaration(name, path, false);

            MacroUI.GetInstance().AddAssembly(ad);
        }
Beispiel #8
0
 public override RemarksDocumentationElement GetRemarks(AssemblyDeclaration assembly)
 => DocumentationElement.Remarks(
     DocumentationElement.Paragraph(
         DocumentationElement.Text("The library has a few core types that make it work: "),
         DocumentationElement.Hyperlink("Mup.IMarkupParser.html", "IMarkupParser"),
         DocumentationElement.Text(" "),
         DocumentationElement.Hyperlink("Mup.Elements.ParseTreeRootElement.html", "ParseTreeRootElement"),
         DocumentationElement.Text(" and "),
         DocumentationElement.Hyperlink("Mup.ParseTreeVisitor.html", "ParseTreeVisitor"),
         DocumentationElement.Text(".")
         ),
     DocumentationElement.Paragraph(
         DocumentationElement.Text("Each parser (currently just Creole) implements the IMarkupParser interface which exposes a number of methods that allow parsing a "),
         DocumentationElement.Hyperlink("https://docs.microsoft.com/dotnet/api/system.string?view=netstandard-1.0", "string"),
         DocumentationElement.Text(" or text from a "),
         DocumentationElement.Hyperlink("https://docs.microsoft.com/dotnet/api/system.io.textreader?view=netstandard-1.0", "TextReader"),
         DocumentationElement.Text(". Each parser supports both synchronous and asynchronous models allowing its users to consume the API any way they want.")
         ),
     DocumentationElement.Paragraph(
         DocumentationElement.Text("The result of any parse method is ultimately a "),
         DocumentationElement.Hyperlink("Mup.Elements.ParseTreeRootElement.html", "ParseTreeRootElement"),
         DocumentationElement.Text(". Surprisingly or not, this interface does not expose something like a root node or anything related to what one would expect when seeing the word \"tree\".")
         ),
     DocumentationElement.Paragraph(
         DocumentationElement.Text("This is because trees can have different representations. For instance, we can have the usual example where we have a root node which exposes a property containing a number of nodes that are in fact child nodes, each child node also exposes such a property that contains their child nodes and so on. A different representation can be a flat one where the entire tree is stored as a list of elements that mark the beginning and end of each node.")
         ),
     DocumentationElement.Paragraph(
         DocumentationElement.Text("Regardless of how we represent a parse tree, we need to be able to traverse it in order to generate a specific output, say HTML. This is where a "),
         DocumentationElement.Hyperlink("Mup.ParseTreeVisitor.html", "ParseTreeVisitor"),
         DocumentationElement.Text(" comes into play. Any "),
         DocumentationElement.Hyperlink("Mup.Elements.ParseTreeRootElement.html", "ParseTreeRootElement"),
         DocumentationElement.Text(" exposes methods that accept a "),
         DocumentationElement.Hyperlink("Mup.ParseTreeVisitor.html", "ParseTreeVisitor"),
         DocumentationElement.Text(", the entire logic for traversing the tree is encapsulated inside itself. Each time a node is being visited, a specific method for that node is called on the visitor. This helps keep the interface clean and completely decouple the language that is being parsed from the desired output format. Any new markup parser will work with existing visitors and any new visitor will work with any existing parser.")
         ),
     DocumentationElement.Paragraph(
         DocumentationElement.Text("The one common rule for all parse trees is that they are all traversed in pre-order (see "),
         DocumentationElement.Hyperlink("https://en.wikipedia.org/wiki/Tree_traversal", "Tree Traversal (Wikipedia)"),
         DocumentationElement.Text(" for more about this topic).")
         )
     );
Beispiel #9
0
        public override IEnumerable <NamespaceDocumentationAddition> GetNamespaceAdditions(AssemblyDeclaration assembly)
        {
            yield return(new MupNamespaceDocumentationAddition());

            yield return(new MupElementsNamespaceDocumentationAddition());
        }
Beispiel #10
0
 public override bool CanApply(AssemblyDeclaration assembly)
 => true;
Beispiel #11
0
 public void RemoveAssembly(AssemblyDeclaration declaration)
 {
     MacroEngine.RemoveAssembly(declaration);
 }
Beispiel #12
0
 public void AddAssembly(AssemblyDeclaration declaration)
 {
     MacroEngine.AddAssembly(declaration);
 }