Пример #1
0
        public PaletteDescriptor(string displayPrefix, string[] extensions, IPaletteLoader loader, IPaletteSaver saver)
        {
            if (extensions == null || (loader == null && saver == null))
            {
                throw new ArgumentNullException("Palette descriptor is initialized incorrectly");
            }

            this.Extensions = extensions;
            this.Loader     = loader;
            this.Saver      = saver;

            FileFilter    ff          = new FileFilter();
            StringBuilder formatNames = new StringBuilder();

            foreach (string ext in extensions)
            {
                if (formatNames.Length > 0)
                {
                    formatNames.Append(", ");
                }

                string wildcard = string.Format("*.{0}", ext);
                ff.AddPattern(wildcard);
                formatNames.Append(wildcard);
            }

            // Translators: {0} is the palette format (e.g. "GIMP") and {1} is a list of file extensions.
            ff.Name     = string.Format(Catalog.GetString("{0} palette ({1})"), displayPrefix, formatNames);
            this.Filter = ff;
        }
Пример #2
0
        public PaletteDescriptor(string displayPrefix, string[] extensions, IPaletteLoader loader, IPaletteSaver saver)
        {
            this.Extensions = extensions;
            this.Loader     = loader;
            this.Saver      = saver;

            FileFilter    ff          = new FileFilter();
            StringBuilder formatNames = new StringBuilder();

            foreach (string ext in extensions)
            {
                if (formatNames.Length > 0)
                {
                    formatNames.Append(", ");
                }

                string wildcard = string.Format("*.{0}", ext);
                ff.AddPattern(wildcard);
                formatNames.Append(wildcard);
            }

            // Translators: {0} is the palette format (e.g. "GIMP") and {1} is a list of file extensions.
            ff.Name     = Translations.GetString("{0} palette ({1})", displayPrefix, formatNames);
            this.Filter = ff;
        }