コード例 #1
0
        public override StringBuilder Execute(Dictionary <string, StringBuilder> values, IWorkspace theWorkspace)
        {
            var serializer = new Dev2JsonSerializer();

            try
            {
                var dbSource    = serializer.Deserialize <PluginSourceDefinition>(values["source"]);
                var containsKey = values.ContainsKey("fetchJson");


                var services = new PluginServices();
                var src      = ResourceCatalog.Instance.GetResource <PluginSource>(GlobalConstants.ServerWorkspaceID, dbSource.Id);
                var methods  = containsKey ? services.NamespacesWithJsonObjects(src, Guid.Empty, Guid.Empty).Select(a => a as INamespaceItem).ToList()
                    : services.Namespaces(src, Guid.Empty, Guid.Empty).Select(a => a as INamespaceItem).ToList();
                return(serializer.SerializeToBuilder(new ExecuteMessage()
                {
                    HasError = false,
                    Message = serializer.SerializeToBuilder(methods)
                }));
            }
            catch (Exception e)
            {
                return(serializer.SerializeToBuilder(new ExecuteMessage()
                {
                    HasError = true,
                    Message = new StringBuilder(e.Message)
                }));
            }
        }