private void InstallJavaScriptFiles(string assemblyName, IEnumerable <string> resourceNames)
        {
            var jsFiles = GetJavaScriptFiles(assemblyName, resourceNames);

            foreach (var theme in Themes.List(ThemeTypes.Site))
            {
                var supportedTheme = SupportedThemes.Get(theme.Id);
                if (supportedTheme == null)
                {
                    continue;
                }

                var themeName = supportedTheme.Name;
                foreach (var jsFile in jsFiles.ToList())
                {
                    using (var stream = EmbeddedResources.GetStream(jsFile.Path))
                    {
                        if (theme.IsConfigurationBased)
                        {
                            ThemeFiles.AddUpdateFactoryDefault(theme, ThemeProperties.JavascriptFiles, jsFile.Name, stream, (int)stream.Length);
                            stream.Seek(0, SeekOrigin.Begin);
                        }
                        ThemeFiles.AddUpdate(theme, ThemeTypes.Site, ThemeProperties.JavascriptFiles, jsFile.Name, stream, (int)stream.Length);
                    }
                }
            }
        }
        private static void CreateFileFromEmbeddedResource(string resourceName, string outputFile = null)
        {
            var directory = Directory.GetCurrentDirectory();

            using (var source = EmbeddedResources.GetStream(resourceName))
                using (var writer = File.Create(Path.Combine(directory, outputFile ?? resourceName)))
                    source.CopyTo(writer);
        }
        private static void CreateFileFromEmbeddedResource(string resourceName)
        {
            var directory = Directory.GetCurrentDirectory();

            using var source = EmbeddedResources.GetStream(resourceName);
            using var writer = File.Create(Path.Combine(directory, resourceName));
            source.CopyTo(writer);
        }
Пример #4
0
        //notes on guids
        //evolutionGuid = "aa8056256ecb481bae92f2db9f87e893";
        //fijiGuid = "7e987e474b714b01ba29b4336720c446";
        //socialGuid = "3fc3f82483d14ec485ef92e206116d49";
        //enterpriseGuid = "424eb7d9138d417b994b64bff44bf274";

        //blogThemeTypeID = new Guid("a3b17ab0-af5f-11dd-a350-1fcf55d89593");
        //groupThemeTypeID = new Guid("c6108064-af65-11dd-b074-de1a56d89593");
        //siteThemeTypeID = new Guid("0c647246-6735-42f9-875d-c8b991fe739b");
        void IInstallablePlugin.Install(Version lastInstalledVersion)
        {
            #region Install Widgets

            FactoryDefaultScriptedContentFragmentProviderFiles.DeleteAllFiles(this);

            //install default widgets and supplementary files
            var definitionFiles = new string[] {
                "SamlLoginAutoSelect-Widget.xml"
                , "SamlLogout-Widget.xml"
            };

            foreach (var definitionFile in definitionFiles)
            {
                using (var stream = EmbeddedResources.GetStream("Telligent.Services.SamlAuthenticationPlugin.Resources.Widgets." + definitionFile))
                    FactoryDefaultScriptedContentFragmentProviderFiles.AddUpdateDefinitionFile(this, definitionFile, stream);
            }

            ContentFragments.Enable(ThemeTypes.Site, ContentFragments.GetScriptedContentFragmentTypeString(new Guid("63b5fbf0d2db41eaa165c27ac43ee0f7"))); //Login Auto Select
            ContentFragments.Enable(ThemeTypes.Site, ContentFragments.GetScriptedContentFragmentTypeString(new Guid("31728beb334e420e84200cc6f81d109c"))); //Logout

            #endregion

            #region Insert Widgets Into existing themes and pages

            foreach (var theme in Themes.List(ThemeTypes.Site))
            {
                //add the saml auto select widget to the login page

                if (theme.Name == "3fc3f82483d14ec485ef92e206116d49")
                {
                    //Add CaseList to User profile page after Activity List
                    InsertWidget(theme
                                 , "common-login"
                                 , false
                                 , "Telligent.Evolution.ScriptedContentFragments.ScriptedContentFragment, Telligent.Evolution.ScriptedContentFragments::b1db6b71c0be43b58925e469eb6315a4"
                                 , ContentFragmentPlacement.Before
                                 , "content"
                                 , "Telligent.Evolution.ScriptedContentFragments.ScriptedContentFragment, Telligent.Evolution.ScriptedContentFragments::63b5fbf0d2db41eaa165c27ac43ee0f7"
                                 , ""
                                 , "no-wrapper responsive-1");
                }
            }


            #endregion

            #region Create Database Table if required
            InitializeScheama();
            #endregion
        }
