public sEmbeddedFile(string dllpath, string url, EmbeddedFileTypes fileType, ImageTypes? imageType) { _dllPath = dllpath; _url = url; _fileType = fileType; _imageType = imageType; }
protected override void PreStart() { EventController.RegisterEventHandler(this); _embeddedFiles = new Dictionary <string, sEmbeddedFile>(); _embeddedFiles.Add("/resources/icons.png", new sEmbeddedFile("Org.Reddragonit.FreeSwitchConfig.Site.Web.resources.icons.png", "/resources/icons.png", EmbeddedFileTypes.Image, ImageTypes.png)); Assembly ass = this.GetType().Assembly; foreach (string str in ass.GetManifestResourceNames()) { if (str.StartsWith("Org.Reddragonit.FreeSwitchConfig.Site.Web.resources.images")) { string url = str.Substring("Org.Reddragonit.FreeSwitchConfig.Site.Web".Length); url = url.Replace(".", "/"); url = url.Substring(0, url.LastIndexOf("/")) + "." + url.Substring(url.LastIndexOf("/") + 1); EmbeddedFileTypes ftype = EmbeddedFileTypes.Text; ImageTypes? itype = null; if (str.EndsWith(".min.js")) { ftype = EmbeddedFileTypes.Compressed_Javascript; url = url.Substring(0, url.Length - "/min.js".Length) + ".min.js"; } else if (str.EndsWith(".js")) { ftype = EmbeddedFileTypes.Javascript; } else if (str.EndsWith(".min.css")) { ftype = EmbeddedFileTypes.Compressed_Css; url = url.Substring(0, url.Length - "/min.css".Length) + ".min.css"; } else if (str.EndsWith(".css")) { ftype = EmbeddedFileTypes.Css; } else if (str.EndsWith(".png")) { ftype = EmbeddedFileTypes.Image; itype = ImageTypes.png; } else if (str.EndsWith(".gif")) { ftype = EmbeddedFileTypes.Image; itype = ImageTypes.gif; } Log.Trace("Assigning embedded file " + str + " to the path " + url); _embeddedFiles.Add(url, new sEmbeddedFile(str, url, ftype, itype)); } } _embeddedServiceTypes = new List <Type>(); _embeddedServiceTypes.Add(typeof(UserManagementService)); _embeddedServiceTypes.Add(typeof(UserService)); foreach (Type t in Utility.LocateTypeInstances(typeof(EmbeddedService), this.GetType().Assembly)) { _embeddedServiceTypes.Add(t); } try { Initializer.Initialize(); } catch (Exception e) { EventController.TriggerEvent(new ErrorOccuredEvent(e)); Log.Error(e); } }