├── .editorconfig ├── .gitattributes ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── ---bug-report.md │ └── ---feature-request.md └── workflows │ └── release.yml ├── .gitignore ├── Installer_Script_x64.iss ├── Installer_Script_x86.iss ├── LICENCE ├── Mapping_Tools.sln ├── Mapping_Tools.sln.DotSettings ├── Mapping_Tools ├── App.config ├── App.xaml ├── App.xaml.cs ├── Classes │ ├── BeatmapHelper │ │ ├── BeatDivisors │ │ │ ├── IBeatDivisor.cs │ │ │ ├── IrrationalBeatDivisor.cs │ │ │ └── RationalBeatDivisor.cs │ │ ├── Beatmap.cs │ │ ├── BeatmapEditor.cs │ │ ├── BeatmapParsingException.cs │ │ ├── ComboColour.cs │ │ ├── Editor.cs │ │ ├── Enums │ │ │ ├── Gamemode.cs │ │ │ ├── HitObjectType.cs │ │ │ ├── Hitsound.cs │ │ │ ├── PathType.cs │ │ │ └── SampleSet.cs │ │ ├── Events │ │ │ ├── Animation.cs │ │ │ ├── Background.cs │ │ │ ├── Break.cs │ │ │ ├── Command.cs │ │ │ ├── EasingType.cs │ │ │ ├── Event.cs │ │ │ ├── EventType.cs │ │ │ ├── IHasDuration.cs │ │ │ ├── IHasEndTime.cs │ │ │ ├── IHasStartTime.cs │ │ │ ├── LoopType.cs │ │ │ ├── Origin.cs │ │ │ ├── OtherCommand.cs │ │ │ ├── ParameterCommand.cs │ │ │ ├── Sprite.cs │ │ │ ├── StandardLoop.cs │ │ │ ├── StoryboardLayer.cs │ │ │ ├── StoryboardSoundSample.cs │ │ │ ├── TriggerLoop.cs │ │ │ └── Video.cs │ │ ├── FileFormatHelper.cs │ │ ├── HitObject.cs │ │ ├── HitObjectComparer.cs │ │ ├── ITextFile.cs │ │ ├── ITextLine.cs │ │ ├── SliderPathStuff │ │ │ ├── PathApproximator.cs │ │ │ └── SliderPath.cs │ │ ├── SpecialColour.cs │ │ ├── Storyboard.cs │ │ ├── StoryboardEditor.cs │ │ ├── TValue.cs │ │ ├── TempoSignature.cs │ │ ├── Timeline.cs │ │ ├── TimelineObject.cs │ │ ├── Timing.cs │ │ └── TimingPoint.cs │ ├── Exceptions │ │ ├── BeatmapIncompatibleException.cs │ │ ├── EditorReaderDisabledException.cs │ │ └── InvalidEditorReaderStateException.cs │ ├── GenericExtensions.cs │ ├── HitsoundStuff │ │ ├── CompleteHitsounds.cs │ │ ├── CustomIndex.cs │ │ ├── Effects │ │ │ ├── DelayFadeOutSampleProvider.cs │ │ │ ├── Effect.cs │ │ │ ├── EffectParameter.cs │ │ │ └── SoftLimiter.cs │ │ ├── HitsoundConverter.cs │ │ ├── HitsoundEvent.cs │ │ ├── HitsoundExporter.cs │ │ ├── HitsoundImporter.cs │ │ ├── HitsoundLayer.cs │ │ ├── HitsoundLayerExtension.cs │ │ ├── HitsoundZone.cs │ │ ├── ImportReloadingArgs.cs │ │ ├── ImportReloadingArgsComparer.cs │ │ ├── ImportType.cs │ │ ├── LayerImportArgs.cs │ │ ├── MidiExporter.cs │ │ ├── SF2Extension.cs │ │ ├── Sample.cs │ │ ├── SampleGeneratingArgs.cs │ │ ├── SampleGeneratingArgsComparer.cs │ │ ├── SampleImporter.cs │ │ ├── SamplePackage.cs │ │ ├── SampleSchema.cs │ │ ├── SampleSoundGenerator.cs │ │ └── VorbisFileWriter.cs │ ├── JsonConverters │ │ └── Vector2Converter.cs │ ├── MathUtil │ │ ├── BezierCurve.cs │ │ ├── BezierCurveCubic.cs │ │ ├── BezierCurveQuadric.cs │ │ ├── BinarySearchUtil.cs │ │ ├── Box2.cs │ │ ├── Box2d.cs │ │ ├── Circle.cs │ │ ├── CircleArc.cs │ │ ├── Extensions.cs │ │ ├── GradientDescentUtil.cs │ │ ├── Line2.cs │ │ ├── LineSegment.cs │ │ ├── MathHelper.cs │ │ ├── Matrix2.cs │ │ ├── Matrix2d.cs │ │ ├── Matrix2x3.cs │ │ ├── Matrix2x3d.cs │ │ ├── Matrix2x4.cs │ │ ├── Matrix2x4d.cs │ │ ├── Matrix3.cs │ │ ├── Matrix3d.cs │ │ ├── Matrix3x2.cs │ │ ├── Matrix3x2d.cs │ │ ├── Matrix3x4.cs │ │ ├── Matrix3x4d.cs │ │ ├── Matrix4.cs │ │ ├── Matrix4d.cs │ │ ├── Matrix4x2.cs │ │ ├── Matrix4x2d.cs │ │ ├── Matrix4x3.cs │ │ ├── Matrix4x3d.cs │ │ ├── Precision.cs │ │ ├── Quaternion.cs │ │ ├── Quaterniond.cs │ │ ├── RNG.cs │ │ ├── Vector2.cs │ │ ├── Vector2d.cs │ │ ├── Vector3.cs │ │ ├── Vector3d.cs │ │ ├── Vector4.cs │ │ └── Vector4d.cs │ ├── SystemTools │ │ ├── ActionHotkey.cs │ │ ├── BackupManager.cs │ │ ├── BindableBase.cs │ │ ├── Hotkey.cs │ │ ├── IHasExtraAutoSaveTarget.cs │ │ ├── IHaveExtraProjectMenuItems.cs │ │ ├── IOHelper.cs │ │ ├── ISavable.cs │ │ ├── ListenerManager.cs │ │ ├── ProjectManager.cs │ │ ├── QuickRun │ │ │ ├── IQuickRun.cs │ │ │ ├── SmartQuickRunTargets.cs │ │ │ └── SmartQuickRunUsageAttribute.cs │ │ ├── RunToolCompletedEventArgs.cs │ │ ├── Settings.cs │ │ ├── SettingsManager.cs │ │ ├── ShowSelectedInFileExplorer.cs │ │ └── TypeConverters.cs │ ├── ToolHelpers │ │ ├── EditorReaderStuff.cs │ │ ├── Sliders │ │ │ ├── BezierConverter.cs │ │ │ ├── BezierSubdivision.cs │ │ │ ├── Newgen │ │ │ │ ├── PathGenerator2.cs │ │ │ │ ├── PathHelper.cs │ │ │ │ ├── PathPoint.cs │ │ │ │ ├── PathWithHints.cs │ │ │ │ ├── ReconstructionHint.cs │ │ │ │ └── Reconstructor.cs │ │ │ ├── PathGenerator.cs │ │ │ └── SliderPathUtil.cs │ │ └── TimingPointsChange.cs │ └── Tools │ │ ├── AutoFailDetector.cs │ │ ├── ComboColourStudio │ │ ├── ColourPoint.cs │ │ ├── ColourPointMode.cs │ │ ├── ComboColourProject.cs │ │ └── SpecialColourDragAndDropListBox.cs │ │ ├── MapCleanerStuff │ │ ├── MapCleaner.cs │ │ ├── MapCleanerArgs.cs │ │ └── MapCleanerResult.cs │ │ ├── PatternGallery │ │ ├── CollectionRenameVm.cs │ │ ├── ExportTimeMode.cs │ │ ├── NewGroupVm.cs │ │ ├── OsuPattern.cs │ │ ├── OsuPatternDetailsVm.cs │ │ ├── OsuPatternFileHandler.cs │ │ ├── OsuPatternMaker.cs │ │ ├── OsuPatternPlacer.cs │ │ ├── PatternCodeImportVm.cs │ │ ├── PatternFileImportVm.cs │ │ ├── PatternOverwriteMode.cs │ │ ├── SelectedPatternImportVm.cs │ │ └── TimingOverwriteMode.cs │ │ ├── RhythmGuide.cs │ │ ├── SlideratorStuff │ │ ├── GraphStateValueGetter.cs │ │ ├── PositionFunctionDelegate.cs │ │ ├── SliderInvisiblator.cs │ │ ├── SliderPicturator.cs │ │ └── Sliderator.cs │ │ ├── SnappingTools │ │ ├── CoordinateConverter.cs │ │ ├── DashStylesEnum.cs │ │ ├── DataStructure │ │ │ ├── LayerCollection.cs │ │ │ ├── Layers │ │ │ │ └── RelevantObjectLayer.cs │ │ │ ├── RelevantObject │ │ │ │ ├── IRelevantDrawable.cs │ │ │ │ ├── IRelevantObject.cs │ │ │ │ ├── RelevantDrawable.cs │ │ │ │ ├── RelevantObject.cs │ │ │ │ ├── RelevantObjectPreferences.cs │ │ │ │ └── RelevantObjects │ │ │ │ │ ├── RelevantCircle.cs │ │ │ │ │ ├── RelevantHitObject.cs │ │ │ │ │ ├── RelevantLine.cs │ │ │ │ │ └── RelevantPoint.cs │ │ │ ├── RelevantObjectCollection │ │ │ │ └── RelevantObjectCollection.cs │ │ │ └── RelevantObjectGenerators │ │ │ │ ├── Allocation │ │ │ │ ├── RelevantObjectPairGenerator.cs │ │ │ │ └── RelevantObjectsGeneratorMethodAttribute.cs │ │ │ │ ├── GeneratorCollection │ │ │ │ └── RelevantObjectsGeneratorCollection.cs │ │ │ │ ├── GeneratorGroupComparer.cs │ │ │ │ ├── GeneratorInputSelection │ │ │ │ ├── SelectionPredicate.cs │ │ │ │ └── SelectionPredicateCollection.cs │ │ │ │ ├── GeneratorSettings.cs │ │ │ │ ├── GeneratorSettingses │ │ │ │ ├── ScaleRotateGeneratorSettings.cs │ │ │ │ ├── SinglePointCircleGeneratorSettings.cs │ │ │ │ ├── SliderPathGeneratorSettings.cs │ │ │ │ └── SymmetryGeneratorSettings.cs │ │ │ │ ├── GeneratorTypes │ │ │ │ ├── GeneratorTemporalPositioning.cs │ │ │ │ └── GeneratorType.cs │ │ │ │ ├── Generators │ │ │ │ ├── AnchorPointGenerator.cs │ │ │ │ ├── AngleBisectorGenerator.cs │ │ │ │ ├── AveragePointGenerator2.cs │ │ │ │ ├── AveragePointGenerator3.cs │ │ │ │ ├── CircleTangentGenerator.cs │ │ │ │ ├── EqualSpacingGenerator.cs │ │ │ │ ├── IntersectionGenerator.cs │ │ │ │ ├── LastAnchorGenerator.cs │ │ │ │ ├── LineGenerator.cs │ │ │ │ ├── LinearLineGenerator.cs │ │ │ │ ├── ParallelismGenerator.cs │ │ │ │ ├── PerfectCircleBlanketGenerator.cs │ │ │ │ ├── PerfectCircleGenerator.cs │ │ │ │ ├── PerpendicularGenerator.cs │ │ │ │ ├── PointBisectorGenerator.cs │ │ │ │ ├── SameTransformGenerator2.cs │ │ │ │ ├── SameTransformGenerator3.cs │ │ │ │ ├── SameTransformGenerator3Reversed.cs │ │ │ │ ├── SameTransformGenerator4.cs │ │ │ │ ├── ScaleRotateGenerator.cs │ │ │ │ ├── SinglePointCircleGenerator.cs │ │ │ │ ├── SliderEndGenerator.cs │ │ │ │ ├── SliderPathGenerator.cs │ │ │ │ ├── SquareGenerator.cs │ │ │ │ ├── SquareGenerator2.cs │ │ │ │ ├── StartPointGenerator.cs │ │ │ │ ├── SymmetryGenerator.cs │ │ │ │ ├── TangentCircleGenerator.cs │ │ │ │ ├── TriangleGenerator.cs │ │ │ │ └── TriangleGenerator2.cs │ │ │ │ └── RelevantObjectsGenerator.cs │ │ └── Serialization │ │ │ ├── SnappingToolsPreferences.cs │ │ │ ├── SnappingToolsProject.cs │ │ │ └── SnappingToolsSaveSlot.cs │ │ └── TumourGenerating │ │ ├── Domain │ │ └── TumourTemplateToIconConverter.cs │ │ ├── Enums │ │ ├── TumourSidedness.cs │ │ ├── TumourTemplate.cs │ │ └── WrappingMode.cs │ │ ├── ITumourAssignment.cs │ │ ├── Options │ │ ├── IRequireInit.cs │ │ ├── ITumourLayer.cs │ │ ├── ITumourTemplate.cs │ │ ├── TumourLayer.cs │ │ └── TumourTemplates │ │ │ ├── CircleTemplate.cs │ │ │ ├── ParabolaTemplate.cs │ │ │ ├── SquareTemplate.cs │ │ │ ├── TriangleTemplate.cs │ │ │ └── TumourTemplateBase.cs │ │ └── TumourGenerator.cs ├── Components │ ├── Dialogs │ │ ├── BeatmapImportDialog.xaml │ │ ├── BeatmapImportDialog.xaml.cs │ │ ├── CustomDialog │ │ │ ├── BeatmapBrowseAttribute.cs │ │ │ ├── ConverterParameterAttribute.cs │ │ │ ├── CustomDialog.xaml │ │ │ ├── CustomDialog.xaml.cs │ │ │ ├── FileBrowseAttribute.cs │ │ │ ├── InvariantCultureAttribute.cs │ │ │ ├── MultiLineInputAttribute.cs │ │ │ ├── TextWrappingAttribute.cs │ │ │ └── TimeInputAttribute.cs │ │ ├── MessageDialog.xaml │ │ ├── MessageDialog.xaml.cs │ │ ├── SampleDialog │ │ │ ├── SampleDialog.xaml │ │ │ ├── SampleDialog.xaml.cs │ │ │ └── SampleDialogViewModel.cs │ │ ├── TypeValueDialog.xaml │ │ └── TypeValueDialog.xaml.cs │ ├── Domain │ │ ├── BeatDivisorArrayToStringConverter.cs │ │ ├── BooleanAndConverter.cs │ │ ├── BooleanConverter.cs │ │ ├── BooleanInvertConverter.cs │ │ ├── BooleanOrConverter.cs │ │ ├── BooleanOrToVisibilityConverter.cs │ │ ├── BooleanToVisibilityConverter.cs │ │ ├── CharacterLimitValidationRule.cs │ │ ├── CircleSizeToThicknessConverter.cs │ │ ├── ColorToBrushConverter.cs │ │ ├── ColorToStringConverter.cs │ │ ├── CommandImplementation.cs │ │ ├── DoubleArrayToStringConverter.cs │ │ ├── DoubleToStringConverter.cs │ │ ├── EnumToBoolConverter.cs │ │ ├── EnumToVisibilityConverter.cs │ │ ├── FlagToBoolConverter.cs │ │ ├── FocusExtension.cs │ │ ├── GraphStateToDoubleConverter.cs │ │ ├── GraphStateToStringConverter.cs │ │ ├── HitsoundToStringConverter.cs │ │ ├── IdentityConverter.cs │ │ ├── ImportTypeToStringConverter.cs │ │ ├── IntToStringConverter.cs │ │ ├── IsASCIIValidationRule.cs │ │ ├── IsGreaterOrEqualValidationRule.cs │ │ ├── IsGreaterValidationRule.cs │ │ ├── IsLessOrEqualValidationRule.cs │ │ ├── IsLessValidationRule.cs │ │ ├── MapPathStringAddNewLinesConverter.cs │ │ ├── MapPathStringJustFilenameConverter.cs │ │ ├── MapPathStringToCountStringConverter.cs │ │ ├── MultiValueConverterGroup.cs │ │ ├── NotEmptyValidationRule.cs │ │ ├── ParsableDoubleListValidationRule.cs │ │ ├── SampleSetToStringConverter.cs │ │ ├── StringArrayToStringConverter.cs │ │ ├── TimeToStringConverter.cs │ │ └── VolumeToPercentageConverter.cs │ ├── DragAndDropListBox.cs │ ├── GIFImageControl.cs │ ├── Graph │ │ ├── Anchor.xaml │ │ ├── Anchor.xaml.cs │ │ ├── AnchorCollection.cs │ │ ├── AnchorState.cs │ │ ├── Graph.xaml │ │ ├── Graph.xaml.cs │ │ ├── GraphDoubleAnimation.cs │ │ ├── GraphIntegralDoubleAnimation.cs │ │ ├── GraphPointControl.cs │ │ ├── GraphState.cs │ │ ├── IGraphAnchor.cs │ │ ├── Interpolation │ │ │ ├── CustomDerivativeExtremaAttribute.cs │ │ │ ├── CustomExtremaAttribute.cs │ │ │ ├── CustomIntegralExtremaAttribute.cs │ │ │ ├── CustomInterpolator.cs │ │ │ ├── IDerivableInterpolator.cs │ │ │ ├── IGraphInterpolator.cs │ │ │ ├── IIntegrableInterpolator.cs │ │ │ ├── IInvertibleInterpolator.cs │ │ │ ├── IgnoreInterpolatorAttribute.cs │ │ │ ├── InterpolatorComparer.cs │ │ │ ├── InterpolatorHelper.cs │ │ │ ├── Interpolators │ │ │ │ ├── DoubleCurveInterpolator.cs │ │ │ │ ├── DoubleCurveInterpolator2.cs │ │ │ │ ├── DoubleCurveInterpolator3.cs │ │ │ │ ├── HalfSineInterpolator.cs │ │ │ │ ├── Helper Interpolators │ │ │ │ │ ├── PrimitiveParabolaInterpolator.cs │ │ │ │ │ └── PrimitiveSingleCurveInterpolator.cs │ │ │ │ ├── LinearInterpolator.cs │ │ │ │ ├── ParabolaInterpolator.cs │ │ │ │ ├── SingleCurveInterpolator.cs │ │ │ │ ├── SingleCurveInterpolator2.cs │ │ │ │ ├── SingleCurveInterpolator3.cs │ │ │ │ └── WaveInterpolator.cs │ │ │ └── VerticalMirrorInterpolatorAttribute.cs │ │ ├── Markers │ │ │ ├── CompositeMarkerGenerator.cs │ │ │ ├── CustomMarkerGenerator.cs │ │ │ ├── DividedBeatMarkerGenerator.cs │ │ │ ├── DoubleMarkerGenerator.cs │ │ │ ├── GraphMarker.cs │ │ │ └── IMarkerGenerator.cs │ │ ├── TensionAnchor.xaml │ │ └── TensionAnchor.xaml.cs │ ├── HotkeyEditorControl.xaml │ ├── HotkeyEditorControl.xaml.cs │ ├── ObjectVisualiser │ │ ├── HitObjectElement.cs │ │ ├── HitObjectElementMarker.cs │ │ └── OsuPatternToThumbnailConverter.cs │ ├── Spectrum │ │ ├── Spectrum.xaml │ │ └── Spectrum.xaml.cs │ ├── TimeLine │ │ ├── TimeLine.xaml │ │ ├── TimeLine.xaml.cs │ │ ├── TimeLineElement.xaml │ │ ├── TimeLineElement.xaml.cs │ │ ├── TimeLineMark.xaml │ │ └── TimeLineMark.xaml.cs │ ├── ValueOrGraphControl.xaml │ ├── ValueOrGraphControl.xaml.cs │ ├── ViewHeaderComponent.xaml │ └── ViewHeaderComponent.xaml.cs ├── Data │ ├── MTcog256.gif │ ├── mt_icon.ico │ ├── mt_logo_256.png │ ├── mt_logo_white_24.png │ └── sample_pattern.jpg ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── Mapping_Tools.csproj ├── Properties │ ├── Annotations.cs │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Updater │ ├── UpdateManager.cs │ ├── UpdaterWindow.xaml │ └── UpdaterWindow.xaml.cs ├── Viewmodels │ ├── AutoFailDetectorVm.cs │ ├── ComboColourStudioVm.cs │ ├── HitsoundCopierVm.cs │ ├── HitsoundPreviewHelperVm.cs │ ├── HitsoundStudioVm.cs │ ├── MainWindowVm.cs │ ├── MapCleanerVm.cs │ ├── MapsetMergerVm.cs │ ├── MetadataManagerVm.cs │ ├── PatternGalleryVm.cs │ ├── PreferencesVm.cs │ ├── PropertyTransformerVm.cs │ ├── RhythmGuideVm.cs │ ├── SliderCompletionatorVm.cs │ ├── SliderMergerVm.cs │ ├── SliderPicturatorVm.cs │ ├── SlideratorVm.cs │ ├── SnappingToolsVm.cs │ ├── StandardVm.cs │ ├── TimingCopierVm.cs │ ├── TimingHelperVm.cs │ └── TumourGeneratorVm.cs └── Views │ ├── AutoFailDetector │ ├── AutoFailDetectorView.xaml │ └── AutoFailDetectorView.xaml.cs │ ├── ComboColourStudio │ ├── ComboColourStudioView.xaml │ └── ComboColourStudioView.xaml.cs │ ├── DontShowTitleAttribute.cs │ ├── Extensions.cs │ ├── HiddenToolAttribute.cs │ ├── HitsoundCopier │ ├── HitsoundCopierView.xaml │ └── HitsoundCopierView.xaml.cs │ ├── HitsoundPreviewHelper │ ├── HitsoundPreviewHelper.xaml │ └── HitsoundPreviewHelper.xaml.cs │ ├── HitsoundStudio │ ├── HitsoundLayerImportWindow.xaml │ ├── HitsoundLayerImportWindow.xaml.cs │ ├── HitsoundStudioExportDialog.xaml │ ├── HitsoundStudioExportDialog.xaml.cs │ ├── HitsoundStudioView.xaml │ └── HitsoundStudioView.xaml.cs │ ├── HorizontalContentScrollAttribute.cs │ ├── MapCleaner │ ├── CleanerView.xaml │ └── CleanerView.xaml.cs │ ├── MappingTool.cs │ ├── MapsetMerger │ ├── MapsetMergerView.cs │ └── MapsetMergerView.xaml │ ├── MetadataManager │ ├── MetadataManagerView.xaml │ └── MetadataManagerView.xaml.cs │ ├── PatternGallery │ ├── PatternGalleryView.xaml │ └── PatternGalleryView.xaml.cs │ ├── Preferences │ ├── PreferencesView.xaml │ └── PreferencesView.xaml.cs │ ├── PropertyTransformer │ ├── PropertyTransformerView.xaml │ └── PropertyTransformerView.xaml.cs │ ├── RhythmGuide │ ├── RhythmGuideView.xaml │ ├── RhythmGuideView.xaml.cs │ ├── RhythmGuideWindow.xaml │ └── RhythmGuideWindow.xaml.cs │ ├── SingleRunMappingTool.cs │ ├── SliderCompletionator │ ├── SliderCompletionatorView.xaml │ └── SliderCompletionatorView.xaml.cs │ ├── SliderMerger │ ├── SliderMergerView.xaml │ └── SliderMergerView.xaml.cs │ ├── SliderPicturator │ ├── SliderPicturatorView.xaml │ └── SliderPicturatorView.xaml.cs │ ├── Sliderator │ ├── SlideratorView.xaml │ └── SlideratorView.xaml.cs │ ├── SnappingTools │ ├── GeneratorSettingsWindow.xaml │ ├── GeneratorSettingsWindow.xaml.cs │ ├── SnappingToolsOverlay.cs │ ├── SnappingToolsPreferencesWindow.xaml │ ├── SnappingToolsPreferencesWindow.xaml.cs │ ├── SnappingToolsProjectWindow.xaml │ ├── SnappingToolsProjectWindow.xaml.cs │ ├── SnappingToolsView.xaml │ └── SnappingToolsView.xaml.cs │ ├── Standard │ ├── MessageWindow.xaml │ ├── MessageWindow.xaml.cs │ ├── StandardView.xaml │ └── StandardView.xaml.cs │ ├── TimingCopier │ ├── TimingCopierView.xaml │ └── TimingCopierView.xaml.cs │ ├── TimingHelper │ ├── TimingHelperView.xaml │ └── TimingHelperView.xaml.cs │ ├── TumourGenerator │ ├── TumourGeneratorView.xaml │ └── TumourGeneratorView.xaml.cs │ ├── VerticalContentScrollAttribute.cs │ └── ViewCollection.cs ├── Mapping_Tools_Tests ├── Classes │ ├── BeatmapHelper │ │ ├── BeatmapHelperTests.cs │ │ └── SliderPathStuff │ │ │ └── SliderPathTests.cs │ ├── ComboColourStudio │ │ └── ComboColourProjectTests.cs │ ├── ExternalFileUtil │ │ └── Reaper │ │ │ └── SerializationTests.cs │ ├── MathUtil │ │ └── GradientDescentUtilTests.cs │ ├── SliderPathStuff │ │ └── BezierSubdivisionTests.cs │ ├── SystemTools │ │ ├── ListenerManagerTests.cs │ │ └── TypeConvertersTests.cs │ ├── ToolHelpers │ │ └── Sliders │ │ │ └── NewGen │ │ │ ├── PathHelperTests.cs │ │ │ └── PathWithHintsTests.cs │ └── Tools │ │ └── TumourGenerating │ │ ├── Options │ │ └── TumourTemplates │ │ │ └── ParabolaGeneratorTests.cs │ │ └── TumourGeneratorTests.cs ├── Mapping_Tools_Tests.csproj ├── Mapping_Tools_Tests.csproj.DotSettings ├── MathUtilTests.cs ├── Properties │ └── AssemblyInfo.cs ├── Resources │ ├── Camellia - Body F10ating in the Zero Gravity Space (Orange_) [Nonsubmersible].osu │ ├── ComplicatedTestMap.osu │ ├── EmptyTestMap.osu │ ├── THE ORAL CIGARETTES - GET BACK (Nikakis) [Sotarks_ Cataclysm].osu │ └── TestStoryboard.osb └── SerializationTests.cs ├── README.md └── lib ├── EditorReader.dll ├── NonInvasiveKeyboardHookLibrary.Core.dll ├── netcorecheck.exe └── netcorecheck_x64.exe /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | ko_fi: OliBomby 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/---bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F41B Bug report" 3 | about: Submit a bug report 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Prerequisites 11 | 12 | 13 | - [ ] I have read the [Mapping Tools FAQ](https://mappingtools.github.io/faq) 14 | 15 | ## Environment 16 | 17 | 18 | **OS version**: 19 | 20 | 21 | **Mapping Tools version**: 22 | 23 | ## Description 24 | A clear and concise description of the bug. What did you expect to happen, and what actually happened? 25 | 26 | ### Reproduction 27 | 28 | Steps to reproduce the behavior: 29 | 1. Go to '...' 30 | 2. Click on '....' 31 | 3. Scroll down to '....' 32 | 4. ... 33 | 5. See error 34 | 35 | ### Screenshots/Recordings 36 | If possible, add screenshots or screen recordings to help explain or show the problem 37 | 38 | ## Additional context 39 | Add any other context about the problem here 40 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/---feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F4A5 Feature request" 3 | about: Suggest a new feature for this project 4 | title: "[Feature Request] " 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Prerequisites 11 | 12 | 13 | - [ ] I have checked the [Trello](https://trello.com/b/iTmmw3eP/mapping-tools) and confirmed that the feature is not already planned 14 | 15 | ## Description 16 | A clear and concise description of what the feature is 17 | 18 | ## Motivation 19 | Outline the motivation for this feature and why it should be implemented. Has it been requested by a large amount of users? Does it address a problem that currently can't, or is difficult to, be fixed? 20 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining a copy 2 | of this software and associated documentation files (the "Software"), to deal 3 | in the Software without restriction, including without limitation the rights 4 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 5 | copies of the Software, and to permit persons to whom the Software is 6 | furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in 9 | all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17 | THE SOFTWARE. 18 | -------------------------------------------------------------------------------- /Mapping_Tools/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Mapping_Tools/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using System.Windows; 4 | using System.Windows.Threading; 5 | using static Mapping_Tools.MainWindow; 6 | 7 | namespace Mapping_Tools { 8 | /// 9 | /// Interaction logic for App.xaml 10 | /// 11 | public partial class App : Application 12 | { 13 | private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { 14 | // Log the exception, display it, etc 15 | var exception = e.Exception; 16 | var lines = new List { exception.Message, exception.StackTrace, exception.Source }; 17 | 18 | while (exception.InnerException != null) { 19 | exception = exception.InnerException; 20 | lines.Add("\nInner exception:"); 21 | lines.Add(exception.Message); 22 | lines.Add(exception.StackTrace); 23 | lines.Add(exception.Source); 24 | } 25 | 26 | const string filename = "crash-log.txt"; 27 | var path = AppDataPath != null ? Path.Combine(AppDataPath, filename) : filename; 28 | File.WriteAllLines(path, lines); 29 | MessageBox.Show($"The program encountered an unhandled exception. Look in {filename} for more info:\n{path}", "Error"); 30 | 31 | // Prevent default unhandled exception processing 32 | e.Handled = AppDataPath != null; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/BeatDivisors/IBeatDivisor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Classes.BeatmapHelper.BeatDivisors { 4 | public interface IBeatDivisor : IEquatable { 5 | double GetValue(); 6 | } 7 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/BeatDivisors/IrrationalBeatDivisor.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.BeatmapHelper.BeatDivisors { 2 | public class IrrationalBeatDivisor : IBeatDivisor { 3 | public readonly double Value; 4 | 5 | public IrrationalBeatDivisor(double value) { 6 | Value = value; 7 | } 8 | 9 | public static implicit operator IrrationalBeatDivisor(double value) { 10 | return new IrrationalBeatDivisor(value); 11 | } 12 | 13 | public double GetValue() { 14 | return Value; 15 | } 16 | 17 | protected bool Equals(IrrationalBeatDivisor other) { 18 | return Value.Equals(other.Value); 19 | } 20 | 21 | public bool Equals(IBeatDivisor other) { 22 | if (other is null) return false; 23 | if (ReferenceEquals(this, other)) return true; 24 | if (other is IrrationalBeatDivisor otherIrrational) return Equals(otherIrrational); 25 | return false; 26 | } 27 | 28 | public override bool Equals(object obj) { 29 | if (obj is null) return false; 30 | if (ReferenceEquals(this, obj)) return true; 31 | return obj.GetType() == GetType() && Equals((IrrationalBeatDivisor) obj); 32 | } 33 | 34 | public override int GetHashCode() { 35 | return Value.GetHashCode(); 36 | } 37 | 38 | public override string ToString() { 39 | return GetValue().ToInvariant(); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/BeatmapParsingException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Classes.BeatmapHelper 4 | { 5 | [Serializable] 6 | class BeatmapParsingException : Exception 7 | { 8 | public BeatmapParsingException() { 9 | 10 | } 11 | 12 | public BeatmapParsingException(string line) 13 | : base($"Unexpected value encountered while parsing beatmap.\n{line}") { 14 | 15 | } 16 | 17 | public BeatmapParsingException(string message, string line) 18 | : base($"{message}\n{line}") { 19 | 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/Enums/Gamemode.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.BeatmapHelper.Enums 2 | { 3 | /// 4 | /// 5 | /// 6 | public enum GameMode 7 | { 8 | Standard = 0, 9 | Taiko = 1, 10 | Catch = 2, 11 | Mania = 3 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/Enums/HitObjectType.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.BeatmapHelper.Enums { 2 | public enum HitObjectType { 3 | Circle, 4 | Slider, 5 | Spinner, 6 | HoldNote 7 | } 8 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/Enums/Hitsound.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.BeatmapHelper.Enums { 2 | /// 3 | /// The hitsound placed into the hitobject. 4 | /// 5 | public enum Hitsound { 6 | /// 7 | Normal = 0, 8 | 9 | /// 10 | Whistle = 1, 11 | 12 | /// 13 | Finish = 2, 14 | 15 | /// 16 | Clap = 3 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/Enums/PathType.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. 2 | // See the LICENCE file in the repository root for full licence text. 3 | 4 | namespace Mapping_Tools.Classes.BeatmapHelper.Enums { 5 | 6 | /// 7 | /// The Slider curve type relating to the osu beatmap. 8 | /// 9 | public enum PathType { 10 | /// 11 | /// The slider curve using Catmull 12 | /// 13 | Catmull, 14 | 15 | /// 16 | /// The slider curve using Bezier 17 | /// 18 | Bezier, 19 | 20 | /// 21 | /// The slider curve using Linear 22 | /// 23 | Linear, 24 | 25 | /// 26 | /// 27 | /// 28 | PerfectCurve, 29 | 30 | /// 31 | /// B-spline curve from lazer 32 | /// 33 | BSpline, 34 | } 35 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/Enums/SampleSet.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.BeatmapHelper.Enums { 2 | /// 3 | /// The types of samples used for inherited timing points and hitobjects themselves. 4 | /// 5 | public enum SampleSet { 6 | /// 7 | /// (Hitobject only) Uses the current inherited timing points' hitsound sampleset and custom list. 8 | /// 9 | None = 0, 10 | /// 11 | /// The sampleset of Normal. 12 | /// 13 | Normal = 1, 14 | /// 15 | /// The sampleset of Soft. 16 | /// 17 | Soft = 2, 18 | /// 19 | /// The sampleset of Drum. 20 | /// 21 | Drum = 3 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/Events/Break.cs: -------------------------------------------------------------------------------- 1 | using static Mapping_Tools.Classes.BeatmapHelper.FileFormatHelper; 2 | 3 | namespace Mapping_Tools.Classes.BeatmapHelper.Events { 4 | public class Break : Event, IHasStartTime, IHasEndTime { 5 | public string EventType { get; set; } 6 | public double StartTime { get; set; } 7 | public double EndTime { get; set; } 8 | 9 | public Break() { } 10 | 11 | public Break(string line) { 12 | SetLine(line); 13 | } 14 | 15 | public override string GetLine() { 16 | return $"{EventType},{(SaveWithFloatPrecision ? StartTime.ToInvariant() : StartTime.ToRoundInvariant())},{(SaveWithFloatPrecision ? EndTime.ToInvariant() : EndTime.ToRoundInvariant())}"; 17 | } 18 | 19 | public override sealed void SetLine(string line) { 20 | string[] values = line.Split(','); 21 | 22 | // Either 'Break' or '2' indicates a break. We save the value so we dont accidentally change it. 23 | if (values[0] != "2" && values[0] != "Break") { 24 | throw new BeatmapParsingException("This line is not a break.", line); 25 | } 26 | 27 | EventType = values[0]; 28 | 29 | if (TryParseDouble(values[1], out double startTime)) 30 | StartTime = startTime; 31 | else throw new BeatmapParsingException("Failed to parse start time of break.", line); 32 | 33 | if (TryParseDouble(values[2], out double endTime)) 34 | EndTime = endTime; 35 | else throw new BeatmapParsingException("Failed to parse end time of break.", line); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/Events/Command.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.BeatmapHelper.Events { 2 | public abstract class Command : Event, IHasStartTime { 3 | public int Indents { get; set; } 4 | public virtual EventType EventType { get; set; } 5 | public double StartTime { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/Events/EasingType.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.BeatmapHelper.Events { 2 | public enum EasingType { 3 | Linear, // Linear: no easing 4 | EasingOut, // EasingType Out: the changes happen fast at first, but then slow down toward the end 5 | EasingIn, // EasingType In: the changes happen slowly at first, but then speed up toward the end 6 | QuadIn, // Quad In 7 | QuadOut, // Quad Out 8 | QuadInOut, // Quad In/Out 9 | CubicIn, // Cubic In 10 | CubicOut, // Cubic Out 11 | CubicInOut, // Cubic In/Out 12 | QuartIn, // Quart In 13 | QuartOut, // Quart Out 14 | QuartInOut, // Quart In/Out 15 | QuintIn, // Quint In 16 | QuintOut, // Quint Out 17 | QuintInOut, // Quint In/Out 18 | SineIn, // Sine In 19 | SineOut, // Sine Out 20 | SineInOut, // Sine In/Out 21 | ExpoIn, // Expo In 22 | ExpoOut, // Expo Out 23 | ExpoInOut, // Expo In/Out 24 | CircIn, // Circ In 25 | CircOut, // Circ Out 26 | CircInOut, // Circ In/Out 27 | ElasticIn, // Elastic In 28 | ElasticOut, // Elastic Out 29 | ElasticHalfOut, // ElasticHalf Out 30 | ElasticQuarterOut, // ElasticQuarter Out 31 | ElasticInOut, // Elastic In/Out 32 | BackIn, // Back In 33 | BackOut, // Back Out 34 | BackInOut, // Back In/Out 35 | BounceIn, // Bounce In 36 | BounceOut, // Bounce Out 37 | BounceInOut, // Bounce In/Out 38 | } 39 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/Events/EventType.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable InconsistentNaming 2 | namespace Mapping_Tools.Classes.BeatmapHelper.Events { 3 | public enum EventType { 4 | F, // Fade 5 | M, // Move 6 | MX, // Move X 7 | MY, // Move Y 8 | S, // Scale 9 | V, // Vector scale 10 | R, // Rotate 11 | C, // Colour 12 | L, // Loop 13 | T, // EventType-triggered loop 14 | P, // Parameters 15 | Unknown, // Unknown command type 16 | } 17 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/Events/IHasDuration.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.BeatmapHelper.Events { 2 | public interface IHasDuration { 3 | double Duration { get; set; } 4 | } 5 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/Events/IHasEndTime.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.BeatmapHelper.Events { 2 | /// 3 | /// Indicates that a type has an end time. Used by Property Transformer on Events 4 | /// 5 | public interface IHasEndTime { 6 | double EndTime { get; set; } 7 | } 8 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/Events/IHasStartTime.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.BeatmapHelper.Events { 2 | /// 3 | /// Indicates that a type has a start time. Used by Property Transformer on Events 4 | /// 5 | public interface IHasStartTime { 6 | double StartTime { get; set; } 7 | } 8 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/Events/LoopType.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.BeatmapHelper.Events { 2 | public enum LoopType { 3 | LoopForever, 4 | LoopOnce, 5 | } 6 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/Events/Origin.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.BeatmapHelper.Events { 2 | public enum Origin { 3 | TopLeft, 4 | Centre, 5 | CentreLeft, 6 | TopRight, 7 | BottomCentre, 8 | TopCentre, 9 | Custom, 10 | CentreRight, 11 | BottomLeft, 12 | BottomRight 13 | } 14 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/Events/StandardLoop.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | using static Mapping_Tools.Classes.BeatmapHelper.FileFormatHelper; 3 | 4 | namespace Mapping_Tools.Classes.BeatmapHelper.Events { 5 | /// 6 | /// Represents the standard loop event. This event has a different syntax so it can't be a . 7 | /// 8 | public class StandardLoop : Command { 9 | public override EventType EventType => EventType.L; 10 | 11 | public int LoopCount { get; set; } 12 | 13 | public override string GetLine() { 14 | return $"{EventType},{(SaveWithFloatPrecision ? StartTime.ToInvariant() : StartTime.ToRoundInvariant())},{LoopCount.ToInvariant()}"; 15 | } 16 | 17 | public override void SetLine(string line) { 18 | var subLine = RemoveIndents(line); 19 | var values = subLine.Split(','); 20 | 21 | if (TryParseDouble(values[1], out double startTime)) 22 | StartTime = startTime; 23 | else throw new BeatmapParsingException("Failed to parse start time of event param.", line); 24 | 25 | if (TryParseInt(values[2], out int loopCount)) 26 | LoopCount = loopCount; 27 | else throw new BeatmapParsingException("Failed to parse loop count of event param.", line); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/Events/StoryboardLayer.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.BeatmapHelper 2 | { 3 | /// 4 | /// The layers according to the osu! Storyboard. 5 | /// 6 | public enum StoryboardLayer 7 | { 8 | /// 9 | /// 10 | /// 11 | Background = 0, 12 | /// 13 | /// 14 | /// 15 | Fail = 1, 16 | /// 17 | /// 18 | /// 19 | Pass = 2, 20 | /// 21 | /// 22 | /// 23 | Foreground = 3, 24 | /// 25 | /// 26 | /// 27 | Overlay = 4, 28 | /// 29 | /// 30 | /// 31 | DifficultyBackground = 5, 32 | /// 33 | /// 34 | /// 35 | DifficultyFail = 6, 36 | DifficultyForeground = 7, 37 | DifficultyOverlay = 8 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/Events/TriggerLoop.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | using static Mapping_Tools.Classes.BeatmapHelper.FileFormatHelper; 3 | 4 | namespace Mapping_Tools.Classes.BeatmapHelper.Events { 5 | /// 6 | /// Represents trigger loop events. Although called loops, these only ever activate once. 7 | /// 8 | public class TriggerLoop : Command, IHasEndTime { 9 | public override EventType EventType => EventType.T; 10 | public double EndTime { get; set; } 11 | public string TriggerName { get; set; } 12 | 13 | public override string GetLine() { 14 | return $"{EventType},{TriggerName},{(SaveWithFloatPrecision ? StartTime.ToInvariant() : StartTime.ToRoundInvariant())},{(SaveWithFloatPrecision ? EndTime.ToInvariant() : EndTime.ToRoundInvariant())}"; 15 | } 16 | 17 | public override void SetLine(string line) { 18 | var subLine = RemoveIndents(line); 19 | var values = subLine.Split(','); 20 | 21 | TriggerName = values[1]; 22 | 23 | if (TryParseDouble(values[2], out double startTime)) 24 | StartTime = startTime; 25 | else throw new BeatmapParsingException("Failed to parse start time of event param.", line); 26 | 27 | if (TryParseDouble(values[3], out double endTime)) 28 | EndTime = endTime; 29 | else throw new BeatmapParsingException("Failed to parse end time of event param.", line); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/ITextFile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Mapping_Tools.Classes.BeatmapHelper 8 | { 9 | /// 10 | /// Interface for a text file. 11 | /// 12 | public interface ITextFile 13 | { 14 | /// 15 | /// Returns with all lines found within text file. 16 | /// 17 | /// 18 | List GetLines(); 19 | 20 | /// 21 | /// Edits the spesified text file with passed through lines. 22 | /// 23 | /// 24 | void SetLines(List lines); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/ITextLine.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.BeatmapHelper 2 | { 3 | interface ITextLine 4 | { 5 | /// 6 | /// 7 | /// 8 | /// 9 | string GetLine(); 10 | /// 11 | /// 12 | /// 13 | /// 14 | void SetLine(string line); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/SpecialColour.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Media; 3 | using Mapping_Tools.Annotations; 4 | 5 | namespace Mapping_Tools.Classes.BeatmapHelper { 6 | 7 | public class SpecialColour :ComboColour, IEquatable, ICloneable { 8 | private string name; 9 | 10 | public string Name { 11 | get => name; 12 | set => Set(ref name, value); 13 | } 14 | 15 | [UsedImplicitly] 16 | public SpecialColour() { } 17 | 18 | public SpecialColour(Color color) : base(color) { 19 | } 20 | 21 | public SpecialColour(Color color, string name) : base(color) { 22 | Name = name; 23 | } 24 | 25 | public object Clone() { 26 | return new SpecialColour(Color, Name); 27 | } 28 | 29 | public bool Equals(SpecialColour other) { 30 | if( other is null ) 31 | return false; 32 | if( ReferenceEquals(this, other) ) 33 | return true; 34 | return name == other.name && Color == other.Color; 35 | } 36 | 37 | public override bool Equals(object obj) { 38 | if( obj is null ) 39 | return false; 40 | if( ReferenceEquals(this, obj) ) 41 | return true; 42 | return obj.GetType() == GetType() && Equals((SpecialColour) obj); 43 | } 44 | 45 | public override int GetHashCode() { 46 | return ( name != null ? name.GetHashCode() : 0 ); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/StoryboardEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Mapping_Tools.Classes.BeatmapHelper 4 | { 5 | /// 6 | /// 7 | /// 8 | public class StoryboardEditor : Editor 9 | { 10 | /// 11 | /// 12 | /// 13 | public StoryBoard StoryBoard => (StoryBoard)TextFile; 14 | 15 | /// 16 | public StoryboardEditor(List lines) { 17 | TextFile = new StoryBoard(lines); 18 | } 19 | 20 | /// 21 | public StoryboardEditor(string path) { 22 | Path = path; 23 | TextFile = new StoryBoard(ReadFile(Path)); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/BeatmapHelper/TValue.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Globalization; 3 | using System.Linq; 4 | using System.Text.RegularExpressions; 5 | 6 | namespace Mapping_Tools.Classes.BeatmapHelper { 7 | /// 8 | /// Helper class for a single string that can represent multiple data types. 9 | /// Provides methods for converting data to and from string. 10 | /// 11 | public class TValue { 12 | public string Value { get; set; } 13 | 14 | public int IntValue { 15 | get => GetInt(); 16 | set => SetInt(value); 17 | } 18 | 19 | public double DoubleValue { 20 | get => GetDouble(); 21 | set => SetDouble(value); 22 | } 23 | 24 | public TValue() { } 25 | 26 | public TValue(string str) { 27 | Value = str; 28 | } 29 | 30 | public void SetValue(object value) { 31 | Value = value.ToInvariant(); 32 | } 33 | 34 | public int GetInt() => int.Parse(Value, CultureInfo.InvariantCulture); 35 | 36 | public void SetInt(int value) => Value = value.ToInvariant(); 37 | 38 | public bool IsInt() => !string.IsNullOrEmpty(Value) && Regex.IsMatch(Value, @"^\-?[0-9]$"); 39 | 40 | public double GetDouble() => double.Parse(Value, NumberStyles.Float, CultureInfo.InvariantCulture); 41 | 42 | public void SetDouble(double value) => Value = value.ToInvariant(); 43 | 44 | public bool IsDouble() => !string.IsNullOrEmpty(Value) && Regex.IsMatch(Value, @"^\-?[0-9]+(\.[0-9]+)?$"); 45 | 46 | public List GetDoubleList() => Value.Split(',').Select(v => double.Parse(v, NumberStyles.Float, CultureInfo.InvariantCulture)).ToList(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Exceptions/BeatmapIncompatibleException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Classes.Exceptions { 4 | public class BeatmapIncompatibleException : Exception { 5 | public static readonly string BeatmapIncompatibleText = "This beatmap is incompatible with this operation."; 6 | 7 | public BeatmapIncompatibleException() : base(BeatmapIncompatibleText) { } 8 | 9 | public BeatmapIncompatibleException(string message) : base(message) { } 10 | 11 | public BeatmapIncompatibleException(string message, Exception innerException) : base(message, innerException) { } 12 | } 13 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Exceptions/EditorReaderDisabledException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Classes.Exceptions { 4 | public class EditorReaderDisabledException : Exception { 5 | public static readonly string EditorReaderDisabledText = "You need to enable Editor Reader to use this feature."; 6 | 7 | public EditorReaderDisabledException() : base(EditorReaderDisabledText) { } 8 | } 9 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Exceptions/InvalidEditorReaderStateException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Classes.Exceptions { 4 | public class InvalidEditorReaderStateException : Exception { 5 | public static readonly string InvalidEditorReaderStateText = "Failed to validate Editor Reader state."; 6 | 7 | public InvalidEditorReaderStateException() : base(InvalidEditorReaderStateText) { } 8 | } 9 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/HitsoundStuff/CompleteHitsounds.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Mapping_Tools.Classes.HitsoundStuff { 8 | 9 | /// 10 | /// 11 | /// 12 | public class CompleteHitsounds { 13 | 14 | /// 15 | /// 16 | /// 17 | public List Hitsounds; 18 | 19 | /// 20 | /// 21 | /// 22 | public List CustomIndices; 23 | 24 | /// 25 | /// 26 | /// 27 | /// 28 | /// 29 | public CompleteHitsounds(List hitsounds, List customIndices) { 30 | Hitsounds = hitsounds; 31 | CustomIndices = customIndices; 32 | } 33 | 34 | /// 35 | /// 36 | /// 37 | /// 38 | public CompleteHitsounds(List hitsounds) { 39 | Hitsounds = hitsounds; 40 | CustomIndices = new List(); 41 | } 42 | 43 | /// 44 | /// 45 | /// 46 | /// 47 | public CompleteHitsounds(List customIndices) { 48 | Hitsounds = new List(); 49 | CustomIndices = customIndices; 50 | } 51 | 52 | /// 53 | /// 54 | /// 55 | public CompleteHitsounds() { 56 | Hitsounds = new List(); 57 | CustomIndices = new List(); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/HitsoundStuff/Effects/EffectParameter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Classes.HitsoundStuff.Effects { 4 | public class EffectParameter { 5 | private float currentValue; 6 | 7 | public EffectParameter(float defaultValue, float minimum, float maximum, string description) { 8 | Min = minimum; 9 | Max = maximum; 10 | Description = description; 11 | CurrentValue = defaultValue; 12 | } 13 | 14 | public float Min { get; } 15 | public float Max { get; } 16 | public string Description { get; } 17 | 18 | public float CurrentValue { 19 | get => currentValue; 20 | set { 21 | if (value < Min || value > Max) 22 | throw new ArgumentOutOfRangeException(nameof(CurrentValue)); 23 | if (currentValue != value) 24 | ValueChanged?.Invoke(this, EventArgs.Empty); 25 | currentValue = value; 26 | } 27 | } 28 | 29 | public event EventHandler ValueChanged; 30 | } 31 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/HitsoundStuff/Effects/SoftLimiter.cs: -------------------------------------------------------------------------------- 1 | using NAudio.Wave; 2 | 3 | namespace Mapping_Tools.Classes.HitsoundStuff.Effects { 4 | public class SoftLimiter : Effect { 5 | private readonly float a = 1.017f; 6 | 7 | private readonly float amp_dB = 8.6562f; 8 | private readonly float b = -0.025f; 9 | private readonly float baseline_threshold_dB = -9f; 10 | private float boost_dB; 11 | private float limit_dB; 12 | private float threshold_dB; 13 | 14 | public SoftLimiter(ISampleProvider source) : base(source) { 15 | RegisterParameters(Boost, Brickwall); 16 | } 17 | 18 | public override string Name => "Soft Clipper/ Limiter"; 19 | 20 | public EffectParameter Boost { get; } = new EffectParameter(0f, 0f, 18f, "Boost"); 21 | public EffectParameter Brickwall { get; } = new EffectParameter(-0.1f, -3.0f, 1f, "Output Brickwall(dB)"); 22 | 23 | protected override void ParamsChanged() { 24 | boost_dB = Boost.CurrentValue; 25 | limit_dB = Brickwall.CurrentValue; 26 | threshold_dB = baseline_threshold_dB + limit_dB; 27 | } 28 | 29 | protected override void Sample(ref float spl0, ref float spl1) { 30 | var dB0 = amp_dB * Log(Abs(spl0)) + boost_dB; 31 | var dB1 = amp_dB * Log(Abs(spl1)) + boost_dB; 32 | 33 | if (dB0 > threshold_dB) { 34 | var over_dB = dB0 - threshold_dB; 35 | over_dB = a * over_dB + b * over_dB * over_dB; 36 | dB0 = Min(threshold_dB + over_dB, limit_dB); 37 | } 38 | 39 | if (dB1 > threshold_dB) { 40 | var over_dB = dB1 - threshold_dB; 41 | over_dB = a * over_dB + b * over_dB * over_dB; 42 | dB1 = Min(threshold_dB + over_dB, limit_dB); 43 | } 44 | 45 | spl0 = Exp(dB0 / amp_dB) * Sign(spl0); 46 | spl1 = Exp(dB1 / amp_dB) * Sign(spl1); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/HitsoundStuff/HitsoundEvent.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.MathUtil; 2 | using System; 3 | using System.Collections; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using Mapping_Tools.Classes.BeatmapHelper; 9 | using Mapping_Tools.Classes.BeatmapHelper.Enums; 10 | 11 | namespace Mapping_Tools.Classes.HitsoundStuff { 12 | /// 13 | /// Represents a hitsound by a single circle in the editor 14 | /// 15 | public class HitsoundEvent { 16 | public double Time; 17 | public Vector2 Pos; 18 | public double Volume; 19 | public string Filename; 20 | public SampleSet SampleSet; 21 | public SampleSet Additions; 22 | public int CustomIndex; 23 | public bool Whistle; 24 | public bool Finish; 25 | public bool Clap; 26 | 27 | public HitsoundEvent(double time, double volume, SampleSet sampleSet, SampleSet additions, int customIndex, bool whistle, bool finish, bool clap) : this( 28 | time, new Vector2(256, 192), volume, string.Empty, sampleSet, additions, customIndex, whistle, finish, clap) { } 29 | 30 | public HitsoundEvent(double time, Vector2 pos, double volume, string filename, SampleSet sampleSet, SampleSet additions, int customIndex, bool whistle, bool finish, bool clap) { 31 | Time = time; 32 | Pos = pos; 33 | Volume = volume; 34 | Filename = filename; 35 | SampleSet = sampleSet; 36 | Additions = additions; 37 | CustomIndex = customIndex; 38 | Whistle = whistle; 39 | Finish = finish; 40 | Clap = clap; 41 | } 42 | 43 | /// 44 | /// 45 | /// 46 | /// 47 | public int GetHitsounds() { 48 | return MathHelper.GetIntFromBitArray(new BitArray(new bool[] { false, Whistle, Finish, Clap })); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/HitsoundStuff/HitsoundLayerExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Mapping_Tools.Classes.HitsoundStuff { 8 | static class HitsoundLayerExtension { 9 | public static string AllToStringOrDefault(this List list, Func func, CultureInfo culture=null) { 10 | if (list.Count == 0) 11 | return ""; 12 | TResult first = func(list.First()); 13 | foreach (TObj o in list) { 14 | if (!func(o).Equals(first)) 15 | return ""; 16 | } 17 | return Convert.ToString(first, culture); 18 | } 19 | 20 | public static string AllToStringOrDefault(this List list, Func func, Func stringConverter) { 21 | if (list.Count == 0) 22 | return ""; 23 | TResult first = func(list.First()); 24 | foreach (TObj o in list) { 25 | if (!func(o).Equals(first)) 26 | return ""; 27 | } 28 | return stringConverter(first); 29 | } 30 | 31 | public static string DoubleListToStringConverter(List list) { 32 | var accumulator = new StringBuilder(list.Count * 2); // Rough guess for capacity of StringBuilder 33 | foreach (double d in list) { 34 | accumulator.Append(d.ToString(CultureInfo.InvariantCulture)).Append(","); 35 | } 36 | if (accumulator.Length > 0) 37 | accumulator.Remove(accumulator.Length - 1, 1); 38 | return accumulator.ToString(); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/HitsoundStuff/ImportType.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.HitsoundStuff { 2 | /// 3 | /// Enumerator of import types of hitsounds. 4 | /// 5 | public enum ImportType { 6 | None = 0, 7 | Stack = 1, 8 | Hitsounds = 2, 9 | // ReSharper disable once InconsistentNaming 10 | MIDI = 3, 11 | Storyboard = 4, 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/MathUtil/Extensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Mapping_Tools.Classes.MathUtil { 8 | public static class MyExtensions { 9 | public static int WordCount(this string str) { 10 | return str.Split(new char[] { ' ', '.', '?' }, 11 | StringSplitOptions.RemoveEmptyEntries).Length; 12 | } 13 | 14 | public static int Length(this List list) { 15 | return list.Count; 16 | } 17 | 18 | public static List Copy(this List list) 19 | { 20 | List newList = new List(); 21 | newList.AddRange(list); 22 | return newList; 23 | } 24 | 25 | public static void Round(this IEnumerable list) { 26 | foreach (var v in list) { 27 | v.Round(); 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/MathUtil/Precision.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. 2 | // See the LICENCE file in the repository root for full licence text. 3 | 4 | using System; 5 | 6 | namespace Mapping_Tools.Classes.MathUtil { 7 | public static class Precision { 8 | public const double DoubleEpsilon = 1e-7; 9 | 10 | public static bool DefinitelyBigger(double value1, double value2, double acceptableDifference = DoubleEpsilon) { 11 | return value1 - acceptableDifference > value2; 12 | } 13 | 14 | public static bool AlmostBigger(double value1, double value2, double acceptableDifference = DoubleEpsilon) { 15 | return value1 > value2 - acceptableDifference; 16 | } 17 | 18 | public static bool AlmostEquals(double value1, double value2, double acceptableDifference = DoubleEpsilon) { 19 | return Math.Abs(value1 - value2) <= acceptableDifference; 20 | } 21 | 22 | public static bool AlmostEquals(Vector2 value1, Vector2 value2, double acceptableDifference = DoubleEpsilon) { 23 | return AlmostEquals(value1.X, value2.X, acceptableDifference) && AlmostEquals(value1.Y, value2.Y, acceptableDifference); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/SystemTools/ActionHotkey.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Classes.SystemTools { 4 | /// 5 | /// Links a spesified user Keyboard with a Action 6 | /// to the spesified Mapping Tool. 7 | /// 8 | public class ActionHotkey { 9 | /// 10 | /// The spesified user keyboard 11 | /// 12 | public Hotkey Hotkey; 13 | 14 | /// 15 | /// The spesified linked to the Mapping Tool. 16 | /// 17 | public Action Action; 18 | 19 | /// 20 | /// Constructer that links a spesified 21 | /// to the Mapping Tools . 22 | /// 23 | /// The spesified user keyboard 24 | /// The spesified linked to the Mapping Tool. 25 | public ActionHotkey(Hotkey hotkey, Action action) { 26 | Hotkey = hotkey; 27 | Action = action; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/SystemTools/BindableBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Runtime.CompilerServices; 4 | 5 | namespace Mapping_Tools.Classes.SystemTools { 6 | 7 | /// 8 | /// 9 | /// 10 | public abstract class BindableBase : INotifyPropertyChanged { 11 | /// 12 | /// 13 | /// 14 | public event PropertyChangedEventHandler PropertyChanged; 15 | 16 | /// 17 | /// Sets the property and executes an action and invokes the property changed event if the property changed. 18 | /// The action gets executed before the property changed event. 19 | /// 20 | /// 21 | /// The variable to change. 22 | /// The new value. 23 | /// The property name for the property changed event. 24 | /// The action to execute before the property change. 25 | /// Whether the property changed or not. 26 | protected bool Set(ref T target, T value, [CallerMemberName] string propertyName = "", Action action = null) { 27 | if (target != null && target.Equals(value)) return false; 28 | target = value; 29 | action?.Invoke(); 30 | RaisePropertyChanged(propertyName); 31 | return true; 32 | } 33 | 34 | /// 35 | /// 36 | /// 37 | /// 38 | protected void RaisePropertyChanged([CallerMemberName] string propertyName = "") { 39 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/SystemTools/Hotkey.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using System.Windows.Input; 4 | 5 | namespace Mapping_Tools.Classes.SystemTools { 6 | public class Hotkey : ICloneable, IEquatable { 7 | public Key Key { get; set; } 8 | 9 | public ModifierKeys Modifiers { get; set; } 10 | 11 | public Hotkey(Key key, ModifierKeys modifiers) { 12 | Key = key; 13 | Modifiers = modifiers; 14 | } 15 | 16 | public override string ToString() { 17 | var str = new StringBuilder(); 18 | 19 | if (Modifiers.HasFlag(ModifierKeys.Control)) 20 | str.Append("Ctrl + "); 21 | if (Modifiers.HasFlag(ModifierKeys.Shift)) 22 | str.Append("Shift + "); 23 | if (Modifiers.HasFlag(ModifierKeys.Alt)) 24 | str.Append("Alt + "); 25 | if (Modifiers.HasFlag(ModifierKeys.Windows)) 26 | str.Append("Win + "); 27 | 28 | str.Append(Key); 29 | 30 | return str.ToString(); 31 | } 32 | 33 | public object Clone() { 34 | return MemberwiseClone(); 35 | } 36 | 37 | public bool Equals(Hotkey other) { 38 | if (other is null) return false; 39 | if (ReferenceEquals(this, other)) return true; 40 | return Key == other.Key && Modifiers == other.Modifiers; 41 | } 42 | 43 | public override bool Equals(object obj) { 44 | if (obj is null) return false; 45 | if (ReferenceEquals(this, obj)) return true; 46 | return obj.GetType() == GetType() && Equals((Hotkey) obj); 47 | } 48 | 49 | public override int GetHashCode() { 50 | unchecked { 51 | return ((int) Key * 397) ^ (int) Modifiers; 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/SystemTools/IHasExtraAutoSaveTarget.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.SystemTools { 2 | public interface IHasExtraAutoSaveTarget { 3 | string ExtraAutoSavePath { get; } 4 | } 5 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/SystemTools/IHaveExtraProjectMenuItems.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace Mapping_Tools.Classes.SystemTools { 4 | /// 5 | /// Indicates that this tool has extra menu items that have to be shown in the Project tab 6 | /// 7 | public interface IHaveExtraProjectMenuItems { 8 | /// 9 | /// Gets the menu items that are going to be shown in the Project tab 10 | /// 11 | MenuItem[] GetMenuItems(); 12 | } 13 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/SystemTools/ISavable.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.SystemTools { 2 | /// 3 | /// Creates a Savable project tool. 4 | /// 5 | /// 6 | public interface ISavable 7 | { 8 | /// 9 | /// Grabs and imports all save data specified into the tool. 10 | /// 11 | /// 12 | T GetSaveData(); 13 | /// 14 | /// 15 | /// 16 | /// 17 | void SetSaveData(T saveData); 18 | /// 19 | /// 20 | /// 21 | string AutoSavePath { get; } 22 | /// 23 | /// 24 | /// 25 | string DefaultSaveFolder { get; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/SystemTools/QuickRun/IQuickRun.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Classes.SystemTools.QuickRun { 4 | /// 5 | /// Interface for the Quick Runnable Tools. 6 | /// 7 | public interface IQuickRun { 8 | /// 9 | /// 10 | /// 11 | void QuickRun(); 12 | /// 13 | /// 14 | /// 15 | event EventHandler RunFinished; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/SystemTools/QuickRun/SmartQuickRunTargets.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Classes.SystemTools.QuickRun { 4 | [Flags] 5 | public enum SmartQuickRunTargets { 6 | NoSelection = 1, 7 | SingleSelection = 1 << 1, 8 | MultipleSelection = 1 << 2, 9 | 10 | AnySelection = SingleSelection | MultipleSelection, 11 | Always = NoSelection | SingleSelection | MultipleSelection, 12 | } 13 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/SystemTools/QuickRun/SmartQuickRunUsageAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Classes.SystemTools.QuickRun { 4 | /// 5 | /// Attributes an IQuickRun tool to show up in SmartQuickRun options 6 | /// 7 | [AttributeUsage(AttributeTargets.Class)] 8 | public class SmartQuickRunUsageAttribute : Attribute { 9 | public SmartQuickRunTargets Targets; 10 | public SmartQuickRunUsageAttribute(SmartQuickRunTargets targets) { 11 | Targets = targets; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/SystemTools/RunToolCompletedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Mapping_Tools.Classes.SystemTools { 8 | public class RunToolCompletedEventArgs : EventArgs { 9 | public bool Quick; 10 | public bool Success; 11 | public bool NeedReload; 12 | 13 | public RunToolCompletedEventArgs(bool success, bool needReload, bool quick) { 14 | Success = success; 15 | NeedReload = needReload; 16 | Quick = quick; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/ComboColourStudio/ColourPointMode.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.Tools.ComboColourStudio { 2 | public enum ColourPointMode { 3 | Normal, 4 | Burst 5 | } 6 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/ComboColourStudio/SpecialColourDragAndDropListBox.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.BeatmapHelper; 2 | using Mapping_Tools.Components; 3 | 4 | namespace Mapping_Tools.Classes.Tools.ComboColourStudio { 5 | public class SpecialColourDragAndDropListBox : DragAndDropListBox { 6 | 7 | } 8 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/MapCleanerStuff/MapCleanerResult.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.Tools.MapCleanerStuff { 2 | public class MapCleanerResult { 3 | public int ObjectsResnapped; 4 | public int SamplesRemoved; 5 | public int TimingPointsRemoved; 6 | 7 | public MapCleanerResult() { 8 | SamplesRemoved = 0; 9 | } 10 | 11 | public MapCleanerResult(int objectsResnapped, int samplesRemoved) { 12 | ObjectsResnapped = objectsResnapped; 13 | SamplesRemoved = 0; 14 | SamplesRemoved = samplesRemoved; 15 | } 16 | 17 | public void Add(MapCleanerResult other) { 18 | ObjectsResnapped += other.ObjectsResnapped; 19 | SamplesRemoved += other.SamplesRemoved; 20 | TimingPointsRemoved += other.TimingPointsRemoved; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/PatternGallery/CollectionRenameVm.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Mapping_Tools.Classes.Tools.PatternGallery { 4 | public class CollectionRenameVm { 5 | [DisplayName("New name")] 6 | [Description("The new name for the collection.")] 7 | public string NewName { get; set; } 8 | 9 | [DisplayName("New directory name")] 10 | [Description("The new name for the collection's directory in the Pattern Files directory.")] 11 | public string NewFolderName { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/PatternGallery/ExportTimeMode.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.Tools.PatternGallery { 2 | public enum ExportTimeMode { 3 | Pattern, 4 | Custom, 5 | Current 6 | } 7 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/PatternGallery/NewGroupVm.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.SystemTools; 2 | using System.ComponentModel; 3 | 4 | namespace Mapping_Tools.Classes.Tools.PatternGallery { 5 | public class NewGroupVm : BindableBase { 6 | private string groupName; 7 | 8 | [DisplayName("Group name")] 9 | [Description("The name for new group.")] 10 | public string GroupName { 11 | get => groupName; 12 | set => Set(ref groupName, value); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/PatternGallery/PatternFileImportVm.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using Mapping_Tools.Classes.SystemTools; 3 | using Mapping_Tools.Components.Dialogs.CustomDialog; 4 | 5 | namespace Mapping_Tools.Classes.Tools.PatternGallery { 6 | public class PatternFileImportVm : BindableBase { 7 | private string name = string.Empty; 8 | private string filePath = string.Empty; 9 | private string filter = string.Empty; 10 | private double startTime = -1; 11 | private double endTime = -1; 12 | 13 | [DisplayName("Name")] 14 | [Description("The name for the pattern.")] 15 | public string Name { 16 | get => name; 17 | set => Set(ref name, value); 18 | } 19 | 20 | [BeatmapBrowse] 21 | [DisplayName("Pattern file path")] 22 | [Description("The path to the pattern file to import.")] 23 | public string FilePath { 24 | get => filePath; 25 | set => Set(ref filePath, value); 26 | } 27 | 28 | [DisplayName("Filter")] 29 | [Description("Input an optional time code here. Example time code: 00:56:823 (1,2,1,2) - ")] 30 | public string Filter { 31 | get => filter; 32 | set => Set(ref filter, value); 33 | } 34 | 35 | [TimeInput] 36 | [ConverterParameter(-1)] 37 | [DisplayName("Start time")] 38 | [Description("Optional lower bound time. All objects before this time will be ignored.")] 39 | public double StartTime { 40 | get => startTime; 41 | set => Set(ref startTime, value); 42 | } 43 | 44 | [TimeInput] 45 | [ConverterParameter(-1)] 46 | [DisplayName("End time")] 47 | [Description("Optional upper bound time. All objects after this time will be ignored.")] 48 | public double EndTime { 49 | get => endTime; 50 | set => Set(ref endTime, value); 51 | } 52 | } 53 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/PatternGallery/PatternOverwriteMode.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.Tools.PatternGallery { 2 | public enum PatternOverwriteMode { 3 | /// 4 | /// Remove no objects from the original beatmap. 5 | /// 6 | NoOverwrite, 7 | /// 8 | /// Remove objects from the original beatmap only in dense parts of the pattern. 9 | /// 10 | PartitionedOverwrite, 11 | /// 12 | /// Remove all objects from the original beatmap between the start time of the pattern and the end time of the pattern. 13 | /// 14 | CompleteOverwrite, 15 | } 16 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/PatternGallery/SelectedPatternImportVm.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.SystemTools; 2 | using System.ComponentModel; 3 | 4 | namespace Mapping_Tools.Classes.Tools.PatternGallery { 5 | public class SelectedPatternImportVm : BindableBase { 6 | private string name; 7 | 8 | [DisplayName("Name")] 9 | [Description("The name for the pattern.")] 10 | public string Name { 11 | get => name; 12 | set => Set(ref name, value); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/PatternGallery/TimingOverwriteMode.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.Tools.PatternGallery { 2 | public enum TimingOverwriteMode { 3 | OriginalTimingOnly, 4 | InPatternRelativeTiming, 5 | InPatternAbsoluteTiming, 6 | PatternTimingOnly 7 | } 8 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SlideratorStuff/GraphStateValueGetter.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Components.Graph; 2 | 3 | namespace Mapping_Tools.Classes.Tools.SlideratorStuff { 4 | public class GraphStateValueGetter { 5 | private readonly GraphState graphState; 6 | private readonly double multiplier; 7 | private readonly double offset; 8 | 9 | public GraphStateValueGetter(GraphState graphState, double multiplier = 1, double offset = 0) { 10 | this.graphState = graphState; 11 | this.multiplier = multiplier; 12 | this.offset = offset; 13 | } 14 | 15 | public double GetValue(double x) { 16 | return offset + multiplier * graphState.GetValue(x); 17 | } 18 | 19 | public double GetDerivative(double x) { 20 | return offset + multiplier * graphState.GetDerivative(x); 21 | } 22 | 23 | public double GetIntegral(double x) { 24 | return offset + multiplier * graphState.GetIntegral(0, x); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SlideratorStuff/PositionFunctionDelegate.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.Tools.SlideratorStuff { 2 | public delegate double PositionFunctionDelegate(double t); 3 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DashStylesEnum.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.Tools.SnappingTools { 2 | /// 3 | /// The of the styles of dashes shown on the SnappingTools overlay. 4 | /// 5 | public enum DashStylesEnum { 6 | /// 7 | Dash = 0, 8 | 9 | /// 10 | Dot = 1, 11 | 12 | /// 13 | DashSingleDot = 2, 14 | 15 | /// 16 | DashDoubleDot = 3, 17 | 18 | /// 19 | Solid = 4 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObject/IRelevantDrawable.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Media; 2 | using Mapping_Tools.Classes.MathUtil; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.Serialization; 4 | 5 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObject { 6 | public interface IRelevantDrawable : IRelevantObject { 7 | string PreferencesName { get; } 8 | double DistanceTo(Vector2 point); 9 | Vector2 NearestPoint(Vector2 point); 10 | bool Intersection(IRelevantObject other, out Vector2[] intersections); 11 | void DrawYourself(DrawingContext context, CoordinateConverter converter, SnappingToolsPreferences preferences); 12 | void DrawYourself(DrawingContext context, CoordinateConverter converter, RelevantObjectPreferences preferences, Pen pen); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/Allocation/RelevantObjectsGeneratorMethodAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mapping_Tools.Annotations; 3 | 4 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Allocation { 5 | /// 6 | /// Marks this method as the (potentially asynchronous) generator for relevant objects. 7 | /// 8 | [MeansImplicitUse] 9 | [AttributeUsage(AttributeTargets.Method)] 10 | public class RelevantObjectsGeneratorMethodAttribute : Attribute { 11 | } 12 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/GeneratorCollection/RelevantObjectsGeneratorCollection.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorCollection { 5 | public class RelevantObjectsGeneratorCollection : List { 6 | public RelevantObjectsGeneratorCollection(IEnumerable collection) : base(collection) {} 7 | 8 | public IEnumerable GetActiveGenerators() { 9 | return this.Where(o => o.Settings.IsActive); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/GeneratorGroupComparer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Windows.Data; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes; 4 | 5 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators { 6 | public class GeneratorGroupComparer : IComparer { 7 | public int Compare(object x, object y) { 8 | // ReSharper disable once ConvertIfStatementToSwitchStatement 9 | if (x == null && y == null) { 10 | return 0; 11 | } 12 | 13 | if (x == null) { 14 | return -1; 15 | } 16 | 17 | if (y == null) { 18 | return 1; 19 | } 20 | 21 | var groupX = (CollectionViewGroup) x; 22 | var groupY = (CollectionViewGroup) y; 23 | var typeX = (GeneratorType)groupX.Name; 24 | var typeY = (GeneratorType)groupY.Name; 25 | return typeX.CompareTo(typeY); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/GeneratorSettingses/SinglePointCircleGeneratorSettings.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorInputSelection; 3 | 4 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorSettingses 5 | { 6 | public class SinglePointCircleGeneratorSettings : GeneratorSettings 7 | { 8 | private double radius; 9 | [DisplayName("Radius")] 10 | [Description("The radius of the circle in osu! pixels.")] 11 | public double Radius 12 | { 13 | get => radius; 14 | set => Set(ref radius, value); 15 | } 16 | 17 | public SinglePointCircleGeneratorSettings() 18 | { 19 | Radius = 0; 20 | } 21 | 22 | public override object Clone() 23 | { 24 | return new SinglePointCircleGeneratorSettings 25 | { 26 | Generator = Generator, 27 | IsActive = IsActive, 28 | IsSequential = IsSequential, 29 | IsDeep = IsDeep, 30 | RelevancyRatio = RelevancyRatio, 31 | GeneratesInheritable = GeneratesInheritable, 32 | InputPredicate = (SelectionPredicateCollection)InputPredicate.Clone(), 33 | Radius = Radius 34 | }; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/GeneratorSettingses/SliderPathGeneratorSettings.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorInputSelection; 3 | 4 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorSettingses { 5 | public class SliderPathGeneratorSettings : GeneratorSettings { 6 | private double pointDensity; 7 | [DisplayName("Point Density")] 8 | [Description("Specifies how many points will be generated per osu! pixel of sliderpath.")] 9 | public double PointDensity { 10 | get => pointDensity; 11 | set => Set(ref pointDensity, value); 12 | } 13 | 14 | public override object Clone() { 15 | return new SliderPathGeneratorSettings {Generator = Generator, IsActive = IsActive, IsSequential = IsSequential, IsDeep = IsDeep, 16 | RelevancyRatio = RelevancyRatio, GeneratesInheritable = GeneratesInheritable, 17 | InputPredicate = (SelectionPredicateCollection)InputPredicate.Clone(), 18 | PointDensity = PointDensity 19 | }; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/GeneratorTypes/GeneratorTemporalPositioning.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes { 2 | public enum GeneratorTemporalPositioning { 3 | Before, 4 | Average, 5 | After, 6 | Custom 7 | } 8 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/GeneratorTypes/GeneratorType.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes { 2 | public enum GeneratorType { 3 | Basic, 4 | Intermediate, 5 | Advanced 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/Generators/AnchorPointGenerator.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObject.RelevantObjects; 4 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Allocation; 5 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes; 6 | 7 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Generators { 8 | public class AnchorPointGenerator : RelevantObjectsGenerator { 9 | public override string Name => "Points on Slider Anchors"; 10 | public override string Tooltip => "Generates virtual points on the anchor points of sliders."; 11 | public override GeneratorType GeneratorType => GeneratorType.Basic; 12 | public override GeneratorTemporalPositioning TemporalPositioning => GeneratorTemporalPositioning.Custom; 13 | 14 | public AnchorPointGenerator() { 15 | Settings.RelevancyRatio = 0.8; 16 | Settings.IsActive = true; 17 | } 18 | 19 | [RelevantObjectsGeneratorMethod] 20 | public IEnumerable GetRelevantObjects(RelevantHitObject relevantHitObject) { 21 | var ho = relevantHitObject.HitObject; 22 | if (!ho.IsSlider) return null; 23 | var curvePoints = ho.GetAllCurvePoints(); 24 | return curvePoints.Select((o, i) => new RelevantPoint(o) { CustomTime = (double)i / (curvePoints.Count - 1) * (ho.EndTime - ho.Time) + ho.Time }); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/Generators/AngleBisectorGenerator.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.MathUtil; 2 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObject.RelevantObjects; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Allocation; 4 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorInputSelection; 5 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes; 6 | 7 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Generators { 8 | public class AngleBisectorGenerator : RelevantObjectsGenerator { 9 | public override string Name => "Bisectors of Angles"; 10 | public override string Tooltip => "Takes a pair virtual lines and generates the bisector of the angle between those lines at the point of the intersection."; 11 | public override GeneratorType GeneratorType => GeneratorType.Intermediate; 12 | 13 | public AngleBisectorGenerator() { 14 | Settings.IsActive = true; 15 | Settings.IsDeep = true; 16 | Settings.InputPredicate.Predicates.Add(new SelectionPredicate {NeedSelected = true, MinRelevancy = 0.8}); 17 | } 18 | 19 | [RelevantObjectsGeneratorMethod] 20 | public RelevantLine[] GetRelevantObjects(RelevantLine line1, RelevantLine line2) { 21 | if (!Line2.Intersection(line1.Child, line2.Child, out var intersection)) return null; 22 | var dir1Norm = Vector2.Normalize(line1.Child.DirectionVector); 23 | var dir2Norm = Vector2.Normalize(line2.Child.DirectionVector); 24 | return new[] { 25 | new RelevantLine(new Line2(intersection, dir1Norm + dir2Norm)), 26 | new RelevantLine(new Line2(intersection, dir1Norm - dir2Norm)) 27 | }; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/Generators/AveragePointGenerator2.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObject.RelevantObjects; 2 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Allocation; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorInputSelection; 4 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes; 5 | 6 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Generators { 7 | public class AveragePointGenerator2 : RelevantObjectsGenerator { 8 | public override string Name => "Average of Two Points"; 9 | public override string Tooltip => "Takes a pair of virtual points and calculates the average of the points."; 10 | public override GeneratorType GeneratorType => GeneratorType.Intermediate; 11 | 12 | public AveragePointGenerator2() { 13 | Settings.IsActive = true; 14 | Settings.IsSequential = true; 15 | Settings.IsDeep = true; 16 | Settings.InputPredicate.Predicates.Add(new SelectionPredicate {NeedSelected = true, MinRelevancy = 0.5}); 17 | } 18 | 19 | [RelevantObjectsGeneratorMethod] 20 | public RelevantPoint GetRelevantObjects(RelevantPoint point1, RelevantPoint point2) { 21 | return new RelevantPoint((point1.Child + point2.Child) / 2); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/Generators/AveragePointGenerator3.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObject.RelevantObjects; 2 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Allocation; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorInputSelection; 4 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes; 5 | 6 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Generators { 7 | public class AveragePointGenerator3 : RelevantObjectsGenerator { 8 | public override string Name => "Average of Three Points"; 9 | public override string Tooltip => "Takes three virtual points and calculates the average of the points."; 10 | public override GeneratorType GeneratorType => GeneratorType.Intermediate; 11 | 12 | public AveragePointGenerator3() { 13 | Settings.IsActive = true; 14 | Settings.IsSequential = true; 15 | Settings.IsDeep = true; 16 | Settings.InputPredicate.Predicates.Add(new SelectionPredicate {NeedSelected = true, MinRelevancy = 0.8}); 17 | } 18 | 19 | [RelevantObjectsGeneratorMethod] 20 | public RelevantPoint GetRelevantObjects(RelevantPoint point1, RelevantPoint point2, RelevantPoint point3) { 21 | return new RelevantPoint((point1.Child + point2.Child + point3.Child) / 3); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/Generators/EqualSpacingGenerator.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.MathUtil; 2 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObject.RelevantObjects; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Allocation; 4 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorInputSelection; 5 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes; 6 | 7 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Generators { 8 | public class EqualSpacingGenerator : RelevantObjectsGenerator { 9 | public override string Name => "Circles by Two Points"; 10 | public override string Tooltip => "Takes a pair of virtual points and generates a pair of virtual circles with their centers on each point. Their radius is equal to the spacing between the two."; 11 | public override GeneratorType GeneratorType => GeneratorType.Intermediate; 12 | 13 | public EqualSpacingGenerator() { 14 | Settings.IsActive = true; 15 | Settings.IsSequential = true; 16 | Settings.IsDeep = true; 17 | Settings.InputPredicate.Predicates.Add(new SelectionPredicate {NeedSelected = true, MinRelevancy = 0.5}); 18 | } 19 | 20 | [RelevantObjectsGeneratorMethod] 21 | public RelevantCircle[] GetRelevantObjects(RelevantPoint point1, RelevantPoint point2) { 22 | var radius = (point1.Child - point2.Child).Length; 23 | return new[] { 24 | new RelevantCircle(new Circle(point1.Child, radius)), 25 | new RelevantCircle(new Circle(point2.Child, radius)) 26 | }; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/Generators/LastAnchorGenerator.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObject.RelevantObjects; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Allocation; 4 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes; 5 | 6 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Generators { 7 | public class LastAnchorGenerator : RelevantObjectsGenerator { 8 | public override string Name => "Points on Last Anchors"; 9 | public override string Tooltip => "Generates virtual points on the last anchors of sliders."; 10 | public override GeneratorType GeneratorType => GeneratorType.Basic; 11 | public override GeneratorTemporalPositioning TemporalPositioning => GeneratorTemporalPositioning.Custom; 12 | 13 | public LastAnchorGenerator() { 14 | Settings.RelevancyRatio = 1; 15 | Settings.IsActive = true; 16 | } 17 | 18 | [RelevantObjectsGeneratorMethod] 19 | public RelevantPoint GetRelevantObjects(RelevantHitObject relevantHitObject) { 20 | var ho = relevantHitObject.HitObject; 21 | if (ho.CurvePoints == null || ho.CurvePoints.Count == 0) 22 | return null; 23 | return ho.IsSlider ? new RelevantPoint(ho.CurvePoints.Last()) { CustomTime = ho.EndTime } : null; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/Generators/LineGenerator.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.MathUtil; 2 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObject.RelevantObjects; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Allocation; 4 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorInputSelection; 5 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes; 6 | 7 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Generators { 8 | public class LineGenerator : RelevantObjectsGenerator { 9 | public override string Name => "Lines by Two Points"; 10 | public override string Tooltip => "Takes a pair of virtual points and generates a virtual line that connects the two."; 11 | public override GeneratorType GeneratorType => GeneratorType.Intermediate; 12 | 13 | public LineGenerator() { 14 | Settings.IsActive = true; 15 | Settings.IsSequential = true; 16 | Settings.IsDeep = true; 17 | Settings.InputPredicate.Predicates.Add(new SelectionPredicate {NeedSelected = true, MinRelevancy = 0.5}); 18 | } 19 | 20 | [RelevantObjectsGeneratorMethod] 21 | public RelevantLine GetRelevantObjects(RelevantPoint point1, RelevantPoint point2) { 22 | return new RelevantLine(Line2.FromPoints(point1.Child, point2.Child)); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/Generators/LinearLineGenerator.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Mapping_Tools.Classes.BeatmapHelper.Enums; 3 | using Mapping_Tools.Classes.MathUtil; 4 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObject.RelevantObjects; 5 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Allocation; 6 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes; 7 | 8 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Generators { 9 | public class LinearLineGenerator : RelevantObjectsGenerator { 10 | public override string Name => "Lines on Linear Sliders"; 11 | public override string Tooltip => "Takes a linear slider and generates a virtual line that matches it."; 12 | public override GeneratorType GeneratorType => GeneratorType.Basic; 13 | 14 | public LinearLineGenerator() { 15 | Settings.RelevancyRatio = 1; 16 | Settings.IsActive = true; 17 | } 18 | 19 | [RelevantObjectsGeneratorMethod] 20 | public RelevantLine GetRelevantObjects(RelevantHitObject relevantHitObject) { 21 | var ho = relevantHitObject.HitObject; 22 | return ho.IsSlider && ho.SliderType == PathType.Linear && ho.CurvePoints.Count >= 1 23 | ? new RelevantLine(Line2.FromPoints(ho.Pos, ho.CurvePoints.Last())) 24 | : null; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/Generators/ParallelismGenerator.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.MathUtil; 2 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObject.RelevantObjects; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Allocation; 4 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorInputSelection; 5 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes; 6 | 7 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Generators { 8 | public class ParallelismGenerator : RelevantObjectsGenerator { 9 | public override string Name => "Parallel Lines"; 10 | public override string Tooltip => "Takes a pair of line and point and generates a virtual line across the point that is parallel to the line."; 11 | public override GeneratorType GeneratorType => GeneratorType.Intermediate; 12 | 13 | public ParallelismGenerator() { 14 | Settings.IsActive = true; 15 | Settings.IsDeep = true; 16 | Settings.InputPredicate.Predicates.Add(new SelectionPredicate {NeedSelected = true, MinRelevancy = 0.5}); 17 | } 18 | 19 | [RelevantObjectsGeneratorMethod] 20 | public RelevantLine GetRelevantObjects(RelevantLine line, RelevantPoint point) { 21 | return new RelevantLine(new Line2(point.Child, line.Child.DirectionVector)); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/Generators/PerfectCircleBlanketGenerator.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.BeatmapHelper.Enums; 2 | using Mapping_Tools.Classes.MathUtil; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObject.RelevantObjects; 4 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Allocation; 5 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes; 6 | 7 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Generators { 8 | public class PerfectCircleBlanketGenerator : RelevantObjectsGenerator { 9 | public override string Name => "Points on Blanket Centers"; 10 | public override string Tooltip => "Takes a circular arc slider and generates a virtual point on its blanket center."; 11 | public override GeneratorType GeneratorType => GeneratorType.Basic; 12 | 13 | public PerfectCircleBlanketGenerator() { 14 | Settings.RelevancyRatio = 0.8; 15 | Settings.IsActive = true; 16 | } 17 | 18 | [RelevantObjectsGeneratorMethod] 19 | public RelevantPoint GetRelevantObjects(RelevantHitObject relevantHitObject) { 20 | var ho = relevantHitObject.HitObject; 21 | return ho.IsSlider && ho.SliderType == PathType.PerfectCurve && ho.CurvePoints.Count == 2 22 | ? new RelevantPoint(new Circle(new CircleArc(ho.GetAllCurvePoints())).Centre) 23 | : null; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/Generators/PerfectCircleGenerator.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.BeatmapHelper.Enums; 2 | using Mapping_Tools.Classes.MathUtil; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObject.RelevantObjects; 4 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Allocation; 5 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes; 6 | 7 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Generators { 8 | public class PerfectCircleGenerator : RelevantObjectsGenerator { 9 | public override string Name => "Circles on 3-Point Sliders"; 10 | public override string Tooltip => "Takes a circular arc slider and generates a virtual circle that completes the arc."; 11 | public override GeneratorType GeneratorType => GeneratorType.Basic; 12 | 13 | public PerfectCircleGenerator() { 14 | Settings.RelevancyRatio = 1; 15 | Settings.IsActive = true; 16 | } 17 | 18 | [RelevantObjectsGeneratorMethod] 19 | public RelevantCircle GetRelevantObjects(RelevantHitObject relevantHitObject) { 20 | var ho = relevantHitObject.HitObject; 21 | return ho.IsSlider && ho.SliderType == PathType.PerfectCurve && ho.CurvePoints.Count == 2 22 | ? new RelevantCircle(new Circle(new CircleArc(ho.GetAllCurvePoints()))) 23 | : null; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/Generators/PerpendicularGenerator.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.MathUtil; 2 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObject.RelevantObjects; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Allocation; 4 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorInputSelection; 5 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes; 6 | 7 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Generators { 8 | public class PerpendicularGenerator : RelevantObjectsGenerator { 9 | public override string Name => "Perpendicular Lines"; 10 | public override string Tooltip => "Takes a pair of line and point and generates a virtual line across the point that is perpendicular to the line."; 11 | public override GeneratorType GeneratorType => GeneratorType.Intermediate; 12 | 13 | public PerpendicularGenerator() { 14 | Settings.IsActive = true; 15 | Settings.IsDeep = true; 16 | Settings.InputPredicate.Predicates.Add(new SelectionPredicate {NeedSelected = true, MinRelevancy = 0.5}); 17 | } 18 | 19 | [RelevantObjectsGeneratorMethod] 20 | public RelevantLine GetRelevantObjects(RelevantLine line, RelevantPoint point) { 21 | return new RelevantLine(new Line2(point.Child, line.Child.DirectionVector.PerpendicularLeft)); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/Generators/PointBisectorGenerator.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.MathUtil; 2 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObject.RelevantObjects; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Allocation; 4 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorInputSelection; 5 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes; 6 | 7 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Generators { 8 | public class PointBisectorGenerator : RelevantObjectsGenerator { 9 | public override string Name => "Bisector of Two Points"; 10 | public override string Tooltip => "Takes a pair virtual points and generates the bisector of those points."; 11 | public override GeneratorType GeneratorType => GeneratorType.Intermediate; 12 | 13 | public PointBisectorGenerator() { 14 | Settings.IsActive = true; 15 | Settings.IsSequential = true; 16 | Settings.IsDeep = true; 17 | Settings.InputPredicate.Predicates.Add(new SelectionPredicate {NeedSelected = true, MinRelevancy = 0.5}); 18 | } 19 | 20 | [RelevantObjectsGeneratorMethod] 21 | public RelevantLine GetRelevantObjects(RelevantPoint point1, RelevantPoint point2) { 22 | return new RelevantLine(new Line2((point1.Child + point2.Child) / 2, (point2.Child - point1.Child).PerpendicularLeft)); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/Generators/SameTransformGenerator2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObject.RelevantObjects; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Allocation; 4 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorInputSelection; 5 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes; 6 | 7 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Generators { 8 | public class SameTransformGenerator2 : RelevantObjectsGenerator { 9 | public override string Name => "Successor of 2 Points"; 10 | public override string Tooltip => "Takes 2 virtual points and calculates the next virtual point using the same velocity."; 11 | public override GeneratorType GeneratorType => GeneratorType.Advanced; 12 | public override GeneratorTemporalPositioning TemporalPositioning => GeneratorTemporalPositioning.After; 13 | 14 | public SameTransformGenerator2() { 15 | Settings.IsSequential = true; 16 | Settings.IsDeep = true; 17 | Settings.InputPredicate.Predicates.Add(new SelectionPredicate {NeedSelected = true, MinRelevancy = 0.5}); 18 | Settings.InputPredicate.Predicates.Add(new SelectionPredicate {NeedGeneratedByThis = true}); 19 | } 20 | 21 | [RelevantObjectsGeneratorMethod] 22 | public RelevantPoint GetRelevantObjects(RelevantPoint point1, RelevantPoint point2) { 23 | // Get the vectors between the points 24 | var a = point2.Child - point1.Child; 25 | 26 | // Return null if length of a is zero 27 | if (Math.Abs(a.X) < double.Epsilon && Math.Abs(a.Y) < double.Epsilon) { 28 | return null; 29 | } 30 | 31 | return new RelevantPoint(point2.Child + a); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/Generators/SliderEndGenerator.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObject.RelevantObjects; 2 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Allocation; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes; 4 | 5 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Generators { 6 | public class SliderEndGenerator : RelevantObjectsGenerator { 7 | public override string Name => "Points on Slider Ends"; 8 | public override string Tooltip => "Generates virtual points on the actual ends of sliders."; 9 | public override GeneratorType GeneratorType => GeneratorType.Basic; 10 | public override GeneratorTemporalPositioning TemporalPositioning => GeneratorTemporalPositioning.Custom; 11 | 12 | public SliderEndGenerator() { 13 | Settings.RelevancyRatio = 0.8; 14 | } 15 | 16 | [RelevantObjectsGeneratorMethod] 17 | public RelevantPoint GetRelevantObjects(RelevantHitObject relevantHitObject) { 18 | var ho = relevantHitObject.HitObject; 19 | return ho.IsSlider ? new RelevantPoint(ho.GetSliderPath().PositionAt(1)) { CustomTime = ho.EndTime } : null; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/Generators/SquareGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mapping_Tools.Classes.MathUtil; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObject.RelevantObjects; 4 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Allocation; 5 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorInputSelection; 6 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes; 7 | 8 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Generators { 9 | public class SquareGenerator : RelevantObjectsGenerator { 10 | public override string Name => "Square from Two Points (Type I)"; 11 | public override string Tooltip => "Takes a pair of virtual points and generates a virtual point on each side to make a single square."; 12 | public override GeneratorType GeneratorType => GeneratorType.Intermediate; 13 | 14 | public SquareGenerator() { 15 | Settings.IsActive = true; 16 | Settings.IsDeep = true; 17 | Settings.InputPredicate.Predicates.Add(new SelectionPredicate {NeedSelected = true, MinRelevancy = 0.5}); 18 | } 19 | 20 | [RelevantObjectsGeneratorMethod] 21 | public RelevantPoint[] GetRelevantObjects(RelevantPoint point1, RelevantPoint point2) { 22 | var diff = point2.Child - point1.Child; 23 | var rotated = Vector2.Rotate(diff, Math.PI * 3 / 4) / Math.Sqrt(2); 24 | 25 | return new[] { 26 | new RelevantPoint(point1.Child - rotated), 27 | new RelevantPoint(point2.Child + rotated) 28 | }; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/Generators/SquareGenerator2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mapping_Tools.Classes.MathUtil; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObject.RelevantObjects; 4 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Allocation; 5 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorInputSelection; 6 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes; 7 | 8 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Generators { 9 | public class SquareGenerator2 : RelevantObjectsGenerator { 10 | public override string Name => "Square from Two Points (Type II)"; 11 | public override string Tooltip => "Takes a pair of virtual points and generates a pair of virtual points on each side to make two squares in total."; 12 | public override GeneratorType GeneratorType => GeneratorType.Intermediate; 13 | 14 | public SquareGenerator2() { 15 | Settings.IsActive = true; 16 | Settings.IsDeep = true; 17 | Settings.InputPredicate.Predicates.Add(new SelectionPredicate {NeedSelected = true, MinRelevancy = 0.5}); 18 | } 19 | 20 | [RelevantObjectsGeneratorMethod] 21 | public RelevantPoint[] GetRelevantObjects(RelevantPoint point1, RelevantPoint point2) { 22 | var diff = point2.Child - point1.Child; 23 | var rotated = Vector2.Rotate(diff, Math.PI / 2); 24 | 25 | return new[] { 26 | new RelevantPoint(point1.Child - rotated), 27 | new RelevantPoint(point1.Child + rotated), 28 | new RelevantPoint(point2.Child - rotated), 29 | new RelevantPoint(point2.Child + rotated) 30 | }; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/Generators/StartPointGenerator.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObject.RelevantObjects; 2 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Allocation; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes; 4 | 5 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Generators { 6 | public class StartPointGenerator : RelevantObjectsGenerator { 7 | public override string Name => "Points on Circles and Slider Heads"; 8 | public override string Tooltip => "Generates virtual points on slider heads and circles."; 9 | public override GeneratorType GeneratorType => GeneratorType.Basic; 10 | 11 | public StartPointGenerator() { 12 | Settings.RelevancyRatio = 1; 13 | Settings.IsActive = true; 14 | } 15 | 16 | [RelevantObjectsGeneratorMethod] 17 | public RelevantPoint GetRelevantObjects(RelevantHitObject ho) { 18 | return new RelevantPoint(ho.HitObject.Pos); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/Generators/TriangleGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mapping_Tools.Classes.MathUtil; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObject.RelevantObjects; 4 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Allocation; 5 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorInputSelection; 6 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes; 7 | 8 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Generators { 9 | public class TriangleGenerator : RelevantObjectsGenerator { 10 | public override string Name => "Equilateral Triangle from Two Points (Type I)"; 11 | public override string Tooltip => "Takes a pair of virtual points and generates a virtual point on each side to make two equilateral triangles."; 12 | public override GeneratorType GeneratorType => GeneratorType.Intermediate; 13 | 14 | public TriangleGenerator() { 15 | Settings.IsActive = true; 16 | Settings.IsDeep = true; 17 | Settings.InputPredicate.Predicates.Add(new SelectionPredicate {NeedSelected = true, MinRelevancy = 0.5}); 18 | Settings.InputPredicate.Predicates.Add(new SelectionPredicate {NeedGeneratedByThis = true}); 19 | } 20 | 21 | [RelevantObjectsGeneratorMethod] 22 | public RelevantPoint[] GetRelevantObjects(RelevantPoint point1, RelevantPoint point2) { 23 | var diff = point2.Child - point1.Child; 24 | var rotated = Vector2.Rotate(diff, Math.PI * 2 / 3); 25 | return new[] { 26 | new RelevantPoint(point1.Child - rotated), 27 | new RelevantPoint(point2.Child + rotated) 28 | }; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/SnappingTools/DataStructure/RelevantObjectGenerators/Generators/TriangleGenerator2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mapping_Tools.Classes.MathUtil; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObject.RelevantObjects; 4 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Allocation; 5 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorInputSelection; 6 | using Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.GeneratorTypes; 7 | 8 | namespace Mapping_Tools.Classes.Tools.SnappingTools.DataStructure.RelevantObjectGenerators.Generators { 9 | public class TriangleGenerator2 : RelevantObjectsGenerator { 10 | public override string Name => "Equilateral Triangle from Two Points (Type II)"; 11 | public override string Tooltip => "Takes a pair of virtual points and generates a virtual point on each side to make two equilateral triangles."; 12 | public override GeneratorType GeneratorType => GeneratorType.Intermediate; 13 | 14 | public TriangleGenerator2() { 15 | Settings.IsActive = true; 16 | Settings.IsDeep = true; 17 | Settings.InputPredicate.Predicates.Add(new SelectionPredicate {NeedSelected = true, MinRelevancy = 0.5}); 18 | } 19 | 20 | [RelevantObjectsGeneratorMethod] 21 | public RelevantPoint[] GetRelevantObjects(RelevantPoint point1, RelevantPoint point2) { 22 | var diff = point2.Child - point1.Child; 23 | var rotated = Vector2.Rotate(diff, Math.PI * 5 / 6) / Math.Sqrt(3); 24 | return new[] { 25 | new RelevantPoint(point1.Child - rotated), 26 | new RelevantPoint(point2.Child + rotated) 27 | }; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/TumourGenerating/Domain/TumourTemplateToIconConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | using Mapping_Tools.Classes.Tools.TumourGenerating.Enums; 5 | using MaterialDesignThemes.Wpf; 6 | 7 | namespace Mapping_Tools.Classes.Tools.TumourGenerating.Domain { 8 | public class TumourTemplateToIconConverter : IValueConverter { 9 | /// 10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 11 | return value switch { 12 | TumourTemplate.Triangle => PackIconKind.TriangleOutline, 13 | TumourTemplate.Square => PackIconKind.SquareOutline, 14 | TumourTemplate.Circle => PackIconKind.CircleOutline, 15 | TumourTemplate.Parabola => PackIconKind.Multiply, 16 | _ => PackIconKind.TriangleOutline, 17 | }; 18 | } 19 | 20 | /// 21 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 22 | return value switch { 23 | PackIconKind.TriangleOutline => TumourTemplate.Triangle, 24 | PackIconKind.SquareOutline => TumourTemplate.Square, 25 | PackIconKind.CircleOutline => TumourTemplate.Circle, 26 | PackIconKind.Multiply => TumourTemplate.Parabola, 27 | _ => TumourTemplate.Triangle, 28 | }; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/TumourGenerating/Enums/TumourSidedness.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.Tools.TumourGenerating.Enums { 2 | public enum TumourSidedness { 3 | Left, 4 | Right, 5 | AlternatingLeft, 6 | AlternatingRight, 7 | Random 8 | } 9 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/TumourGenerating/Enums/TumourTemplate.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.Tools.TumourGenerating.Enums { 2 | public enum TumourTemplate { 3 | Triangle, 4 | Square, 5 | Circle, 6 | Parabola 7 | } 8 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/TumourGenerating/Enums/WrappingMode.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.Tools.TumourGenerating.Enums { 2 | public enum WrappingMode { 3 | Simple, 4 | Wrap, 5 | Absolute 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/TumourGenerating/ITumourAssignment.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.Tools.TumourGenerating.Enums; 2 | using Mapping_Tools.Classes.Tools.TumourGenerating.Options; 3 | 4 | namespace Mapping_Tools.Classes.Tools.TumourGenerating { 5 | public interface ITumourAssignment { 6 | /// 7 | /// The pixel length cumulative distance of the start of the tumour. 8 | /// 9 | double Start { get; } 10 | 11 | /// 12 | /// The pixel length cumulative distance of the end of the tumour. 13 | /// 14 | double End { get; } 15 | 16 | /// 17 | /// The longitudinal length of the tumour. 18 | /// 19 | public double Length { get; } 20 | 21 | /// 22 | /// The size scalar of the tumour. 23 | /// 24 | public double Scalar { get; } 25 | 26 | /// 27 | /// Rotational offset of the tumour in radians. 28 | /// 29 | public double Rotation { get; } 30 | 31 | /// 32 | /// The wrapping mode controls how the tumour sits on the slider. 33 | /// 34 | public WrappingMode WrappingMode { get; } 35 | 36 | /// 37 | /// Whether to invert the sidedness of the tumour. 38 | /// If false, up (-Y) will be on the left-hand side of the slider. 39 | /// If true, up (-Y) will be on the right-hand side of the slider. 40 | /// 41 | public bool Inverted { get; } 42 | 43 | /// 44 | /// The tumour shape. 45 | /// 46 | ITumourTemplate GetTemplate(); 47 | } 48 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/TumourGenerating/Options/IRequireInit.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Classes.Tools.TumourGenerating.Options { 2 | public interface IRequireInit { 3 | void Init(); 4 | } 5 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/TumourGenerating/Options/ITumourLayer.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.Tools.TumourGenerating.Enums; 2 | using Mapping_Tools.Components.Graph; 3 | 4 | namespace Mapping_Tools.Classes.Tools.TumourGenerating.Options { 5 | public interface ITumourLayer { 6 | ITumourTemplate TumourTemplate { get; } 7 | 8 | /// 9 | /// The wrapping mode controls how the tumour sits on the slider. 10 | /// 11 | WrappingMode WrappingMode { get; set; } 12 | TumourSidedness TumourSidedness { get; } 13 | GraphState TumourLength { get; } 14 | GraphState TumourScale { get; } 15 | GraphState TumourRotation { get; } 16 | GraphState TumourParameter { get; } 17 | GraphState TumourDistance { get; } 18 | int TumourCount { get; } 19 | 20 | /// 21 | /// Completion at which to start generating the tumours. 22 | /// 23 | double TumourStart { get; } 24 | 25 | /// 26 | /// Completion at which to stop generating the tumours. 27 | /// 28 | double TumourEnd { get; } 29 | 30 | /// 31 | /// The random seed used for random sidedness. 32 | /// 33 | int RandomSeed { get; } 34 | 35 | /// 36 | /// Whether the and are not relative to the slider's length. 37 | /// 38 | bool UseAbsoluteRange { get; } 39 | 40 | bool Recalculate { get; } 41 | bool IsActive { get; } 42 | } 43 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/TumourGenerating/Options/TumourTemplates/TriangleTemplate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Mapping_Tools.Classes.BeatmapHelper.Enums; 4 | using Mapping_Tools.Classes.MathUtil; 5 | 6 | namespace Mapping_Tools.Classes.Tools.TumourGenerating.Options.TumourTemplates { 7 | public class TriangleTemplate : TumourTemplateBase { 8 | public override Vector2 GetOffset(double t) { 9 | return t < 0.5 ? -2 * Width * t * Vector2.UnitY : 2 * Width * (-1 + t) * Vector2.UnitY; 10 | } 11 | 12 | public override double GetLength() { 13 | return 2 * Math.Sqrt(0.25 * Length * Length + Width * Width); 14 | } 15 | 16 | public override double GetDefaultSpan() { 17 | return Length; 18 | } 19 | 20 | public override IEnumerable GetCriticalPoints() { 21 | yield return 0.5; 22 | } 23 | 24 | public override int GetDetailLevel() { 25 | return 1; 26 | } 27 | 28 | public override List GetReconstructionHint() { 29 | return new List { Vector2.Zero, new(0.5 * Length, -Width), Length * Vector2.UnitX }; 30 | } 31 | 32 | public override PathType GetReconstructionHintPathType() { 33 | return PathType.Linear; 34 | } 35 | 36 | public override Func GetDistanceRelation() { 37 | return null; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Mapping_Tools/Classes/Tools/TumourGenerating/Options/TumourTemplates/TumourTemplateBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Mapping_Tools.Classes.BeatmapHelper.Enums; 4 | using Mapping_Tools.Classes.MathUtil; 5 | using Newtonsoft.Json; 6 | 7 | namespace Mapping_Tools.Classes.Tools.TumourGenerating.Options.TumourTemplates { 8 | public abstract class TumourTemplateBase : ITumourTemplate { 9 | [JsonIgnore] 10 | public double Length { get; set; } 11 | 12 | [JsonIgnore] 13 | public double Width { get; set; } 14 | 15 | [JsonIgnore] 16 | public double Parameter { get; set; } 17 | 18 | public virtual bool NeedsParameter => false; 19 | 20 | public abstract Vector2 GetOffset(double t); 21 | 22 | public abstract double GetLength(); 23 | 24 | public abstract double GetDefaultSpan(); 25 | 26 | public abstract int GetDetailLevel(); 27 | 28 | public abstract IEnumerable GetCriticalPoints(); 29 | 30 | public abstract List GetReconstructionHint(); 31 | 32 | public abstract PathType GetReconstructionHintPathType(); 33 | 34 | public abstract Func GetDistanceRelation(); 35 | } 36 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Dialogs/CustomDialog/BeatmapBrowseAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Components.Dialogs.CustomDialog { 4 | public class BeatmapBrowseAttribute : Attribute { 5 | 6 | } 7 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Dialogs/CustomDialog/ConverterParameterAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Components.Dialogs.CustomDialog { 4 | public class ConverterParameterAttribute : Attribute { 5 | public readonly object Parameter; 6 | 7 | public ConverterParameterAttribute(object parameter) { 8 | Parameter = parameter; 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Dialogs/CustomDialog/CustomDialog.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 29 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Dialogs/CustomDialog/FileBrowseAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Components.Dialogs.CustomDialog { 4 | public class FileBrowseAttribute : Attribute { 5 | 6 | } 7 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Dialogs/CustomDialog/InvariantCultureAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | 4 | namespace Mapping_Tools.Components.Dialogs.CustomDialog { 5 | public class InvariantCultureAttribute : Attribute { 6 | } 7 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Dialogs/CustomDialog/MultiLineInputAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Components.Dialogs.CustomDialog { 4 | public class MultiLineInputAttribute : Attribute { 5 | 6 | } 7 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Dialogs/CustomDialog/TextWrappingAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | 4 | namespace Mapping_Tools.Components.Dialogs.CustomDialog { 5 | public class TextWrappingAttribute : Attribute { 6 | public readonly TextWrapping TextWrapping; 7 | 8 | public TextWrappingAttribute(TextWrapping textWrapping) { 9 | TextWrapping = textWrapping; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Dialogs/CustomDialog/TimeInputAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Components.Dialogs.CustomDialog { 4 | public class TimeInputAttribute : Attribute { 5 | 6 | } 7 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Dialogs/MessageDialog.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 18 | 20 | 27 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Dialogs/MessageDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Components.Dialogs { 2 | public partial class MessageDialog { 3 | public MessageDialog(string message) { 4 | InitializeComponent(); 5 | MessageTextBlock.Text = message; 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Dialogs/SampleDialog/SampleDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Components.Dialogs.SampleDialog { 2 | /// 3 | /// Interaction logic for SampleDialog.xaml 4 | /// 5 | public partial class SampleDialog { 6 | public SampleDialogViewModel ViewModel => (SampleDialogViewModel) DataContext; 7 | 8 | public SampleDialog() { 9 | InitializeComponent(); 10 | DataContext = new SampleDialogViewModel(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Dialogs/SampleDialog/SampleDialogViewModel.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.SystemTools; 2 | 3 | namespace Mapping_Tools.Components.Dialogs.SampleDialog { 4 | public class SampleDialogViewModel : BindableBase 5 | { 6 | private string name; 7 | 8 | public string Name { 9 | get => name; 10 | set => Set(ref name, value); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Dialogs/TypeValueDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using System.Windows; 3 | 4 | namespace Mapping_Tools.Components.Dialogs { 5 | /// 6 | /// Interaction logic for TypeValueDialog.xaml 7 | /// 8 | public partial class TypeValueDialog { 9 | public TypeValueDialog(double initialValue = 0) { 10 | InitializeComponent(); 11 | ValueBox.Text = initialValue.ToString(CultureInfo.InvariantCulture); 12 | } 13 | 14 | private void TypeValueDialog_OnLoaded(object sender, RoutedEventArgs e) { 15 | ValueBox.Focus(); 16 | ValueBox.SelectAll(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/BooleanAndConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Windows.Data; 5 | 6 | namespace Mapping_Tools.Components.Domain 7 | { 8 | public class BooleanAndConverter : IMultiValueConverter 9 | { 10 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | foreach (object value in values) { 13 | if ((value is bool) && (bool)value == false) { 14 | return false; 15 | } 16 | } 17 | return true; 18 | } 19 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 20 | { 21 | throw new NotSupportedException("BooleanAndConverter is a OneWay converter."); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/BooleanConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Windows.Data; 5 | 6 | namespace Mapping_Tools.Components.Domain { 7 | public class BooleanConverter : IValueConverter, IMultiValueConverter { 8 | public BooleanConverter(T trueValue, T falseValue) { 9 | True = trueValue; 10 | False = falseValue; 11 | } 12 | 13 | public T True { get; set; } 14 | public T False { get; set; } 15 | 16 | public virtual object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 17 | return value is bool && ((bool)value) ? True : False; 18 | } 19 | 20 | public virtual object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 21 | return value is T && EqualityComparer.Default.Equals((T)value, True); 22 | } 23 | 24 | public virtual object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 25 | { 26 | return values[0] is bool && ((bool)values[0]) ? True : False; 27 | } 28 | 29 | public virtual object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 30 | { 31 | throw new NotImplementedException(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/BooleanInvertConverter.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Components.Domain 2 | { 3 | public sealed class BooleanInvertConverter : BooleanConverter 4 | { 5 | public BooleanInvertConverter() : 6 | base(false, true) 7 | { } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/BooleanOrConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Windows.Data; 5 | 6 | namespace Mapping_Tools.Components.Domain 7 | { 8 | public class BooleanOrConverter : IMultiValueConverter 9 | { 10 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | foreach (object value in values) { 13 | if ((value is bool) && (bool)value) { 14 | return true; 15 | } 16 | } 17 | return false; 18 | } 19 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 20 | { 21 | throw new NotSupportedException("BooleanOrConverter is a OneWay converter."); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/BooleanOrToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | using System.Windows; 5 | 6 | namespace Mapping_Tools.Components.Domain 7 | { 8 | public class BooleanOrToVisibilityConverter : IMultiValueConverter 9 | { 10 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | foreach (object value in values) { 13 | if ((value is bool) && (bool)value == false) { 14 | return Visibility.Collapsed; 15 | } 16 | } 17 | return Visibility.Visible; 18 | } 19 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 20 | { 21 | throw new NotSupportedException("BooleanOrConverter is a OneWay converter."); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/BooleanToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace Mapping_Tools.Components.Domain 4 | { 5 | class BooleanToVisibilityConverter : BooleanConverter { 6 | public BooleanToVisibilityConverter() : 7 | base(Visibility.Visible, Visibility.Collapsed) 8 | { } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/CharacterLimitValidationRule.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | 5 | namespace Mapping_Tools.Components.Domain { 6 | internal class CharacterLimitValidationRule : ValidationRule 7 | { 8 | public override ValidationResult Validate(object value, CultureInfo cultureInfo) { 9 | int limit = LimitWrapper.Value; 10 | string str = (value ?? "").ToString(); 11 | return str.Length <= limit ? ValidationResult.ValidResult : new ValidationResult(false, $"Field can not be over {limit} characters long."); 12 | } 13 | 14 | public IntWrapper LimitWrapper { get; set; } 15 | } 16 | 17 | public class IntWrapper : DependencyObject 18 | { 19 | public static readonly DependencyProperty FormatProperty = 20 | DependencyProperty.Register("Value", typeof(int), 21 | typeof(IntWrapper), new FrameworkPropertyMetadata(null)); 22 | 23 | public int Value { 24 | get => (int)GetValue(FormatProperty); 25 | set => SetValue(FormatProperty, value); 26 | } 27 | } 28 | 29 | public class BindingProxy : Freezable 30 | { 31 | protected override Freezable CreateInstanceCore() { 32 | return new BindingProxy(); 33 | } 34 | 35 | public object Data { 36 | get => GetValue(DataProperty); 37 | set => SetValue(DataProperty, value); 38 | } 39 | 40 | public static readonly DependencyProperty DataProperty = 41 | DependencyProperty.Register("Data", typeof(object), typeof(BindingProxy), new PropertyMetadata(null)); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/CircleSizeToThicknessConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | using Mapping_Tools.Classes.BeatmapHelper; 5 | 6 | namespace Mapping_Tools.Components.Domain { 7 | public class CircleSizeToThicknessConverter : IValueConverter { 8 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 9 | return value is double d ? Beatmap.GetHitObjectRadius(d) * 2 : 50; 10 | } 11 | 12 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 13 | throw new NotSupportedException("CircleSizeToThicknessConverter is a OneWay converter."); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/ColorToBrushConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | using System.Windows.Media; 5 | 6 | namespace Mapping_Tools.Components.Domain 7 | { 8 | /// 9 | /// Changes the to and back. 10 | /// 11 | public class ColorToBrushConverter : IValueConverter 12 | { 13 | /// 14 | /// 15 | /// 16 | /// 17 | /// 18 | /// 19 | /// 20 | /// 21 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 22 | { 23 | if (value is Color color) 24 | { 25 | return new SolidColorBrush(color); 26 | } 27 | return Binding.DoNothing; 28 | } 29 | 30 | /// 31 | /// 32 | /// 33 | /// 34 | /// 35 | /// 36 | /// 37 | /// 38 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 39 | { 40 | if (value is SolidColorBrush brush) 41 | { 42 | return brush.Color; 43 | } 44 | return default(Color); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/ColorToStringConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Controls; 4 | using System.Windows.Data; 5 | using System.Windows.Media; 6 | 7 | namespace Mapping_Tools.Components.Domain { 8 | internal class ColorToStringConverter : IValueConverter { 9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 10 | var str = ((Color)value).ToString(); 11 | if (str.Length == 9) { 12 | str = "#" + str.Substring(3, str.Length - 3); 13 | } 14 | return str; 15 | } 16 | 17 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 18 | if (value is not string str) 19 | return new ValidationResult(false, "Cannot convert back null."); 20 | 21 | if (str.Length > 0 && str[0] != '#') 22 | str = "#" + str; 23 | 24 | try { 25 | return (Color)ColorConverter.ConvertFromString(str)!; 26 | } 27 | catch (Exception e) { 28 | Console.WriteLine(e); 29 | } 30 | 31 | return new ValidationResult(false, "Color format error."); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/DoubleArrayToStringConverter.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.BeatmapHelper; 2 | using Mapping_Tools.Classes.SystemTools; 3 | using System; 4 | using System.Globalization; 5 | using System.Text; 6 | using System.Windows.Controls; 7 | using System.Windows.Data; 8 | 9 | namespace Mapping_Tools.Components.Domain { 10 | internal class DoubleArrayToStringConverter : IValueConverter { 11 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 12 | if (!(value is double[] beatDivisors)) return string.Empty; 13 | 14 | var builder = new StringBuilder(); 15 | bool first = true; 16 | foreach (var d in beatDivisors) { 17 | if (!first) { 18 | builder.Append(", "); 19 | } 20 | 21 | builder.Append(d.ToInvariant()); 22 | 23 | first = false; 24 | } 25 | 26 | return builder.ToString(); 27 | } 28 | 29 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 30 | if (!(value is string str)) return new double[0]; 31 | if (string.IsNullOrWhiteSpace(str)) return new double[0]; 32 | 33 | var vals = str.Split(','); 34 | var beatDivisors = new double[vals.Length]; 35 | 36 | for (int i = 0; i < vals.Length; i++) { 37 | var val = vals[i]; 38 | 39 | var valid = TypeConverters.TryParseDouble(val, out double doubleValue); 40 | if (valid) { 41 | beatDivisors[i] = doubleValue; 42 | } else { 43 | return new ValidationResult(false, "Double format error."); 44 | } 45 | } 46 | 47 | return beatDivisors; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/DoubleToStringConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Controls; 4 | using System.Windows.Data; 5 | using Mapping_Tools.Classes.SystemTools; 6 | 7 | namespace Mapping_Tools.Components.Domain { 8 | internal class DoubleToStringConverter : IValueConverter { 9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 10 | if (value != null) { 11 | if ((double) value == 727) { 12 | return "727 WYSI"; 13 | } 14 | return ((double) value).ToString(CultureInfo.InvariantCulture); 15 | } 16 | return parameter != null ? parameter.ToString() : ""; 17 | } 18 | 19 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 20 | if (value == null) { 21 | if (parameter != null) { 22 | return double.Parse(parameter.ToString()); 23 | } 24 | return new ValidationResult(false, "Cannot convert back null."); 25 | } 26 | 27 | if (value.ToString() == "727 WYSI") { 28 | return 727; 29 | } 30 | 31 | if (parameter == null) { 32 | if (TypeConverters.TryParseDouble(value.ToString(), out double result1)) { 33 | return result1; 34 | } 35 | 36 | return new ValidationResult(false, "Double format error."); 37 | } 38 | TypeConverters.TryParseDouble(value.ToString(), out double result2, double.Parse(parameter.ToString())); 39 | return result2; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/EnumToBoolConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace Mapping_Tools.Components.Domain{ 6 | /// 7 | /// Converts the type to a boolean. 8 | /// 9 | public class EnumToBoolConverter : IValueConverter { 10 | /// 11 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 12 | return value != null && value.Equals(parameter); 13 | } 14 | 15 | /// 16 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 17 | return value != null && ((bool)value) ? parameter : Binding.DoNothing; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/EnumToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace Mapping_Tools.Components.Domain{ 7 | /// 8 | /// Converts the type to visible if the enum matches the parameter and collapsed otherwise. 9 | /// 10 | public class EnumToVisibilityConverter : IValueConverter { 11 | /// 12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 13 | return value != null && value.Equals(parameter) ? Visibility.Visible : Visibility.Collapsed; 14 | } 15 | 16 | /// 17 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 18 | return value != null && value.Equals(Visibility.Visible) ? parameter : Binding.DoNothing; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/FlagToBoolConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace Mapping_Tools.Components.Domain { 6 | public class FlagToBoolConverter : IValueConverter { 7 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 8 | return value != null && parameter != null && ((Enum) value).HasFlag((Enum) parameter); 9 | } 10 | 11 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 12 | return value != null && parameter != null && (bool) value ? parameter : Binding.DoNothing; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/FocusExtension.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace Mapping_Tools.Components.Domain { 4 | public static class FocusExtension { 5 | public static bool GetIsFocused(DependencyObject obj) { 6 | return (bool)obj.GetValue(IsFocusedProperty); 7 | } 8 | 9 | public static void SetIsFocused(DependencyObject obj, bool value) { 10 | obj.SetValue(IsFocusedProperty, value); 11 | } 12 | 13 | public static readonly DependencyProperty IsFocusedProperty = 14 | DependencyProperty.RegisterAttached( 15 | "IsFocused", typeof(bool), typeof(FocusExtension), 16 | new UIPropertyMetadata(false, OnIsFocusedPropertyChanged)); 17 | 18 | private static void OnIsFocusedPropertyChanged( 19 | DependencyObject d, 20 | DependencyPropertyChangedEventArgs e) { 21 | var uie = (UIElement)d; 22 | if ((bool)e.NewValue) { 23 | uie.Focus(); // Don't care about false values. 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/HitsoundToStringConverter.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.HitsoundStuff; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows.Data; 9 | using Mapping_Tools.Classes.BeatmapHelper; 10 | using Mapping_Tools.Classes.BeatmapHelper.Enums; 11 | 12 | namespace Mapping_Tools.Components.Domain { 13 | class HitsoundToStringConverter : IValueConverter { 14 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 15 | return ((Hitsound)value).ToString(); 16 | } 17 | 18 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 19 | string str = value.ToString(); 20 | return Enum.Parse(typeof(Hitsound), str); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/IdentityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace Mapping_Tools.Components.Domain 6 | { 7 | public class IdentityConverter : IValueConverter, IMultiValueConverter 8 | { 9 | public virtual object Convert(object value, Type targetType, object parameter, CultureInfo culture) 10 | { 11 | return value; 12 | } 13 | 14 | public virtual object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 15 | { 16 | return value; 17 | } 18 | 19 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 20 | { 21 | return values[0]; 22 | } 23 | 24 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 25 | { 26 | throw new NotImplementedException(); 27 | } 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/ImportTypeToStringConverter.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.HitsoundStuff; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows.Data; 9 | 10 | namespace Mapping_Tools.Components.Domain { 11 | class ImportTypeToStringConverter : IValueConverter { 12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 13 | return ((ImportType)value).ToString(); 14 | } 15 | 16 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 17 | string str = value.ToString(); 18 | return Enum.Parse(typeof(ImportType), str); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/IntToStringConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Controls; 4 | using System.Windows.Data; 5 | using Mapping_Tools.Classes.SystemTools; 6 | 7 | namespace Mapping_Tools.Components.Domain { 8 | internal class IntToStringConverter : IValueConverter { 9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 10 | if (value != null) { 11 | if ((int)value == 727) { 12 | return "727 WYSI"; 13 | } 14 | return ((int) value).ToString(CultureInfo.InvariantCulture); 15 | } 16 | return parameter != null ? parameter.ToString() : ""; 17 | } 18 | 19 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 20 | if (value == null) { 21 | if (parameter != null) { 22 | return (int) parameter; 23 | } 24 | return new ValidationResult(false, "Cannot convert back null."); 25 | } 26 | 27 | if (value.ToString() == "727 WYSI") { 28 | return 727; 29 | } 30 | 31 | if (parameter == null) { 32 | if (TypeConverters.TryParseInt(value.ToString(), out int result1)) { 33 | return result1; 34 | } 35 | 36 | return new ValidationResult(false, "Int format error."); 37 | } 38 | TypeConverters.TryParseInt(value.ToString(), out int result2, int.Parse(parameter.ToString())); 39 | return result2; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/IsASCIIValidationRule.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using System.Text; 3 | using System.Windows.Controls; 4 | 5 | namespace Mapping_Tools.Components.Domain { 6 | internal class IsASCIIValidationRule : ValidationRule 7 | { 8 | public override ValidationResult Validate(object value, CultureInfo cultureInfo) { 9 | string str = (value ?? "").ToString(); 10 | return Encoding.UTF8.GetByteCount(str) == str.Length ? 11 | ValidationResult.ValidResult : 12 | new ValidationResult(false, "Field is not ASCII."); 13 | } 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/IsGreaterOrEqualValidationRule.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.SystemTools; 2 | using System.Globalization; 3 | using System.Windows.Controls; 4 | 5 | namespace Mapping_Tools.Components.Domain { 6 | internal class IsGreaterOrEqualValidationRule : ValidationRule 7 | { 8 | public override ValidationResult Validate(object value, CultureInfo cultureInfo) { 9 | double limit = ValueWrapper.Value; 10 | string str = (value ?? "").ToString(); 11 | if (!TypeConverters.TryParseDouble(str, out double result)) { 12 | return new ValidationResult(false, "Double format error."); 13 | } 14 | return result >= limit ? ValidationResult.ValidResult : new ValidationResult(false, $"Value can not be less than {limit}."); 15 | } 16 | 17 | public DoubleWrapper ValueWrapper { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/IsGreaterValidationRule.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.SystemTools; 2 | using System.Globalization; 3 | using System.Windows.Controls; 4 | 5 | namespace Mapping_Tools.Components.Domain { 6 | internal class IsGreaterValidationRule : ValidationRule 7 | { 8 | public override ValidationResult Validate(object value, CultureInfo cultureInfo) { 9 | double limit = ValueWrapper.Value; 10 | string str = (value ?? "").ToString(); 11 | if (!TypeConverters.TryParseDouble(str, out double result)) { 12 | return new ValidationResult(false, "Double format error."); 13 | } 14 | return result > limit ? ValidationResult.ValidResult : new ValidationResult(false, $"Value must be greater than {limit}."); 15 | } 16 | 17 | public DoubleWrapper ValueWrapper { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/IsLessOrEqualValidationRule.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using Mapping_Tools.Classes.SystemTools; 5 | 6 | namespace Mapping_Tools.Components.Domain { 7 | internal class IsLessOrEqualValidationRule : ValidationRule 8 | { 9 | public override ValidationResult Validate(object value, CultureInfo cultureInfo) { 10 | double limit = ValueWrapper.Value; 11 | string str = (value ?? "").ToString(); 12 | if (!TypeConverters.TryParseDouble(str, out double result)) { 13 | return new ValidationResult(false, "Double format error."); 14 | } 15 | return result <= limit ? ValidationResult.ValidResult : new ValidationResult(false, $"Value can not be greater than {limit}."); 16 | } 17 | 18 | public DoubleWrapper ValueWrapper { get; set; } 19 | } 20 | 21 | public class DoubleWrapper : DependencyObject 22 | { 23 | public static readonly DependencyProperty FormatProperty = 24 | DependencyProperty.Register("Value", typeof(double), 25 | typeof(DoubleWrapper), new FrameworkPropertyMetadata(null)); 26 | 27 | public double Value { 28 | get => (double)GetValue(FormatProperty); 29 | set => SetValue(FormatProperty, value); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/IsLessValidationRule.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.SystemTools; 2 | using System.Globalization; 3 | using System.Windows.Controls; 4 | 5 | namespace Mapping_Tools.Components.Domain { 6 | internal class IsLessValidationRule : ValidationRule 7 | { 8 | public override ValidationResult Validate(object value, CultureInfo cultureInfo) { 9 | double limit = ValueWrapper.Value; 10 | string str = (value ?? "").ToString(); 11 | if (!TypeConverters.TryParseDouble(str, out double result)) { 12 | return new ValidationResult(false, "Double format error."); 13 | } 14 | return result < limit ? ValidationResult.ValidResult : new ValidationResult(false, $"Value must be less than {limit}."); 15 | } 16 | 17 | public DoubleWrapper ValueWrapper { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/MapPathStringAddNewLinesConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace Mapping_Tools.Components.Domain { 6 | internal class MapPathStringAddNewLinesConverter : IValueConverter { 7 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 8 | if (value is not string str) return string.Empty; 9 | return str.Replace('|', '\n'); 10 | } 11 | 12 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 13 | if (value is not string str) return string.Empty; 14 | return str.Replace('\n', '|'); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/MapPathStringJustFilenameConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Windows.Data; 6 | 7 | namespace Mapping_Tools.Components.Domain { 8 | internal class MapPathStringJustFilenameConverter : IValueConverter { 9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 10 | return value is not string str ? string.Empty : string.Join(" | ", str.Split('|').Select(Path.GetFileName)); 11 | } 12 | 13 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 14 | throw new InvalidOperationException("MapPathStringJustFilenameConverter can not convert back values."); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/MapPathStringToCountStringConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace Mapping_Tools.Components.Domain { 6 | internal class MapPathStringToCountStringConverter : IValueConverter { 7 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 8 | int c = 0; 9 | if (!string.IsNullOrEmpty(value as string)) { 10 | c = ((string) value).Split('|').Length; 11 | } 12 | return c == 1 ? $"({c}) map total" : $"({c}) maps total"; 13 | } 14 | 15 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 16 | return string.Empty; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/MultiValueConverterGroup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Windows.Data; 6 | 7 | namespace Mapping_Tools.Components.Domain 8 | { 9 | public class MultiValueConverterGroup : List, IMultiValueConverter 10 | { 11 | #region IValueConverter Members 12 | 13 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 14 | { 15 | if ((this.Count - 1) % values.Length != 0) { 16 | throw new ArgumentException("Could not interpret how to apply converters to values (make sure each value goes through the same number of converters, and there's one left at the end to combine them!)"); 17 | } 18 | int conversionsPerValue = (this.Count - 1) / values.Length; 19 | for (int i = 0; i < values.Length; i++) { 20 | for (int j = 0; j < conversionsPerValue; j++) { 21 | values[i] = this[j + i * conversionsPerValue].Convert(new object[] { values[i] }, targetType, parameter, culture); 22 | } 23 | } 24 | return this.Last().Convert(values, targetType, parameter, culture); 25 | } 26 | 27 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 28 | { 29 | throw new NotImplementedException(); 30 | } 31 | 32 | #endregion 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/NotEmptyValidationRule.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using System.Windows.Controls; 3 | 4 | namespace Mapping_Tools.Components.Domain { 5 | public class NotEmptyValidationRule : ValidationRule { 6 | public override ValidationResult Validate(object value, CultureInfo cultureInfo) { 7 | return string.IsNullOrWhiteSpace((value ?? "").ToString()) 8 | ? new ValidationResult(false, "Field is required.") 9 | : ValidationResult.ValidResult; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/ParsableDoubleListValidationRule.cs: -------------------------------------------------------------------------------- 1 | using System.Globalization; 2 | using System.Text.RegularExpressions; 3 | using System.Windows.Controls; 4 | 5 | namespace Mapping_Tools.Components.Domain 6 | { 7 | internal class ParsableDoubleListValidationRule : ValidationRule 8 | { 9 | public override ValidationResult Validate(object value, CultureInfo cultureInfo) { 10 | return Regex.IsMatch((value ?? "").ToString(), @"^([0-9]+(\.[0-9]+)?(,[0-9]+(\.[0-9]+)?)*)?$") ? 11 | ValidationResult.ValidResult : 12 | new ValidationResult(false, "Field cannot be parsed."); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/SampleSetToStringConverter.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.HitsoundStuff; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Globalization; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows.Data; 9 | using Mapping_Tools.Classes.BeatmapHelper; 10 | using Mapping_Tools.Classes.BeatmapHelper.Enums; 11 | 12 | namespace Mapping_Tools.Components.Domain { 13 | class SampleSetToStringConverter : IValueConverter { 14 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 15 | return ((SampleSet)value).ToString(); 16 | } 17 | 18 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 19 | string str = value.ToString(); 20 | return Enum.Parse(typeof(SampleSet), str); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/StringArrayToStringConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace Mapping_Tools.Components.Domain { 6 | class StringArrayToStringConverter : IValueConverter { 7 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 8 | return value == null ? "" : string.Join("|", (string[])value); 9 | } 10 | 11 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 12 | return value?.ToString().Split('|'); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Domain/VolumeToPercentageConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | using Mapping_Tools.Classes.SystemTools; 5 | 6 | namespace Mapping_Tools.Components.Domain { 7 | class VolumeToPercentageConverter : IValueConverter { 8 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 9 | return ((double)value * 100).ToString(CultureInfo.InvariantCulture); 10 | } 11 | 12 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 13 | TypeConverters.TryParseDouble(value.ToString(), out double result, double.Parse(parameter.ToString())); 14 | return result / 100; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Anchor.xaml: -------------------------------------------------------------------------------- 1 |  14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Graph.xaml: -------------------------------------------------------------------------------- 1 |  17 | 20 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/IGraphAnchor.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.MathUtil; 2 | using Mapping_Tools.Components.Graph.Interpolation; 3 | 4 | namespace Mapping_Tools.Components.Graph { 5 | public interface IGraphAnchor { 6 | Vector2 Pos { get; set; } 7 | IGraphInterpolator Interpolator { get; set; } 8 | double Tension { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Interpolation/CustomDerivativeExtremaAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Components.Graph.Interpolation { 4 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] 5 | public class CustomDerivativeExtremaAttribute : Attribute { 6 | public double[] ExtremaPositions { get; set; } 7 | 8 | public CustomDerivativeExtremaAttribute(double[] extremaPositions) { 9 | ExtremaPositions = extremaPositions; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Interpolation/CustomExtremaAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Components.Graph.Interpolation { 4 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] 5 | public class CustomExtremaAttribute : Attribute { 6 | public double[] ExtremaPositions { get; set; } 7 | 8 | public CustomExtremaAttribute(double[] extremaPositions) { 9 | ExtremaPositions = extremaPositions; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Interpolation/CustomIntegralExtremaAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Components.Graph.Interpolation { 4 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] 5 | public class CustomIntegralExtremaAttribute : Attribute { 6 | public double[] ExtremaPositions { get; set; } 7 | 8 | public CustomIntegralExtremaAttribute(double[] extremaPositions) { 9 | ExtremaPositions = extremaPositions; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Interpolation/CustomInterpolator.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using Newtonsoft.Json; 3 | 4 | namespace Mapping_Tools.Components.Graph.Interpolation { 5 | [IgnoreInterpolator] 6 | [DisplayName("Custom")] 7 | public class CustomInterpolator : IGraphInterpolator { 8 | public delegate double InterpolationDelegate(double t); 9 | 10 | [JsonIgnore] 11 | public InterpolationDelegate InterpolationFunction { get; set; } 12 | public double P { get; set; } = 0; 13 | 14 | public CustomInterpolator() { 15 | InterpolationFunction = t => t; 16 | } 17 | 18 | public CustomInterpolator(InterpolationDelegate interpolationFunction) { 19 | InterpolationFunction = interpolationFunction; 20 | } 21 | 22 | public double GetInterpolation(double t) { 23 | return InterpolationFunction(t); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Interpolation/IDerivableInterpolator.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Components.Graph.Interpolation { 2 | public interface IDerivableInterpolator { 3 | /// 4 | /// Calculates the derivative of the interpolator function at t. 5 | /// 6 | /// 7 | /// 8 | double GetDerivative(double t); 9 | } 10 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Interpolation/IGraphInterpolator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Components.Graph.Interpolation { 4 | public interface IGraphInterpolator { 5 | double P { get; set; } 6 | double GetInterpolation(double t); 7 | } 8 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Interpolation/IIntegrableInterpolator.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Components.Graph.Interpolation { 2 | public interface IIntegrableInterpolator { 3 | /// 4 | /// Calculates the integral of the interpolator function between t1 and t2. 5 | /// 6 | /// 7 | /// 8 | /// 9 | double GetIntegral(double t1, double t2); 10 | } 11 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Interpolation/IInvertibleInterpolator.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Mapping_Tools.Components.Graph.Interpolation { 4 | public interface IInvertibleInterpolator { 5 | /// 6 | /// Calculates all X values that correspond to specified Y value. 7 | /// 8 | /// 9 | /// 10 | IEnumerable GetInverse(double y); 11 | } 12 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Interpolation/IgnoreInterpolatorAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Components.Graph.Interpolation { 4 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] 5 | public class IgnoreInterpolatorAttribute : Attribute { 6 | 7 | } 8 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Interpolation/InterpolatorComparer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Mapping_Tools.Components.Graph.Interpolation { 5 | public class InterpolatorComparer : IComparer { 6 | public static string[] InterpolatorOrder = {"Single curve", "Single curve 2", "Single curve 3", 7 | "Double curve", "Double curve 2", "Double curve 3", "Half sine", "Wave", "Parabola", "Linear"}; 8 | 9 | public int Compare(string x, string y) { 10 | // ReSharper disable once ConvertIfStatementToSwitchStatement 11 | if (x == null && y == null) { 12 | return 0; 13 | } 14 | 15 | if (x == null) { 16 | return -1; 17 | } 18 | 19 | if (y == null) { 20 | return 1; 21 | } 22 | 23 | var indexX = IndexOf(x); 24 | var indexY = IndexOf(y); 25 | 26 | if (indexX == -1 && indexY == -1) { 27 | return string.Compare(x, y, StringComparison.Ordinal); 28 | } 29 | 30 | return indexX.CompareTo(indexY); 31 | } 32 | 33 | private int IndexOf(string name) { 34 | for (int i = 0; i < InterpolatorOrder.Length; i++) { 35 | if (InterpolatorOrder[i] == name) { 36 | return i; 37 | } 38 | } 39 | 40 | return -1; 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Interpolation/Interpolators/Helper Interpolators/PrimitiveParabolaInterpolator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mapping_Tools.Annotations; 3 | using Mapping_Tools.Classes.MathUtil; 4 | 5 | namespace Mapping_Tools.Components.Graph.Interpolation.Interpolators.Helper_Interpolators { 6 | [IgnoreInterpolator] 7 | public class PrimitiveParabolaInterpolator : CustomInterpolator, IDerivableInterpolator { 8 | private readonly double y1; 9 | private readonly double y2; 10 | 11 | [UsedImplicitly] 12 | public PrimitiveParabolaInterpolator() : this(0, 1) { } 13 | 14 | public PrimitiveParabolaInterpolator(double y1, double y2) { 15 | this.y1 = y1; 16 | this.y2 = y2; 17 | InterpolationFunction = Function; 18 | } 19 | 20 | public double Function(double t) { 21 | var p = MathHelper.Clamp(P, -1, 1); 22 | return (t * (2 * p * Math.Pow(t, 2) * (y2 - y1) + 3 * (p + 1) * t * (y1 - y2) - 6 * y1)) / (y1 * (p - 3) - y2 * (p + 3)); 23 | } 24 | 25 | public double GetDerivative(double t) { 26 | var p = MathHelper.Clamp(P, -1, 1); 27 | return -(6 * (y1 * (t - 1) * (p * t - 1) + y2 * t * (p * -t + p + 1))) / (y1 * (p - 3) - y2 * (p + 3)); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Interpolation/Interpolators/Helper Interpolators/PrimitiveSingleCurveInterpolator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mapping_Tools.Annotations; 3 | using Mapping_Tools.Classes.MathUtil; 4 | 5 | namespace Mapping_Tools.Components.Graph.Interpolation.Interpolators.Helper_Interpolators { 6 | [IgnoreInterpolator] 7 | [VerticalMirrorInterpolator] 8 | public class PrimitiveSingleCurveInterpolator : CustomInterpolator, IDerivableInterpolator { 9 | private readonly ParabolaInterpolator parabolaDegenerate; 10 | private readonly double y1; 11 | private readonly double y2; 12 | 13 | [UsedImplicitly] 14 | public PrimitiveSingleCurveInterpolator() : this(0, 1) { } 15 | 16 | public PrimitiveSingleCurveInterpolator(double y1, double y2) { 17 | this.y1 = y1; 18 | this.y2 = y2; 19 | parabolaDegenerate = new ParabolaInterpolator {P = (y1 - y2) / (y1 + y2)}; 20 | InterpolationFunction = Function; 21 | } 22 | 23 | public double Function(double t) { 24 | if (Math.Abs(P) < Precision.DoubleEpsilon) { 25 | return parabolaDegenerate.GetInterpolation(t); 26 | } 27 | 28 | var p = -MathHelper.Clamp(P, -1, 1) * 10; 29 | return (-y1 * Math.Exp(p * t) + y1 * p * t * Math.Exp(p) + y1 + y2 * Math.Exp(p * t) - y2 * p * t - y2) / 30 | (-y1 * Math.Exp(p) + y1 * p * Math.Exp(p) + y1 + y2 * Math.Exp(p) - y2 * p - y2); 31 | } 32 | 33 | public IGraphInterpolator GetDerivativeInterpolator() { 34 | return new SingleCurveInterpolator {P = P}; 35 | } 36 | 37 | public double GetDerivative(double t) { 38 | var p = -MathHelper.Clamp(P, -1, 1) * 10; 39 | return (p * ((y2 - y1) * Math.Exp(p * t) + y1 * Math.Exp(p) - y2)) / 40 | (y1 * Math.Exp(p) * (p - 1) + y1 + y2 * (-p + Math.Exp(p) - 1)); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Interpolation/Interpolators/LinearInterpolator.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Mapping_Tools.Components.Graph.Interpolation.Interpolators { 4 | [IgnoreInterpolator] 5 | [DisplayName("Linear")] 6 | public class LinearInterpolator : CustomInterpolator, IDerivableInterpolator, IIntegrableInterpolator { 7 | public LinearInterpolator() : base(t => t) {} 8 | 9 | public double GetDerivative(double t) { 10 | return 1; 11 | } 12 | 13 | public double GetIntegral(double t1, double t2) { 14 | return 0.5 * t2 * t2 - 0.5 * t1 * t1; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Interpolation/Interpolators/ParabolaInterpolator.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.MathUtil; 2 | using System; 3 | using System.ComponentModel; 4 | 5 | namespace Mapping_Tools.Components.Graph.Interpolation.Interpolators { 6 | [DisplayName("Parabola")] 7 | [VerticalMirrorInterpolator] 8 | public class ParabolaInterpolator : CustomInterpolator, IDerivableInterpolator, IIntegrableInterpolator { 9 | public string Name => "Parabola"; 10 | 11 | public ParabolaInterpolator() { 12 | InterpolationFunction = Function; 13 | } 14 | 15 | public double Function(double t) { 16 | var p = MathHelper.Clamp(P, -1, 1); 17 | return -p * Math.Pow(t, 2) + (p + 1) * t; 18 | } 19 | 20 | public double GetDerivative(double t) { 21 | var p = MathHelper.Clamp(P, -1, 1); 22 | return -2 * p * t + p + 1; 23 | } 24 | 25 | public double GetIntegral(double t1, double t2) { 26 | return Primitive(t2) - Primitive(t1); 27 | } 28 | 29 | private double Primitive(double t) { 30 | var p = MathHelper.Clamp(P, -1, 1); 31 | return 1d / 3 * -p * Math.Pow(t, 3) + 0.5 * (p + 1) * Math.Pow(t, 2); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Interpolation/Interpolators/SingleCurveInterpolator.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.MathUtil; 2 | using System; 3 | using System.ComponentModel; 4 | 5 | namespace Mapping_Tools.Components.Graph.Interpolation.Interpolators { 6 | [DisplayName("Single curve")] 7 | [VerticalMirrorInterpolator] 8 | public class SingleCurveInterpolator : CustomInterpolator, IDerivableInterpolator, IIntegrableInterpolator { 9 | private readonly LinearInterpolator linearDegenerate; 10 | 11 | public SingleCurveInterpolator() { 12 | linearDegenerate = new LinearInterpolator(); 13 | InterpolationFunction = Function; 14 | } 15 | 16 | public double Function(double t) { 17 | if (Math.Abs(P) < Precision.DoubleEpsilon) { 18 | return linearDegenerate.GetInterpolation(t); 19 | } 20 | 21 | var p = -MathHelper.Clamp(P, -1, 1) * 10; 22 | return F(t, p); 23 | } 24 | 25 | private static double F(double t, double k) { 26 | return (Math.Exp(k * t) - 1) / (Math.Exp(k) - 1); 27 | } 28 | 29 | public double GetDerivative(double t) { 30 | if (Math.Abs(P) < Precision.DoubleEpsilon) { 31 | return linearDegenerate.GetDerivative(t); 32 | } 33 | 34 | var p = -MathHelper.Clamp(P, -1, 1) * 10; 35 | return p * Math.Exp(p * t) / (Math.Exp(p) - 1); 36 | } 37 | 38 | public double GetIntegral(double t1, double t2) { 39 | if (Math.Abs(P) < Precision.DoubleEpsilon) { 40 | return linearDegenerate.GetIntegral(t1, t2); 41 | } 42 | 43 | var p = -MathHelper.Clamp(P, -1, 1) * 10; 44 | return Primitive(t2, p) - Primitive(t1, p); 45 | } 46 | 47 | private static double Primitive(double t, double p) { 48 | return (Math.Exp(p * t) / p - t) / (Math.Exp(p) - 1); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Interpolation/Interpolators/SingleCurveInterpolator2.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using Mapping_Tools.Classes.MathUtil; 4 | 5 | namespace Mapping_Tools.Components.Graph.Interpolation.Interpolators { 6 | [DisplayName("Single curve 2")] 7 | [VerticalMirrorInterpolator] 8 | public class SingleCurveInterpolator2 : CustomInterpolator, IDerivableInterpolator, IIntegrableInterpolator { 9 | private readonly LinearInterpolator linearDegenerate; 10 | 11 | public SingleCurveInterpolator2() { 12 | linearDegenerate = new LinearInterpolator(); 13 | InterpolationFunction = Function; 14 | } 15 | 16 | public double Function(double t) { 17 | if (Math.Abs(P) < Precision.DoubleEpsilon) { 18 | return linearDegenerate.GetInterpolation(t); 19 | } 20 | 21 | var p = -MathHelper.Clamp(P, -1, 1) * 10; 22 | return F(t, p); 23 | } 24 | 25 | private static double F(double t, double k) { 26 | return (Math.Pow(2, k * t) - 1) / (Math.Pow(2, k) - 1); 27 | } 28 | 29 | public double GetDerivative(double t) { 30 | if (Math.Abs(P) < Precision.DoubleEpsilon) { 31 | return linearDegenerate.GetDerivative(t); 32 | } 33 | 34 | var p = -MathHelper.Clamp(P, -1, 1) * 10; 35 | return p * Math.Log(2) * Math.Pow(2, p * t) / (Math.Pow(2, p) - 1); 36 | } 37 | 38 | public double GetIntegral(double t1, double t2) { 39 | if (Math.Abs(P) < Precision.DoubleEpsilon) { 40 | return linearDegenerate.GetIntegral(t1, t2); 41 | } 42 | 43 | var p = -MathHelper.Clamp(P, -1, 1) * 10; 44 | return Primitive(t2, p) - Primitive(t1, p); 45 | } 46 | 47 | private static double Primitive(double t, double p) { 48 | return (Math.Pow(2, p * t) / (p * Math.Log(2)) - t) / (Math.Pow(2, p) - 1); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Interpolation/Interpolators/SingleCurveInterpolator3.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using Mapping_Tools.Classes.MathUtil; 4 | 5 | namespace Mapping_Tools.Components.Graph.Interpolation.Interpolators { 6 | [DisplayName("Single curve 3")] 7 | [VerticalMirrorInterpolator] 8 | public class SingleCurveInterpolator3 : CustomInterpolator, IDerivableInterpolator, IIntegrableInterpolator { 9 | private readonly LinearInterpolator linearDegenerate; 10 | 11 | public SingleCurveInterpolator3() { 12 | linearDegenerate = new LinearInterpolator(); 13 | InterpolationFunction = Function; 14 | } 15 | 16 | public double Function(double t) { 17 | if (Math.Abs(P) < Precision.DoubleEpsilon) { 18 | return linearDegenerate.GetInterpolation(t); 19 | } 20 | 21 | var p = MathHelper.Clamp(P, -1, 1) * 7; 22 | return F(t, p); 23 | } 24 | 25 | private static double F(double t, double k) { 26 | return (Math.Exp(k) * t) / ((Math.Exp(k) - 1) * t + 1); 27 | } 28 | 29 | public double GetDerivative(double t) { 30 | if (Math.Abs(P) < Precision.DoubleEpsilon) { 31 | return linearDegenerate.GetDerivative(t); 32 | } 33 | 34 | var p = MathHelper.Clamp(P, -1, 1) * 7; 35 | return Math.Exp(p) / Math.Pow(t * (Math.Exp(p) - 1) + 1, 2); 36 | } 37 | 38 | public double GetIntegral(double t1, double t2) { 39 | if (Math.Abs(P) < Precision.DoubleEpsilon) { 40 | return linearDegenerate.GetIntegral(t1, t2); 41 | } 42 | 43 | var p = MathHelper.Clamp(P, -1, 1) * 7; 44 | return Primitive(t2, p) - Primitive(t1, p); 45 | } 46 | 47 | private static double Primitive(double t, double p) { 48 | return (Math.Exp(p * t) / p - t) / (Math.Exp(p) - 1); 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Interpolation/VerticalMirrorInterpolatorAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Components.Graph.Interpolation { 4 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] 5 | public class VerticalMirrorInterpolatorAttribute : Attribute { 6 | 7 | } 8 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Markers/CompositeMarkerGenerator.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Annotations; 2 | using System.Collections.Generic; 3 | using System.Windows.Controls; 4 | 5 | namespace Mapping_Tools.Components.Graph.Markers { 6 | public class CompositeMarkerGenerator : IMarkerGenerator { 7 | [NotNull] 8 | public IMarkerGenerator[] Generators { get; set; } 9 | 10 | public CompositeMarkerGenerator(IMarkerGenerator[] generators) { 11 | Generators = generators; 12 | } 13 | 14 | public IEnumerable GenerateMarkers(double start, double end, Orientation orientation, int maxMarkers) { 15 | foreach (var generator in Generators) { 16 | foreach (var marker in generator.GenerateMarkers(start, end, orientation, maxMarkers)) { 17 | yield return marker; 18 | } 19 | } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Markers/DoubleMarkerGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Windows.Controls; 4 | using Mapping_Tools.Annotations; 5 | using Mapping_Tools.Classes.MathUtil; 6 | 7 | namespace Mapping_Tools.Components.Graph.Markers { 8 | public class DoubleMarkerGenerator : IMarkerGenerator { 9 | [NotNull] 10 | public string Unit { get; set; } 11 | 12 | public double Offset { get; set; } 13 | public double Step { get; set; } 14 | 15 | public bool Snappable { get; set; } 16 | 17 | public DoubleMarkerGenerator(double offset, double step) : this(offset, step, "") {} 18 | 19 | public DoubleMarkerGenerator(double offset, double step, string unit, bool snappable = false) { 20 | Offset = offset; 21 | Step = step; 22 | Unit = unit; 23 | Snappable = snappable; 24 | } 25 | 26 | public IEnumerable GenerateMarkers(double start, double end, Orientation orientation, int maxMarkers) { 27 | var markers = new List(); 28 | 29 | double step = Step; 30 | while ((end - start) / step > maxMarkers) { 31 | step *= 2; 32 | } 33 | 34 | var vStart = Math.Ceiling((start - Offset) / step) * step + Offset; 35 | var v = vStart; 36 | int i = 0; 37 | while (v <= end + Precision.DoubleEpsilon) { 38 | markers.Add(new GraphMarker {Orientation = orientation, Text = $"{v:g2}{Unit}", Value = v, Snappable = Snappable}); 39 | v = vStart + step * ++i; 40 | } 41 | 42 | return markers; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/Markers/IMarkerGenerator.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Windows.Controls; 3 | 4 | namespace Mapping_Tools.Components.Graph.Markers { 5 | public interface IMarkerGenerator { 6 | IEnumerable GenerateMarkers(double start, double end, Orientation orientation, int maxMarkers); 7 | } 8 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Graph/TensionAnchor.xaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/HotkeyEditorControl.xaml: -------------------------------------------------------------------------------- 1 |  10 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/ObjectVisualiser/HitObjectElementMarker.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Media; 3 | 4 | namespace Mapping_Tools.Components.ObjectVisualiser { 5 | public class HitObjectElementMarker { 6 | public double Progress { get; set; } 7 | public double Size { get; set; } 8 | public Brush Brush { get; set; } 9 | 10 | public HitObjectElementMarker(double progress, double size, Brush brush) { 11 | Progress = progress; 12 | Size = size; 13 | Brush = brush; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Mapping_Tools/Components/Spectrum/Spectrum.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/Spectrum/Spectrum.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Mapping_Tools.Components.Spectrum 17 | { 18 | /// 19 | /// Interaction logic for Spectrum.xaml 20 | /// 21 | public partial class Spectrum : UserControl 22 | { 23 | 24 | public Spectrum() 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/TimeLine/TimeLine.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/TimeLine/TimeLineElement.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/TimeLine/TimeLineMark.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 00:00 9 | 10 | 11 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/TimeLine/TimeLineMark.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Controls; 3 | 4 | namespace Mapping_Tools.Components.TimeLine { 5 | /// 6 | /// Interaction logic for TimelineMark.xaml 7 | /// 8 | public partial class TimeLineMark :UserControl { 9 | public double Time { get; set; } 10 | 11 | public TimeLineMark(double mSeconds) { 12 | InitializeComponent(); 13 | Time = mSeconds; 14 | 15 | TimeSpan ts = TimeSpan.FromMilliseconds(mSeconds); 16 | string m = ts.Minutes.ToString(); 17 | if( m.Length < 2 ) 18 | m = "0" + m; 19 | string s = ts.Seconds.ToString(); 20 | if( s.Length < 2) 21 | s = "0" + s; 22 | 23 | Text.Text = string.Format("{0}:{1}", m, s); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Mapping_Tools/Components/ViewHeaderComponent.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | This tool is compatible with QuickRun! 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Mapping_Tools/Data/MTcog256.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliBomby/Mapping_Tools/59f65e661ff32648f6dff43ad91fdd72070aafee/Mapping_Tools/Data/MTcog256.gif -------------------------------------------------------------------------------- /Mapping_Tools/Data/mt_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliBomby/Mapping_Tools/59f65e661ff32648f6dff43ad91fdd72070aafee/Mapping_Tools/Data/mt_icon.ico -------------------------------------------------------------------------------- /Mapping_Tools/Data/mt_logo_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliBomby/Mapping_Tools/59f65e661ff32648f6dff43ad91fdd72070aafee/Mapping_Tools/Data/mt_logo_256.png -------------------------------------------------------------------------------- /Mapping_Tools/Data/mt_logo_white_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliBomby/Mapping_Tools/59f65e661ff32648f6dff43ad91fdd72070aafee/Mapping_Tools/Data/mt_logo_white_24.png -------------------------------------------------------------------------------- /Mapping_Tools/Data/sample_pattern.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliBomby/Mapping_Tools/59f65e661ff32648f6dff43ad91fdd72070aafee/Mapping_Tools/Data/sample_pattern.jpg -------------------------------------------------------------------------------- /Mapping_Tools/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 5 | //(used if a resource is not found in the page, 6 | // or application resource dictionaries) 7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 8 | //(used if a resource is not found in the page, 9 | // app, or any theme specific resource dictionaries) 10 | )] 11 | -------------------------------------------------------------------------------- /Mapping_Tools/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Mapping_Tools.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Mapping_Tools/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Mapping_Tools/Viewmodels/ComboColourStudioVm.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.SystemTools; 2 | using Mapping_Tools.Classes.Tools.ComboColourStudio; 3 | 4 | namespace Mapping_Tools.Viewmodels { 5 | 6 | public class ComboColourStudioVm : BindableBase { 7 | private ComboColourProject project; 8 | 9 | public ComboColourStudioVm() { 10 | Project = new ComboColourProject(); 11 | } 12 | 13 | public ComboColourProject Project { 14 | get => project; 15 | set => Set(ref project, value); 16 | } 17 | 18 | public string ExportPath { get; set; } 19 | } 20 | } -------------------------------------------------------------------------------- /Mapping_Tools/Viewmodels/MapCleanerVm.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.Tools; 2 | using Mapping_Tools.Classes.Tools.MapCleanerStuff; 3 | using Newtonsoft.Json; 4 | 5 | namespace Mapping_Tools.Viewmodels { 6 | /// 7 | /// Map Cleaner View Model 8 | /// 9 | public class MapCleanerVm { 10 | [JsonIgnore] 11 | public string[] Paths { get; set; } 12 | 13 | [JsonIgnore] 14 | public bool Quick { get; set; } 15 | 16 | public MapCleanerArgs MapCleanerArgs { get; set; } 17 | 18 | public MapCleanerVm() { 19 | MapCleanerArgs = MapCleanerArgs.BasicResnap; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Mapping_Tools/Viewmodels/PreferencesVm.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Viewmodels { 2 | public class PreferencesVM { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /Mapping_Tools/Viewmodels/StandardVm.cs: -------------------------------------------------------------------------------- 1 | namespace Mapping_Tools.Viewmodels { 2 | /// 3 | /// 4 | /// 5 | public class StandardVm { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Mapping_Tools/Views/DontShowTitleAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Views { 4 | /// 5 | /// 6 | /// 7 | [AttributeUsage(AttributeTargets.Class)] 8 | public class DontShowTitleAttribute : Attribute { 9 | 10 | } 11 | } -------------------------------------------------------------------------------- /Mapping_Tools/Views/Extensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Controls; 8 | 9 | namespace Mapping_Tools.Views { 10 | /// 11 | /// TODO: Change class to different name as it's similar to file extensions. 12 | /// 13 | public static class Extensions { 14 | public static double GetDouble(this TextBox textBox, double defaultValue=-1) { 15 | try { 16 | return ParseDouble(textBox.Text); 17 | } catch { 18 | return defaultValue; 19 | } 20 | } 21 | 22 | public static int GetInt(this TextBox textBox, int defaultValue = -1) { 23 | try { 24 | return ParseInt(textBox.Text); 25 | } catch { 26 | return defaultValue; 27 | } 28 | } 29 | 30 | public static double ParseDouble(string str) { 31 | using (DataTable dt = new DataTable()) { 32 | string text = str.Replace(",", "."); 33 | var v = dt.Compute(text, ""); 34 | return Convert.ToDouble(v); 35 | } 36 | } 37 | 38 | public static int ParseInt(string str) { 39 | using (DataTable dt = new DataTable()) { 40 | string text = str.Replace(",", "."); 41 | var v = dt.Compute(text, ""); 42 | return Convert.ToInt32(v); 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Mapping_Tools/Views/HiddenToolAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Views { 4 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] 5 | public class HiddenToolAttribute : Attribute { 6 | 7 | } 8 | } -------------------------------------------------------------------------------- /Mapping_Tools/Views/HitsoundStudio/HitsoundStudioExportDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using Mapping_Tools.Classes.SystemTools; 3 | using Mapping_Tools.Viewmodels; 4 | 5 | namespace Mapping_Tools.Views.HitsoundStudio { 6 | /// 7 | /// Interaction logic for HitsoundStudioExportDialog.xaml 8 | /// 9 | public partial class HitsoundStudioExportDialog { 10 | public HitsoundStudioVm Settings => (HitsoundStudioVm) DataContext; 11 | 12 | public HitsoundStudioExportDialog(HitsoundStudioVm settings) { 13 | InitializeComponent(); 14 | DataContext = settings; 15 | } 16 | 17 | private void ExportFolderBrowseButton_OnClick(object sender, RoutedEventArgs e) { 18 | string path = IOHelper.FolderDialog(); 19 | if (!string.IsNullOrWhiteSpace(path)) { 20 | ExportFolderBox.Text = path; 21 | Settings.ExportFolder = path; 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Mapping_Tools/Views/HorizontalContentScrollAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Views { 4 | [AttributeUsage(AttributeTargets.Class)] 5 | class HorizontalContentScrollAttribute : Attribute { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Mapping_Tools/Views/MappingTool.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Runtime.CompilerServices; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | 7 | namespace Mapping_Tools.Views { 8 | [HiddenTool] 9 | public class MappingTool : UserControl, INotifyPropertyChanged, IDisposable { 10 | public event PropertyChangedEventHandler PropertyChanged; 11 | 12 | public static readonly DependencyProperty IsActiveProperty = 13 | DependencyProperty.Register(nameof(IsActive), typeof(bool), typeof(MappingTool), 14 | new FrameworkPropertyMetadata(default(bool), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); 15 | 16 | public bool IsActive { 17 | get => (bool)GetValue(IsActiveProperty); 18 | set => SetValue(IsActiveProperty, value); 19 | } 20 | 21 | public virtual void Activate() { 22 | IsActive = true; 23 | } 24 | public virtual void Deactivate() { 25 | IsActive = false; 26 | } 27 | 28 | protected void Set(ref T target, T value, [CallerMemberName] string propertyName = "") { 29 | target = value; 30 | RaisePropertyChanged(propertyName); 31 | } 32 | 33 | protected void RaisePropertyChanged([CallerMemberName] string propertyName = "") { 34 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 35 | } 36 | 37 | public virtual void Dispose() { 38 | IsActive = false; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Mapping_Tools/Views/SnappingTools/SnappingToolsPreferencesWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using Mapping_Tools.Classes.Tools.SnappingTools.Serialization; 4 | 5 | namespace Mapping_Tools.Views.SnappingTools { 6 | /// 7 | /// Interaction logic for SnappingToolsPreferencesWindow.xaml 8 | /// 9 | public partial class SnappingToolsPreferencesWindow 10 | { 11 | public SnappingToolsPreferences Preferences { 12 | get => (SnappingToolsPreferences)DataContext; 13 | set => DataContext = value; 14 | } 15 | 16 | public SnappingToolsPreferencesWindow(SnappingToolsPreferences preferences = null) { 17 | Preferences = (SnappingToolsPreferences)preferences?.Clone() ?? new SnappingToolsPreferences(); 18 | InitializeComponent(); 19 | } 20 | 21 | private void ApplyButton_Click(object sender, RoutedEventArgs e) 22 | { 23 | DialogResult = true; 24 | Close(); 25 | } 26 | 27 | private void CancelButton_Click(object sender, RoutedEventArgs e) 28 | { 29 | DialogResult = false; 30 | Close(); 31 | } 32 | 33 | private void KeyDownViewModeSelector_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { 34 | foreach (var addedItem in e.AddedItems) { 35 | var item = (ListBoxItem) addedItem; 36 | Preferences.KeyDownViewMode |= (ViewMode)item.Tag; 37 | } 38 | foreach (var removedItem in e.RemovedItems) { 39 | var item = (ListBoxItem) removedItem; 40 | Preferences.KeyDownViewMode &= ~(ViewMode)item.Tag; 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Mapping_Tools/Views/VerticalContentScrollAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Mapping_Tools.Views { 4 | [AttributeUsage(AttributeTargets.Class)] 5 | class VerticalContentScrollAttribute : Attribute { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Mapping_Tools_Tests/Classes/BeatmapHelper/SliderPathStuff/SliderPathTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mapping_Tools.Classes.BeatmapHelper; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace Mapping_Tools_Tests.Classes.BeatmapHelper.SliderPathStuff { 6 | [TestClass] 7 | public class SliderPathTests { 8 | [TestMethod] 9 | public void SliderPathSegmentsTest() { 10 | var slider = 11 | new HitObject("42,179,300,2,0,B|135:234|219:171|219:171|194:100|194:100|266:53|345:48|405:117,1,499.999952316284"); 12 | 13 | var sliderPath = slider.GetSliderPath(); 14 | 15 | Assert.AreEqual(3, sliderPath.SegmentStarts.Count); 16 | 17 | int i = 0; 18 | foreach (var segmentStart in sliderPath.SegmentStarts) { 19 | Console.WriteLine(++i + " : " + segmentStart); 20 | } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Mapping_Tools_Tests/Classes/ComboColourStudio/ComboColourProjectTests.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.Tools.ComboColourStudio; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | 4 | namespace Mapping_Tools_Tests.Classes.ComboColourStudio { 5 | [TestClass] 6 | public class ComboColourProjectTests { 7 | [TestMethod] 8 | public void IsSubSequenceTest() { 9 | Assert.IsTrue(ComboColourProject.IsSubSequence(new []{1,2,3}, new []{1,2,3,4})); 10 | Assert.IsTrue(ComboColourProject.IsSubSequence(new []{1,2,3}, new []{1,2,3,4,6,5,2})); 11 | Assert.IsTrue(ComboColourProject.IsSubSequence(new int[]{}, new []{1,2,3,4})); 12 | Assert.IsFalse(ComboColourProject.IsSubSequence(new []{1,2,3}, new []{1,2,2,4})); 13 | Assert.IsFalse(ComboColourProject.IsSubSequence(new []{1,2,3}, new []{1,2})); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Mapping_Tools_Tests/Classes/ExternalFileUtil/Reaper/SerializationTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | 3 | namespace Mapping_Tools_Tests.Classes.ExternalFileUtil.Reaper 4 | { 5 | [TestClass()] 6 | public class SerializationTests 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /Mapping_Tools_Tests/Classes/MathUtil/GradientDescentUtilTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Mapping_Tools.Classes.MathUtil; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace Mapping_Tools_Tests.Classes.MathUtil { 6 | [TestClass] 7 | public class GradientDescentUtilTests { 8 | [TestMethod] 9 | public void GradientDescentTest() { 10 | Func func = Math.Sin; 11 | const double lower = 0; 12 | const double upper = 2 * Math.PI; 13 | const double rate = 0.5; 14 | 15 | double result1 = GradientDescentUtil.GradientDescent(func, lower, upper, rate); 16 | Assert.IsTrue(Math.Abs(result1 - 1.5 * Math.PI) < 0.001); 17 | 18 | double result2 = GradientDescentUtil.GradientAscent(func, lower, upper, rate); 19 | Assert.IsTrue(Math.Abs(result2 - 0.5 * Math.PI) < 0.001); 20 | 21 | double result3 = GradientDescentUtil.GradientDescent(func, lower + 4 * Math.PI, upper + 4 * Math.PI, rate); 22 | Assert.IsTrue(Math.Abs(result3 - (1.5 * Math.PI + 4 * Math.PI)) < 0.001); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /Mapping_Tools_Tests/Classes/SystemTools/ListenerManagerTests.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Input; 2 | using Mapping_Tools.Classes.SystemTools; 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | namespace Mapping_Tools_Tests.Classes.SystemTools { 6 | [TestClass] 7 | public class ListenerManagerTests { 8 | [TestMethod] 9 | public void RemoveActiveHotkeyTest() { 10 | var listenerManager = new ListenerManager(); 11 | 12 | listenerManager.AddActiveHotkey("testKey", new ActionHotkey(new Hotkey(Key.A, ModifierKeys.Alt), () => {})); 13 | 14 | Assert.IsTrue(listenerManager.ActiveHotkeys.ContainsKey("testKey")); 15 | 16 | listenerManager.RemoveActiveHotkey("testKey"); 17 | 18 | Assert.IsFalse(listenerManager.ActiveHotkeys.ContainsKey("testKey")); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Mapping_Tools_Tests/Classes/SystemTools/TypeConvertersTests.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.SystemTools; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | 4 | namespace Mapping_Tools_Tests.Classes.SystemTools { 5 | [TestClass] 6 | public class TypeConvertersTests { 7 | [TestMethod] 8 | public void TimestampParserTest() { 9 | var test1 = TypeConverters.ParseOsuTimestamp("00:00:891 (1) - "); 10 | Assert.AreEqual(891, test1.TotalMilliseconds); 11 | 12 | var test2 = TypeConverters.ParseOsuTimestamp("60:00:074 (2,4) - "); 13 | Assert.AreEqual(3600074, test2.TotalMilliseconds); 14 | 15 | var test3 = TypeConverters.ParseOsuTimestamp("60:00:074 - "); 16 | Assert.AreEqual(3600074, test3.TotalMilliseconds); 17 | 18 | var test4 = TypeConverters.ParseOsuTimestamp("00:-01:-230 (1) - "); 19 | Assert.AreEqual(-1230, test4.TotalMilliseconds); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Mapping_Tools_Tests/Classes/Tools/TumourGenerating/Options/TumourTemplates/ParabolaGeneratorTests.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.Tools.TumourGenerating.Options.TumourTemplates; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | 4 | namespace Mapping_Tools_Tests.Classes.Tools.TumourGenerating.Options.TumourTemplates { 5 | [TestClass] 6 | public class ParabolaGeneratorTests { 7 | [TestMethod] 8 | public void TestDistanceFunction() { 9 | var template = new ParabolaTemplate { Length = 1, Width = 1 }; 10 | var distanceFunc = template.GetDistanceRelation(); 11 | 12 | Assert.AreEqual(0, distanceFunc(0)); 13 | Assert.AreEqual(0.5, distanceFunc(0.5)); 14 | Assert.AreEqual(1, distanceFunc(1)); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Mapping_Tools_Tests/Mapping_Tools_Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | net5.0-windows 4 | false 5 | AnyCPU;x86;x64 6 | 7 | 8 | 9 | 10 | PreserveNewest 11 | 12 | 13 | PreserveNewest 14 | 15 | 16 | 17 | 18 | PreserveNewest 19 | 20 | 21 | PreserveNewest 22 | 23 | 24 | PreserveNewest 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Mapping_Tools_Tests/Mapping_Tools_Tests.csproj.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | No -------------------------------------------------------------------------------- /Mapping_Tools_Tests/MathUtilTests.cs: -------------------------------------------------------------------------------- 1 | using Mapping_Tools.Classes.MathUtil; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | 4 | namespace Mapping_Tools_Tests { 5 | [TestClass] 6 | public class MathUtilTests { 7 | [TestMethod] 8 | public void Vector2AddTest() { 9 | var v1 = new Vector2(1, -4); 10 | var v2 = new Vector2(-8, 16); 11 | var expected = new Vector2(-7, 12); 12 | 13 | var actual = v1 + v2; 14 | 15 | Assert.AreEqual(expected, actual, "Epic Fail"); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Mapping_Tools_Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("Mapping_Tools_Tests")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("Mapping_Tools_Tests")] 10 | [assembly: AssemblyCopyright("Copyright © 2019")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | 14 | [assembly: ComVisible(false)] 15 | 16 | [assembly: Guid("d01ed42e-8057-489c-96b4-ffdcebd5e53f")] 17 | 18 | // [assembly: AssemblyVersion("1.0.*")] 19 | [assembly: AssemblyVersion("1.0.0.0")] 20 | [assembly: AssemblyFileVersion("1.0.0.0")] 21 | -------------------------------------------------------------------------------- /Mapping_Tools_Tests/Resources/EmptyTestMap.osu: -------------------------------------------------------------------------------- 1 | osu file format v14 2 | 3 | [General] 4 | AudioFilename: audio.mp3 5 | AudioLeadIn: 0 6 | PreviewTime: 0 7 | Countdown: 1 8 | SampleSet: Normal 9 | StackLeniency: 1 10 | Mode: 0 11 | LetterboxInBreaks: 0 12 | WidescreenStoryboard: 1 13 | 14 | [Editor] 15 | DistanceSpacing: 2 16 | BeatDivisor: 4 17 | GridSize: 4 18 | TimelineZoom: 3.200005 19 | 20 | [Metadata] 21 | Title:Why you have to be mad? 22 | TitleUnicode:Why you have to be mad? 23 | Artist:idk 24 | ArtistUnicode:idk 25 | Creator:OliBomby 26 | Version:empty 27 | Source: 28 | Tags:ilya bryzgalov simple visualisation 29 | BeatmapID:0 30 | BeatmapSetID:727066 31 | 32 | [Difficulty] 33 | HPDrainRate:3 34 | CircleSize:4 35 | OverallDifficulty:2 36 | ApproachRate:10 37 | SliderMultiplier:2.79999990463257 38 | SliderTickRate:0.5 39 | 40 | [Events] 41 | //Background and Video events 42 | 0,0,"maxresdefault (4).jpg",0,0 43 | //Break Periods 44 | //Storyboard Layer 0 (Background) 45 | //Storyboard Layer 1 (Fail) 46 | //Storyboard Layer 2 (Pass) 47 | //Storyboard Layer 3 (Foreground) 48 | //Storyboard Layer 4 (Overlay) 49 | //Storyboard Sound Samples 50 | Sample,0,0,"normal-hitnormal3.wav",0 51 | 52 | [TimingPoints] 53 | 0,333.333333333333,4,1,0,100,1,0 54 | 55 | 56 | [HitObjects] 57 | -------------------------------------------------------------------------------- /lib/EditorReader.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliBomby/Mapping_Tools/59f65e661ff32648f6dff43ad91fdd72070aafee/lib/EditorReader.dll -------------------------------------------------------------------------------- /lib/NonInvasiveKeyboardHookLibrary.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliBomby/Mapping_Tools/59f65e661ff32648f6dff43ad91fdd72070aafee/lib/NonInvasiveKeyboardHookLibrary.Core.dll -------------------------------------------------------------------------------- /lib/netcorecheck.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliBomby/Mapping_Tools/59f65e661ff32648f6dff43ad91fdd72070aafee/lib/netcorecheck.exe -------------------------------------------------------------------------------- /lib/netcorecheck_x64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OliBomby/Mapping_Tools/59f65e661ff32648f6dff43ad91fdd72070aafee/lib/netcorecheck_x64.exe --------------------------------------------------------------------------------