示例#1
0
        private void Close(object sender, RoutedEventArgs e)
        {
            var an = new DoubleAnimation(0, TimeSpan.FromMilliseconds(200));

            an.Completed += (s, ev) =>
            {
                Hide();
                if (Settings.ForceSoftwareRendering)
                {
                    RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
                }
            };
            BeginAnimation(OpacityProperty, an);
            SettingsWriter.Save();
        }
示例#2
0
        public SystemMessagesConfigWindow()
        {
            InitializeComponent();
            DataContext     = this;
            _hiddenMessages = new SynchronizedObservableCollection <SystemMessageViewModel>();
            _showedMessages = new SynchronizedObservableCollection <SystemMessageViewModel>();

            SettingsHolder.UserExcludedSysMsg.ForEach(opc =>
            {
                _hiddenMessages.Add(new SystemMessageViewModel(opc, SessionManager.DB.SystemMessagesDatabase.Messages[opc]));
            });
            SessionManager.DB.SystemMessagesDatabase.Messages.ToList().ForEach(keyVal =>
            {
                if (SettingsHolder.UserExcludedSysMsg.Contains(keyVal.Key))
                {
                    return;
                }
                _showedMessages.Add(new SystemMessageViewModel(keyVal.Key, keyVal.Value));
            });

            _hiddenMessages.CollectionChanged += (_, args) =>
            {
                switch (args.Action)
                {
                case System.Collections.Specialized.NotifyCollectionChangedAction.Add:
                    foreach (var item in args.NewItems)
                    {
                        SettingsHolder.UserExcludedSysMsg.Add((item as SystemMessageViewModel)?.Opcode);
                    }
                    break;

                case System.Collections.Specialized.NotifyCollectionChangedAction.Remove:
                    foreach (var item in args.OldItems)
                    {
                        SettingsHolder.UserExcludedSysMsg.Remove((item as SystemMessageViewModel)?.Opcode);
                    }
                    break;
                }
                SettingsWriter.Save();
            };

            ShowedMessagesView = CollectionViewUtils.InitLiveView(null, ShowedMessages, new string[] { }, new SortDescription[] { });
            HiddenMessagesView = CollectionViewUtils.InitLiveView(null, HiddenMessages, new string[] { }, new SortDescription[] { });
            ((ICollectionView)ShowedMessagesView).CollectionChanged += GcPls;
            ((ICollectionView)HiddenMessagesView).CollectionChanged += GcPls;
        }
示例#3
0
 private void OnSizeChanged(object sender, SizeChangedEventArgs e)
 {
     if (!WindowSettings.AllowOffScreen)
     {
         CheckBounds();
     }
     if (_ignoreSize)
     {
         return;
     }
     if (WindowSettings.W != ActualWidth ||
         WindowSettings.H != ActualHeight)
     {
         WindowSettings.W = ActualWidth;
         WindowSettings.H = ActualHeight;
         if (!App.Loading)
         {
             SettingsWriter.Save();
         }
     }
 }
示例#4
0
 protected void Drag(object sender, MouseButtonEventArgs e)
 {
     try
     {
         if (!_ignoreSize)
         {
             ResizeMode = ResizeMode.NoResize;
         }
         DragMove();
         UpdateButtons();
         CheckBounds();
         if (!_ignoreSize)
         {
             ResizeMode = ResizeMode.CanResize;
         }
         WindowSettings.X = Left / WindowManager.ScreenSize.Width;
         WindowSettings.Y = Top / WindowManager.ScreenSize.Height;
         SettingsWriter.Save();
     }
     catch
     {
         // ignored
     }
 }
示例#5
0
 protected void Drag(object sender, MouseButtonEventArgs e)
 {
     try
     {
         if (!_ignoreSize)
         {
             ResizeMode = ResizeMode.NoResize;
         }
         DragMove();
         UpdateButtons();
         CheckBounds();
         if (!_ignoreSize)
         {
             ResizeMode = ResizeMode.CanResize;
         }
         _settings.X = Left / Settings.ScreenW;
         _settings.Y = Top / Settings.ScreenH;
         SettingsWriter.Save();
     }
     catch
     {
         // ignored
     }
 }
