Beispiel #1
0
        // POST: Service/PluginServices/Namespaces
        public virtual NamespaceList Namespaces(ComPluginSource args, Guid workspaceId, Guid dataListId)
        {
            var result = new NamespaceList();

            try
            {
                if (args != null)
                {
                    var broker = new ComPluginBroker();
                    return(broker.GetNamespaces(args));
                }
            }
            catch (BadImageFormatException e)
            {
                RaiseError(e);
                throw;
            }
            catch (Exception ex) when(ex is COMException)
            {
                throw;
            }
            catch (Exception ex)
            {
                RaiseError(ex);
            }
            return(result);
        }
Beispiel #2
0
        protected virtual RecordsetList FetchRecordset(ComPluginService pluginService, bool addFields)
        {
            if (pluginService == null)
            {
                throw new ArgumentNullException(nameof(pluginService));
            }
            var broker            = new ComPluginBroker();
            var outputDescription = broker.TestPlugin(pluginService);
            var dataSourceShape   = outputDescription.DataSourceShapes[0];
            var recSet            = outputDescription.ToRecordsetList(pluginService.Recordsets, GlobalConstants.PrimitiveReturnValueTag);

            if (recSet != null)
            {
                foreach (var recordset in recSet)
                {
                    foreach (var field in recordset.Fields)
                    {
                        if (string.IsNullOrEmpty(field.Name))
                        {
                            continue;
                        }
                        var path    = field.Path;
                        var rsAlias = string.IsNullOrEmpty(field.RecordsetAlias) ? "" : field.RecordsetAlias.Replace("()", "");

                        var value = string.Empty;
                        if (!string.IsNullOrEmpty(field.Alias))
                        {
                            value = string.IsNullOrEmpty(rsAlias)
                                        ? $"[[{field.Alias}]]"
                                : $"[[{rsAlias}().{field.Alias}]]";
                        }

                        if (path != null)
                        {
                            path.OutputExpression = value;
                            var foundPath = dataSourceShape.Paths.FirstOrDefault(path1 => path1.OutputExpression == path.OutputExpression);
                            if (foundPath == null)
                            {
                                dataSourceShape.Paths.Add(path);
                            }
                            else
                            {
                                foundPath.OutputExpression = path.OutputExpression;
                            }
                        }
                    }
                }
            }
            return(recSet);
        }
Beispiel #3
0
        // POST: Service/PluginServices/Methods
        public ServiceMethodList Methods(ComPluginService args, Guid workspaceId, Guid dataListId)
        {
            var result = new ServiceMethodList();

            try
            {
                var broker          = new ComPluginBroker();
                var comPluginSource = (ComPluginSource)args.Source;
                result = broker.GetMethods(comPluginSource.ClsId, comPluginSource.Is32Bit);
                return(result);
            }
            catch (Exception ex)
            {
                RaiseError(ex);
            }
            return(result);
        }
Beispiel #4
0
        protected virtual RecordsetList FetchRecordset(ComPluginService pluginService, bool addFields)
        {
            if (pluginService == null)
            {
                throw new ArgumentNullException(nameof(pluginService));
            }
            var broker            = new ComPluginBroker();
            var outputDescription = broker.TestPlugin(pluginService);
            var dataSourceShape   = outputDescription.DataSourceShapes[0];
            var recSet            = outputDescription.ToRecordsetList(pluginService.Recordsets, GlobalConstants.PrimitiveReturnValueTag);

            if (recSet != null)
            {
                foreach (var recordset in recSet)
                {
                    FetchRecordsetFields_ComPluginService(dataSourceShape, recordset);
                }
            }
            return(recSet);
        }