Пример #5
0
        public SoftwareKeyboardRendererBase(IHostUiTheme uiTheme)
        {
            int ryujinxLogoSize = 32;

            Stream logoStream = EmbeddedResources.GetStream("Ryujinx.Ui.Common/Resources/Logo_Ryujinx.png");

            _ryujinxLogo = LoadResource(logoStream, ryujinxLogoSize, ryujinxLogoSize);

            string padAcceptIconPath = "Ryujinx.HLE.HOS.Applets.SoftwareKeyboard.Resources.Icon_BtnA.png";
            string padCancelIconPath = "Ryujinx.HLE.HOS.Applets.SoftwareKeyboard.Resources.Icon_BtnB.png";
            string keyModeIconPath   = "Ryujinx.HLE.HOS.Applets.SoftwareKeyboard.Resources.Icon_KeyF6.png";

            _padAcceptIcon = LoadResource(Assembly.GetExecutingAssembly(), padAcceptIconPath, 0, 0);
            _padCancelIcon = LoadResource(Assembly.GetExecutingAssembly(), padCancelIconPath, 0, 0);
            _keyModeIcon   = LoadResource(Assembly.GetExecutingAssembly(), keyModeIconPath, 0, 0);

            Color panelColor               = ToColor(uiTheme.DefaultBackgroundColor, 255);
            Color panelTransparentColor    = ToColor(uiTheme.DefaultBackgroundColor, 150);
            Color borderColor              = ToColor(uiTheme.DefaultBorderColor);
            Color selectionBackgroundColor = ToColor(uiTheme.SelectionBackgroundColor);

            _textNormalColor     = ToColor(uiTheme.DefaultForegroundColor);
            _textSelectedColor   = ToColor(uiTheme.SelectionForegroundColor);
            _textOverCursorColor = ToColor(uiTheme.DefaultForegroundColor, null, true);

            float cursorWidth = 2;

            _textBoxOutlineWidth = 2;
            _padPressedPenWidth  = 2;

            _panelBrush        = new SolidBrush(panelColor);
            _disabledBrush     = new SolidBrush(panelTransparentColor);
            _cursorBrush       = new SolidBrush(_textNormalColor);
            _selectionBoxBrush = new SolidBrush(selectionBackgroundColor);

            _textBoxOutlinePen = new Pen(borderColor, _textBoxOutlineWidth);
            _cursorPen         = new Pen(_textNormalColor, cursorWidth);
            _selectionBoxPen   = new Pen(selectionBackgroundColor, cursorWidth);
            _padPressedPen     = new Pen(borderColor, _padPressedPenWidth);

            _inputTextFontSize = 20;

            CreateFonts(uiTheme.FontFamily);
        }
        public void Install(Version lastInstalledVersion)
        {
            if (lastInstalledVersion < Version)
            {
                Uninstall();
                string basePath = BaseResourcePath + ".Filestore.";

                EmbeddedResources.EnumerateReosurces(basePath, "", resourceName =>
                {
                    string file;

                    var cfsStore = GetFileStorageProvider(basePath, resourceName, out file);

                    if (cfsStore != null)
                    {
                        cfsStore.AddUpdateFile("", file, EmbeddedResources.GetStream(resourceName));
                    }
                });
            }
        }
Пример #7
0
            public void ProcessRequest(HttpContext context)
            {
                const string cacheId     = "Office365Icon";
                var          iconContent = (byte[])cacheService.Get(cacheId, Extensibility.Caching.Version1.CacheScope.Context | Extensibility.Caching.Version1.CacheScope.Process);

                if (iconContent == null)
                {
                    var assemblyName = GetType().Assembly.GetName().Name;
                    using (var memoryStream = new MemoryStream())
                    {
                        using (var stream = EmbeddedResources.GetStream(assemblyName + ".Resources.OAuth.office365.png"))
                        {
                            stream.CopyTo(memoryStream);
                        }
                        iconContent = memoryStream.ToArray();
                    }
                    cacheService.Put(cacheId, iconContent, Extensibility.Caching.Version1.CacheScope.Context | Extensibility.Caching.Version1.CacheScope.Process, null, CacheTimeOut);
                }
                context.Response.ContentType = "image/png";
                context.Response.BinaryWrite(iconContent);
            }
