Esempio n. 1
0
        private async Task LoadExtension(IAppExtension extension)
        {
            if (!extension.Package.VerifyIsOK() || !_allowedPackageSignatureKinds.Contains(extension.Package.SignatureKind))
            {
                //TODO: Log
                return;
            }

            var identifier = extension.GetUniqueId();

            var existingExtension = Extensions.FirstOrDefault(e => e.UniqueId == identifier);

            if (existingExtension == null)
            {
                var newExtension = new Extension <TMessage, TResponse>(extension, _connectionFactory);
                Extensions.Add(newExtension);
                await newExtension.Initialize();

                newExtension.Load();
            }
            else
            {
                existingExtension.Unload();
                await existingExtension.Update(extension);
            }
        }
Esempio n. 2
0
        static Bridge()
        {
            var currentDirectory = new DirectoryInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));

            foreach (var file in currentDirectory.GetFiles("ReportPortal.*.dll"))
            {
                AppDomain.CurrentDomain.Load(Path.GetFileNameWithoutExtension(file.Name));
            }

            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                try
                {
                    foreach (var type in assembly.GetTypes())
                    {
                        if (type.GetInterfaces().Contains(typeof(IBridgeExtension)))
                        {
                            var extension = Activator.CreateInstance(type);
                            Extensions.Add((IBridgeExtension)extension);
                        }
                    }
                }
                catch (ReflectionTypeLoadException)
                {
                }
            }

            Extensions = Extensions.OrderBy(ext => ext.Order).ToList();
        }
Esempio n. 3
0
        /// <summary>
        /// Loads extensions from the configuration file
        /// </summary>
        /// <param name="id">Extension ID</param>
        /// <param name="logger">Logger</param>
        /// <exception cref="ExtensionException">Loading failure</exception>
        private void LoadExtension(string id, IEventWriter logger)
        {
            if (Extensions.ContainsKey(id))
            {
                throw new ExtensionException(id, "Extension has been already loaded");
            }

            var        extensionsConfig = ServiceDescriptor.ExtensionsConfiguration;
            XmlElement configNode       = (extensionsConfig != null) ? extensionsConfig.SelectSingleNode("extension[@id='" + id + "'][1]") as XmlElement : null;

            if (configNode == null)
            {
                throw new ExtensionException(id, "Cannot get the configuration entry");
            }

            var descriptor = WinSWExtensionDescriptor.FromXml(configNode);

            if (descriptor.Enabled)
            {
                IWinSWExtension extension = CreateExtensionInstance(descriptor.Id, descriptor.ClassName);
                extension.Descriptor = descriptor;
                //TODO: Handle exceptions
                extension.Configure(ServiceDescriptor, configNode, logger);
                Extensions.Add(id, extension);
                logger.LogEvent("Extension loaded: " + id, EventLogEntryType.Information);
            }
            else
            {
                logger.LogEvent("Extension is disabled: " + id, EventLogEntryType.Warning);
            }
        }
