Exemplo n.º 1
0
        /// <summary>
        /// Gets git diff entries.
        /// </summary>
        /// <param name="snippet">The <see cref="ISnippet"/> containing diff entries.</param>
        /// <param name="position">The position the starting diff entry that exists in the git diff.</param>
        /// <param name="lineNumber">The starting line number of the diff entry.</param>
        /// <returns><see cref="IReadOnlyList{T}"/> of <see cref="GitDiffEntry"/>.</returns>
        public IReadOnlyList<GitDiffEntry> GetList(ISnippet snippet, int position, int lineNumber)
        {
            if (snippet == null)
            {
                throw new ArgumentNullException("snippet");
            }

            var gitDiff = new List<GitDiffEntry>();

            gitDiff.AddRange(
                snippet.OriginalLines.SelectMany(line => line.Spans)
                    .Where(span => span.Kind == SpanKind.Equal)
                    .Select(originalLine => new EqualGitDiffEntry(position++)));

            gitDiff.AddRange(
                snippet.OriginalLines.SelectMany(line => line.Spans)
                    .Where(span => span.Kind == SpanKind.Deletion)
                    .Select(line => new ModificationGitDiffEntry(position++, GitDiffEntryStatus.Removed, default(int))));

            gitDiff.AddRange(
                snippet.ModifiedLines.SelectMany(line => line.Spans)
                    .Where(span => span.Kind == SpanKind.Addition)
                    .Select(line => new ModificationGitDiffEntry(position++, GitDiffEntryStatus.New, lineNumber++)));

            return gitDiff;
        }
Exemplo n.º 2
0
        internal static IHtmlString SnippetInternal(this HtmlHelper html, ISnippet snippet, string editType = "html", bool htmlEncode = false, string tagName = "div", string cssClass = null, bool liquidEnabled = LiquidExtensions.LiquidEnabledDefault, Context liquidContext = null, string defaultValue = null)
        {
            if (snippet == null)
            {
                throw new ArgumentNullException("snippet");
            }

            string snippetDisplayName = snippet.DisplayName ?? snippet.Name;

            return(html.AttributeInternal(snippet.Value, editType, snippetDisplayName, htmlEncode, tagName, cssClass, liquidEnabled, liquidContext, defaultValue, snippet.LanguageName));
        }
Exemplo n.º 3
0
 public void Add(ISnippet snippet, string header)
 {
     if (snippet is SnippetParent)
     {
         var parentSnippet = snippet as SnippetParent;
         parentSnippet.Childrens.Add(new SnippetChild()
         {
             Header = header
         });
     }
     else
     {
         SnippetsCollection.Add(new SnippetParent()
         {
             Header = header
         });
     }
 }