示例#6
0
        private void SaveSettings()
        {
            SaveProfile();

            SettingsWriter sw = new SettingsWriter("CUE Tools", "settings.txt", Application.ExecutablePath);
            SaveScripts(SelectedAction);
            sw.Save("LastMOTD", lastMOTD);
            sw.Save("ChoiceWidth", _choiceWidth);
            sw.Save("ChoiceHeight", _choiceHeight);
            sw.Save("ChoiceMaxed", _choiceMaxed);
            sw.Save("InputPath", InputPath);
            sw.Save("DefaultLosslessFormat", _defaultLosslessFormat);
            sw.Save("DefaultLossyFormat", _defaultLossyFormat);
            sw.Save("DefaultHybridFormat", _defaultHybridFormat);
            sw.Save("DefaultNoAudioFormat", _defaultNoAudioFormat);
            sw.Save("DontGenerate", !_outputPathUseTemplate);
            sw.Save("OutputPathUseTemplates", comboBoxOutputFormat.Items.Count - OutputPathUseTemplates.Length);
            for (int iFormat = comboBoxOutputFormat.Items.Count - 1; iFormat >= OutputPathUseTemplates.Length; iFormat--)
                sw.Save(string.Format("OutputPathUseTemplate{0}", iFormat - OutputPathUseTemplates.Length), comboBoxOutputFormat.Items[iFormat].ToString());

            sw.Save("UsePregapForFirstTrackInSingleFile", _usePregapForFirstTrackInSingleFile);
            sw.Save("ReducePriority", _reducePriority);
            sw.Save("FileBrowserState", (int)FileBrowserState);
            sw.Save("ReportState", ReportState);
            sw.Save("CorrectorLookup", (int)CorrectorMode);
            sw.Save("CorrectorOverwrite", toolStripButtonCorrectorOverwrite.Checked);
            sw.Save("CorrectorFormat", toolStripDropDownButtonCorrectorFormat.Text);
            sw.Save("WidthIncrement", FileBrowserState == FileBrowserStateEnum.Hidden ? SizeIncrement.Width : Width - OpenMinimumSize.Width);
            sw.Save("HeightIncrement", !ReportState ? SizeIncrement.Height : Height - OpenMinimumSize.Height);
            sw.Save("Top", Top);
            sw.Save("Left", Left);

            StringBuilder profiles = new StringBuilder();
            foreach (ToolStripItem item in toolStripDropDownButtonProfile.DropDownItems)
                if (item != toolStripTextBoxAddProfile
                    && item != toolStripMenuItemDeleteProfile
                    && item != defaultToolStripMenuItem
                    && item != toolStripSeparator5
                    )
                {
                    if (profiles.Length > 0)
                        profiles.Append(' ');
                    profiles.Append(item.Text);
                }
            sw.Save("Profiles", profiles.ToString());

            _defaultProfile.Save(sw);
            sw.Close();
        }
 private void OnCloseButtonClick(object sender, RoutedEventArgs e)
 {
     HideWindow();
     SettingsWriter.Save();
 }
示例#8
0
 private void Image_MouseLeftButtonDown(object sender, RoutedEventArgs routedEventArgs)
 {
     SettingsWriter.Save();
     HideWindow();
 }