Пример #8
0
        public virtual void Install(Version lastInstalledVersion)
        {
            if (lastInstalledVersion < Version)
            {
                Uninstall();

                string basePath = BaseResourcePath + "Widgets.";

                EmbeddedResources.EnumerateReosurces(basePath, ".xml", resourceName =>
                {
                    try
                    {
                        string widgetName = resourceName.Substring(basePath.Length);

                        using (var stream = EmbeddedResources.GetStream(resourceName))
                        {
                            FactoryDefaultScriptedContentFragmentProviderFiles.AddUpdateDefinitionFile(this, widgetName, stream);
                        }

                        // Get widget identifier
                        XDocument xdoc = XDocument.Parse(EmbeddedResources.GetString(resourceName));
                        XElement root  = xdoc.Root;

                        if (root == null)
                        {
                            return;
                        }

                        XElement element = root.Element("scriptedContentFragment");

                        if (element == null)
                        {
                            return;
                        }

                        XAttribute attribute = element.Attribute("instanceIdentifier");

                        if (attribute == null)
                        {
                            return;
                        }

                        Guid instanceId = new Guid(attribute.Value);

                        string widgetBasePath = string.Concat(basePath, char.IsNumber(attribute.Value[0]) ? "_" : "", instanceId.ToString("N"), ".");
                        IEnumerable <string> supplementaryResources =
                            GetType().Assembly.GetManifestResourceNames().Where(r => r.StartsWith(widgetBasePath)).ToArray();

                        if (!supplementaryResources.Any())
                        {
                            return;
                        }

                        foreach (string supplementPath in supplementaryResources)
                        {
                            string supplementName = supplementPath.Substring(widgetBasePath.Length);

                            using (var stream = EmbeddedResources.GetStream(supplementPath))
                            {
                                FactoryDefaultScriptedContentFragmentProviderFiles
                                .AddUpdateSupplementaryFile(this, instanceId, supplementName, stream);
                            }
                        }
                    }
                    catch (Exception exception)
                    {
                        new CSException(CSExceptionType.UnknownError, string.Format("Couldn't load widget from '{0}' embedded resource.", resourceName), exception).Log();
                    }
                });
            }
        }
Пример #9
0
 public static Stream GetStream(string name, out string mimeType)
 {
     return(EmbeddedResources.GetStream(m_resourceList, "Microsoft.ReportingServices.Rendering.HtmlRenderer.RendererResources." + name, out mimeType));
 }
 public static Stream GetStream(string name, out string mimeType)
 {
     return(EmbeddedResources.GetStream(HTMLRendererResources.m_resourceList, "AspNetCore.ReportingServices.Rendering.HtmlRenderer.RendererResources." + name, out mimeType));
 }
 protected string ReadAllText(string resourceName)
 {
     using (var stream = EmbeddedResources.GetStream(resourceName))
         using (var reader = new StreamReader(stream))
             return(reader.ReadToEnd());
 }
        private void InstallWidgets(string assemblyName, IEnumerable <string> resourceNames)
        {
            foreach (string resourceName in resourceNames)
            {
                string[] path = resourceName.Split('.');

                // path: Resources.Widgets.[name]
                const int resourcesIndex  = 0;
                const int widgetsIndex    = 1;
                const int widgetNameIndex = 2;

                // path: Resources.Widgets.[name].[file].xml
                const int xmlFileIndex      = 3;
                int       xmlExtensionIndex = path.Length - 1;

                // path: Resources.Widgets.[name].[guid].[theme].[file]
                const int widgetFolderIdIndex = 3;
                const int themeIndex          = 4;
                const int fileIndex           = 5;

                bool isAWidgetDefinitionFile = path.Length > 4 &&
                                               string.Equals(path[resourcesIndex], "Resources", StringComparison.OrdinalIgnoreCase) &&
                                               string.Equals(path[widgetsIndex], "Widgets", StringComparison.OrdinalIgnoreCase);
                if (!isAWidgetDefinitionFile)
                {
                    continue;
                }

                var  resourceFullName = string.Concat(assemblyName, ".", resourceName);
                bool isAWidgetXmlFile = path.Length == 5 &&
                                        string.Equals(path[xmlExtensionIndex], "xml", StringComparison.OrdinalIgnoreCase);
                if (isAWidgetXmlFile)
                {
                    var fileName = string.Join(".", path.ToList().GetRange(xmlFileIndex, path.Length - xmlFileIndex));
                    FactoryDefaultScriptedContentFragmentProviderFiles.AddUpdateDefinitionFile(
                        this,
                        fileName,
                        EmbeddedResources.GetStream(resourceFullName));
                    continue;
                }

                var  widgetFolderId        = GetGuidFromResourceString(path[widgetFolderIdIndex]);
                bool isAWidgetResourceFile = path.Length > 5 &&
                                             widgetFolderId != Guid.Empty;
                if (isAWidgetResourceFile)
                {
                    var fileName = string.Join(".", path.ToList().GetRange(fileIndex, path.Length - fileIndex));
                    var theme    = SupportedThemes.Get(path[themeIndex]);
                    if (theme != null)
                    {
                        FactoryDefaultScriptedContentFragmentProviderFiles.AddUpdateSupplementaryFile(
                            this,
                            widgetFolderId,
                            theme.Id.ToString("N"),
                            fileName,
                            EmbeddedResources.GetStream(resourceFullName));
                    }
                    else
                    {
                        FactoryDefaultScriptedContentFragmentProviderFiles.AddUpdateSupplementaryFile(
                            this,
                            widgetFolderId,
                            fileName,
                            EmbeddedResources.GetStream(resourceFullName));
                    }
                }
            }
        }