Exemplo n.º 4
0
        public void Remove(ISnippet snippet)
        {
            if (snippet is SnippetParent)
            {
                SnippetsCollection.Remove(snippet as SnippetParent);
            }
            else
            {
                var snippetChild  = snippet as SnippetChild;
                var snippetParent = (from snip in SnippetsCollection
                                     where snip.Childrens.Contains(snippetChild)
                                     select snip).FirstOrDefault();

                if (!snippetParent.Equals(null))
                {
                    snippetParent.Childrens.Remove(snippetChild);
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Renders a a Snippet (adx_contentsnippet) value, with no encoding or other modification.
        /// </summary>
        /// <param name="html">Extension method target, provides support for HTML rendering and access to view context/data.</param>
        /// <param name="snippet">The <see cref="ISnippet"/> to be rendered.</param>
        /// <param name="defaultValue">An optional default value to be returned if the snippet has no value.</param>
        /// <returns>
        /// A literal content snippet value, or <paramref name="defaultValue"/>, if the snippet has no value. If <paramref name="defaultValue"/>
        /// is also null, returns an empty string.
        /// </returns>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="snippet"/> is null.</exception>
        public static string SnippetLiteral(this HtmlHelper html, ISnippet snippet, string defaultValue = null, bool liquidEnabled = LiquidExtensions.LiquidEnabledDefault)
        {
            if (snippet == null)
            {
                throw new ArgumentNullException("snippet");
            }

            var snippetValue = snippet.Value.Value;

            if (snippetValue == null)
            {
                return(liquidEnabled && defaultValue != null
                                        ? html.Liquid(defaultValue)
                                        : defaultValue);
            }

            return(liquidEnabled
                                ? html.Liquid(snippetValue.ToString())
                                : snippetValue.ToString());
        }
Exemplo n.º 6
0
        public DataSet CompileAndRun(string language, string code)
        {
            Assembly a = compile(language, code, true, null);

            Type[] types = a.GetExportedTypes();
            foreach (Type type in types)
            {
                object o = a.CreateInstance(type.FullName);
                if (o != null)
                {
                    ISnippet snip = o as ISnippet;

                    if (snip != null)
                    {
                        DataSet ds = snip.GetMyData();
                        return(ds);
                    }
                }
            }
            throw new SQL8rException("Could not find type implementing ISnippet");
        }
Exemplo n.º 7
0
        private void ShowDialog(DialogType dialogType, ISnippet selectedSnippet)
        {
            if (dialogType == DialogType.Add)
            {
                DialogTextBlockText     = string.Format("Enter name for new node inside a *{0}* tree", selectedSnippet?.Header);
                DialogTextBoxVisibility = Visibility.Visible;
                DialogIsOpen            = true;
            }
            else if (dialogType == DialogType.Rename)
            {
                DialogTextBlockText     = string.Format("Enter new name for *{0}* node", selectedSnippet?.Header);
                DialogTextBoxVisibility = Visibility.Visible;
                DialogIsOpen            = true;
            }
            else if (dialogType == DialogType.Delete)
            {
                DialogTextBlockText     = string.Format("Are you sure you want to delete *{0}* node?\nAll children nodes will be lost as well.", selectedSnippet?.Header);
                DialogTextBoxVisibility = Visibility.Collapsed;
                DialogIsOpen            = true;
            }

            currentDialogType = dialogType;
        }
 public void Initialize(ISnippet snippet)
 {
     Snippet = snippet;
 }
 public List <ReturnType> ShutDownAction <ReturnType>(ISnippet <ReturnType> t) where ReturnType : class, new()
 {
     t.Execute();
     return(t.ExecutionResult());
 }
Exemplo n.º 10
0
        public async static Task LoadPlugins(string projectsDirectory)
        {
            ICollection <Type> pluginTypes    = new List <Type>();
            ICollection <Type> snippetTypes   = new List <Type>();
            ICollection <Type> runPluginTypes = new List <Type>();

            await Task.Run(() =>
            {
                List <string> dllFileNames = new List <string>();
                foreach (var path in System.IO.Directory.GetFiles(projectsDirectory, "*.dll"))
                {
                    dllFileNames.Add(path);
                }
                ICollection <Assembly> assemblies = new List <Assembly>();
                foreach (string dllFile in dllFileNames)
                {
                    try
                    {
                        AssemblyName an   = AssemblyName.GetAssemblyName(dllFile);
                        Assembly assembly = Assembly.Load(an);
                        assemblies.Add(assembly);
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex, "");
                    }
                }
                foreach (Assembly assembly in assemblies)
                {
                    if (assembly != null)
                    {
                        try
                        {
                            Type[] types = assembly.GetTypes();
                            foreach (Type type in types)
                            {
                                if (type.IsInterface || type.IsAbstract)
                                {
                                    continue;
                                }
                                else
                                {
                                    if (type.GetInterface(typeof(IPlugin).FullName) != null)
                                    {
                                        pluginTypes.Add(type);
                                    }
                                    if (type.GetInterface(typeof(IDetectorPlugin).FullName) != null)
                                    {
                                        Plugins.detectorPluginTypes.Add(type.FullName, type);
                                    }
                                    if (type.GetInterface(typeof(ISnippet).FullName) != null)
                                    {
                                        snippetTypes.Add(type);
                                    }
                                    if (type.GetInterface(typeof(IRunPlugin).FullName) != null)
                                    {
                                        runPluginTypes.Add(type);
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            Log.Error(ex, "loadPlugins");
                        }
                    }
                }
            });

            foreach (Type type in pluginTypes)
            {
                try
                {
                    IPlugin plugin = (IPlugin)Activator.CreateInstance(type);
                    Log.Information("Initialize plugin " + plugin.Name);
                    // SetStatus("Initialize plugin " + plugin.Name);
                    plugin.Initialize();
                    recordPlugins.Add(plugin);
                }
                catch (Exception ex)
                {
                    Log.Error(ex.ToString());
                }
            }
            foreach (Type type in snippetTypes)
            {
                try
                {
                    ISnippet plugin = (ISnippet)Activator.CreateInstance(type);
                    Log.Information("Initialize snippet " + plugin.Name);
                    Snippets.Add(plugin);
                }
                catch (Exception ex)
                {
                    Log.Error(ex.ToString());
                }
            }
            foreach (Type type in runPluginTypes)
            {
                try
                {
                    IRunPlugin plugin = (IRunPlugin)Activator.CreateInstance(type);
                    Log.Information("Initialize RunPlugin " + plugin.Name);
                    runPlugins.Add(plugin);
                }
                catch (Exception ex)
                {
                    Log.Error(ex.ToString());
                }
            }
        }
Exemplo n.º 11
0
        public static void LoadPlugins(IOpenRPAClient client, string projectsDirectory)
        {
            var sw = new System.Diagnostics.Stopwatch();

            sw.Start();
            Log.Information("LoadPlugins::begin " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
            ICollection <Type> alltypes             = new List <Type>();
            ICollection <Type> pluginTypes          = new List <Type>();
            ICollection <Type> snippetTypes         = new List <Type>();
            ICollection <Type> runPluginTypes       = new List <Type>();
            ICollection <Type> IDetectorPluginTypes = new List <Type>();

            List <string> dllFileNames = new List <string>();

            foreach (var path in System.IO.Directory.GetFiles(projectsDirectory, "*.dll"))
            {
                dllFileNames.Add(path);
            }
            ICollection <Assembly> assemblies = new List <Assembly>();

            foreach (string dllFile in dllFileNames)
            {
                try
                {
                    // if (dllFile.Contains("OpenRPA.Interfaces.")) continue;
                    if (dllFile.Contains("DotNetProjects."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("Emgu."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("Microsoft.CodeAnalysis."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("Microsoft.Office."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("NuGet."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("System.Collections."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("System.ComponentModel."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("System.Composition."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("System.Data."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("System.Diagnostics."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("System.Globalization."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("System.IO."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("System.Linq."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("System.Net."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("System.Reflection."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("System.Resources."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("System.Runtime."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("System.Security."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("System.Text."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("System.Threading."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("System.Xml."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("System.Windows."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("ToastNotifications."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("Xceed.Wpf."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("ControlzEx."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("MahApps."))
                    {
                        continue;
                    }
                    if (dllFile.Contains("Interop.SAPFEWSELib"))
                    {
                        continue;
                    }
                    if (dllFile.Contains("Interop.SapROTWr"))
                    {
                        continue;
                    }
                    AssemblyName an       = AssemblyName.GetAssemblyName(dllFile);
                    Assembly     assembly = Assembly.Load(an);
                    assemblies.Add(assembly);
                }
                catch (Exception ex)
                {
                    Log.Error(ex, "");
                }
            }
            Log.Information("LoadPlugins::Get types " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
            foreach (var a in assemblies)
            {
                try
                {
                    foreach (var s in a.GetTypes())
                    {
                        alltypes.Add(s);
                    }
                }
                catch (Exception) { }
            }

            Log.Information("LoadPlugins::Get all IRecordPlugins " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
            var IRecordPlugintype = typeof(IRecordPlugin);

            foreach (var p in alltypes)
            {
                try
                {
                    if (IRecordPlugintype.IsAssignableFrom(p) && p.IsInterface == false)
                    {
                        pluginTypes.Add(p);
                    }
                }
                catch (Exception) { }
            }
            Log.Information("LoadPlugins::Get all IDetectorPlugin " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
            var IDetectorPlugintype = typeof(IDetectorPlugin);

            foreach (var p in alltypes)
            {
                try
                {
                    if (IDetectorPlugintype.IsAssignableFrom(p) && p.IsInterface == false)
                    {
                        IDetectorPluginTypes.Add(p);
                    }
                }
                catch (Exception) { }
            }

            Log.Information("LoadPlugins::Get all ISnippet " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
            var ISnippettype = typeof(ISnippet);

            foreach (var p in alltypes)
            {
                try
                {
                    if (ISnippettype.IsAssignableFrom(p) && p.IsInterface == false)
                    {
                        snippetTypes.Add(p);
                    }
                }
                catch (Exception) { }
            }

            Log.Information("LoadPlugins::Get all IRunPlugin " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
            var IRunPlugintype = typeof(IRunPlugin);

            foreach (var p in alltypes)
            {
                try
                {
                    if (IRunPlugintype.IsAssignableFrom(p) && p.IsInterface == false)
                    {
                        runPluginTypes.Add(p);
                    }
                }
                catch (Exception) { }
            }

            foreach (var type in IDetectorPluginTypes)
            {
                Plugins.detectorPluginTypes.Add(type.FullName, type);
            }
            foreach (Type type in pluginTypes)
            {
                try
                {
                    IRecordPlugin plugin = (IRecordPlugin)Activator.CreateInstance(type);
                    Log.Information("LoadPlugins::Initialize plugin " + plugin.Name + " " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
                    // SetStatus("Initialize plugin " + plugin.Name);
                    plugin.Initialize(client);
                    GenericTools.RunUI(() => recordPlugins.Add(plugin));
                }
                catch (Exception ex)
                {
                    Log.Error(ex.ToString());
                }
            }
            foreach (Type type in snippetTypes)
            {
                try
                {
                    ISnippet plugin = (ISnippet)Activator.CreateInstance(type);
                    Log.Information("LoadPlugins::Initialize snippet " + plugin.Name + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
                    Snippets.Add(plugin);
                }
                catch (Exception ex)
                {
                    Log.Error(ex.ToString());
                }
            }
            foreach (Type type in runPluginTypes)
            {
                try
                {
                    IRunPlugin plugin = (IRunPlugin)Activator.CreateInstance(type);
                    Log.Information("LoadPlugins::Initialize RunPlugin " + plugin.Name + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
                    plugin.Initialize(client);
                    GenericTools.RunUI(() => runPlugins.Add(plugin));
                }
                catch (Exception ex)
                {
                    Log.Error(ex.ToString());
                }
            }
            Log.Information("LoadPlugins::end " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
        }
Exemplo n.º 12
0
 /// <summary>
 /// Renders an HTML structure containing a Snippet (adx_contentsnippet) value as text, with support for inline CMS text editing
 /// for users with permission.
 /// </summary>
 /// <param name="html">Extension method target, provides support for HTML rendering and access to view context/data.</param>
 /// <param name="snippet">The <see cref="ISnippet"/> to be rendered.</param>
 /// <param name="htmlEncode">
 /// Whether or not the string value of the snippet should be rendered as HTML encoded. Set to false for fields that are
 /// intended to support HTML content, and to true for attributes that are not.
 /// </param>
 /// <param name="tagName">
 /// The HTML element name that will be used to enclose the literal snippet value. These enclosing elements are required
 /// by the CMS editing system. A DIV tag is used by default, and this is the element that should be used in most situations.
 /// </param>
 /// <param name="cssClass">
 /// A class attribute value that will be applied to the outermost container element rendered this helper.
 /// </param>
 /// <param name="defaultValue">
 /// Provide a default value to be rendered in the case that the snippet does not exist, or has no value.
 /// </param>
 /// <returns>
 /// An HTML structure containing a CRM entity attribute value as text, with support for inline CMS editing for users with
 /// permission.
 /// </returns>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="snippet"/> is null.</exception>
 public static IHtmlString TextSnippet(this HtmlHelper html, ISnippet snippet, bool htmlEncode = true, string tagName = "div", string cssClass = null, bool liquidEnabled = LiquidExtensions.LiquidEnabledDefault, string defaultValue = null)
 {
     return(Snippet(html, snippet, "text", htmlEncode, tagName, cssClass, liquidEnabled, defaultValue));
 }
Exemplo n.º 13
0
 /// <summary>
 /// Renders an HTML structure containing a Snippet (adx_contentsnippet) value as text, with support for inline CMS editing
 /// for users with permission.
 /// </summary>
 /// <param name="html">Extension method target, provides support for HTML rendering and access to view context/data.</param>
 /// <param name="snippet">The <see cref="ISnippet"/> to be rendered.</param>
 /// <param name="editType">
 /// The type of CMS editing interface to use for this snippet. The values "text" and "html" are supported by default.
 /// </param>
 /// <param name="htmlEncode">
 /// Whether or not the string value of the attribute should be rendered as HTML encoded. Set to false for fields that are
 /// intended to support HTML content, and to true for attributes that are not.
 /// </param>
 /// <param name="tagName">
 /// The HTML element name that will be used to enclose the literal attribute value. These enclosing elements are required
 /// by the CMS editing system. A DIV tag is used by default, and this is the element that should be used in most situations.
 /// </param>
 /// <param name="cssClass">
 /// A class attribute value that will be applied to the outermost container element rendered this helper.
 /// </param>
 /// <param name="defaultValue">
 /// Provide a default value to be rendered in the case that the snippet does not exist, or has no value.
 /// </param>
 /// <returns>
 /// An HTML structure containing a CRM entity attribute value as text, with support for inline CMS editing for users with
 /// permission.
 /// </returns>
 /// <exception cref="ArgumentNullException">Thrown if <see cref="ArgumentNullException"/> is null.</exception>
 public static IHtmlString Snippet(this HtmlHelper html, ISnippet snippet, string editType = "html", bool htmlEncode = false, string tagName = "div", string cssClass = null, bool liquidEnabled = LiquidExtensions.LiquidEnabledDefault, string defaultValue = null)
 {
     return(html.SnippetInternal(snippet, editType, htmlEncode, tagName, cssClass, liquidEnabled, defaultValue: defaultValue));
 }
Exemplo n.º 14
0
 public void Rename(ISnippet snippet, string newHeader)
 {
     snippet.Rename(newHeader);
 }
 public SnippetCompletionData(ISnippet content)
 {
     _snippet = content;
 }
Exemplo n.º 16
0
        public static void LoadPlugins(IOpenRPAClient client)
        {
            var sw = new System.Diagnostics.Stopwatch();

            sw.Start();

            IEnumerable <System.Reflection.Assembly> assemblies = AppDomain.CurrentDomain.GetAssemblies().OrderBy(a => a.GetName().Name);
            ICollection <Type> alltypes             = new List <Type>();
            ICollection <Type> pluginTypes          = new List <Type>();
            ICollection <Type> snippetTypes         = new List <Type>();
            ICollection <Type> runPluginTypes       = new List <Type>();
            ICollection <Type> IDetectorPluginTypes = new List <Type>();

            Log.Information("LoadPlugins::Get types " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
            foreach (var a in assemblies)
            {
                try
                {
                    foreach (var s in a.GetTypes())
                    {
                        alltypes.Add(s);
                    }
                }
                catch (Exception) { }
            }

            Log.Information("LoadPlugins::Get all IRecordPlugins " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
            var IRecordPlugintype = typeof(IRecordPlugin);

            foreach (var p in alltypes)
            {
                try
                {
                    if (IRecordPlugintype.IsAssignableFrom(p) && p.IsInterface == false)
                    {
                        pluginTypes.Add(p);
                    }
                }
                catch (Exception) { }
            }
            Log.Information("LoadPlugins::Get all IDetectorPlugin " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
            var IDetectorPlugintype = typeof(IDetectorPlugin);

            foreach (var p in alltypes)
            {
                try
                {
                    if (IDetectorPlugintype.IsAssignableFrom(p) && p.IsInterface == false)
                    {
                        IDetectorPluginTypes.Add(p);
                    }
                }
                catch (Exception) { }
            }

            Log.Information("LoadPlugins::Get all ISnippet " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
            var ISnippettype = typeof(ISnippet);

            foreach (var p in alltypes)
            {
                try
                {
                    if (ISnippettype.IsAssignableFrom(p) && p.IsInterface == false)
                    {
                        snippetTypes.Add(p);
                    }
                }
                catch (Exception) { }
            }

            Log.Information("LoadPlugins::Get all IRunPlugin " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
            var IRunPlugintype = typeof(IRunPlugin);

            foreach (var p in alltypes)
            {
                try
                {
                    if (IRunPlugintype.IsAssignableFrom(p) && p.IsInterface == false)
                    {
                        runPluginTypes.Add(p);
                    }
                }
                catch (Exception) { }
            }
            Log.Information("LoadPlugins::Get all ICustomWorkflowExtension " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
            var WorkflowExtensiontype = typeof(ICustomWorkflowExtension);

            foreach (var p in alltypes)
            {
                try
                {
                    if (WorkflowExtensiontype.IsAssignableFrom(p) && p.IsInterface == false)
                    {
                        if (!WorkflowExtensionsTypes.Contains(p))
                        {
                            WorkflowExtensionsTypes.Add(p);
                        }
                    }
                }
                catch (Exception) { }
            }


            foreach (var type in IDetectorPluginTypes)
            {
                if (!detectorPluginTypes.ContainsKey(type.FullName))
                {
                    detectorPluginTypes.Add(type.FullName, type);
                }
            }
            foreach (Type type in pluginTypes)
            {
                try
                {
                    IRecordPlugin plugin = null;
                    foreach (var p in recordPlugins)
                    {
                        if (p.GetType() == type)
                        {
                            plugin = p;
                            break;
                        }
                    }
                    if (plugin == null)
                    {
                        plugin = (IRecordPlugin)Activator.CreateInstance(type);
                        Log.Information("LoadPlugins::Initialize plugin " + plugin.Name + " " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
                        // SetStatus("Initialize plugin " + plugin.Name);
                        plugin.Initialize(client);
                        GenericTools.RunUI(() => recordPlugins.Add(plugin));
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex.ToString());
                }
            }
            foreach (Type type in snippetTypes)
            {
                try
                {
                    ISnippet plugin = null;
                    foreach (var p in Snippets)
                    {
                        if (p.GetType() == type)
                        {
                            plugin = p;
                            break;
                        }
                    }
                    if (plugin == null)
                    {
                        plugin = (ISnippet)Activator.CreateInstance(type);
                        Log.Information("LoadPlugins::Initialize snippet " + plugin.Name + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
                        Snippets.Add(plugin);
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex.ToString());
                }
            }
            foreach (Type type in runPluginTypes)
            {
                try
                {
                    IRunPlugin plugin = null;
                    foreach (var p in runPlugins)
                    {
                        if (p.GetType() == type)
                        {
                            plugin = p;
                            break;
                        }
                    }

                    if (plugin == null)
                    {
                        plugin = (IRunPlugin)Activator.CreateInstance(type);
                        Log.Information("LoadPlugins::Initialize RunPlugin " + plugin.Name + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
                        plugin.Initialize(client);
                        GenericTools.RunUI(() => runPlugins.Add(plugin));
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex.ToString());
                }
            }
            Log.Information("LoadPlugins::end " + string.Format("{0:mm\\:ss\\.fff}", sw.Elapsed));
        }
Exemplo n.º 17
0
 /// <summary>
 /// Renders an HTML structure containing a Snippet (adx_contentsnippet) value as text, with support for inline CMS HTML editing
 /// for users with permission.
 /// </summary>
 /// <param name="html">Extension method target, provides support for HTML rendering and access to view context/data.</param>
 /// <param name="snippet">The <see cref="ISnippet"/> to be rendered.</param>
 /// <param name="cssClass">
 /// A class attribute value that will be applied to the outermost container element rendered this helper.
 /// </param>
 /// <param name="defaultValue">
 /// Provide a default value to be rendered in the case that the snippet does not exist, or has no value.
 /// </param>
 /// <returns>
 /// An HTML structure containing a CRM entity attribute value as text, with support for inline CMS editing for users with
 /// permission.
 /// </returns>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="snippet"/> is null.</exception>
 public static IHtmlString HtmlSnippet(this HtmlHelper html, ISnippet snippet, string cssClass = null, bool liquidEnabled = LiquidExtensions.LiquidEnabledDefault, string defaultValue = null)
 {
     return(Snippet(html, snippet, "html", false, "div", cssClass, liquidEnabled, defaultValue));
 }
Exemplo n.º 18
0
 private static void SnippetMgr_SnippetCalled(ISnippet snippet)
 {
 }