/// <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 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); } }