public Roms(RomType romType) { switch (romType) { case RomType.MAME: Directory = P_romsDirectory_MAME.ToLower().Trim(); P_extensions = P_extensions_MAME.Trim(); break; default: break; } //FileExtensions if (P_extensions.Contains(";")) { FileExtensions = P_extensions.Split(';').Select(a => a != null ? a.Trim() : null).ToList(); } else { FileExtensions.Add(P_extensions); } FileExtensions.Remove(string.Empty); P_extensions = null; }
/// <summary> /// Initializes a new instance of the <see cref="GorgonSpriteEditorPlugIn"/> class. /// </summary> public GorgonSpriteEditorPlugIn() : base(Resources.GORSPR_DESC) { Settings = new GorgonSpritePlugInSettings(); Settings.Load(); FileExtensions.Add(new GorgonFileExtension("gorSprite", string.Format("{0} (*.gorSprite)", Resources.GORSPR_CONTENT_EXTENSION_DESC))); }
public void AddFileExtension(string extension) { if (string.IsNullOrEmpty(extension)) { return; } FileExtensions.Add(extension); UpdateFileExtensionItems(); }
/// <summary> /// Initializes a new instance of the <see cref="GorgonFontEditorPlugIn"/> class. /// </summary> public GorgonFontEditorPlugIn() : base(Resources.GORFNT_DESC) { FileExtensions.Add(new GorgonFileExtension("gorFont", string.Format("{0} (*.gorFont)", Resources.GORFNT_CONTENT_EXTENSION_DESC))); UpdateCachedFonts(); Settings = new GorgonFontPlugInSettings(); Settings.Load(); }
static UrlBaseMapHandler ConfigureFileHandler(JObject config) { if (config != null) { JObject hand = config["simpleFileHandler"] as JObject; //allows us to host static files if (hand != null) { JArray urls; JValue root = hand["rootDirectory"] as JValue; if (root != null) { string rootDir = root.ToString(); if (!string.IsNullOrEmpty(rootDir)) { urls = hand["defaultFiles"] as JArray; if (urls != null) { List <string> defFiles = new List <string>(); foreach (JToken cur in urls) { string tmp = cur.ToString(); if (!string.IsNullOrEmpty(tmp)) { defFiles.Add(tmp); } } if (defFiles.Count > 0) { urls = hand["allowedExtensions"] as JArray; if (urls != null) { FileExtensions exts = new FileExtensions(); foreach (JToken cur in urls) { string tmp = cur.ToString(); if (!string.IsNullOrEmpty(tmp)) { exts.Add(tmp); } } if (exts.Count > 0) { SimpleFileHandler handler = new SimpleFileHandler(rootDir, defFiles, MimeTypes.GetAllWellKnown(), exts, new FileExtensions()); //so we can also have static files return(new UrlBaseMapHandler(handler, new string[] { "/" })); } } } } } } } } return(null); }
/// <summary> /// Function to create the list of codecs /// </summary> internal void GetCodecs() { _codecs = new Dictionary <GorgonFileExtension, GorgonImageCodec>(); GorgonImageCodec[] codecs = { new GorgonCodecBMP(), new GorgonCodecDDS(), new GorgonCodecGIF(), new GorgonCodecHDP(), new GorgonCodecJPEG(), new GorgonCodecPNG(), new GorgonCodecTGA(), new GorgonCodecTIFF() }; // Get extensions and descriptions from the codecs. var description = new StringBuilder(256); foreach (var codec in codecs) { description.Length = 0; description.AppendFormat("{0} (*.{1})", codec.CodecDescription, string.Join("; *.", codec.CodecCommonExtensions)); foreach (string extension in codec.CodecCommonExtensions) { _codecs[new GorgonFileExtension(extension, description.ToString())] = codec; } } // Load external codecs. foreach (string assemblyPath in Settings.CustomCodecs) { LoadExternalCodec(assemblyPath); } _codecDropDown = _codecs.Values.Distinct().ToArray(); FileExtensions.Clear(); // Update the list of available extensions (because they're not static) when we create our content for display. foreach (var codec in _codecs.Where(codec => !FileExtensions.Contains(codec.Key))) { FileExtensions.Add(codec.Key); } }
//private static string IconsPath //{ // get { return new UrlHelper(HttpContext.Current.Request.RequestContext).Content("~/Content/img/file_icons/"); } //} static FileNameToFileTypeIcon() { FileExtensions.Add("bmp", "bmp"); FileExtensions.Add("doc", "doc"); FileExtensions.Add("docx", "doc"); FileExtensions.Add("jpg", "jpg"); FileExtensions.Add("jpeg", "jpg"); FileExtensions.Add("pdf", "pdf"); FileExtensions.Add("png", "png"); FileExtensions.Add("ppt", "ppt"); FileExtensions.Add("pptx", "ppt"); FileExtensions.Add("rar", "rar"); FileExtensions.Add("txt", "txt"); FileExtensions.Add("xls", "xls"); FileExtensions.Add("xlsx", "xls"); FileExtensions.Add("zip", "zip"); }
private void CollectImages() { if (InitialImagePath != "") { ShortPathZip = InitialImagePath;//.Substring(8); FolderNameZip = new DirectoryInfo(System.IO.Path.GetDirectoryName(ShortPathZip)); var _fileExtension = System.IO.Path.GetExtension(ShortPathZip); var FilesDetails = (Directory.GetFiles(FolderNameZip.ToString(), "*" + _fileExtension)); ImagesZip.Clear(); FileExtensions.Clear(); string tempfolder = Path.Combine(Settings.ApplicationTempFolder, "og_" + Path.GetRandomFileName()); if (!Directory.Exists(tempfolder)) { Directory.CreateDirectory(tempfolder); } FileExtensions.Add("Jpg"); FileExtensions.Add("Png"); FileExtensions.Add("Bmp"); foreach (var f in FilesDetails) { string a = f; //if (watermarkName.ImageName != "") //{ // var file = Path.Combine(tempfolder, Path.GetFileName(f)); // File.Copy(f, file); // WatermarkProperties.ApplyWatermark(file); // a = file; //} ImageDetails id = new ImageDetails() { Path = a, FileName = System.IO.Path.GetFileName(a), Extension = System.IO.Path.GetExtension(a), DateModified = System.IO.File.GetCreationTime(a).ToString("yyyy-MM-dd") }; //FileExtensions.Add(id.Extension); ImagesZip.Add(id); } ZipImageCount = ImagesZip.Count(str => str.IsZIPSelected == true); } }
private static IHandlerMapper InitFiles(ConfigurationProviderBase prov) { ConfigurationParameter param = prov.Get(typeof(SimpleFileHandler), "rootDirectory"); if (param != null) { string rootDir = (string)param.Value; param = prov.Get(typeof(SimpleFileHandler), "logicalDirectory"); if (param != null) { string localDir = (string)param.Value; string[] defFiles; param = prov.Get(typeof(SimpleFileHandler), "defaultFiles"); if (param != null) { defFiles = (string[])param.Value; FileExtensions exts = new FileExtensions(); param = prov.Get(typeof(SimpleFileHandler), "allowedExtensions"); if (param != null) { string[] tmp = (string[])param.Value; foreach (string cur in tmp) { exts.Add(cur); } SimpleFileHandler handler = new SimpleFileHandler(rootDir, defFiles, MimeTypes.GetAllWellKnown(), exts, new FileExtensions()); //so we can also have static files return(new UrlBaseMapHandler(handler, new string[] { localDir })); } } } } return(null); }
/// <summary> /// Initializes a new instance of the <see cref="GorgonGorPackWriterPlugIn"/> class. /// </summary> public GorgonGorPackWriterPlugIn() : base(Resources.GORPKW_DESC) { FileExtensions.Add(new GorgonFileExtension("gorPack", Resources.GORPKW_GORPACK_FILE_EXT_DESC)); }