Esempio n. 4
0
        private void LoadExtensions()
        {
            foreach (var extension in Extensions)
            {
                var pages = extension.GetTabPages(_corporate);
                if (pages == null)
                {
                    continue;
                }
                tabControlCorporate.TabPages.AddRange(pages);
            }
            var tabs = _applicationController.GetAllInstances <ICorporateTabs>();

            foreach (var tab in tabs)
            {
                if (Extensions.Any(i => i.GetType() == tab.GetType()))
                {
                    continue;
                }
                var pages = tab.GetTabPages(_corporate);
                if (pages == null)
                {
                    continue;
                }
                tabControlCorporate.TabPages.AddRange(pages);
                Extensions.Add(tab);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Find the offset position for the TCP given a position, a direction vector and the offset value
        /// </summary>
        /// <param name="vertexPosition">A position of a vertex in a mesh</param>
        /// <param name="vertexNormal">A direction vector for a vertex indicating its normal</param>
        public Vector3 FindURPosition(Vector3 vertexPosition, Vector3 vertexNormal)
        {
            Vector3 pos       = vertexPosition;
            Vector3 offset    = Extensions.Multiply(vertexNormal, UR_PROBE_OFFSET);
            Vector3 offsetPos = Extensions.Add(pos, offset);

            return(offsetPos);
        }
Esempio n. 6
0
 private void InsertEntity(int x, int y, Entity e)
 {
     if (x < 0 || y < 0 || x >= W || y >= H)
     {
         return;
     }
     Extensions.Add(_entitiesInTiles[x + y * W], e);
 }
Esempio n. 7
0
 public void EnableExtension(IExtensibleFrameworkInterface extension)
 {
     if (Extensions == null)
     {
         Extensions = new List <IExtensibleFrameworkInterface>();
     }
     Extensions.Add(extension);
 }
Esempio n. 8
0
 public T AddExtensions(params object[] extensions)
 {
     foreach (object extension in extensions)
     {
         Extensions.Add(WcfExplicitExtension.CreateFrom(extension));
     }
     return((T)this);
 }
Esempio n. 9
0
 /// <summary>
 /// Gets the avaliable extensions in the files
 /// </summary>
 public void RebuildExtensions()
 {
     foreach (var file in FileList.Where(file => !Extensions.Contains(file.Name.Split('.').Last())))
     {
         Extensions.Add(file.Name.Split('.').Last());
     }
     Extensions.Sort();
 }
Esempio n. 10
0
 public void addExtension(String s)
 {
     if (this.Extensions == null)
     {
         this.Extensions = new List <String>();
     }
     Extensions.Add(s);
 }
        internal void ParseXml(XPathNavigator commonNav)
        {
            XPathNavigator sourceNav = commonNav.SelectSingleNode("source");

            if (sourceNav != null)
            {
                Source = sourceNav.Value;
            }

            XPathNavigator noteNav = commonNav.SelectSingleNode("note");

            if (noteNav != null)
            {
                Note = noteNav.Value;
            }

            // Please leave this code until the data-xml/common/tags gets removed.
            XPathNavigator tagsNav = commonNav.SelectSingleNode("tags");

            if (tagsNav != null)
            {
#pragma warning disable CS0618 // Type or member is obsolete
                Tags = tagsNav.Value;
#pragma warning restore CS0618 // Type or member is obsolete
            }

            XPathNodeIterator extensionIterator = commonNav.Select("extension");

            foreach (XPathNavigator extensionNav in extensionIterator)
            {
                ThingExtension extension = DeserializeExtension(extensionNav);

                if (extension != null)
                {
                    Extensions.Add(extension);
                }
            }

            XPathNodeIterator relationshipIterator =
                commonNav.Select("related-thing[./thing-id != '' or ./client-thing-id != '']");

            foreach (XPathNavigator relationshipNav in relationshipIterator)
            {
                ThingRelationship relationship =
                    new ThingRelationship();

                relationship.ParseXml(relationshipNav);

                RelatedItems.Add(relationship);
            }

            XPathNavigator clientIdNav = commonNav.SelectSingleNode("client-thing-id");
            if (clientIdNav != null)
            {
                ClientId = clientIdNav.Value;
            }
        }
        /// <summary>
        /// Registers a new Package Manager UI extension
        /// </summary>
        /// <param name="extension">A Package Manager UI extension</param>
        public static void RegisterExtension(IPackageManagerExtension extension)
        {
            if (extension == null)
            {
                return;
            }

            Extensions.Add(extension);
        }
Esempio n. 13
0
 public ImageLocator(global::System.Resources.ResourceManager resourceManager) :
     base("jpg")
 {
     mResourceManager = resourceManager;
     Extensions.Add("jpeg");
     Extensions.Add("png");
     Extensions.Add("gif");
     Extensions.Add("icon");
 }
Esempio n. 14
0
        public void Add(TLDefinition tld, Stream srcStm)
        {
            TLFunction tlf = tld as TLFunction;

            if (tlf != null)
            {
                if (tlf.Signature.IsExtension)
                {
                    Extensions.Add(tlf, srcStm);
                }
                else if (tlf.IsTopLevelFunction)
                {
                    if (tlf.Signature is SwiftAddressorType)
                    {
                        Variables.Add(tlf, srcStm);
                    }
                    else if (tlf.Signature is SwiftWitnessTableType)
                    {
                        WitnessTables.Add(tld, srcStm);
                    }
                    else
                    {
                        Functions.Add(tlf, srcStm);
                    }
                }
                else
                {
                    if (tlf.Class.EntityKind == MemberNesting.Protocol)
                    {
                        Protocols.Add(tlf, srcStm);
                    }
                    else
                    {
                        Classes.Add(tld, srcStm);
                    }
                }
            }
            else
            {
                if (tld is TLVariable tlvar && ((TLVariable)tld).Class == null)
                {
                    if (tlvar is TLPropertyDescriptor propDesc)
                    {
                        if (propDesc.ExtensionOn != null)
                        {
                            ExtensionDescriptors.Add(propDesc);
                        }
                        else
                        {
                            PropertyDescriptors.Add(tlvar, srcStm);
                        }
                    }
                    else
                    {
                        Variables.Add(tld, srcStm);
                    }
                }
Esempio n. 15
0
        /// <summary>
        /// Registers an extension that will be executed when building services.
        /// </summary>
        /// <param name="extension"></param>
        public void RegisterExtension(ICapOptionsExtension extension)
        {
            if (extension == null)
            {
                throw new ArgumentNullException(nameof(extension));
            }

            Extensions.Add(extension);
        }
Esempio n. 16
0
 /// <summary>
 /// This method hooks up the click of the associated menu item in the
 /// BIDSHelperPackage.vsct file with the Exec method in this plugin.
 /// </summary>
 /// <param name="commandId">The ordinal of this commandID has to match the id in the BIDSHelperPackage.vsct file</param>
 /// <param name="extension">This menu item will only display for files with this extension (eg ".cube")</param>
 public void CreateContextMenu(CommandList commandId, string extension)
 {
     if (!extension.StartsWith("."))
     {
         throw new ArgumentException("the extension argument to CreateContextMenu must start with a period (.)");
     }
     Extensions.Add(extension);
     CreateMenu(CommandSet, (int)commandId);
 }
Esempio n. 17
0
        internal void Parse()
        {
            if (String.IsNullOrEmpty(FileName))
            {
                throw new InvalidOperationException();
            }

            string extensionDir = String.Empty;

            using (StreamReader reader = new StreamReader(FileName))
            {
                foreach (object o in PHPIniFile.ParseIniFile(reader))
                {
                    PHPIniSetting directive = o as PHPIniSetting;
                    if (directive != null)
                    {
                        Settings.Add(directive);
                        RawEntries.Add(directive);

                        // Get the path to the extension directory - this will be used later
                        if (String.Equals(directive.Name, "extension_dir", StringComparison.OrdinalIgnoreCase))
                        {
                            extensionDir = directive.GetTrimmedValue();
                        }
                    }
                    else
                    {
                        PHPIniExtension extension = o as PHPIniExtension;
                        if (extension != null)
                        {
                            Extensions.Add(extension);
                            RawEntries.Add(extension);
                        }
                        else
                        {
                            PHPIniBase entry = o as PHPIniBase;
                            if (entry != null)
                            {
                                RawEntries.Add(entry);
                            }
                        }
                    }
                }
            }

            if (String.IsNullOrEmpty(extensionDir) ||
                !Path.IsPathRooted(extensionDir))
            {
                extensionDir = Path.Combine(Path.GetDirectoryName(FileName), "ext");
            }

            if (Directory.Exists(extensionDir))
            {
                AddAllAvailableExtensions(extensionDir);
            }
        }
Esempio n. 18
0
        public static Extensions Parse(Mobile from, ref string[] args)
        {
            var parsed = new Extensions();

            var size = args.Length;

            Type baseType = null;

            for (var i = args.Length - 1; i >= 0; --i)
            {
                if (!ExtensionInfo.Table.TryGetValue(args[i], out var extInfo))
                {
                    continue;
                }

                if (extInfo.IsFixedSize && i != size - extInfo.Size - 1)
                {
                    throw new Exception("Invalid extended argument count.");
                }

                var ext = extInfo.Constructor();

                ext.Parse(from, args, i + 1, size - i - 1);

                if (ext is WhereExtension extension)
                {
                    baseType = extension.Conditional.Type;
                }

                parsed.Add(ext);

                size = i;
            }

            parsed.Sort((a, b) => a.Order - b.Order);

            AssemblyEmitter emitter = null;

            foreach (var update in parsed)
            {
                update.Optimize(from, baseType, ref emitter);
            }

            if (size != args.Length)
            {
                var old = args;
                args = new string[size];

                for (var i = 0; i < args.Length; ++i)
                {
                    args[i] = old[i];
                }
            }

            return(parsed);
        }
Esempio n. 19
0
 private void GetPathandExtension(DirectoryInfo dir)
 {
     FileInfo[] files = dir.GetFiles();
     foreach (FileInfo item in files)
     {
         Pathes.Add(item.FullName);
         Extensions.Add(item.Extension);
         CreationTime.Add(item.CreationTime);
     }
 }
        public FailureDetails(string traceId)
            : this()
        {
            Title  = "One or more validation errors occurred.";
            Detail = "The inputs supplied to the API are invalid";
            Type   = "https://tools.ietf.org/html/rfc7231#section-6.5";
            Status = StatusCodes.Status400BadRequest;

            Extensions.Add("traceId", traceId);
        }
Esempio n. 21
0
        public void Extensions_Load(Stream _s)
        {
            _s.ReadInteger();
            int num = _s.ReadInteger();

            for (int i = 0; i < num; i++)
            {
                GMExtension item = new GMExtension(this, _s);
                Extensions.Add(item);
            }
        }
 public IdentitySecurityScheme()
 {
     Type        = "IdentitySecurityScheme";
     Description = "Security definition that provides to the user of Swagger a mechanism to obtain a token from the identity service that secures the api";
     Extensions.Add("authorizationUrl", "http://localhost:5101/Auth/Client/popup.html");
     Extensions.Add("flow", "implicit");
     Extensions.Add("scopes", new List <string>
     {
         "catalog"
     });
 }
Esempio n. 23
0
 public IdentitySecurityScheme()
 {
     Type        = "IdentitySecurityScheme";
     Description = "";
     Extensions.Add("authorizationUrl", "http://localhost:5103/Auth/Client/popup.html");
     Extensions.Add("flow", "implicit");
     Extensions.Add("scopes", new List <string>
     {
         "cart"
     });
 }
Esempio n. 24
0
 public void addExtensions(String[] s)
 {
     if (this.Extensions == null)
     {
         this.Extensions = new List <String>();
     }
     foreach (String str in s)
     {
         Extensions.Add(str);
     }
 }
        public void Init(params Type[] parts)
        {
            _calculatorExtensionsManager.InitializeContainer(parts);

            foreach (var extension in _calculatorExtensionsManager.GetExtensionInformation())
            {
                var vm = new ExtensionViewModel(extension);
                vm.ActivatedExtensionChanged += OnActivatedExtensionChanged;
                Extensions.Add(vm);
            }
        }
Esempio n. 26
0
 public void LoadExtensions()
 {
     Extensions.Clear();
     foreach (Extension e in UsedExtensions)
     {
         if (e.Selected)
         {
             Extensions.Add(e);
         }
     }
 }
Esempio n. 27
0
        public void DictionaryAddCreatesNewList()
        {
            const int key        = 0;
            var       dictionary = new Dictionary <int, List <int> >();

            Extensions.Add(dictionary, key, 1);
            Assert.IsTrue(dictionary.ContainsKey(key));
            var list = dictionary[key];

            Assert.AreEqual(1, list.Count);
            Assert.AreEqual(1, list[0]);
        }
Esempio n. 28
0
        public override XmlDocument ToXml()
        {
            var updateExt = new IisDomainUpdateExtension
            {
                ClientDelete = ClientDelete
            };

            Extensions.Clear();
            Extensions.Add(updateExt);

            return(base.ToXml());
        }
Esempio n. 29
0
        public override XmlDocument ToXml()
        {
            IisContactUpdateExtension updateExt = new IisContactUpdateExtension
            {
                VatNumber = VatNumber
            };

            Extensions.Clear();
            Extensions.Add(updateExt);

            return(base.ToXml());
        }
Esempio n. 30
0
        private void CopyFile(string sourceFilePath, string targetFilePath, string sourceSolutionName, string targetSolutionName)
        {
            string extension       = Path.GetExtension(sourceFilePath);
            string targetDirectory = Path.GetDirectoryName(targetFilePath);

            if (Extensions.SingleOrDefault(i => i.Equals(extension, StringComparison.CurrentCultureIgnoreCase)) == null)
            {
                Extensions.Add(extension);
            }

            if (targetDirectory != null &&
                Directory.Exists(targetDirectory) == false)
            {
                Directory.CreateDirectory(targetDirectory);
            }

            if (ReplaceExtensions.SingleOrDefault(i => i.Equals(extension, StringComparison.CurrentCultureIgnoreCase)) != null)
            {
                var targetLines = new List <string>();
                var sourceLines = File.ReadAllLines(sourceFilePath, Encoding.Default);
                var regex       = new Regex(sourceSolutionName, RegexOptions.IgnoreCase);

                if (sourceFilePath.EndsWith("BlazorApp.csproj"))
                {
                    for (int i = 0; i < sourceLines.Length; i++)
                    {
                        var sourceLine = sourceLines[i];

                        if (sourceLine.TrimStart().StartsWith("<UserSecretsId>"))
                        {
                            sourceLine     = $"    <UserSecretsId>{Guid.NewGuid()}</UserSecretsId>";
                            sourceLines[i] = sourceLine;
                        }
                    }
                }

                if (sourceLines.Any() && sourceLines.First().Contains(QnSIgnoreLabel) == false)
                {
                    foreach (var sourceLine in sourceLines)
                    {
                        var targetLine = regex.Replace(sourceLine, targetSolutionName);

                        targetLine = targetLine.Replace(QnSBaseCodeLabel, QnSCodeCopyLabel);
                        targetLines.Add(targetLine);
                    }
                    File.WriteAllLines(targetFilePath, targetLines.ToArray(), Encoding.Default);
                }
            }
            else if (File.Exists(targetFilePath) == false)
            {
                File.Copy(sourceFilePath, targetFilePath);
            }
        }