示例#1
0
        /// <summary>
        ///    Constructs and initializes a new instance of <see
        ///    cref="File" /> for a specified file abstraction with an
        ///    average read style.
        /// </summary>
        /// <param name="abstraction">
        ///    A <see cref="IFileAbstraction" /> object to use when
        ///    reading from and writing to the file.
        /// </param>
        /// <exception cref="ArgumentNullException">
        ///    <paramref name="abstraction" /> is <see langword="null"
        ///    />.
        /// </exception>
        public File(File.IFileAbstraction abstraction, CUEToolsTagger _tagger)
            : base(abstraction)
        {
            tagger = _tagger;
            // Make sure we have a tag.
            switch (tagger)
            {
            case CUEToolsTagger.APEv2:
                GetTag(TagTypes.Ape, true);
                break;

            case CUEToolsTagger.ID3v2:
                GetTag(TagTypes.Id3v2, true);
                break;
            }
        }
示例#2
0
        /// <summary>
        ///    Constructs and initializes a new instance of <see
        ///    cref="File" /> for a specified path in the local file
        ///    system and specified read style.
        /// </summary>
        /// <param name="path">
        ///    A <see cref="string" /> object containing the path of the
        ///    file to use in the new instance.
        /// </param>
        /// <param name="propertiesStyle">
        ///    A <see cref="ReadStyle" /> value specifying at what level
        ///    of accuracy to read the media properties, or <see
        ///    cref="ReadStyle.None" /> to ignore the properties.
        /// </param>
        /// <exception cref="ArgumentNullException">
        ///    <paramref name="path" /> is <see langword="null" />.
        /// </exception>
        public File(string path, ReadStyle propertiesStyle, CUEToolsTagger _tagger)
            : base(path, propertiesStyle)
        {
            tagger = _tagger;
            // Make sure we have a tag.
            switch (tagger)
            {
            case CUEToolsTagger.APEv2:
                GetTag(TagTypes.Ape, true);
                break;

            case CUEToolsTagger.ID3v2:
                GetTag(TagTypes.Id3v2, true);
                break;
            }
        }
示例#3
0
 public CUEToolsFormat(
     string _extension,
     CUEToolsTagger _tagger,
     bool _allowLossless,
     bool _allowLossy,
     bool _allowEmbed,
     bool _builtin,
     CUEToolsUDC _encoderLossless,
     CUEToolsUDC _encoderLossy,
     CUEToolsUDC _decoder)
 {
     extension = _extension;
     tagger = _tagger;
     allowLossless = _allowLossless;
     allowLossy = _allowLossy;
     allowEmbed = _allowEmbed;
     builtin = _builtin;
     encoderLossless = _encoderLossless;
     encoderLossy = _encoderLossy;
     decoder = _decoder;
 }
示例#4
0
 public CUEToolsFormat(
     string _extension,
     CUEToolsTagger _tagger,
     bool _allowLossless,
     bool _allowLossy,
     bool _allowEmbed,
     bool _builtin,
     AudioEncoderSettingsViewModel _encoderLossless,
     AudioEncoderSettingsViewModel _encoderLossy,
     AudioDecoderSettingsViewModel _decoder)
 {
     extension       = _extension;
     tagger          = _tagger;
     allowLossless   = _allowLossless;
     allowLossy      = _allowLossy;
     allowEmbed      = _allowEmbed;
     builtin         = _builtin;
     encoderLossless = _encoderLossless;
     encoderLossy    = _encoderLossy;
     decoder         = _decoder;
 }
示例#5
0
 public CUEToolsFormat(
     string _extension,
     CUEToolsTagger _tagger,
     bool _allowLossless,
     bool _allowLossy,
     bool _allowEmbed,
     bool _builtin,
     CUEToolsUDC _encoderLossless,
     CUEToolsUDC _encoderLossy,
     CUEToolsUDC _decoder)
 {
     extension       = _extension;
     tagger          = _tagger;
     allowLossless   = _allowLossless;
     allowLossy      = _allowLossy;
     allowEmbed      = _allowEmbed;
     builtin         = _builtin;
     encoderLossless = _encoderLossless;
     encoderLossy    = _encoderLossy;
     decoder         = _decoder;
 }