示例#9
0
        public void Save(SettingsWriter sw)
        {
            sw.Save("Version", 204);
            sw.Save("ArFixWhenConfidence", fixOffsetMinimumConfidence);
            sw.Save("ArFixWhenPercent", fixOffsetMinimumTracksPercent);
            sw.Save("ArEncodeWhenConfidence", encodeWhenConfidence);
            sw.Save("ArEncodeWhenPercent", encodeWhenPercent);
            sw.Save("ArEncodeWhenZeroOffset", encodeWhenZeroOffset);
            sw.Save("ArNoUnverifiedOutput", noUnverifiedOutput);
            sw.Save("ArFixOffset", fixOffset);
            sw.Save("ArWriteCRC", writeArTagsOnEncode);
            sw.Save("ArWriteLog", writeArLogOnConvert);
            sw.Save("ArWriteTagsOnVerify", writeArTagsOnVerify);
            sw.Save("ArWriteLogOnVerify", writeArLogOnVerify);

            sw.Save("PreserveHTOA", preserveHTOA);
            sw.Save("DetectGaps", detectGaps);
            sw.Save("AutoCorrectFilenames", autoCorrectFilenames);
            sw.Save("KeepOriginalFilenames", keepOriginalFilenames);
            sw.Save("SingleFilenameFormat", singleFilenameFormat);
            sw.Save("TrackFilenameFormat", trackFilenameFormat);
            sw.Save("RemoveSpecialCharacters", removeSpecial);
            sw.Save("SpecialCharactersExceptions", specialExceptions);
            sw.Save("ReplaceSpaces", replaceSpaces);
            sw.Save("EmbedLog", embedLog);
            sw.Save("ExtractLog", extractLog);
            sw.Save("FillUpCUE", fillUpCUE);
            sw.Save("OverwriteCUEData", overwriteCUEData);
            sw.Save("FilenamesANSISafe", filenamesANSISafe);
            if (bruteForceDTL)
            {
                sw.Save("BruteForceDTL", bruteForceDTL);
            }
            sw.Save("CreateEACLOG", createEACLOG);
            sw.Save("DetectHDCD", detectHDCD);
            sw.Save("Wait750FramesForHDCD", wait750FramesForHDCD);
            sw.Save("DecodeHDCD", decodeHDCD);
            sw.Save("CreateM3U", createM3U);
            sw.Save("CreateCUEFileWhenEmbedded", createCUEFileWhenEmbedded);
            sw.Save("Truncate4608ExtraSamples", truncate4608ExtraSamples);
            sw.Save("DecodeHDCDToLossyWAV16", decodeHDCDtoLW16);
            sw.Save("DecodeHDCDTo24bit", decodeHDCDto24bit);
            sw.Save("OneInstance", oneInstance);
            sw.Save("CheckForUpdates", checkForUpdates);
            sw.Save("Language", language);

            sw.Save("SeparateDecodingThread", separateDecodingThread);

            sw.Save("WriteBasicTagsFromCUEData", writeBasicTagsFromCUEData);
            sw.Save("CopyBasicTags", copyBasicTags);
            sw.Save("CopyUnknownTags", copyUnknownTags);
            sw.Save("CopyAlbumArt", CopyAlbumArt);
            sw.Save("EmbedAlbumArt", embedAlbumArt);
            sw.Save("ExtractAlbumArt", extractAlbumArt);
            sw.Save("MaxAlbumArtSize", maxAlbumArtSize);

            sw.Save("ArLogToSourceFolder", arLogToSourceFolder);
            sw.Save("ArLogVerbose", arLogVerbose);
            sw.Save("FixOffsetToNearest", fixOffsetToNearest);

            sw.Save("ArLogFilenameFormat", ArLogFilenameFormat);
            sw.Save("AlArtFilenameFormat", AlArtFilenameFormat);

            sw.SaveText("Advanced", JsonConvert.SerializeObject(advanced,
                                                                Newtonsoft.Json.Formatting.Indented,
                                                                new JsonSerializerSettings
            {
                DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate,
                TypeNameHandling     = TypeNameHandling.Auto,
            }));

            int nFormats = 0;

            foreach (KeyValuePair <string, CUEToolsFormat> format in formats)
            {
                sw.Save(string.Format("CustomFormat{0}Name", nFormats), format.Key);
                sw.Save(string.Format("CustomFormat{0}EncoderLossless", nFormats), format.Value.encoderLossless == null ? "" : format.Value.encoderLossless.Name);
                sw.Save(string.Format("CustomFormat{0}EncoderLossy", nFormats), format.Value.encoderLossy == null ? "" : format.Value.encoderLossy.Name);
                sw.Save(string.Format("CustomFormat{0}Decoder", nFormats), format.Value.decoder == null ? "" : format.Value.decoder.Name);
                sw.Save(string.Format("CustomFormat{0}Tagger", nFormats), (int)format.Value.tagger);
                sw.Save(string.Format("CustomFormat{0}AllowLossless", nFormats), format.Value.allowLossless);
                sw.Save(string.Format("CustomFormat{0}AllowLossy", nFormats), format.Value.allowLossy);
                sw.Save(string.Format("CustomFormat{0}AllowEmbed", nFormats), format.Value.allowEmbed);
                nFormats++;
            }
            sw.Save("CustomFormats", nFormats);

            int nScripts = 0;

            foreach (KeyValuePair <string, CUEToolsScript> script in scripts)
            {
                sw.Save(string.Format("CustomScript{0}Name", nScripts), script.Key);
                int nCondition = 0;
                foreach (CUEAction action in script.Value.conditions)
                {
                    sw.Save(string.Format("CustomScript{0}Condition{1}", nScripts, nCondition++), (int)action);
                }
                sw.Save(string.Format("CustomScript{0}Conditions", nScripts), nCondition);
                nScripts++;
            }
            sw.Save("CustomScripts", nScripts);
            sw.Save("DefaultVerifyScript", defaultVerifyScript);
            sw.Save("DefaultVerifyAndConvertScript", defaultEncodeScript);

            sw.Save("GapsHandling", (int)gapsHandling);
        }
示例#10
0
        public void Save(SettingsWriter sw)
        {
            _config.Save(sw);

            sw.Save("MusicBrainzLookup", _editTags);
            sw.Save("CTDBVerifyOnEncode", _CTDBVerifyOnEncode);
            sw.Save("AccurateRipLookup", _ARVerifyOnEncode);
            sw.Save("LocalDBLookup", _useLocalDB);
            sw.Save("SkipRecent", _skipRecent);
            sw.Save("CUEToolsDBLookup", _CTDBVerify);
            sw.Save("OutputAudioType", (int)_outputAudioType);
            sw.Save("OutputAudioFmt", _outputAudioFormat);
            sw.Save("AccurateRipMode", (int)_action);
            sw.Save("CUEStyle", (int)_CUEStyle);
            sw.Save("WriteOffset", (int)_writeOffset);
            sw.Save("OutputPathTemplate", _outputTemplate);
            sw.Save("Script", _script);
        }