示例#6
0
        public void Load(SettingsReader sr)
        {
            int version = sr.LoadInt32("Version", null, null) ?? 202;

            fixOffsetMinimumConfidence    = sr.LoadUInt32("ArFixWhenConfidence", 1, 1000) ?? 2;
            fixOffsetMinimumTracksPercent = sr.LoadUInt32("ArFixWhenPercent", 1, 100) ?? 51;
            encodeWhenConfidence          = sr.LoadUInt32("ArEncodeWhenConfidence", 1, 1000) ?? 2;
            encodeWhenPercent             = sr.LoadUInt32("ArEncodeWhenPercent", 1, 100) ?? 100;
            encodeWhenZeroOffset          = sr.LoadBoolean("ArEncodeWhenZeroOffset") ?? false;
            noUnverifiedOutput            = sr.LoadBoolean("ArNoUnverifiedOutput") ?? false;
            fixOffset           = sr.LoadBoolean("ArFixOffset") ?? false;
            writeArTagsOnEncode = sr.LoadBoolean("ArWriteCRC") ?? writeArTagsOnEncode;
            writeArLogOnConvert = sr.LoadBoolean("ArWriteLog") ?? true;
            writeArTagsOnVerify = sr.LoadBoolean("ArWriteTagsOnVerify") ?? false;
            writeArLogOnVerify  = sr.LoadBoolean("ArWriteLogOnVerify") ?? false;

            preserveHTOA          = sr.LoadBoolean("PreserveHTOA") ?? true;
            detectGaps            = sr.LoadBoolean("DetectGaps") ?? true;
            autoCorrectFilenames  = sr.LoadBoolean("AutoCorrectFilenames") ?? true;
            keepOriginalFilenames = sr.LoadBoolean("KeepOriginalFilenames") ?? false;
            singleFilenameFormat  = sr.Load("SingleFilenameFormat") ?? singleFilenameFormat;
            trackFilenameFormat   = sr.Load("TrackFilenameFormat") ?? trackFilenameFormat;
            removeSpecial         = sr.LoadBoolean("RemoveSpecialCharacters") ?? false;
            specialExceptions     = sr.Load("SpecialCharactersExceptions") ?? "-()";
            replaceSpaces         = sr.LoadBoolean("ReplaceSpaces") ?? false;
            embedLog                  = sr.LoadBoolean("EmbedLog") ?? true;
            extractLog                = sr.LoadBoolean("ExtractLog") ?? true;
            fillUpCUE                 = sr.LoadBoolean("FillUpCUE") ?? true;
            overwriteCUEData          = sr.LoadBoolean("OverwriteCUEData") ?? false;
            filenamesANSISafe         = sr.LoadBoolean("FilenamesANSISafe") ?? true;
            bruteForceDTL             = sr.LoadBoolean("BruteForceDTL") ?? false;
            createEACLOG              = sr.LoadBoolean("CreateEACLOG") ?? createEACLOG;
            detectHDCD                = sr.LoadBoolean("DetectHDCD") ?? true;
            wait750FramesForHDCD      = sr.LoadBoolean("Wait750FramesForHDCD") ?? true;
            decodeHDCD                = sr.LoadBoolean("DecodeHDCD") ?? false;
            createM3U                 = sr.LoadBoolean("CreateM3U") ?? false;
            createCUEFileWhenEmbedded = sr.LoadBoolean("CreateCUEFileWhenEmbedded") ?? true;
            truncate4608ExtraSamples  = sr.LoadBoolean("Truncate4608ExtraSamples") ?? true;
            decodeHDCDtoLW16          = sr.LoadBoolean("DecodeHDCDToLossyWAV16") ?? false;
            decodeHDCDto24bit         = sr.LoadBoolean("DecodeHDCDTo24bit") ?? true;

            oneInstance     = sr.LoadBoolean("OneInstance") ?? true;
            checkForUpdates = sr.LoadBoolean("CheckForUpdates") ?? true;

            writeBasicTagsFromCUEData = sr.LoadBoolean("WriteBasicTagsFromCUEData") ?? true;
            copyBasicTags             = sr.LoadBoolean("CopyBasicTags") ?? true;
            copyUnknownTags           = sr.LoadBoolean("CopyUnknownTags") ?? true;
            CopyAlbumArt    = sr.LoadBoolean("CopyAlbumArt") ?? true;
            embedAlbumArt   = sr.LoadBoolean("EmbedAlbumArt") ?? true;
            extractAlbumArt = sr.LoadBoolean("ExtractAlbumArt") ?? true;
            maxAlbumArtSize = sr.LoadInt32("MaxAlbumArtSize", 100, 10000) ?? maxAlbumArtSize;

            arLogToSourceFolder = sr.LoadBoolean("ArLogToSourceFolder") ?? arLogToSourceFolder;
            arLogVerbose        = sr.LoadBoolean("ArLogVerbose") ?? arLogVerbose;
            fixOffsetToNearest  = sr.LoadBoolean("FixOffsetToNearest") ?? fixOffsetToNearest;
            ArLogFilenameFormat = sr.Load("ArLogFilenameFormat") ?? ArLogFilenameFormat;
            AlArtFilenameFormat = sr.Load("AlArtFilenameFormat") ?? AlArtFilenameFormat;

            separateDecodingThread = sr.LoadBoolean("SeparateDecodingThread") ?? separateDecodingThread;

            var jsonConfig = sr.Load("Advanced");

            if (jsonConfig != null)
            {
                var backup = advanced;
                try
                {
                    var jsonObject = JsonConvert.DeserializeObject(jsonConfig,
                                                                   typeof(CUEConfigAdvanced),
                                                                   new JsonSerializerSettings
                    {
                        DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate,
                        TypeNameHandling     = TypeNameHandling.Auto,
                        Error = (sender, ev) => {
                            System.Diagnostics.Trace.WriteLine(ev.ErrorContext.Error.ToString());
                            ev.ErrorContext.Handled = true;
                        }
                    });
                    if (jsonObject as CUEConfigAdvanced == null)
                    {
                        throw new Exception();
                    }
                    advanced = jsonObject as CUEConfigAdvanced;

                    // Add missing codecs
                    backup.encoders.Where(x => advanced.encoders
                                          .FindAll(y => y.Extension == x.Extension && y.Lossless == x.Lossless && y.Name == x.Name).Count == 0)
                    .ToList().ForEach(x => advanced.encoders.Add(x));
                    backup.decoders.Where(x => advanced.decoders
                                          .FindAll(y => y.Extension == x.Extension && y.Name == x.Name).Count == 0)
                    .ToList().ForEach(x => advanced.decoders.Add(x));

                    // Reset the ViewModel
                    advanced.encodersViewModel = new EncoderListViewModel(advanced.encoders);
                    advanced.decodersViewModel = new DecoderListViewModel(advanced.decoders);

                    // Reset the links in formats
                    foreach (var extension in formats.Keys)
                    {
                        var format = formats[extension];
                        AudioEncoderSettingsViewModel encoderLossless, encoderLossy;
                        AudioDecoderSettingsViewModel decoder;
                        if (format.encoderLossless == null || !Encoders.TryGetValue(extension, true, format.encoderLossless.Name, out encoderLossless))
                        {
                            encoderLossless = Encoders.GetDefault(extension, true);
                        }
                        if (format.encoderLossy == null || !Encoders.TryGetValue(extension, false, format.encoderLossy.Name, out encoderLossy))
                        {
                            encoderLossy = Encoders.GetDefault(extension, false);
                        }
                        if (format.decoder == null || !Decoders.TryGetValue(extension, format.decoder.Name, out decoder))
                        {
                            decoder = Decoders.GetDefault(extension);
                        }
                        format.encoderLossless = encoderLossless;
                        format.encoderLossy    = encoderLossy;
                        format.decoder         = decoder;
                    }
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Trace.WriteLine(ex.Message);
                    advanced = backup;
                }
            }

            int totalFormats = sr.LoadInt32("CustomFormats", 0, null) ?? 0;

            for (int nFormats = 0; nFormats < totalFormats; nFormats++)
            {
                string         extension       = sr.Load(string.Format("CustomFormat{0}Name", nFormats));
                string         encoderLossless = sr.Load(string.Format("CustomFormat{0}EncoderLossless", nFormats)) ?? "";
                string         encoderLossy    = sr.Load(string.Format("CustomFormat{0}EncoderLossy", nFormats)) ?? "";
                string         decoder         = sr.Load(string.Format("CustomFormat{0}Decoder", nFormats));
                CUEToolsTagger tagger          = (CUEToolsTagger)(sr.LoadInt32(string.Format("CustomFormat{0}Tagger", nFormats), 0, 2) ?? 0);
                bool           allowLossless   = sr.LoadBoolean(string.Format("CustomFormat{0}AllowLossless", nFormats)) ?? false;
                bool           allowLossy      = sr.LoadBoolean(string.Format("CustomFormat{0}AllowLossy", nFormats)) ?? false;
                bool           allowEmbed      = sr.LoadBoolean(string.Format("CustomFormat{0}AllowEmbed", nFormats)) ?? false;
                CUEToolsFormat format;
                AudioEncoderSettingsViewModel udcLossless, udcLossy;
                AudioDecoderSettingsViewModel udcDecoder;
                if (encoderLossless == "" || !Encoders.TryGetValue(extension, true, encoderLossless, out udcLossless))
                {
                    udcLossless = Encoders.GetDefault(extension, true);
                }
                if (encoderLossy == "" || !Encoders.TryGetValue(extension, false, encoderLossy, out udcLossy))
                {
                    udcLossy = Encoders.GetDefault(extension, false);
                }
                if (decoder == "" || !Decoders.TryGetValue(extension, decoder, out udcDecoder))
                {
                    udcDecoder = Decoders.GetDefault(extension);
                }
                if (!formats.TryGetValue(extension, out format))
                {
                    formats.Add(extension, new CUEToolsFormat(extension, tagger, allowLossless, allowLossy, allowEmbed, false, udcLossless, udcLossy, udcDecoder));
                }
                else
                {
                    format.encoderLossless = udcLossless;
                    format.encoderLossy    = udcLossy;
                    format.decoder         = udcDecoder;
                    if (!format.builtin)
                    {
                        format.tagger        = tagger;
                        format.allowLossless = allowLossless;
                        format.allowLossy    = allowLossy;
                        format.allowEmbed    = allowEmbed;
                    }
                }
            }

            defaultVerifyScript = sr.Load("DefaultVerifyScript") ?? "default";
            defaultEncodeScript = sr.Load("DefaultVerifyAndConvertScript") ?? "default";

            gapsHandling = (CUEStyle?)sr.LoadInt32("GapsHandling", null, null) ?? gapsHandling;

            language = sr.Load("Language") ?? Thread.CurrentThread.CurrentUICulture.Name;

            if (ArLogFilenameFormat.Contains("%F"))
            {
                ArLogFilenameFormat = "%filename%.accurip";
            }
            if (singleFilenameFormat.Contains("%F"))
            {
                singleFilenameFormat = "%filename%";
            }
            if (trackFilenameFormat.Contains("%N"))
            {
                trackFilenameFormat = "%tracknumber%. %title%";
            }
        }
示例#7
0
        public void Load(SettingsReader sr)
        {
            int version = sr.LoadInt32("Version", null, null) ?? 202;

            fixOffsetMinimumConfidence    = sr.LoadUInt32("ArFixWhenConfidence", 1, 1000) ?? 2;
            fixOffsetMinimumTracksPercent = sr.LoadUInt32("ArFixWhenPercent", 1, 100) ?? 51;
            encodeWhenConfidence          = sr.LoadUInt32("ArEncodeWhenConfidence", 1, 1000) ?? 2;
            encodeWhenPercent             = sr.LoadUInt32("ArEncodeWhenPercent", 1, 100) ?? 100;
            encodeWhenZeroOffset          = sr.LoadBoolean("ArEncodeWhenZeroOffset") ?? false;
            noUnverifiedOutput            = sr.LoadBoolean("ArNoUnverifiedOutput") ?? false;
            fixOffset           = sr.LoadBoolean("ArFixOffset") ?? false;
            writeArTagsOnEncode = sr.LoadBoolean("ArWriteCRC") ?? writeArTagsOnEncode;
            writeArLogOnConvert = sr.LoadBoolean("ArWriteLog") ?? true;
            writeArTagsOnVerify = sr.LoadBoolean("ArWriteTagsOnVerify") ?? false;
            writeArLogOnVerify  = sr.LoadBoolean("ArWriteLogOnVerify") ?? false;

            preserveHTOA          = sr.LoadBoolean("PreserveHTOA") ?? true;
            detectGaps            = sr.LoadBoolean("DetectGaps") ?? true;
            autoCorrectFilenames  = sr.LoadBoolean("AutoCorrectFilenames") ?? true;
            keepOriginalFilenames = sr.LoadBoolean("KeepOriginalFilenames") ?? false;
            singleFilenameFormat  = sr.Load("SingleFilenameFormat") ?? singleFilenameFormat;
            trackFilenameFormat   = sr.Load("TrackFilenameFormat") ?? trackFilenameFormat;
            removeSpecial         = sr.LoadBoolean("RemoveSpecialCharacters") ?? false;
            specialExceptions     = sr.Load("SpecialCharactersExceptions") ?? "-()";
            replaceSpaces         = sr.LoadBoolean("ReplaceSpaces") ?? false;
            embedLog                  = sr.LoadBoolean("EmbedLog") ?? true;
            extractLog                = sr.LoadBoolean("ExtractLog") ?? true;
            fillUpCUE                 = sr.LoadBoolean("FillUpCUE") ?? true;
            overwriteCUEData          = sr.LoadBoolean("OverwriteCUEData") ?? false;
            filenamesANSISafe         = sr.LoadBoolean("FilenamesANSISafe") ?? true;
            bruteForceDTL             = sr.LoadBoolean("BruteForceDTL") ?? false;
            createEACLOG              = sr.LoadBoolean("CreateEACLOG") ?? createEACLOG;
            detectHDCD                = sr.LoadBoolean("DetectHDCD") ?? true;
            wait750FramesForHDCD      = sr.LoadBoolean("Wait750FramesForHDCD") ?? true;
            decodeHDCD                = sr.LoadBoolean("DecodeHDCD") ?? false;
            createM3U                 = sr.LoadBoolean("CreateM3U") ?? false;
            createCUEFileWhenEmbedded = sr.LoadBoolean("CreateCUEFileWhenEmbedded") ?? true;
            truncate4608ExtraSamples  = sr.LoadBoolean("Truncate4608ExtraSamples") ?? true;
            decodeHDCDtoLW16          = sr.LoadBoolean("DecodeHDCDToLossyWAV16") ?? false;
            decodeHDCDto24bit         = sr.LoadBoolean("DecodeHDCDTo24bit") ?? true;

            oneInstance     = sr.LoadBoolean("OneInstance") ?? true;
            checkForUpdates = sr.LoadBoolean("CheckForUpdates") ?? true;

            writeBasicTagsFromCUEData = sr.LoadBoolean("WriteBasicTagsFromCUEData") ?? true;
            copyBasicTags             = sr.LoadBoolean("CopyBasicTags") ?? true;
            copyUnknownTags           = sr.LoadBoolean("CopyUnknownTags") ?? true;
            CopyAlbumArt    = sr.LoadBoolean("CopyAlbumArt") ?? true;
            embedAlbumArt   = sr.LoadBoolean("EmbedAlbumArt") ?? true;
            extractAlbumArt = sr.LoadBoolean("ExtractAlbumArt") ?? true;
            maxAlbumArtSize = sr.LoadInt32("MaxAlbumArtSize", 100, 10000) ?? maxAlbumArtSize;

            arLogToSourceFolder = sr.LoadBoolean("ArLogToSourceFolder") ?? arLogToSourceFolder;
            arLogVerbose        = sr.LoadBoolean("ArLogVerbose") ?? arLogVerbose;
            fixOffsetToNearest  = sr.LoadBoolean("FixOffsetToNearest") ?? fixOffsetToNearest;
            ArLogFilenameFormat = sr.Load("ArLogFilenameFormat") ?? ArLogFilenameFormat;
            AlArtFilenameFormat = sr.Load("AlArtFilenameFormat") ?? AlArtFilenameFormat;

            separateDecodingThread = sr.LoadBoolean("SeparateDecodingThread") ?? separateDecodingThread;

            try
            {
                using (TextReader reader = new StringReader(sr.Load("Advanced")))
                    advanced = CUEConfigAdvanced.serializer.Deserialize(reader) as CUEConfigAdvanced;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.Message);
            }

            int totalEncoders = sr.LoadInt32("ExternalEncoders", 0, null) ?? 0;

            for (int nEncoders = 0; nEncoders < totalEncoders; nEncoders++)
            {
                string      name      = sr.Load(string.Format("ExternalEncoder{0}Name", nEncoders));
                string      extension = sr.Load(string.Format("ExternalEncoder{0}Extension", nEncoders));
                string      settings  = sr.Load(string.Format("ExternalEncoder{0}Settings", nEncoders));
                bool        lossless  = sr.LoadBoolean(string.Format("ExternalEncoder{0}Lossless", nEncoders)) ?? true;
                CUEToolsUDC encoder;
                if (name == null || extension == null)
                {
                    continue;
                }
                if (!encoders.TryGetValue(extension, lossless, name, out encoder))
                {
                    encoder = new CUEToolsUDC(name, extension, lossless, "", "", "", "");
                    encoders.Add(encoder);
                }
                try
                {
                    using (TextReader reader = new StringReader(settings))
                        encoder.settings = encoder.settingsSerializer.Deserialize(reader) as AudioEncoderSettings;
                    if (encoder.settings is UserDefinedEncoderSettings && (encoder.settings as UserDefinedEncoderSettings).Path == "")
                    {
                        throw new Exception();
                    }
                }
                catch
                {
                    if (version == 203 && encoder.settings is UserDefinedEncoderSettings)
                    {
                        (encoder.settings as UserDefinedEncoderSettings).SupportedModes = sr.Load(string.Format("ExternalEncoder{0}Modes", nEncoders));
                        (encoder.settings as UserDefinedEncoderSettings).EncoderMode    = sr.Load(string.Format("ExternalEncoder{0}Mode", nEncoders));
                        (encoder.settings as UserDefinedEncoderSettings).Path           = sr.Load(string.Format("ExternalEncoder{0}Path", nEncoders));
                        (encoder.settings as UserDefinedEncoderSettings).Parameters     = sr.Load(string.Format("ExternalEncoder{0}Parameters", nEncoders));
                    }
                    else
                    {
                        encoders.Remove(encoder);
                    }
                }
            }

            int totalDecoders = sr.LoadInt32("ExternalDecoders", 0, null) ?? 0;

            for (int nDecoders = 0; nDecoders < totalDecoders; nDecoders++)
            {
                string      name       = sr.Load(string.Format("ExternalDecoder{0}Name", nDecoders));
                string      extension  = sr.Load(string.Format("ExternalDecoder{0}Extension", nDecoders));
                string      path       = sr.Load(string.Format("ExternalDecoder{0}Path", nDecoders));
                string      parameters = sr.Load(string.Format("ExternalDecoder{0}Parameters", nDecoders));
                CUEToolsUDC decoder;
                if (!decoders.TryGetValue(extension, true, name, out decoder))
                {
                    decoders.Add(new CUEToolsUDC(name, extension, path, parameters));
                }
                else
                {
                    decoder.extension  = extension;
                    decoder.path       = path;
                    decoder.parameters = parameters;
                }
            }

            int totalFormats = sr.LoadInt32("CustomFormats", 0, null) ?? 0;

            for (int nFormats = 0; nFormats < totalFormats; nFormats++)
            {
                string         extension       = sr.Load(string.Format("CustomFormat{0}Name", nFormats));
                string         encoderLossless = sr.Load(string.Format("CustomFormat{0}EncoderLossless", nFormats)) ?? "";
                string         encoderLossy    = sr.Load(string.Format("CustomFormat{0}EncoderLossy", nFormats)) ?? "";
                string         decoder         = sr.Load(string.Format("CustomFormat{0}Decoder", nFormats));
                CUEToolsTagger tagger          = (CUEToolsTagger)(sr.LoadInt32(string.Format("CustomFormat{0}Tagger", nFormats), 0, 2) ?? 0);
                bool           allowLossless   = sr.LoadBoolean(string.Format("CustomFormat{0}AllowLossless", nFormats)) ?? false;
                bool           allowLossy      = sr.LoadBoolean(string.Format("CustomFormat{0}AllowLossy", nFormats)) ?? false;
                bool           allowEmbed      = sr.LoadBoolean(string.Format("CustomFormat{0}AllowEmbed", nFormats)) ?? false;
                CUEToolsFormat format;
                CUEToolsUDC    udcLossless, udcLossy, udcDecoder;
                if (encoderLossless == "" || !encoders.TryGetValue(extension, true, encoderLossless, out udcLossless))
                {
                    udcLossless = encoders.GetDefault(extension, true);
                }
                if (encoderLossy == "" || !encoders.TryGetValue(extension, false, encoderLossy, out udcLossy))
                {
                    udcLossy = encoders.GetDefault(extension, false);
                }
                if (decoder == "" || !decoders.TryGetValue(extension, true, decoder, out udcDecoder))
                {
                    udcDecoder = decoders.GetDefault(extension, true);
                }
                if (!formats.TryGetValue(extension, out format))
                {
                    formats.Add(extension, new CUEToolsFormat(extension, tagger, allowLossless, allowLossy, allowEmbed, false, udcLossless, udcLossy, udcDecoder));
                }
                else
                {
                    format.encoderLossless = udcLossless;
                    format.encoderLossy    = udcLossy;
                    format.decoder         = udcDecoder;
                    if (!format.builtin)
                    {
                        format.tagger        = tagger;
                        format.allowLossless = allowLossless;
                        format.allowLossy    = allowLossy;
                        format.allowEmbed    = allowEmbed;
                    }
                }
            }

            defaultVerifyScript = sr.Load("DefaultVerifyScript") ?? "default";
            defaultEncodeScript = sr.Load("DefaultVerifyAndConvertScript") ?? "default";

            gapsHandling = (CUEStyle?)sr.LoadInt32("GapsHandling", null, null) ?? gapsHandling;

            language = sr.Load("Language") ?? Thread.CurrentThread.CurrentUICulture.Name;

            if (ArLogFilenameFormat.Contains("%F"))
            {
                ArLogFilenameFormat = "%filename%.accurip";
            }
            if (singleFilenameFormat.Contains("%F"))
            {
                singleFilenameFormat = "%filename%";
            }
            if (trackFilenameFormat.Contains("%N"))
            {
                trackFilenameFormat = "%tracknumber%. %title%";
            }
        }