├── .gitignore ├── LICENSE ├── README.md └── source ├── 00 Docs ├── 00_SampleMerge.png ├── BinaryDiff.png ├── DiffControl.png ├── DirDiffScreen.png ├── DirectoryDiff.png ├── FileDiffScreen.png ├── LinkedImages.png ├── Textdiff.png ├── Ähnlich1.png ├── Ähnlich2.png └── ÄhnlichDemo.png ├── Aehnlich.sln ├── Aehnlich ├── Aehnlich │ ├── Aehnlich.csproj │ ├── App.config │ ├── App.xaml │ ├── App.xaml.cs │ ├── BindToMLib │ │ ├── AehnlichViewLib_Dark_LightBrushs.xaml │ │ ├── AvalonDock_Dark_LightBrushs.xaml │ │ ├── MWindowLib │ │ │ └── DarkLightBrushs.xaml │ │ └── SuggestionLibDarkLightBrushs.xaml │ ├── Converters │ │ ├── ActiveDocumentConverter.cs │ │ ├── StringEmptyToBoolPropConverter.cs │ │ └── TruncateMiddleConverter.cs │ ├── Events │ │ └── DocumentChangedEventArgs.cs │ ├── Interfaces │ │ ├── IDocumentBaseViewModel.cs │ │ └── IDocumentManagerViewModel.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── Models │ │ ├── AppCore.cs │ │ └── SettingDefaults.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── ServiceInjector.cs │ ├── Themes │ │ └── Generic.xaml │ ├── ViewModels │ │ ├── AppLifeCycleViewModel.cs │ │ ├── AppViewModel.cs │ │ ├── Base │ │ │ ├── ModelBase.cs │ │ │ ├── RelayCommand.cs │ │ │ └── ViewModelBase.cs │ │ ├── DirectoryDiff │ │ │ ├── DirDiffContentTemplateSelector.cs │ │ │ ├── DirDiffDocSetupViewModel.cs │ │ │ ├── DirDiffDocViewModel.cs │ │ │ └── DirDiffDocViewViewModel.cs │ │ ├── DocDiff │ │ │ └── DocDiffDocViewViewModel.cs │ │ ├── DocumentManagerViewModel.cs │ │ ├── Documents │ │ │ ├── DocumentBaseViewModel.cs │ │ │ └── PaneViewModel.cs │ │ ├── IAenlichAppViewModel.cs │ │ ├── ObservableRangeCollection.cs │ │ └── Themes │ │ │ ├── ThemeDefinitionViewModel.cs │ │ │ └── ThemeViewModel.cs │ ├── Views │ │ ├── AvalonDockView.xaml │ │ ├── AvalonDockView.xaml.cs │ │ ├── Dir │ │ │ ├── DirDiffDocControl.xaml │ │ │ ├── DirDiffDocControl.xaml.cs │ │ │ ├── DirDiffDocView.xaml │ │ │ ├── DirDiffDocView.xaml.cs │ │ │ ├── DirDiffSetupView.xaml │ │ │ └── DirDiffSetupView.xaml.cs │ │ └── Documents │ │ │ ├── PanesStyleSelector.cs │ │ │ └── PanesTemplateSelector.cs │ ├── packages.config │ └── tilde_LightDark.ico └── Components │ ├── ServiceLocator │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── ServiceContainer.cs │ └── ServiceLocator.csproj │ └── Settings │ ├── Settings │ ├── Interfaces │ │ ├── IOptions.cs │ │ ├── IOptionsPanel.cs │ │ ├── IProfile.cs │ │ ├── ISettingsManager.cs │ │ └── IViewPosSizeModel.cs │ ├── Internal │ │ └── SettingsManagerImpl.cs │ ├── ProgramSettings │ │ ├── LanguageCollection.cs │ │ └── OptionsPanel.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SerializableDictionary.cs │ ├── Settings.csproj │ ├── SettingsManager.cs │ ├── UserProfile │ │ ├── IViewSize.cs │ │ ├── LocalizabilityAttribute.cs │ │ ├── Profile.cs │ │ ├── ViewPosSizeModel.cs │ │ └── ViewSize.cs │ └── packages.config │ └── SettingsModel │ ├── ExtensionMethods │ └── SecureStringExtensionMethod.cs │ ├── Interfaces │ ├── IEngine.cs │ ├── IOptionGroup.cs │ └── IOptionsSchema.cs │ ├── Models │ ├── Factory.cs │ ├── FileReference.cs │ ├── OptionGroup.cs │ ├── OptionsEngine.cs │ ├── OptionsSchema.cs │ └── XML │ │ ├── Converters │ │ ├── AlternativeDataTypeHandler.cs │ │ ├── IAlternativeDataTypeHandler.cs │ │ └── SecureStringHandler.cs │ │ └── XMLLayer.cs │ ├── Overview.cd │ ├── Properties │ └── AssemblyInfo.cs │ └── SettingsModel.csproj ├── AehnlichLib ├── AehnlichLib.csproj ├── Binaries │ ├── AddCopyCollection.cs │ ├── Addition.cs │ ├── BinaryDiff.cs │ ├── BinaryDiffLines.cs │ ├── Copy.cs │ └── Resources │ │ └── NonExistingFile.bin ├── ClassDiagram1.cd ├── Dir │ ├── DiffUtility.cs │ ├── DirDiffArgs.cs │ ├── DirectoryDiff.cs │ ├── DirectoryDiffEntry.cs │ ├── DirectoryDiffEntryCollection.cs │ ├── DirectoryDiffFileFilter.cs │ ├── DirectoryDiffRoot.cs │ ├── FileSystemInfoComparer.cs │ └── Merge │ │ ├── MergeIndex.cs │ │ └── MergedEntry.cs ├── Docs │ └── Readme.txt ├── Enums │ ├── CompareType.cs │ ├── DiffType.cs │ ├── EditType.cs │ └── HashType.cs ├── Files │ ├── AsyncPump.cs │ ├── FileContentInfo.cs │ └── FileEx.cs ├── Interfaces │ ├── IAddCopy.cs │ ├── IDiffProgress.cs │ ├── IDirectoryDiffEntry.cs │ └── IDirectoryDiffRoot.cs ├── Properties │ └── AssemblyInfo.cs ├── Text │ ├── DiagonalVector.cs │ ├── Edit.cs │ ├── EditScript.cs │ ├── MyersDiff.cs │ ├── ProcessTextDiff.cs │ ├── StringHasher.cs │ ├── SubArray.cs │ ├── TextBinaryDiffArgs.cs │ └── TextDiff.cs └── packages.config ├── AehnlichLib_UnitTests ├── AehnlichLib_UnitTests.csproj ├── DirectoryDiffTests.cs ├── EditScriptTests.cs └── Mock_IFileSystemInfo │ └── FileSystemInfoImpl.cs ├── AehnlichViewLib ├── AehnlichViewLib.csproj ├── Behaviors │ └── DoubleClickItemBehavior.cs ├── Controls │ ├── AvalonEditEx │ │ ├── CustomLineNumberMargin.cs │ │ ├── DiffLineBackgroundRenderer.cs │ │ ├── HighlightCurrentLineBackgroundRenderer.cs │ │ └── TextBoxController │ │ │ ├── DiffView_TextController.cs │ │ │ ├── ITextBoxController.cs │ │ │ └── TextBoxController.cs │ ├── DiffDirView.xaml │ ├── DiffDirView.xaml.cs │ ├── DiffTextView.xaml │ ├── DiffTextView.xaml.cs │ ├── DiffView.xaml │ ├── DiffView.xaml.cs │ ├── GridStyle.xaml │ ├── Overview │ │ ├── DoublesToVisibilityConverter.cs │ │ ├── RangeAlignment.cs │ │ ├── RangeItemsControl.xaml │ │ ├── RangeItemsControl.xaml.cs │ │ ├── RangePanel.cs │ │ ├── RangeScrollbar.xaml │ │ └── RangeScrollbar.xaml.cs │ └── Utils │ │ ├── ExtensionMethods.cs │ │ └── TextFormatterFactory.cs ├── Converters │ ├── AssociatedIconConverter.cs │ ├── BindingProxy .cs │ ├── BoolToVisibilityPropConverter.cs │ ├── BooleanInvertConverter.cs │ ├── DiffToBackgroundColorConverter.cs │ ├── DiffToForegroundColorConverter.cs │ ├── DoubleBytesToStringReadableSizeConverter.cs │ ├── InvertColorConverter.cs │ ├── NullToEnabledPropConverter.cs │ ├── NullToVisibilityPropConverter.cs │ └── SentinelConverter.cs ├── Enums │ ├── DiffContext.cs │ ├── Focus.cs │ └── ViewMode.cs ├── Events │ ├── ColumnWidthChangedEvent.cs │ └── DiffLineInfoChangedEvent.cs ├── Icons │ ├── Dark │ │ ├── Close_White_16x.ico │ │ ├── Close_White_16x.svg │ │ ├── Refresh_white_16x.ico │ │ ├── Refresh_white_16x.svg │ │ ├── desk-lamp-dark.ico │ │ ├── desk-lamp-dark.svg │ │ ├── tilde.ico │ │ └── tilde.svg │ └── Light │ │ ├── Close.ico │ │ ├── Close_16x.svg │ │ ├── Copy.ico │ │ ├── Copy_16x.svg │ │ ├── FolderOpen_Down.ico │ │ ├── FolderOpen_Down1_16x.ico │ │ ├── FolderOpen_Down1_16x.svg │ │ ├── FolderOpen_Down_16x.svg │ │ ├── FolderOpen_Up.ico │ │ ├── FolderOpen_Up1_16x.ico │ │ ├── FolderOpen_Up1_16x.svg │ │ ├── FolderOpen_Up_16x.svg │ │ ├── GoToBottom.ico │ │ ├── GoToBottom_16x.svg │ │ ├── GoToNext.ico │ │ ├── GoToNext_16x.svg │ │ ├── GoToPrev.ico │ │ ├── GoToPrev_16x.svg │ │ ├── GoToTop.ico │ │ ├── GoToTop_16x.svg │ │ ├── Next_16x.ico │ │ ├── Next_16x.svg │ │ ├── OpenFile.ico │ │ ├── OpenFile_16x.svg │ │ ├── Previous_16x.ico │ │ ├── Previous_16x.svg │ │ ├── Refresh_16x.svg │ │ ├── Refresh_black_16x.ico │ │ ├── Search_16x.ico │ │ ├── Search_16x.svg │ │ ├── Settings.ico │ │ ├── Settings_16x.svg │ │ ├── ThisLine.ico │ │ ├── ThisLine_16x.svg │ │ ├── arrow_down.ico │ │ ├── arrow_down.svg │ │ ├── arrow_left.ico │ │ ├── arrow_left.svg │ │ ├── arrow_right.ico │ │ ├── arrow_right.svg │ │ ├── arrow_up.ico │ │ ├── arrow_up.svg │ │ ├── desk-lamp-light.ico │ │ ├── desk-lamp-light.svg │ │ ├── minus.ico │ │ ├── minus.svg │ │ ├── plus.ico │ │ ├── plus.svg │ │ ├── tilde.ico │ │ └── tilde.svg ├── Interfaces │ ├── IDiffColorDefinitions.cs │ ├── IDiffLineInfo.cs │ ├── IDiffView.cs │ ├── IGridSplitterSupport.cs │ └── ILineDiffProvider.cs ├── Models │ ├── DiffColorDefinitions.cs │ ├── DiffViewPort.cs │ └── Segment.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Themes │ ├── DarkBrushs.xaml │ ├── DarkIcons.xaml │ ├── DataGridDarkBrushs.xaml │ ├── DataGridLightBrushs.xaml │ ├── Generic.xaml │ ├── LightBrushs.xaml │ ├── LightIcons.xaml │ └── ResourceKeys.cs └── packages.config ├── CleanAll.bat ├── Demos ├── Dir │ ├── AehnlichDirDemo │ │ ├── AehnlichDirDemo.csproj │ │ ├── App.config │ │ ├── App.xaml │ │ ├── App.xaml.cs │ │ ├── MainWindow.xaml │ │ ├── MainWindow.xaml.cs │ │ └── Properties │ │ │ ├── AssemblyInfo.cs │ │ │ ├── Resources.Designer.cs │ │ │ ├── Resources.resx │ │ │ ├── Settings.Designer.cs │ │ │ └── Settings.settings │ └── AehnlichDirViewModelLib │ │ ├── AehnlichDirViewModelLib.csproj │ │ ├── Behaviors │ │ └── SelectionChangedCommand.cs │ │ ├── Converters │ │ ├── MultiBoolToVisibilityPropConverter.cs │ │ └── MultiParToParConverter.cs │ │ ├── Enums │ │ └── DiffViewModeEnum.cs │ │ ├── Events │ │ └── OpenFileDiffEvent.cs │ │ ├── Interfaces │ │ ├── IAppViewModel.cs │ │ ├── IDiffFileModeItemViewModel.cs │ │ ├── IDirDiffDocViewModel.cs │ │ ├── IDirEntryViewModel.cs │ │ ├── IFileDiffModeViewModel.cs │ │ └── IListItemViewModel.cs │ │ ├── Models │ │ └── FileSystemCommands.cs │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── ViewModels │ │ ├── AppViewModel.cs │ │ ├── Base │ │ │ ├── RelayCommand.cs │ │ │ └── ViewModelBase.cs │ │ ├── DiffFileModeItemViewModel.cs │ │ ├── DiffProgressViewModel.cs │ │ ├── DirDiffDocViewModel.cs │ │ ├── DirEntryViewModel.cs │ │ ├── Factory.cs │ │ ├── FileDiffModeViewModel.cs │ │ ├── ListItemViewModel.cs │ │ └── ObservableRangeCollection.cs │ │ └── Views │ │ ├── DirDiffView.xaml │ │ └── DirDiffView.xaml.cs └── TextFileDemo │ ├── AehnlichFileDemo │ ├── AehnlichFileDemo.csproj │ ├── App.config │ ├── App.xaml │ ├── App.xaml.cs │ ├── DemoTestFiles │ │ ├── ClassTemplate.txt │ │ ├── ClassTemplate1.txt │ │ ├── Empty.txt │ │ ├── MyersDiff.txt │ │ └── MyersDiff_V1.txt │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── packages.config │ └── tilde.ico │ └── AehnlichViewModelsLib │ ├── AehnlichViewModelsLib.csproj │ ├── Behaviors │ ├── NewLocationRequestBehavior.cs │ ├── OnEnterToCommandBehavior.cs │ └── SelectionChangedBehavior.cs │ ├── ClassDiagram1.cd │ ├── ClassDiagram2.cd │ ├── Converters │ ├── BoolToVisibilityPropConverter.cs │ ├── CompareTypeToBoolConverter.cs │ ├── CompareTypeToVisibilityConverter.cs │ ├── DiffContextToColorPropConverter.cs │ ├── DiffContextToVisibilityPropConverter.cs │ ├── EnumMatchToBooleanConverter.cs │ ├── InlineDilaogToVisibilityPropConverter.cs │ └── MultiParToParConverter.cs │ ├── Enums │ ├── ChangeDiffOptions.cs │ ├── InlineDialogMode.cs │ └── ViewSource.cs │ ├── Events │ ├── CaretPositionChangedEvent.cs │ └── DocumentPropertyChangedEvent.cs │ ├── Interfaces │ ├── IAppViewModel.cs │ ├── IDiffDocViewModel.cs │ ├── IDiffLineViewModel.cs │ ├── IDiffLines.cs │ ├── IDiffSideTextViewModel.cs │ ├── IDiffSideViewModel.cs │ ├── IDiffSideViewModelParent.cs │ ├── IDiffViewPosition.cs │ └── IGotoLineControllerViewModel.cs │ ├── Models │ └── FileSystemCommands.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── Tasks │ └── OneTaskLimitedScheduler.cs │ ├── ViewModels │ ├── AppViewModel.cs │ ├── Base │ │ ├── ModelBase.cs │ │ ├── RelayCommand.cs │ │ └── ViewModelBase.cs │ ├── Dialogs │ │ ├── DialogtTemplateSelector.cs │ │ ├── GotoLineControllerViewModel.cs │ │ └── OptionsControllerViewModel.cs │ ├── DiffDocViewModel.cs │ ├── DiffProgressViewModel.cs │ ├── DiffSideTextViewModel.cs │ ├── DiffSideViewModel.cs │ ├── DiffViewPosition.cs │ ├── Factory.cs │ ├── LineInfo │ │ ├── DiffLineViewModel.cs │ │ ├── DiffViewLine.cs │ │ └── LinesFactory.cs │ ├── ObservableRangeCollection.cs │ └── Suggest │ │ ├── ISuggestSourceViewModel.cs │ │ ├── SuggestQueryResultModel.cs │ │ └── SuggestSourceViewModel.cs │ ├── Views │ ├── FileDiffView.xaml │ ├── FileDiffView.xaml.cs │ ├── GotoControl.xaml │ ├── GotoControl.xaml.cs │ ├── OptionsControl.xaml │ └── OptionsControl.xaml.cs │ ├── app.config │ └── packages.config └── FsDataLib ├── ClassDiagram1.cd ├── Dir ├── DirDataSource.cs ├── DirDataSourceFactory.cs ├── DirectoryInfoImpl.cs ├── FileInfoImpl.cs └── FileSystemInfoImpl.cs ├── Enums ├── DiffDirFileMode.cs └── FileType.cs ├── FsDataLib.csproj ├── Interfaces └── Dir │ ├── IDataSource.cs │ ├── IDataSourceFactory.cs │ ├── IDirectoryInfo.cs │ ├── IFileInfo.cs │ └── IFileSystemInfo.cs └── Properties └── AssemblyInfo.cs /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /source/00 Docs/00_SampleMerge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/00 Docs/00_SampleMerge.png -------------------------------------------------------------------------------- /source/00 Docs/BinaryDiff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/00 Docs/BinaryDiff.png -------------------------------------------------------------------------------- /source/00 Docs/DiffControl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/00 Docs/DiffControl.png -------------------------------------------------------------------------------- /source/00 Docs/DirDiffScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/00 Docs/DirDiffScreen.png -------------------------------------------------------------------------------- /source/00 Docs/DirectoryDiff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/00 Docs/DirectoryDiff.png -------------------------------------------------------------------------------- /source/00 Docs/FileDiffScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/00 Docs/FileDiffScreen.png -------------------------------------------------------------------------------- /source/00 Docs/LinkedImages.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/00 Docs/LinkedImages.png -------------------------------------------------------------------------------- /source/00 Docs/Textdiff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/00 Docs/Textdiff.png -------------------------------------------------------------------------------- /source/00 Docs/Ähnlich1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/00 Docs/Ähnlich1.png -------------------------------------------------------------------------------- /source/00 Docs/Ähnlich2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/00 Docs/Ähnlich2.png -------------------------------------------------------------------------------- /source/00 Docs/ÄhnlichDemo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/00 Docs/ÄhnlichDemo.png -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/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 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/BindToMLib/MWindowLib/DarkLightBrushs.xaml: -------------------------------------------------------------------------------- 1 |  7 | 11 | Blue 12 | 13 | 14 | 15 | 16 | #FFF4F4F5 17 | 18 | #FF2D2D30 19 | 20 | 21 | 22 | 23 | 24 | 25 | #FF3F3F41 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/BindToMLib/SuggestionLibDarkLightBrushs.xaml: -------------------------------------------------------------------------------- 1 |  7 | 11 | 15 | Blue 16 | 17 | 22 | 23 | 28 | 29 | 34 | 35 | 40 | 41 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/Converters/ActiveDocumentConverter.cs: -------------------------------------------------------------------------------- 1 | namespace Aehnlich.Converters 2 | { 3 | using Aehnlich.Interfaces; 4 | using System; 5 | using System.Windows.Data; 6 | 7 | /// 8 | /// This converter is invoked when a new ActiveDocument (ActiveContent) is being selected and brought into view. 9 | /// Return the corresponding ViewModel or Binding.DoNothing (if the document type should not be selected and brought 10 | /// into view via ActiveDocument property in . 11 | /// 12 | public class ActiveDocumentConverter : IValueConverter 13 | { 14 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 15 | { 16 | if (value is IDocumentBaseViewModel) 17 | return value; 18 | 19 | return Binding.DoNothing; 20 | } 21 | 22 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 23 | { 24 | if (value is IDocumentBaseViewModel) 25 | return value; 26 | 27 | return Binding.DoNothing; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/Converters/TruncateMiddleConverter.cs: -------------------------------------------------------------------------------- 1 | namespace Aehnlich.Converters 2 | { 3 | using System; 4 | using System.Globalization; 5 | using System.Windows; 6 | using System.Windows.Data; 7 | 8 | /// 9 | /// Converter to truncate middle of long string. 10 | /// This can be helpful if information at the end is important. 11 | /// It truncates a long document title with an ellipsis in the middle. 12 | /// 13 | /// https://github.com/tgjones/gemini/pull/294 14 | /// 15 | public class TruncateMiddleConverter : IValueConverter 16 | { 17 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 18 | { 19 | if (value == null) 20 | return DependencyProperty.UnsetValue; 21 | 22 | string result = value.ToString(); 23 | int frontLength = 15; 24 | int backLength = 16; 25 | 26 | var lengths = parameter as int[]; 27 | if (lengths != null && lengths.Length == 2) 28 | { 29 | frontLength = lengths[0]; 30 | backLength = lengths[1]; 31 | } 32 | 33 | if (result.Length > frontLength + 3 + backLength) 34 | { 35 | result = result.Substring(0, frontLength).Trim() + "..." + result.Substring(result.Length - backLength).Trim(); 36 | } 37 | 38 | return result; 39 | } 40 | 41 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 42 | { 43 | throw new NotSupportedException(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/Events/DocumentChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace Aehnlich.Events 2 | { 3 | using Aehnlich.Interfaces; 4 | using System; 5 | 6 | public delegate void DocumentChangedEventHandler(object sender, DocumentChangedEventArgs e); 7 | 8 | /// 9 | /// This kind of event should be fired by the document container when a new document becomes active. 10 | /// 11 | /// The initial design follows this article: 12 | /// http://www.codeproject.com/Articles/5043/Step-by-Step-Event-handling-in-C 13 | /// 14 | public class DocumentChangedEventArgs : EventArgs 15 | { 16 | #region fields 17 | 18 | #endregion fields 19 | 20 | #region constrcutor 21 | public DocumentChangedEventArgs(IDocumentBaseViewModel activeDocument) 22 | { 23 | ActiveDocument = activeDocument; 24 | } 25 | #endregion constrcutor 26 | 27 | #region methods 28 | /// 29 | /// Get the active document that is active now (as of this event). 30 | /// 31 | public IDocumentBaseViewModel ActiveDocument { get; } 32 | 33 | #endregion methods 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/Interfaces/IDocumentBaseViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace Aehnlich.Interfaces 2 | { 3 | using System; 4 | using System.ComponentModel; 5 | 6 | /// 7 | /// Defines a base interface that should be implemented 8 | /// by all document viewmodels in the application. 9 | /// 10 | public interface IDocumentBaseViewModel : INotifyPropertyChanged 11 | { 12 | #region properties 13 | /// 14 | /// Gets a unique if for a document or document type (eg: Start page). 15 | /// 16 | /// This information is used to find already existing documents in a 17 | /// collection of documents or id document layouts for store/restore 18 | /// on app exit/restart. 19 | /// 20 | string ContentId { get; } 21 | 22 | /// 23 | /// Gets the title of a document (for display in document tab) 24 | /// 25 | string Title { get; } 26 | 27 | /// 28 | /// Gets the Uri of the icon that should be shown for this document. 29 | /// 30 | Uri IconSource { get; } 31 | #endregion properties 32 | 33 | #region methods 34 | /// 35 | /// Invoke this method before application shut down 36 | /// to save all relevant user settings for recovery on appliaction re-start. 37 | /// 38 | void SaveSettings(); 39 | #endregion methods 40 | } 41 | } -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/Interfaces/IDocumentManagerViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace Aehnlich.Interfaces 2 | { 3 | using AehnlichDirViewModelLib.Events; 4 | using System.Collections.Generic; 5 | 6 | internal interface IDocumentManagerViewModel : System.IDisposable 7 | { 8 | IEnumerable Documents { get; } 9 | 10 | bool CloseDocument(IDocumentBaseViewModel closeMe); 11 | 12 | void SaveSettings(); 13 | 14 | /// 15 | /// Is raised when the user requests to view a file content diff (binary or text). 16 | /// 17 | /// 18 | /// 19 | void DocDiffDoc_CompareFilesRequest(object sender, OpenFileDiffEventArgs e); 20 | } 21 | } -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Aehnlich 2 | { 3 | using Settings.UserProfile; 4 | 5 | /// 6 | /// Interaction logic for MainWindow.xaml 7 | /// 8 | public partial class MainWindow : MWindowLib.MetroWindow 9 | , IViewSize // Implements saving and loading/repositioning of Window 10 | { 11 | public MainWindow() 12 | { 13 | InitializeComponent(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/Models/SettingDefaults.cs: -------------------------------------------------------------------------------- 1 | namespace Aehnlich.Models 2 | { 3 | using Settings.Interfaces; 4 | using SettingsModel.Interfaces; 5 | using System.Windows.Media; 6 | 7 | /// 8 | /// Class contains all methods necessary to initialize the applications settings model. 9 | /// 10 | internal static class SettingDefaults 11 | { 12 | /// 13 | /// Create the minimal settings model that should be used for every application. 14 | /// This model does not include advanced features like theming etc... 15 | /// 16 | /// 17 | public static void CreateGeneralSettings(IEngine options) 18 | { 19 | const string groupName = "Options"; 20 | 21 | options.AddOption(groupName, "ReloadOpenFilesFromLastSession", typeof(bool), false, true); 22 | options.AddOption(groupName, "SourceFilePath", typeof(string), false, @"C:\temp\source\"); 23 | options.AddOption(groupName, "LanguageSelected", typeof(string), false, "en-US"); 24 | 25 | ////var schema = optsEngine.AddListOption(groupName, "BookmarkedFolders", typeof(string), false, new List()); 26 | ////schema.List_AddValue(@"C:\TEMP", @"C:\TEMP"); 27 | ////schema.List_AddValue(@"C:\Windows", @"C:\Windows"); 28 | } 29 | 30 | /// 31 | /// Create the minimal settings model that should be used for every application. 32 | /// 33 | /// 34 | public static void CreateAppearanceSettings(IEngine options, ISettingsManager settings) 35 | { 36 | const string groupName = "Appearance"; 37 | 38 | options.AddOption(groupName, "ThemeDisplayName", typeof(string), false, "Light"); 39 | options.AddOption(groupName, "ApplyWindowsDefaultAccent", typeof(bool), false, true); 40 | options.AddOption(groupName, "AccentColor", typeof(Color), false, Color.FromRgb(0x33, 0x99, 0xff)); 41 | 42 | ////options.AddOption(groupName, "DefaultIconSize", typeof(int), false, settings.DefaultIconSize); 43 | ////options.AddOption(groupName, "DefaultFontSize", typeof(int), false, settings.DefaultFontSize); 44 | ////options.AddOption(groupName, "FixedFontSize", typeof(int), false, settings.DefaultFixedFontSize); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/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 Aehnlich.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.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 | [global::System.Configuration.UserScopedSettingAttribute()] 27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 28 | [global::System.Configuration.DefaultSettingValueAttribute("")] 29 | public string LeftDirPath { 30 | get { 31 | return ((string)(this["LeftDirPath"])); 32 | } 33 | set { 34 | this["LeftDirPath"] = value; 35 | } 36 | } 37 | 38 | [global::System.Configuration.UserScopedSettingAttribute()] 39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 40 | [global::System.Configuration.DefaultSettingValueAttribute("")] 41 | public string RightDirPath { 42 | get { 43 | return ((string)(this["RightDirPath"])); 44 | } 45 | set { 46 | this["RightDirPath"] = value; 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/ServiceInjector.cs: -------------------------------------------------------------------------------- 1 | namespace Aehnlich 2 | { 3 | using HL.Interfaces; 4 | using HL.Manager; 5 | using MLib; 6 | using MLib.Interfaces; 7 | using ServiceLocator; 8 | using Settings; 9 | using Settings.Interfaces; 10 | 11 | /// 12 | /// Creates and initializes all services. 13 | /// 14 | public static class ServiceInjector 15 | { 16 | /// 17 | /// Loads service objects into the ServiceContainer on startup of application. 18 | /// 19 | /// Returns the current instance 20 | /// to let caller work with service container items right after creation. 21 | public static ServiceContainer InjectServices() 22 | { 23 | var appearance = AppearanceManager.GetInstance(); 24 | ServiceContainer.Instance.AddService(SettingsManager.GetInstance(appearance.CreateThemeInfos())); 25 | ServiceContainer.Instance.AddService(appearance); 26 | ServiceContainer.Instance.AddService(ThemedHighlightingManager.Instance); 27 | 28 | return ServiceContainer.Instance; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/Themes/Generic.xaml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/ViewModels/Base/ModelBase.cs: -------------------------------------------------------------------------------- 1 | namespace Aehnlich.ViewModels.Base 2 | { 3 | public class ModelBase 4 | { 5 | /// 6 | /// Gets an instance of the service container and retrieves the requested service coponent. 7 | /// 8 | /// 9 | /// 10 | public TServiceContract GetService() where TServiceContract : class 11 | { 12 | return ServiceLocator.ServiceContainer.Instance.GetService(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/ViewModels/Base/ViewModelBase.cs: -------------------------------------------------------------------------------- 1 | namespace Aehnlich.ViewModels.Base 2 | { 3 | using System; 4 | using System.ComponentModel; 5 | using System.Linq.Expressions; 6 | 7 | /// 8 | /// Implements a base class for all viewmodel classes 9 | /// that implements interface for binding. 10 | /// 11 | public class ViewModelBase : ModelBase, INotifyPropertyChanged 12 | { 13 | /// 14 | /// Standard implementation of . 15 | /// 16 | public event PropertyChangedEventHandler PropertyChanged; 17 | 18 | /// 19 | /// Tell bound controls (via WPF binding) to refresh their display. 20 | /// 21 | /// Sample call: this.NotifyPropertyChanged(() => this.IsSelected); 22 | /// where 'this' is derived from 23 | /// and IsSelected is a property. 24 | /// 25 | /// 26 | /// 27 | public void NotifyPropertyChanged(Expression> property) 28 | { 29 | var lambda = (LambdaExpression)property; 30 | MemberExpression memberExpression; 31 | 32 | if (lambda.Body is UnaryExpression) 33 | { 34 | var unaryExpression = (UnaryExpression)lambda.Body; 35 | memberExpression = (MemberExpression)unaryExpression.Operand; 36 | } 37 | else 38 | memberExpression = (MemberExpression)lambda.Body; 39 | 40 | this.NotifyPropertyChanged(memberExpression.Member.Name); 41 | } 42 | 43 | /// 44 | /// Tell bound controls (via WPF binding) to refresh their display. 45 | /// Standard implementation through . 46 | /// 47 | /// 48 | protected virtual void NotifyPropertyChanged(string propertyName) 49 | { 50 | if (this.PropertyChanged != null) 51 | this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/ViewModels/DirectoryDiff/DirDiffContentTemplateSelector.cs: -------------------------------------------------------------------------------- 1 | namespace Aehnlich.ViewModels.DirectoryDiff 2 | { 3 | using Aehnlich.ViewModels.Documents; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | 7 | /// 8 | /// This determines the view to be shown for each viewmodel 9 | /// that is associated with the different stages of the . 10 | /// 11 | internal class DirDiffContentTemplateSelector : DataTemplateSelector 12 | { 13 | /// 14 | /// Gets the view that is used to adjust options 15 | /// and settings for a particular directory comparison. 16 | /// 17 | public DataTemplate SetupPage { get; set; } 18 | 19 | /// 20 | /// Gets the view that is used to display directory diff results and browse the 21 | /// directory structure. 22 | /// 23 | public DataTemplate ViewPage { get; set; } 24 | 25 | /// 26 | /// Returns a based on custom logic. 27 | /// 28 | /// The data object for which to select the template. 29 | /// The data-bound object. 30 | /// Returns a or null. The default value is null. 31 | public override DataTemplate SelectTemplate(object item, DependencyObject container) 32 | { 33 | if (item is DirDiffDocViewViewModel) 34 | return ViewPage; 35 | 36 | if (item is DirDiffDocSetupViewModel) 37 | return SetupPage; 38 | 39 | return base.SelectTemplate(item, container); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/ViewModels/IAenlichAppViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace Aehnlich.ViewModels 2 | { 3 | internal interface IAehnlichAppViewModel 4 | { 5 | /// 6 | /// Invoke this method before application shut down 7 | /// to save all relevant user settings for recovery on appliaction re-start. 8 | /// 9 | void SaveSettings(); 10 | } 11 | } -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/Views/AvalonDockView.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Aehnlich.Views 2 | { 3 | using AvalonDock; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | 7 | /// 8 | /// 9 | /// 10 | [TemplatePartAttribute(Name = PART_DockView, Type = typeof(DockingManager))] 11 | public partial class AvalonDockView : UserControl 12 | { 13 | #region fields 14 | /// 15 | /// defines the nme of the required control in the attached control XAML 16 | /// 17 | const string PART_DockView = "PART_DockView"; 18 | private DockingManager _PART_DockView; 19 | #endregion fields 20 | 21 | #region constructors 22 | static AvalonDockView() 23 | { 24 | DefaultStyleKeyProperty.OverrideMetadata(typeof(AvalonDockView), 25 | new FrameworkPropertyMetadata(typeof(AvalonDockView))); 26 | } 27 | 28 | /// 29 | /// Standard constructor 30 | /// 31 | public AvalonDockView() 32 | { 33 | } 34 | #endregion constructors 35 | 36 | #region properties 37 | 38 | #endregion properties 39 | 40 | #region methods 41 | public override void OnApplyTemplate() 42 | { 43 | base.OnApplyTemplate(); 44 | 45 | Loaded += AvalonDockView_Loaded; 46 | } 47 | 48 | private void AvalonDockView_Loaded(object sender, RoutedEventArgs e) 49 | { 50 | _PART_DockView = Template.FindName("PART_DockView", this) as DockingManager; 51 | } 52 | #endregion methods 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/Views/Dir/DirDiffDocControl.xaml: -------------------------------------------------------------------------------- 1 |  6 | 10 | 47 | 48 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/Views/Dir/DirDiffDocControl.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Aehnlich.Views.Dir 2 | { 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | 6 | /// 7 | /// Implements a view that can be used to display directory diff information. 8 | /// 9 | public class DirDiffDocControl : Control 10 | { 11 | #region ctors 12 | /// 13 | /// Static class constructor 14 | /// 15 | static DirDiffDocControl() 16 | { 17 | DefaultStyleKeyProperty.OverrideMetadata(typeof(DirDiffDocControl), 18 | new FrameworkPropertyMetadata(typeof(DirDiffDocControl))); 19 | } 20 | #endregion ctors 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/Views/Dir/DirDiffDocView.xaml: -------------------------------------------------------------------------------- 1 |  11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/Views/Dir/DirDiffSetupView.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace Aehnlich.Views.Dir 2 | { 3 | using System.Windows.Controls; 4 | 5 | /// 6 | /// Interaction logic for DirDiffSetupView.xaml 7 | /// 8 | public partial class DirDiffSetupView : UserControl 9 | { 10 | public DirDiffSetupView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/Views/Documents/PanesStyleSelector.cs: -------------------------------------------------------------------------------- 1 | namespace Aehnlich.Views.Documents 2 | { 3 | using Aehnlich.Interfaces; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | 7 | /// 8 | /// Provides a way to apply styles based on custom logic. 9 | /// 10 | internal class PanesStyleSelector : StyleSelector 11 | { 12 | public Style DocumentStyle 13 | { 14 | get; 15 | set; 16 | } 17 | 18 | /// 19 | /// Returns a System.Windows.Style based on custom logic. 20 | /// 21 | /// The content. 22 | /// The element to which the style will be applied. 23 | /// An application-specific style to apply; otherwise, null. 24 | public override Style SelectStyle(object item, System.Windows.DependencyObject container) 25 | { 26 | if (item is IDocumentBaseViewModel) 27 | return DocumentStyle; 28 | 29 | return base.SelectStyle(item, container); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/Views/Documents/PanesTemplateSelector.cs: -------------------------------------------------------------------------------- 1 | namespace Aehnlich.Views.Documents 2 | { 3 | using Aehnlich.ViewModels.Documents; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | 7 | /// 8 | /// Provides a way to choose a System.Windows.DataTemplate based on the data object 9 | /// and the data-bound element. 10 | /// 11 | internal class PanesTemplateSelector : DataTemplateSelector 12 | { 13 | public DataTemplate DirDiffDocumentViewTemplate 14 | { 15 | get; 16 | set; 17 | } 18 | 19 | public DataTemplate DocDiffDocumentViewTemplate 20 | { 21 | get; 22 | set; 23 | } 24 | 25 | /// 26 | /// Returns a System.Windows.DataTemplate based on custom logic. 27 | /// 28 | /// The data object for which to select the template. 29 | /// The data-bound object. 30 | /// Returns a or null. The default value is null. 31 | public override DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container) 32 | { 33 | ////var itemAsLayoutContent = item as LayoutContent; 34 | 35 | if (item is DirDiffDocViewModel) 36 | return DirDiffDocumentViewTemplate; 37 | 38 | if (item is DocDiffDocViewViewModel) 39 | return DocDiffDocumentViewTemplate; 40 | 41 | return base.SelectTemplate(item, container); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /source/Aehnlich/Aehnlich/tilde_LightDark.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/Aehnlich/Aehnlich/tilde_LightDark.ico -------------------------------------------------------------------------------- /source/Aehnlich/Components/ServiceLocator/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("ServiceLocator")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("HP")] 11 | [assembly: AssemblyProduct("ServiceLocator")] 12 | [assembly: AssemblyCopyright("Copyright © 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("2516097b-2435-44a4-a9b8-9899bca81a6e")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /source/Aehnlich/Components/ServiceLocator/ServiceContainer.cs: -------------------------------------------------------------------------------- 1 | namespace ServiceLocator 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | /// 7 | /// Source: http://www.codeproject.com/Articles/70223/Using-a-Service-Locator-to-Work-with-MessageBoxes 8 | /// 9 | public class ServiceContainer 10 | { 11 | #region fields 12 | public static readonly ServiceContainer Instance = new ServiceContainer(); 13 | 14 | readonly Dictionary _serviceMap; 15 | readonly object _serviceMapLock; 16 | #endregion fields 17 | 18 | #region constructors 19 | /// 20 | /// Class Constructor 21 | /// 22 | private ServiceContainer() 23 | { 24 | _serviceMap = new Dictionary(); 25 | _serviceMapLock = new object(); 26 | } 27 | #endregion constructors 28 | 29 | #region methods 30 | public void AddService(TServiceContract implementation) 31 | where TServiceContract : class 32 | { 33 | lock (_serviceMapLock) 34 | { 35 | _serviceMap[typeof(TServiceContract)] = implementation; 36 | } 37 | } 38 | 39 | public TServiceContract GetService() 40 | where TServiceContract : class 41 | { 42 | object service; 43 | lock (_serviceMapLock) 44 | { 45 | _serviceMap.TryGetValue(typeof(TServiceContract), out service); 46 | } 47 | 48 | return service as TServiceContract; 49 | } 50 | #endregion methods 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /source/Aehnlich/Components/Settings/Settings/Interfaces/IOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Settings.Interfaces 2 | { 3 | public interface IOptions 4 | { 5 | #region properties 6 | bool IsDirty { get; set; } 7 | string LanguageSelected { get; set; } 8 | bool ReloadOpenFilesOnAppStart { get; set; } 9 | string SourceFilePath { get; set; } 10 | 11 | string DefaultSourceLanguage { get; set; } 12 | string DefaultTargetLanguage { get; set; } 13 | 14 | string DefaultDefaultSourceLanguage { get; } 15 | string DefaultDefaultTargetLanguage { get; } 16 | 17 | int DefaultIconSize { get; } 18 | int IconSizeMin { get; } 19 | int IconSizeMax { get; } 20 | 21 | int DefaultFontSize { get; } 22 | int FontSizeMin { get; } 23 | int FontSizeMax { get; } 24 | #endregion properties 25 | 26 | #region methods 27 | /// 28 | /// Reset the dirty flag (e.g. after saving program options when they where edit). 29 | /// 30 | /// 31 | void SetDirtyFlag(bool flag); 32 | 33 | void SetIconSize(int size); 34 | void SetFontSize(int size); 35 | #endregion methods 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/Aehnlich/Components/Settings/Settings/Interfaces/IOptionsPanel.cs: -------------------------------------------------------------------------------- 1 | namespace Settings.Interfaces 2 | { 3 | using SettingsModel.Interfaces; 4 | 5 | public interface IOptionsPanel 6 | { 7 | IEngine Options { get; } 8 | } 9 | } -------------------------------------------------------------------------------- /source/Aehnlich/Components/Settings/Settings/Interfaces/IProfile.cs: -------------------------------------------------------------------------------- 1 | namespace Settings.Interfaces 2 | { 3 | using Settings.UserProfile; 4 | using SettingsModel.Models; 5 | using System.Collections.Generic; 6 | 7 | public interface IProfile 8 | { 9 | #region properties 10 | string GetLastActivePath(); 11 | string LastActiveSolution { get; set; } 12 | 13 | 14 | string LastActiveTargetFile { get; set; } 15 | 16 | List LastActiveSourceFiles { get; set; } 17 | 18 | /// 19 | /// Gets the key name of the MainWindow item in the collection. 20 | /// Ths name can be used as key in the WindowPosSz property 21 | /// to read and write MainWindow position and size information. 22 | /// 23 | string MainWindowName { get; } 24 | 25 | /// 26 | /// Gets a collection of window position and size items. 27 | /// 28 | SerializableDictionary WindowPosSz { get; } 29 | #endregion properties 30 | 31 | #region methods 32 | /// 33 | /// Checks the MainWindow for visibility when re-starting application 34 | /// (with different screen configuration). 35 | /// 36 | /// 37 | /// 38 | void CheckSettingsOnLoad(double SystemParameters_VirtualScreenLeft, double SystemParameters_VirtualScreenTop); 39 | 40 | /// 41 | /// Updates or inserts the requested window pos size item in the collection. 42 | /// 43 | /// 44 | /// 45 | /// 46 | void UpdateInsertWindowPosSize(string windowName, ViewPosSizeModel model); 47 | #endregion methods 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /source/Aehnlich/Components/Settings/Settings/Interfaces/ISettingsManager.cs: -------------------------------------------------------------------------------- 1 | namespace Settings.Interfaces 2 | { 3 | using MLib.Interfaces; 4 | using Settings.ProgramSettings; 5 | using System.Collections.Generic; 6 | using System.Xml.Serialization; 7 | 8 | public interface ISettingsManager : IOptionsPanel 9 | { 10 | void CheckSettingsOnLoad(double SystemParameters_VirtualScreenLeft, double SystemParameters_VirtualScreenTop); 11 | 12 | ////void LoadOptions(string settingsFileName); 13 | void LoadSessionData(string sessionDataFileName); 14 | 15 | ////bool SaveOptions(string settingsFileName, Settings.Interfaces.IOptions optionsModel); 16 | bool SaveSessionData(string sessionDataFileName, Settings.Interfaces.IProfile model); 17 | 18 | /// 19 | /// Get a list of all supported languages in Edi. 20 | /// 21 | /// 22 | IEnumerable GetSupportedLanguages(); 23 | 24 | #region properties 25 | Settings.Interfaces.IProfile SessionData { get; } 26 | 27 | int IconSizeMin { get; } 28 | int IconSizeMax { get; } 29 | 30 | int FontSizeMin { get; } 31 | int FontSizeMax { get; } 32 | 33 | /// 34 | /// Gets the default icon size for the application. 35 | /// 36 | int DefaultIconSize { get; } 37 | 38 | /// 39 | /// Gets the default font size for the application. 40 | /// 41 | int DefaultFontSize { get; } 42 | 43 | /// 44 | /// Gets the default fixed font size for the application. 45 | /// 46 | int DefaultFixedFontSize { get; } 47 | 48 | /// 49 | /// Gets the internal name and Uri source for all available themes. 50 | /// 51 | [XmlIgnore] 52 | IThemeInfos Themes { get; } 53 | #endregion properties 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /source/Aehnlich/Components/Settings/Settings/Interfaces/IViewPosSizeModel.cs: -------------------------------------------------------------------------------- 1 | namespace Settings.Interfaces 2 | { 3 | public interface IViewPosSizeModel 4 | { 5 | bool DefaultConstruct { get; } 6 | double Height { get; set; } 7 | bool IsMaximized { get; set; } 8 | double Width { get; set; } 9 | double X { get; set; } 10 | double Y { get; set; } 11 | 12 | void SetValidPos(double SystemParameters_VirtualScreenLeft, double SystemParameters_VirtualScreenTop); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /source/Aehnlich/Components/Settings/Settings/ProgramSettings/LanguageCollection.cs: -------------------------------------------------------------------------------- 1 | namespace Settings.ProgramSettings 2 | { 3 | using System; 4 | 5 | /// 6 | /// Base class for enumeration over languages (and their locale) that 7 | /// are supported with specific (non-English) button and tool tip strings. 8 | /// 9 | /// The class definition is based on BCP 47 which in turn is used to 10 | /// set the UI and thread culture (which in turn selects the correct 11 | /// string resource in MsgBox assembly). 12 | /// 13 | public class LanguageCollection 14 | { 15 | public string Language { get; set; } 16 | public string Locale { get; set; } 17 | public string Name { get; set; } 18 | 19 | /// 20 | /// Get BCP47 language tag for this language 21 | /// See also http://en.wikipedia.org/wiki/IETF_language_tag 22 | /// 23 | public string BCP47 24 | { 25 | get 26 | { 27 | if (string.IsNullOrEmpty(Locale) == false) 28 | return String.Format("{0}-{1}", Language, Locale); 29 | else 30 | return String.Format("{0}", Language); 31 | } 32 | } 33 | 34 | /// 35 | /// Get BCP47 language tag for this language 36 | /// See also http://en.wikipedia.org/wiki/IETF_language_tag 37 | /// 38 | public string DisplayName 39 | { 40 | get 41 | { 42 | return String.Format("{0} {1}", Name, BCP47); 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /source/Aehnlich/Components/Settings/Settings/ProgramSettings/OptionsPanel.cs: -------------------------------------------------------------------------------- 1 | namespace Settings.ProgramSettings 2 | { 3 | using Settings.Interfaces; 4 | using SettingsModel.Interfaces; 5 | using SettingsModel.Models; 6 | 7 | internal class OptionsPanel : IOptionsPanel 8 | { 9 | private IEngine mQuery = null; 10 | 11 | public OptionsPanel() 12 | { 13 | mQuery = Factory.CreateEngine(); 14 | } 15 | 16 | /// 17 | /// Gets the options that used to manage program options. 18 | /// 19 | public IEngine Options 20 | { 21 | get 22 | { 23 | return mQuery; 24 | } 25 | 26 | private set 27 | { 28 | mQuery = value; 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /source/Aehnlich/Components/Settings/Settings/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("Settings")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("HP")] 11 | [assembly: AssemblyProduct("Settings")] 12 | [assembly: AssemblyCopyright("The MIT License (MIT) Copyright © 2013 - 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("7f13f2b5-a017-4045-8ead-f5496101a616")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /source/Aehnlich/Components/Settings/Settings/SettingsManager.cs: -------------------------------------------------------------------------------- 1 | namespace Settings 2 | { 3 | using MLib.Interfaces; 4 | using Settings.Interfaces; 5 | using Settings.Internal; 6 | 7 | /// 8 | /// Helper class to initialize an 9 | /// service interface. 10 | /// 11 | public sealed class SettingsManager 12 | { 13 | /// 14 | /// Hidden default constructor. 15 | /// 16 | private SettingsManager() 17 | { 18 | } 19 | 20 | /// 21 | /// Gets an instance of an object that implements the 22 | /// interface. 23 | /// 24 | /// 25 | public static ISettingsManager GetInstance(IThemeInfos themeInfos) 26 | { 27 | return new SettingsManagerImpl(themeInfos); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/Aehnlich/Components/Settings/Settings/UserProfile/IViewSize.cs: -------------------------------------------------------------------------------- 1 | namespace Settings.UserProfile 2 | { 3 | using System.Windows; 4 | 5 | /// 6 | /// Provide an interface to implement saving and loading/repositioning of Window or view. 7 | /// 8 | public interface IViewSize 9 | { 10 | // 11 | // Zusammenfassung: 12 | // Ruft die Position des linken Fensterrands im Verhältnis zum Desktop ab oder legt 13 | // diese fest. 14 | // 15 | // Rückgabewerte: 16 | // Die Position des linken Fensterrands in logischen Einheiten (1/96 Zoll). 17 | double Left { get; set; } 18 | 19 | // 20 | // Zusammenfassung: 21 | // Ruft die Position des oberen Fensterrands im Verhältnis zum Desktop ab oder legt 22 | // diese fest. 23 | // 24 | // Rückgabewerte: 25 | // Die Position des oberen Fensterrands in logischen Einheiten (1/96 "). 26 | double Top { get; set; } 27 | 28 | // 29 | // Zusammenfassung: 30 | // Ruft die Breite des Elements ab bzw. legt diese fest. 31 | // 32 | // Rückgabewerte: 33 | // Die Breite des Elements in geräteunabhängige Einheiten (1/96th inch per unit).Der 34 | // Standardwert ist System.Double.NaN.Dieser Wert muss größer oder gleich 0,0 sein.In 35 | // den Hinweisen finden Sie Informationen über obere Grenzen. 36 | double Width { get; set; } 37 | 38 | // 39 | // Zusammenfassung: 40 | // Ruft die vorgeschlagene Höhe des Elements ab oder legt diese fest. 41 | // 42 | // Rückgabewerte: 43 | // Die Höhe des Elements in geräteunabhängige Einheiten (1/96th inch per unit).Der 44 | // Standardwert ist System.Double.NaN.Dieser Wert muss größer oder gleich 0,0 sein.In 45 | // den Hinweisen finden Sie Informationen über obere Grenzen. 46 | double Height { get; set; } 47 | 48 | // 49 | // Zusammenfassung: 50 | // Ruft einen Wert ab, der angibt, ob ein Fenster wiederhergestellt, minimiert oder 51 | // maximiert ist, oder legt diesen fest. 52 | // 53 | // Rückgabewerte: 54 | // Ein System.Windows.WindowState, der bestimmt, ob ein Fenster wiederhergestellt, 55 | // minimiert oder maximiert ist.Der Standardwert ist System.Windows.WindowState.Normal 56 | // (wiederhergestellt). 57 | WindowState WindowState { get; set; } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /source/Aehnlich/Components/Settings/Settings/UserProfile/LocalizabilityAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Settings.UserProfile 4 | { 5 | internal class LocalizabilityAttribute : Attribute 6 | { 7 | } 8 | } -------------------------------------------------------------------------------- /source/Aehnlich/Components/Settings/Settings/UserProfile/ViewSize.cs: -------------------------------------------------------------------------------- 1 | namespace Settings.UserProfile 2 | { 3 | // 50, 50, 800, 550 4 | public class ViewSize 5 | { 6 | public ViewSize(double x, double y, double width, double height) 7 | { 8 | X = x; 9 | Y = y; 10 | Width = width; 11 | Height = height; 12 | } 13 | 14 | public double X { get; private set; } 15 | public double Y { get; private set; } 16 | public double Width { get; private set; } 17 | public double Height { get; private set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/Aehnlich/Components/Settings/Settings/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /source/Aehnlich/Components/Settings/SettingsModel/ExtensionMethods/SecureStringExtensionMethod.cs: -------------------------------------------------------------------------------- 1 | namespace SettingsModel.ExtensionMethods 2 | { 3 | using System; 4 | using System.Runtime.InteropServices; 5 | using System.Security; 6 | 7 | /// 8 | /// Source: http://blogs.msdn.com/b/fpintos/archive/2009/06/12/how-to-properly-convert-securestring-to-string.aspx 9 | /// 10 | internal static class SecureStringExtensionMethod 11 | { 12 | public static string ConvertToUnsecureString(this SecureString securePassword) 13 | { 14 | if (securePassword == null) 15 | throw new ArgumentNullException("securePassword"); 16 | 17 | IntPtr unmanagedString = IntPtr.Zero; 18 | try 19 | { 20 | unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(securePassword); 21 | return Marshal.PtrToStringUni(unmanagedString); 22 | } 23 | finally 24 | { 25 | Marshal.ZeroFreeGlobalAllocUnicode(unmanagedString); 26 | } 27 | } 28 | 29 | public static SecureString ConvertToSecureString(this string password) 30 | { 31 | if (password == null) 32 | throw new ArgumentNullException("password"); 33 | 34 | var securePassword = new SecureString(); 35 | foreach (char c in password) 36 | securePassword.AppendChar(c); 37 | 38 | securePassword.MakeReadOnly(); 39 | return securePassword; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /source/Aehnlich/Components/Settings/SettingsModel/Models/Factory.cs: -------------------------------------------------------------------------------- 1 | namespace SettingsModel.Models 2 | { 3 | using SettingsModel.Interfaces; 4 | 5 | /// 6 | /// Factory class to create an 7 | /// object from a class that is otherwise unknown to the outside world. 8 | /// 9 | public static class Factory 10 | { 11 | /// 12 | /// Create a new engine object that provides all root functions required 13 | /// to model, track, persist, and load data at run-time. 14 | /// 15 | /// 16 | public static IEngine CreateEngine() 17 | { 18 | return new OptionsEngine(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /source/Aehnlich/Components/Settings/SettingsModel/Models/FileReference.cs: -------------------------------------------------------------------------------- 1 | namespace SettingsModel.Models 2 | { 3 | using System.Xml.Serialization; 4 | 5 | /// 6 | /// Implement a simple file reverence model to allow XML persistence 7 | /// of a List via this class. 8 | /// 9 | public class FileReference 10 | { 11 | /// 12 | /// Gets/sets the path to a file. 13 | /// 14 | [XmlAttribute(AttributeName = "path")] 15 | public string path { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /source/Aehnlich/Components/Settings/SettingsModel/Models/XML/Converters/AlternativeDataTypeHandler.cs: -------------------------------------------------------------------------------- 1 | namespace SettingsModel.Models.XML.Converters 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Security; 6 | 7 | /// 8 | /// Holds a collection of alternative datatype 9 | /// handlers to handle datatypes that are not supported through equivalent conversion 10 | /// in alternative datatypes. 11 | /// 12 | internal class AlternativeDataTypeHandler 13 | { 14 | #region fields 15 | private readonly Dictionary converters; 16 | #endregion fields 17 | 18 | public AlternativeDataTypeHandler() 19 | { 20 | converters = new Dictionary(); 21 | 22 | converters.Add(typeof(SecureString), new SecureStringHandler()); 23 | } 24 | 25 | /// 26 | /// Finds an alternative datatype handler to handle datatypes that are not 27 | /// supported through equivalent conversion in alternative datatypes. 28 | /// 29 | /// 30 | /// 31 | public IAlternativeDataTypeHandler FindHandler(Type typeOfDataType2Handle) 32 | { 33 | IAlternativeDataTypeHandler ret = null; 34 | 35 | try 36 | { 37 | converters.TryGetValue(typeOfDataType2Handle, out ret); 38 | } 39 | catch 40 | { 41 | // Make sure that exceptions in converter do not crash the application 42 | } 43 | 44 | return ret; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /source/Aehnlich/Components/Settings/SettingsModel/Models/XML/Converters/IAlternativeDataTypeHandler.cs: -------------------------------------------------------------------------------- 1 | namespace SettingsModel.Models.XML.Converters 2 | { 3 | using System; 4 | 5 | internal interface IAlternativeDataTypeHandler 6 | { 7 | Type SourceDataType { get; } 8 | Type TargetDataType { get; } 9 | 10 | object Convert(object objectInput); 11 | object ConvertBack(object objectEncryptedData); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /source/Aehnlich/Components/Settings/SettingsModel/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("SettingsModel")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("SettingsModel")] 12 | [assembly: AssemblyCopyright("The MIT License (MIT) Copyright © 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("9b0ba841-5a2f-4ed3-a908-253dbca70e77")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /source/AehnlichLib/Binaries/Addition.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichLib.Binaries 2 | { 3 | using AehnlichLib.Interfaces; 4 | 5 | public sealed class Addition : IAddCopy 6 | { 7 | #region Private Data Members 8 | 9 | private readonly byte[] bytes; 10 | 11 | #endregion 12 | 13 | #region Constructors 14 | 15 | internal Addition(byte[] bytes) 16 | { 17 | this.bytes = bytes; 18 | } 19 | 20 | #endregion 21 | 22 | #region Public Properties 23 | 24 | public bool IsAdd => true; 25 | 26 | #endregion 27 | 28 | #region Public Methods 29 | 30 | public byte[] GetBytes() => this.bytes; 31 | 32 | #endregion 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /source/AehnlichLib/Binaries/Copy.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichLib.Binaries 2 | { 3 | using AehnlichLib.Interfaces; 4 | 5 | public sealed class Copy : IAddCopy 6 | { 7 | #region Constructors 8 | 9 | internal Copy(int baseOffset, int length) 10 | { 11 | this.BaseOffset = baseOffset; 12 | this.Length = length; 13 | } 14 | 15 | #endregion 16 | 17 | #region Public Properties 18 | 19 | public bool IsAdd => false; 20 | 21 | public int BaseOffset { get; } 22 | 23 | public int Length { get; } 24 | 25 | #endregion 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /source/AehnlichLib/Binaries/Resources/NonExistingFile.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichLib/Binaries/Resources/NonExistingFile.bin -------------------------------------------------------------------------------- /source/AehnlichLib/Dir/DirectoryDiffEntryCollection.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichLib.Dir 2 | { 3 | using AehnlichLib.Interfaces; 4 | using System.Collections.Generic; 5 | using System.Collections.ObjectModel; 6 | 7 | public sealed class DirectoryDiffEntryCollection : ReadOnlyCollection 8 | { 9 | #region Constructors 10 | 11 | internal DirectoryDiffEntryCollection() 12 | : base(new List()) 13 | { 14 | } 15 | 16 | #endregion 17 | 18 | #region Internal Methods 19 | 20 | internal void Add(IDirectoryDiffEntry entry) 21 | { 22 | this.Items.Add(entry); 23 | } 24 | 25 | #endregion 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /source/AehnlichLib/Dir/Merge/MergedEntry.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichLib.Dir.Merge 2 | { 3 | using FsDataLib.Interfaces.Dir; 4 | using System.Diagnostics; 5 | 6 | [DebuggerDisplay("InfoA = {InfoA}, InfoB = {InfoB}, BothGotChildren = {BothGotChildren}")] 7 | internal class MergedEntry 8 | { 9 | #region ctors 10 | public MergedEntry(IFileSystemInfo infoA, 11 | IFileSystemInfo infoB) 12 | : this() 13 | { 14 | this.InfoA = infoA; 15 | this.InfoB = infoB; 16 | } 17 | 18 | /// 19 | /// Hidden standard constructor 20 | /// 21 | protected MergedEntry() 22 | { 23 | } 24 | #endregion ctors 25 | 26 | public IFileSystemInfo InfoA { get; } 27 | 28 | public IFileSystemInfo InfoB { get; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/AehnlichLib/Enums/CompareType.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichLib.Enums 2 | { 3 | /// 4 | /// Controls the way of how the diff engine should diff the given information. 5 | /// 6 | public enum CompareType 7 | { 8 | /// 9 | /// Determine the right mode of diff automatically. 10 | /// 11 | Auto, 12 | 13 | /// 14 | /// Diff files as text files. 15 | /// 16 | Text, 17 | 18 | /// 19 | /// Diff files as XML files. 20 | /// 21 | Xml, 22 | 23 | /// 24 | /// Diff files as binary files. 25 | /// 26 | Binary 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /source/AehnlichLib/Enums/DiffType.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichLib.Enums 2 | { 3 | /// 4 | /// Describes the types of target object use case for the comparison 5 | /// of 2 files, 2 directories, or 2 text documents. 6 | /// 7 | public enum DiffType 8 | { 9 | /// 10 | /// Not determined indicates an error if this ever pops-up in an 11 | /// constructed object when comparison is intended. 12 | /// 13 | Unknown, 14 | 15 | /// 16 | /// We are comparing files here. 17 | /// 18 | File, 19 | 20 | /// 21 | /// We are comparing directories here. 22 | /// 23 | Directory, 24 | 25 | /// 26 | /// We are comparing text here. 27 | /// 28 | Text 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/AehnlichLib/Enums/EditType.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichLib.Enums 2 | { 3 | /// 4 | /// Defines a type of edit operation that is necessary to transform stringA into stringB. 5 | /// 6 | /// This is applicable to use case where users want to compare stringA with stringB and 7 | /// which to display differences (mergeing text). Typically, these differences are based 8 | /// on a type of difference (insert, delete, change, none) which is denoted by this enumeration. 9 | /// 10 | public enum EditType : uint 11 | { 12 | /// 13 | /// The sequences in stringA and stringB are equal. Therefore, no edit operation is required 14 | /// to transform stringA into stringB. 15 | /// 16 | None = 0, 17 | 18 | /// 19 | /// The sequences in stringA and stringB are NOT equal. 20 | /// A delete operation (eg: delete letter 'A' in position n) 21 | /// in stringA is required to make stringA 22 | /// more equal in comparison towards stringB. 23 | /// 24 | Delete = 1, 25 | 26 | /// 27 | /// The sequences in stringA and stringB are NOT equal. 28 | /// An insert operation (eg: insert letter 'A' in position n) 29 | /// in stringA is required to make stringA 30 | /// more equal in comparison towards stringB. 31 | /// 32 | Insert = 2, 33 | 34 | /// 35 | /// The sequences in stringA and stringB are NOT equal. 36 | /// An change operation (eg: exchange letter 'A' in position n with letter 'B') 37 | /// in stringA is required to make stringA more equal in comparison towards stringB. 38 | /// 39 | Change = 3 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /source/AehnlichLib/Enums/HashType.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichLib.Enums 2 | { 3 | using System.Diagnostics.CodeAnalysis; 4 | 5 | /// 6 | /// Defines the type of hashing algorithm that is used to 7 | /// efficiently compare a sequenceA with sequenceB and determine 8 | /// whether they can be matched or not. 9 | /// 10 | public enum HashType 11 | { 12 | /// 13 | /// Default for hash based comparison of sequenceA and sequenceB is based on the GetHashCode() method 14 | /// implemented in class or its override of an inheriting class 15 | /// (eg. new string("XXX").GetHashCode()). 16 | /// 17 | /// https://docs.microsoft.com/en-us/dotnet/api/system.object.gethashcode 18 | /// 19 | HashCode, 20 | 21 | /// 22 | /// The hash based comparison of sequenceA and sequenceB is based on the CRC32 algorithm. 23 | /// For more info see: 24 | /// http://www.efg2.com/Lab/Mathematics/CRC.htm. 25 | /// 26 | [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Crc", 27 | Justification = "CRC is for 'cyclic redundancy check'.")] 28 | Crc32, 29 | 30 | /// 31 | /// The hash based comparison of sequenceA and sequenceB is based on the unique occurence of a sequence. 32 | /// That is, each unique sequence will have the same hash code. Consider for example the following 33 | /// sequence of strings (sequences): 34 | /// 35 | /// Number String Hash Value 36 | /// 0 'XXXX' -> 0 37 | /// 1 'Abc' -> 1 38 | /// 2 'cda' -> 2 39 | /// 3 'XXXX' -> 0 40 | /// 4 'Abc' -> 1 41 | /// 42 | /// The hash value is derived from the line number in which a given unique string occured for the first time. 43 | /// 44 | Unique 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /source/AehnlichLib/Interfaces/IAddCopy.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichLib.Interfaces 2 | { 3 | public interface IAddCopy 4 | { 5 | bool IsAdd { get; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /source/AehnlichLib/Interfaces/IDirectoryDiffEntry.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichLib.Interfaces 2 | { 3 | using AehnlichLib.Dir; 4 | using AehnlichLib.Enums; 5 | using System; 6 | 7 | public interface IDirectoryDiffEntry 8 | { 9 | #region Public Properties 10 | bool Different { get; set; } 11 | 12 | string Error { get; set; } 13 | 14 | bool InA { get; } 15 | 16 | bool InB { get; } 17 | 18 | /// 19 | /// Gets the context of this diff (none, delete, add, change) 20 | /// as an enumeration value. 21 | /// 22 | EditType EditContext { get; } 23 | 24 | bool IsFile { get; } 25 | 26 | string BasePath { get; } 27 | 28 | string Name { get; } 29 | 30 | /// 31 | /// Gets the last time this item has been changed through a write access. 32 | /// 33 | DateTime LastUpdateA { get; } 34 | 35 | /// 36 | /// Gets the last time this item has been changed through a write access. 37 | /// 38 | DateTime LastUpdateB { get; } 39 | 40 | /// 41 | /// Gets the size, in bytes, of the current file system item. 42 | /// 43 | double LengthA { get; set; } 44 | 45 | /// 46 | /// Gets the size, in bytes, of the current file system item. 47 | /// 48 | double LengthB { get; set; } 49 | 50 | DirectoryDiffEntryCollection Subentries { get; } 51 | #endregion properties 52 | 53 | #region methods 54 | void AddSubEntry(IDirectoryDiffEntry entry); 55 | 56 | int CountSubDirectories(); 57 | 58 | bool SetDiffBasedOnChildren(bool ignoreDirectoryComparison); 59 | #endregion methods 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /source/AehnlichLib/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("AehnlichLib")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("AehnlichLib")] 13 | [assembly: AssemblyCopyright("Copyright © 2019")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("c0d1e820-eb48-4b79-bcd6-c2de7cc367f2")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | 38 | [assembly: InternalsVisibleTo("AehnlichLib_UnitTests")] 39 | 40 | -------------------------------------------------------------------------------- /source/AehnlichLib/Text/DiagonalVector.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichLib.Text 2 | { 3 | using System; 4 | using System.Diagnostics; 5 | 6 | /// 7 | /// Implements a vector from -MAX to MAX 8 | /// 9 | internal sealed class DiagonalVector 10 | { 11 | #region Private Data Members 12 | 13 | private readonly int[] data; 14 | private readonly int max; 15 | 16 | #endregion 17 | 18 | #region Constructors 19 | /// 20 | /// Class constructor 21 | /// 22 | /// 23 | /// 24 | public DiagonalVector(int n, int m) 25 | { 26 | int delta = n - m; 27 | 28 | // We have to add Delta to support reverse vectors, which are 29 | // centered around the Delta diagonal instead of the 0 diagonal. 30 | this.max = n + m + Math.Abs(delta); 31 | 32 | // Create an array of size 2*MAX+1 to hold -MAX..+MAX. 33 | this.data = new int[(2 * this.max) + 1]; 34 | } 35 | #endregion 36 | 37 | #region Public Properties 38 | 39 | public int this[int userIndex] 40 | { 41 | get 42 | { 43 | return this.data[this.GetActualIndex(userIndex)]; 44 | } 45 | 46 | set 47 | { 48 | this.data[this.GetActualIndex(userIndex)] = value; 49 | } 50 | } 51 | 52 | #endregion 53 | 54 | #region Private Methods 55 | 56 | private int GetActualIndex(int userIndex) 57 | { 58 | int result = userIndex + this.max; 59 | Debug.Assert(result >= 0 && result < this.data.Length, "The actual index must be within the actual data array's bounds."); 60 | return result; 61 | } 62 | 63 | #endregion 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /source/AehnlichLib/Text/EditScript.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichLib.Text 2 | { 3 | using AehnlichLib.Enums; 4 | using System.Collections.Generic; 5 | using System.Collections.ObjectModel; 6 | using System.Diagnostics.CodeAnalysis; 7 | 8 | /// 9 | /// Implements an edit script object that holds a sequence of operations 10 | /// (none, insert, delete, change) necessary to transform sequenceA into sequenceB. 11 | /// 12 | /// The resulting object is a collection of objects, 13 | /// which in turn, define each edit operation (none, delete, insert, replace) 14 | /// at the appropriate position and length in sequenceA. 15 | /// 16 | [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", 17 | Justification = "Using the same name as in Myers's paper.")] 18 | public sealed class EditScript : ReadOnlyCollection 19 | { 20 | #region Private Data Members 21 | private int totalEditLength; 22 | #endregion 23 | 24 | #region Constructors 25 | /// 26 | /// Class constructor. 27 | /// 28 | internal EditScript(double similarity) 29 | : base(new List()) 30 | { 31 | this.Similarity = similarity; 32 | } 33 | #endregion 34 | 35 | #region Public Properties 36 | /// 37 | /// Gets the sum of all edit lengths 38 | /// of all objects in this collection. 39 | /// 40 | /// A Change operation is multiplied with a factor of 2 41 | /// while all other operations Insert, Delete, and None (?) are counted as 1 edit. 42 | /// 43 | public int TotalEditLength => this.totalEditLength; 44 | 45 | /// 46 | /// Gets a similarity value that must be available at contructor time 47 | /// (computed externally). 48 | /// 49 | public double Similarity { get; } 50 | 51 | #endregion 52 | 53 | #region Internal Methods 54 | 55 | /// 56 | /// Adds another edit operation into the sequence of operations. 57 | /// 58 | internal void Add(Edit edit) 59 | { 60 | if (edit.EditType == EditType.Change) 61 | { 62 | this.totalEditLength += 2 * edit.Length; 63 | } 64 | else 65 | { 66 | this.totalEditLength += edit.Length; 67 | } 68 | 69 | this.Items.Add(edit); 70 | } 71 | 72 | #endregion 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /source/AehnlichLib/Text/SubArray.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichLib.Text 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | /// 8 | /// Allows 1..M access for a selected portion of an int array. 9 | /// 10 | internal sealed class SubArray where T : IComparable 11 | { 12 | #region Private Data Members 13 | 14 | private readonly IList data; 15 | private readonly int length; // Stores the length of this subarray 16 | private readonly int offset; // Stores the 0-based offset into this.arData where this subarray should start 17 | 18 | #endregion 19 | 20 | #region Constructors 21 | 22 | public SubArray(IList data) 23 | { 24 | this.data = data; 25 | this.offset = 0; 26 | this.length = this.data.Count; 27 | } 28 | 29 | public SubArray(SubArray data, int offset, int length) 30 | { 31 | this.data = data.data; 32 | 33 | // Subtract 1 here because offset will be 1-based 34 | this.offset = data.offset + offset - 1; 35 | this.length = length; 36 | } 37 | 38 | #endregion 39 | 40 | #region Public Properties 41 | 42 | public int Length => this.length; 43 | 44 | public int Offset => this.offset; 45 | 46 | public T this[int index] => this.data[this.offset + index - 1]; 47 | 48 | #endregion 49 | 50 | #region Public Methods 51 | 52 | public override string ToString() 53 | { 54 | StringBuilder sb = new StringBuilder(3 * this.length); 55 | for (int i = 0; i < this.length; i++) 56 | { 57 | sb.AppendFormat("{0} ", this.data[this.offset + i]); 58 | } 59 | 60 | return sb.ToString(); 61 | } 62 | 63 | #endregion 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /source/AehnlichLib/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /source/AehnlichLib_UnitTests/AehnlichLib_UnitTests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp2.1 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /source/AehnlichLib_UnitTests/DirectoryDiffTests.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichLib_UnitTests 2 | { 3 | using Microsoft.VisualStudio.TestTools.UnitTesting; 4 | 5 | [TestClass] 6 | public class DirectoryDiffTests 7 | { 8 | /// 9 | /// This test determines whether the DirectoryDiff.GetBasePath() method determines 10 | /// the correct relative base path for left and right merged directories or not. 11 | /// 12 | [TestMethod] 13 | public void TestGetBasePath() 14 | { 15 | string[] t = { "Y:\\FILES\\MP3", null, // params A 16 | "X:\\", "X:\\00", // params B 17 | "00" // Expected output 18 | }; 19 | 20 | string[] t1 = { "Y:\\FILES\\MP3", "Y:\\FILES\\MP3\\01_mp3_mix", // params A 21 | "X:\\", "X:\\01_mp3_mix", // params B 22 | "01_mp3_mix" // Expected output 23 | }; 24 | 25 | string[] t2 = { "Y:\\DOWNLOADS\\CLEAN3_5", "Y:\\DOWNLOADS\\CLEAN3_5\\Aehnlich", // params A 26 | "X:\\DOWNLOADS\\CLEAN3_6", "Y:\\DOWNLOADS\\CLEAN3_6\\Aehnlich", // params B 27 | "Aehnlich" // Expected output 28 | }; 29 | 30 | string[] t3 = { "Y:\\DOWNLOADS\\CLEAN3_5", "Y:\\DOWNLOADS\\CLEAN3_5\\Aehnlich\\Props", // params A 31 | "X:\\DOWNLOADS\\CLEAN3_6", "Y:\\DOWNLOADS\\CLEAN3_6\\Aehnlich\\Props", // params B 32 | "Aehnlich\\Props" // Expected output 33 | }; 34 | 35 | string[][] tList = new string[][] { t, t1, t2, t3 }; 36 | 37 | foreach (var item in tList) 38 | { 39 | string result = AehnlichLib.Dir.DirectoryDiff.GetBasePath( 40 | item[0], new Mock_IFileSystemInfo.FileSystemInfoImpl(item[1]), 41 | item[2], new Mock_IFileSystemInfo.FileSystemInfoImpl(item[3])); 42 | 43 | // Check if output meets expectations 44 | Assert.AreEqual(item[4], result); 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /source/AehnlichLib_UnitTests/Mock_IFileSystemInfo/FileSystemInfoImpl.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichLib_UnitTests.Mock_IFileSystemInfo 2 | { 3 | using FsDataLib.Interfaces.Dir; 4 | using System; 5 | 6 | /// Implement a mock-up class for usage with UNIT TESTING. 7 | internal class FileSystemInfoImpl : IFileSystemInfo 8 | { 9 | #region fields 10 | private string _path; 11 | #endregion fields 12 | 13 | #region ctors 14 | /// 15 | /// Class constructor 16 | /// 17 | /// 18 | public FileSystemInfoImpl(string path) 19 | : this() 20 | { 21 | _path = path; 22 | } 23 | 24 | /// 25 | /// Class constructor 26 | /// 27 | protected FileSystemInfoImpl() 28 | { 29 | } 30 | #endregion ctors 31 | 32 | #region properties 33 | 34 | public string FullName => _path; 35 | 36 | public string Name => throw new NotImplementedException(); 37 | 38 | public bool DirectoryExists => throw new NotImplementedException(); 39 | 40 | public bool FileExists => throw new NotImplementedException(); 41 | 42 | public DateTime LastWriteTime => throw new NotImplementedException(); 43 | #endregion properties 44 | 45 | #region methods 46 | #endregion methods 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Controls/Overview/DoublesToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewLib.Converters 2 | { 3 | using System; 4 | using System.Globalization; 5 | using System.Windows; 6 | using System.Windows.Data; 7 | 8 | /// 9 | /// Implements a converter that controls whether a thumb is visible based on the bound 10 | /// - (one based) ViewPortSize and the 11 | /// - (zero based) DocumentLength. 12 | /// 13 | /// A thumb should be shown if we have: ViewPortSize > (DocumentLength + 1) 14 | /// and be hidden in all other cases. 15 | /// 16 | [ValueConversion(typeof(double), typeof(Visibility))] 17 | public class DoublesToVisibilityConverter : DependencyObject, IMultiValueConverter 18 | { 19 | /// 20 | /// Converts the multibound properties ViewPortSize and DocumentLength into a 21 | /// value. 22 | /// 23 | /// 24 | /// 25 | /// 26 | /// 27 | /// 28 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 29 | { 30 | if (values == null) 31 | return Binding.DoNothing; 32 | 33 | if (values.Length != 2) 34 | return Binding.DoNothing; 35 | 36 | if ((values[0] is double && values[1] is double) == false) 37 | return Visibility.Collapsed; 38 | 39 | double firstValue = (double)values[0]; 40 | double secondValue = (double)values[1]; 41 | 42 | if (((int)secondValue) > (int)(firstValue + 1)) 43 | return Visibility.Visible; 44 | 45 | // Entries appear to be equal 46 | return Visibility.Collapsed; 47 | } 48 | 49 | /// 50 | /// Not Implemented. 51 | /// 52 | /// 53 | /// 54 | /// 55 | /// 56 | /// 57 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 58 | { 59 | throw new NotImplementedException(); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Controls/Overview/RangeAlignment.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewLib.Controls.Overview 2 | { 3 | 4 | /// 5 | /// Original Source: https://github.com/Ttxman/WpfRangeControls 6 | /// 7 | public enum RangeAlignment 8 | { 9 | Begin, 10 | End, 11 | Center 12 | } 13 | } -------------------------------------------------------------------------------- /source/AehnlichViewLib/Controls/Overview/RangeItemsControl.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 18 | 19 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Controls/Overview/RangeItemsControl.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewLib.Controls.Overview 2 | { 3 | using System.ComponentModel; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | 7 | /// 8 | /// Original Source: https://github.com/Ttxman/WpfRangeControls 9 | /// 10 | public class RangeItemsControl : ItemsControl 11 | { 12 | public static DependencyProperty OrientationProperty = 13 | RangePanel.OrientationProperty.AddOwner(typeof(RangeItemsControl)); 14 | 15 | public static DependencyProperty MinimumProperty = 16 | RangePanel.MinimumProperty.AddOwner(typeof(RangeItemsControl)); 17 | 18 | public static DependencyProperty MaximumProperty = 19 | RangePanel.MaximumProperty.AddOwner(typeof(RangeItemsControl)); 20 | 21 | static RangeItemsControl() 22 | { 23 | DefaultStyleKeyProperty.OverrideMetadata(typeof(RangeItemsControl), 24 | new FrameworkPropertyMetadata(typeof(RangeItemsControl))); 25 | } 26 | 27 | public Orientation Orientation 28 | { 29 | get { return (Orientation)GetValue(OrientationProperty); } 30 | set { SetValue(OrientationProperty, value); } 31 | } 32 | 33 | /// 34 | /// Minimum restricts the minimum value of range 35 | /// 36 | [Bindable(true), Category("Behavior")] 37 | public double Minimum 38 | { 39 | get { return (double)GetValue(MinimumProperty); } 40 | set { SetValue(MinimumProperty, value); } 41 | } 42 | 43 | /// 44 | /// Minimum restricts the minimum value of range 45 | /// 46 | [Bindable(true), Category("Behavior")] 47 | public double Maximum 48 | { 49 | get { return (double)GetValue(MaximumProperty); } 50 | set { SetValue(MaximumProperty, value); } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Converters/BindingProxy .cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewLib.Converters 2 | { 3 | using System.Windows; 4 | 5 | /// 6 | /// Implements an XAML proxy which can be used to bind items (TreeViewItem, ListViewItem etc) 7 | /// with a viewmodel that manages the collecrions. 8 | /// 9 | /// Source: http://www.thomaslevesque.com/2011/03/21/wpf-how-to-bind-to-data-when-the-datacontext-is-not-inherited/ 10 | /// Issue: http://stackoverflow.com/questions/9994241/mvvm-binding-command-to-contextmenu-item 11 | /// 12 | public class BindingProxy : Freezable 13 | { 14 | /// 15 | /// Backing store of the dependency property. 16 | /// 17 | public static readonly DependencyProperty DataProperty = 18 | DependencyProperty.Register("Data", typeof(object), typeof(BindingProxy), new UIPropertyMetadata(null)); 19 | 20 | /// 21 | /// Gets the data object this class is forwarding to everyone 22 | /// who has a reference to this object. 23 | /// 24 | public object Data 25 | { 26 | get { return (object)this.GetValue(DataProperty); } 27 | set { this.SetValue(DataProperty, value); } 28 | } 29 | 30 | /// 31 | /// Overrides of Freezable 32 | /// 33 | /// 34 | protected override Freezable CreateInstanceCore() 35 | { 36 | return new BindingProxy(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Converters/BooleanInvertConverter.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewLib.Converters 2 | { 3 | using System; 4 | using System.Globalization; 5 | using System.Windows.Data; 6 | 7 | /// 8 | /// Inverts a boolean value and returns it. 9 | /// 10 | public class BooleanInvertConverter : IValueConverter 11 | { 12 | /// 13 | /// Inverts a boolean value and returns it. 14 | /// 15 | /// 16 | /// 17 | /// 18 | /// 19 | /// 20 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 21 | { 22 | if ((value is bool) == false) 23 | return Binding.DoNothing; 24 | 25 | return !((bool)value); 26 | } 27 | 28 | /// 29 | /// Inverts a boolean value and returns it. 30 | /// 31 | /// 32 | /// 33 | /// 34 | /// 35 | /// 36 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 37 | { 38 | if ((value is bool) == false) 39 | return Binding.DoNothing; 40 | 41 | return !((bool)value); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Converters/DiffToBackgroundColorConverter.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewLib.Converters 2 | { 3 | using AehnlichViewLib.Interfaces; 4 | using System; 5 | using System.Globalization; 6 | using System.Windows; 7 | using System.Windows.Data; 8 | 9 | /// 10 | /// Considers all arguments of difference between two compared items and 11 | /// converts it into an associated background color key. 12 | /// 13 | public class DiffToBackgroundColorConverter : DependencyObject, IMultiValueConverter 14 | { 15 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 16 | { 17 | if (values == null) 18 | return Binding.DoNothing; 19 | 20 | if (values.Length != 4) 21 | return Binding.DoNothing; 22 | 23 | bool IsFromA = true; 24 | if ((string)parameter == "fromB") 25 | IsFromA = false; 26 | else 27 | IsFromA = true; 28 | 29 | bool IsItemInA = (bool)values[0]; 30 | bool IsItemInB = (bool)values[1]; 31 | bool IsItemDifferent = (bool)values[2]; 32 | var colorDefs = values[3] as IDiffColorDefinitions; 33 | 34 | if (colorDefs == null) 35 | return Binding.DoNothing; 36 | 37 | if (IsItemDifferent && IsItemInA == true && IsItemInB == true) 38 | return colorDefs.ColorBackgroundContext; 39 | 40 | if (IsItemInA == false && IsItemInB == true) 41 | { 42 | if (IsFromA) 43 | return colorDefs.ColorBackgroundImaginaryLineAdded; 44 | else 45 | return colorDefs.ColorBackgroundAdded; 46 | } 47 | else 48 | { 49 | if (IsItemInA == true && IsItemInB == false) 50 | { 51 | if (IsFromA) 52 | return colorDefs.ColorBackgroundDeleted; 53 | else 54 | return colorDefs.ColorBackgroundImaginaryLineDeleted; 55 | } 56 | } 57 | 58 | // Entries appear to be equal 59 | return Binding.DoNothing; 60 | } 61 | 62 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 63 | { 64 | throw new NotImplementedException(); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Converters/DiffToForegroundColorConverter.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewLib.Converters 2 | { 3 | using AehnlichViewLib.Interfaces; 4 | using System; 5 | using System.Globalization; 6 | using System.Windows; 7 | using System.Windows.Data; 8 | 9 | /// 10 | /// Considers all arguments of difference between two compared items and 11 | /// converts it into an associated Foreground color key. 12 | /// 13 | public class DiffToForegroundColorConverter : DependencyObject, IMultiValueConverter 14 | { 15 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 16 | { 17 | if (values == null) 18 | return Binding.DoNothing; 19 | 20 | if (values.Length != 4) 21 | return Binding.DoNothing; 22 | 23 | bool IsFromA = true; 24 | if ((string)parameter == "fromB") 25 | IsFromA = false; 26 | else 27 | IsFromA = true; 28 | 29 | bool IsItemInA = (bool)values[0]; 30 | bool IsItemInB = (bool)values[1]; 31 | bool IsItemDifferent = (bool)values[2]; 32 | var colorDefs = values[3] as IDiffColorDefinitions; 33 | 34 | if (colorDefs == null) 35 | return Binding.DoNothing; 36 | 37 | if (IsItemDifferent && IsItemInA == true && IsItemInB == true) 38 | return colorDefs.ColorForegroundContext; 39 | 40 | if (IsItemInA == false && IsItemInB == true) 41 | { 42 | if (IsFromA) 43 | return Binding.DoNothing; // Imaginary Lines do not have a foreground item 44 | else 45 | return colorDefs.ColorForegroundAdded; 46 | } 47 | else 48 | { 49 | if (IsItemInA == true && IsItemInB == false) 50 | { 51 | if (IsFromA) 52 | return colorDefs.ColorForegroundDeleted; 53 | else 54 | return Binding.DoNothing; // Imaginary Lines do not have a foreground item 55 | } 56 | } 57 | 58 | // Entries appear to be equal 59 | return colorDefs.ColorForegroundBlank; 60 | } 61 | 62 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 63 | { 64 | throw new NotImplementedException(); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Converters/DoubleBytesToStringReadableSizeConverter.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewLib.Converters 2 | { 3 | using System; 4 | using System.Globalization; 5 | using System.Windows.Data; 6 | 7 | /// 8 | /// Converts a given byte value as double number into human readable string (eg.: "1,5 Gb"). 9 | /// The actual value input is expected to be an integer but we use a double here to avoid 10 | /// overflow issues when analyzing large directories. 11 | /// 12 | [ValueConversion(typeof(double), typeof(string))] 13 | public class DoubleBytesToStringReadableSizeConverter : IValueConverter 14 | { 15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 16 | { 17 | if (value is double == false) 18 | return Binding.DoNothing; 19 | 20 | var param = (double)value; 21 | 22 | if (param < 1024) 23 | return string.Format("{0:f2} bytes", param); 24 | 25 | param = param / 1024; 26 | 27 | if (param < 1024) 28 | return string.Format("{0:f2} Kb", param); 29 | 30 | param = param / 1024; 31 | 32 | if (param < 1024) 33 | return string.Format("{0:f2} Mb", param); 34 | 35 | param = param / 1024; 36 | 37 | if (param < 1024) 38 | return string.Format("{0:f2} Gb", param); 39 | 40 | param = param / 1024; 41 | 42 | if (param < 1024) 43 | return string.Format("{0:f2} Tb", param); 44 | 45 | param = param / 1024; 46 | 47 | return string.Format("{0:f2} Pb", param); 48 | } 49 | 50 | /// 51 | /// Not implemented. 52 | /// 53 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 54 | { 55 | throw new NotImplementedException(); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Converters/InvertColorConverter.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewLib.Converters 2 | { 3 | using System; 4 | using System.Globalization; 5 | using System.Windows; 6 | using System.Windows.Data; 7 | using System.Windows.Media; 8 | 9 | internal class InvertColorConverter : IValueConverter 10 | { 11 | #region fields 12 | 13 | #endregion fields 14 | 15 | #region ctors 16 | /// 17 | /// Class constructor 18 | /// 19 | public InvertColorConverter() 20 | { 21 | } 22 | #endregion ctors 23 | 24 | #region methods 25 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 26 | { 27 | if (value is Color) 28 | { 29 | return InvertColor((Color)value); 30 | } 31 | else 32 | { 33 | var brush = value as SolidColorBrush; 34 | if (brush != null) 35 | { 36 | SolidColorBrush convertedBrush = new SolidColorBrush(InvertColor(brush.Color)); 37 | convertedBrush.Freeze(); 38 | 39 | return convertedBrush; 40 | } 41 | } 42 | 43 | return DependencyProperty.UnsetValue; 44 | } 45 | 46 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 47 | { 48 | return DependencyProperty.UnsetValue; 49 | } 50 | 51 | private Color InvertColor(Color ColourToInvert) 52 | { 53 | return Color.FromArgb(ColourToInvert.A, 54 | (byte)~ColourToInvert.R, (byte)~ColourToInvert.G, (byte)~ColourToInvert.B); 55 | } 56 | #endregion methods 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Converters/NullToEnabledPropConverter.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewLib.Converters 2 | { 3 | using System; 4 | using System.Globalization; 5 | using System.Windows; 6 | using System.Windows.Data; 7 | 8 | /// 9 | /// Converts an object null or non-null value into a configurable 10 | /// value of type . 11 | /// 12 | [ValueConversion(typeof(object), typeof(bool))] 13 | public sealed class NullToEnabledPropConverter : IValueConverter 14 | { 15 | #region constructor 16 | /// 17 | /// Class constructor 18 | /// 19 | public NullToEnabledPropConverter() 20 | { 21 | // set defaults 22 | NullValue = false; 23 | NonNullValue = true; 24 | } 25 | #endregion constructor 26 | 27 | #region properties 28 | /// 29 | /// Gets/sets the value that is associated 30 | /// (converted into) with the boolean true value. 31 | /// 32 | public bool NullValue { get; set; } 33 | 34 | /// 35 | /// Gets/sets the value that is associated 36 | /// (converted into) with the boolean false value. 37 | /// 38 | public bool NonNullValue { get; set; } 39 | #endregion properties 40 | 41 | #region methods 42 | /// 43 | /// Convertzs a bool value into as configured in the 44 | /// and properties. 45 | /// 46 | /// 47 | /// 48 | /// 49 | /// 50 | /// 51 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 52 | { 53 | if (value == null) 54 | return NullValue; 55 | 56 | return NonNullValue; 57 | } 58 | 59 | /// 60 | /// Not implemented. 61 | /// 62 | /// 63 | /// 64 | /// 65 | /// 66 | /// 67 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 68 | { 69 | throw new NotImplementedException(); 70 | } 71 | #endregion methods 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Converters/SentinelConverter.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewLib.Converters 2 | { 3 | using System; 4 | using System.Windows.Data; 5 | 6 | /// 7 | /// This converter ensures that new lines (with editing in DataGrid) are not bound 8 | /// to the viewmodel. 9 | /// 10 | /// https://stackoverflow.com/questions/9109103/wpf-datagrid-selecteditem 11 | /// 12 | public sealed class SentinelConverter : IValueConverter 13 | { 14 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 15 | { 16 | return value; 17 | } 18 | 19 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 20 | { 21 | if (value != null && string.Equals("{NewItemPlaceholder}", value.ToString(), StringComparison.Ordinal)) 22 | { 23 | return null; 24 | } 25 | 26 | return value; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /source/AehnlichViewLib/Enums/DiffContext.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewLib.Enums 2 | { 3 | /// 4 | /// Enumerates a model value that hints whether 2 items are different 5 | /// (one of them was Added or Deleted or both are there but different: Changed) 6 | /// or if there is no difference between both lines (Context). 7 | /// 8 | public enum DiffContext 9 | { 10 | /// 11 | /// Both compared items are empty (eg. contain strings with length 0). 12 | /// 13 | Blank, 14 | 15 | /// 16 | /// The left or right part of the compared items was added. 17 | /// 18 | Added, 19 | 20 | /// 21 | /// The left or right part of the compared items was deleted. 22 | /// 23 | Deleted, 24 | 25 | /// 26 | /// The left and right part are similar enough to hint that they are not 27 | /// the same but have changed between each other. 28 | /// 29 | Context, 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Enums/Focus.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewLib.Enums 2 | { 3 | /// 4 | /// Enumerates UI elements in the diff view that can be focused by default. 5 | /// 6 | public enum Focus 7 | { 8 | /// No UI element to focus by default. 9 | None, 10 | 11 | /// Focus the left diff view UI element (control) by default. 12 | LeftView, 13 | 14 | /// Focus the right diff view UI element (control) by default. 15 | RightView 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Enums/ViewMode.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewLib.Enums 2 | { 3 | /// 4 | /// Determine whether (text) content is displayed for comparison or editing. 5 | /// 6 | public enum DisplayMode 7 | { 8 | /// Comparing (text) content (with highlighting differences in left and right view). 9 | Comparing 10 | 11 | /// Editing (text) content (without highlighting differences in left and right view). 12 | , Editing 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Events/ColumnWidthChangedEvent.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewLib.Events 2 | { 3 | using System; 4 | using System.Windows; 5 | 6 | public class ColumnWidthChangedEvent : EventArgs 7 | { 8 | public ColumnWidthChangedEvent(GridLength columnWidthA, GridLength columnWidthB) 9 | { 10 | ColumnWidthA = new GridLength(columnWidthA.Value, columnWidthA.GridUnitType); 11 | ColumnWidthB = new GridLength(columnWidthB.Value, columnWidthB.GridUnitType); 12 | } 13 | 14 | public GridLength ColumnWidthA { get; } 15 | 16 | public GridLength ColumnWidthB { get; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Events/DiffLineInfoChangedEvent.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewLib.Events 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | 6 | public enum DiffLineInfoChange 7 | { 8 | /// 9 | /// Is used with the to 10 | /// hint that Line Edit Script Segments should be re-drawn since 11 | /// this information has changed. 12 | /// 13 | LineEditScriptSegments 14 | } 15 | 16 | public class DiffLineInfoChangedEvent : EventArgs 17 | { 18 | public DiffLineInfoChangedEvent(DiffLineInfoChange parTypeOfInfoChange, 19 | IList parLinesChanged) 20 | { 21 | TypeOfInfoChange = parTypeOfInfoChange; 22 | LinesChanged = parLinesChanged; 23 | } 24 | 25 | public DiffLineInfoChange TypeOfInfoChange { get; } 26 | 27 | public IList LinesChanged { get; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Dark/Close_White_16x.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Dark/Close_White_16x.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Dark/Refresh_white_16x.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Dark/Refresh_white_16x.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Dark/Refresh_white_16x.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Dark/desk-lamp-dark.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Dark/desk-lamp-dark.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Dark/desk-lamp-dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 20 | 22 | 23 | 25 | image/svg+xml 26 | 28 | 29 | 30 | 31 | 33 | 53 | 57 | 58 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Dark/tilde.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Dark/tilde.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Dark/tilde.svg: -------------------------------------------------------------------------------- 1 | 2 | 20 | 22 | 23 | 25 | image/svg+xml 26 | 28 | 29 | 30 | 31 | 33 | 53 | 57 | 58 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/Close.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/Close.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/Close_16x.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/Copy.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/Copy.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/Copy_16x.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/FolderOpen_Down.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/FolderOpen_Down.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/FolderOpen_Down1_16x.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/FolderOpen_Down1_16x.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/FolderOpen_Up.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/FolderOpen_Up.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/FolderOpen_Up1_16x.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/FolderOpen_Up1_16x.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/GoToBottom.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/GoToBottom.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/GoToBottom_16x.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/GoToNext.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/GoToNext.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/GoToPrev.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/GoToPrev.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/GoToTop.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/GoToTop.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/GoToTop_16x.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/Next_16x.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/Next_16x.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/OpenFile.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/OpenFile.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/OpenFile_16x.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/Previous_16x.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/Previous_16x.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/Previous_16x.svg: -------------------------------------------------------------------------------- 1 | 2 | 15 | 17 | 18 | 20 | image/svg+xml 21 | 23 | 24 | 25 | 26 | 28 | 48 | 50 | 54 | 58 | 61 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/Refresh_16x.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/Refresh_black_16x.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/Refresh_black_16x.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/Search_16x.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/Search_16x.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/Search_16x.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/Settings.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/Settings.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/Settings_16x.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/ThisLine.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/ThisLine.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/arrow_down.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/arrow_down.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/arrow_down.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/arrow_left.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/arrow_left.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/arrow_left.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/arrow_right.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/arrow_right.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/arrow_right.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/arrow_up.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/arrow_up.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/arrow_up.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/desk-lamp-light.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/desk-lamp-light.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/desk-lamp-light.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/minus.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/minus.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/minus.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/plus.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/plus.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/plus.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/tilde.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/AehnlichViewLib/Icons/Light/tilde.ico -------------------------------------------------------------------------------- /source/AehnlichViewLib/Icons/Light/tilde.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Interfaces/IDiffLineInfo.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewLib.Interfaces 2 | { 3 | using AehnlichViewLib.Enums; 4 | using ICSharpCode.AvalonEdit.Document; 5 | using System.Collections.Generic; 6 | 7 | /// 8 | /// Gets the elements per line that are relevant for the view to draw 9 | /// colored backgrounds and (imaginary) line numbers to indicate 10 | /// change operations (insert, delete, change, none) in order to 11 | /// sync both views. 12 | /// 13 | public interface IDiffLineInfo 14 | { 15 | /// 16 | /// Gets the change context for this line in comparison to its 17 | /// counterpart (insert, delete, change, none). 18 | /// 19 | DiffContext Context { get; } 20 | 21 | /// 22 | /// Gets null if this line is imaginary (has no representation in 23 | /// the original text) or the line number as it was available in the 24 | /// original text (without accounting for imaginary lines. 25 | /// 26 | int? ImaginaryLineNumber { get; } 27 | 28 | /// 29 | /// Gets the collection that describes the difference 30 | /// between 2 matched lines through their indicated background highlighting. 31 | /// 32 | IReadOnlyCollection LineEditScriptSegments { get; } 33 | 34 | /// 35 | /// Gets whether have previously been 36 | /// computed or whether these segments are yet to be computed on demand. 37 | /// 38 | /// Gets false if the line has previously been matched to its counterpart line 39 | /// and true if matching is still to be performed on demand. 40 | /// 41 | bool LineEditScriptSegmentsIsDirty { get; } 42 | 43 | /// 44 | /// Gets whether this line is from the (left) viewA (usually used as reference) 45 | /// or not. 46 | /// 47 | bool FromA { get; } 48 | } 49 | } -------------------------------------------------------------------------------- /source/AehnlichViewLib/Interfaces/IGridSplitterSupport.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewLib.Interfaces 2 | { 3 | using AehnlichViewLib.Events; 4 | using System; 5 | using System.Windows; 6 | 7 | /// 8 | /// Defines properties and events of a class that supports a vertical split view 9 | /// using a GridSplitter that can be extended in the client application of a control 10 | /// that implements this interface. 11 | /// 12 | public interface IGridSplitterSupport 13 | { 14 | /// 15 | /// Implements an event that is invoked when the column view with columns A and B 16 | /// (PART_GridA and PART_GridB separated by a GridSplitter) is being 17 | /// resized in the way that the visible proportional width has been changed. 18 | /// 19 | event EventHandler ColumnWidthChanged; 20 | 21 | #region Column A B GridSplitter Synchronization 22 | /// 23 | /// Gets the width of column A in a view with columns A and B being separated by a GridSplitter. 24 | /// 25 | GridLength ColumnWidthA 26 | { 27 | get; set; 28 | } 29 | 30 | /// 31 | /// Gets the width of column B in a view with columns A and B being separated by a GridSplitter. 32 | /// 33 | GridLength ColumnWidthB 34 | { 35 | get; set; 36 | } 37 | #endregion Column A B GridSplitter Synchronization 38 | } 39 | } -------------------------------------------------------------------------------- /source/AehnlichViewLib/Interfaces/ILineDiffProvider.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewLib.Interfaces 2 | { 3 | using AehnlichViewLib.Events; 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | /// 8 | /// Defines an object that can match additional lines on demand when 9 | /// the user scrolls the view outside of the matched lines area 10 | /// (which has initially zero lines). 11 | /// 12 | /// The request method below is used to initiate the computation and the 13 | /// result event is sent when the computation is finished and results in 14 | /// new highlightings. 15 | /// 16 | /// The computation should be done on a non-ui thread to ensure a fluent UI. 17 | /// 18 | public interface ILineDiffProvider 19 | { 20 | /// 21 | /// Event is raised when newly requested line diff edit script segments 22 | /// have been computed and are available for hightlighting. 23 | /// 24 | event EventHandler DiffLineInfoChanged; 25 | 26 | /// 27 | /// Implements a method that is invoked by the view to request 28 | /// the matching (edit script computation) of the indicates text lines. 29 | /// 30 | /// This method should be called on the UI thread since 31 | /// the resulting event 32 | /// will be raised on the calling thread. 33 | /// 34 | /// Number of lines matched (may not be as requested if line appears to have been matched already). 35 | void RequestLineDiff(IEnumerable linenumbers); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Models/DiffViewPort.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewLib.Models 2 | { 3 | /// 4 | /// Describes the currently available text view by giving its first and 5 | /// last line (number of lines visible in display) and the total numer 6 | /// of line in the bound text document. 7 | /// 8 | public class DiffViewPort 9 | { 10 | /// 11 | /// Class constructor 12 | /// 13 | /// 14 | /// 15 | /// 16 | /// 17 | /// 18 | public DiffViewPort(int firstLine, int lastLine, int lineCount, 19 | int caretLine, int caretColumn) 20 | { 21 | this.FirstLine = firstLine; 22 | this.LastLine = lastLine; 23 | this.LineCount = lineCount; 24 | 25 | this.CaretLine = caretLine; 26 | this.CaretColumn = caretColumn; 27 | } 28 | 29 | /// 30 | /// Gets the line number of the first visible line in the text view. 31 | /// 32 | public int FirstLine { get; } 33 | 34 | /// 35 | /// Gets the line number of the last visible line in the text view. 36 | /// 37 | public int LastLine { get; } 38 | 39 | /// 40 | /// Gets the total number of all text lines in the text document. 41 | /// 42 | public int LineCount { get; } 43 | 44 | /// 45 | /// Gets the 1 based line number in which the cursor is currently positioned. 46 | /// 47 | public int CaretLine { get; } 48 | 49 | /// 50 | /// Gets the 1 based column number in which the cursor is currently positioned. 51 | /// 52 | public int CaretColumn { get; } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Models/Segment.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewLib.Models 2 | { 3 | using ICSharpCode.AvalonEdit.Document; 4 | using System.Diagnostics; 5 | 6 | [DebuggerDisplay("Offset = {Offset}, EndOffset = {EndOffset}, Length = {Length}")] 7 | public struct Segment : ISegment 8 | { 9 | #region Constructors 10 | /// 11 | /// Constructor 12 | /// 13 | /// 14 | /// 15 | /// 16 | public Segment(int start, int length, int endOffset) 17 | : this() 18 | { 19 | this.Offset = start; 20 | this.Length = length; 21 | this.EndOffset = endOffset; 22 | } 23 | 24 | #endregion 25 | 26 | #region Public Properties 27 | 28 | public int Length { get; } 29 | 30 | public int Offset { get; } 31 | 32 | public int EndOffset { get; } 33 | #endregion 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/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 AehnlichViewLib.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.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 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/Themes/Generic.xaml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /source/AehnlichViewLib/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /source/Demos/Dir/AehnlichDirDemo/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 | -------------------------------------------------------------------------------- /source/Demos/Dir/AehnlichDirDemo/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | -------------------------------------------------------------------------------- /source/Demos/Dir/AehnlichDirDemo/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace AehnlichDirDemo 4 | { 5 | /// 6 | /// Interaction logic for App.xaml 7 | /// 8 | public partial class App : Application 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /source/Demos/Dir/AehnlichDirDemo/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /source/Demos/Dir/AehnlichDirDemo/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichDirDemo 2 | { 3 | using AehnlichDirViewModelLib.Interfaces; 4 | using AehnlichDirViewModelLib.ViewModels; 5 | using System.Windows; 6 | 7 | /// 8 | /// Interaction logic for MainWindow.xaml 9 | /// 10 | public partial class MainWindow : Window 11 | { 12 | public MainWindow() 13 | { 14 | InitializeComponent(); 15 | 16 | Loaded += MainWindow_Loaded; 17 | Unloaded += MainWindow_Unloaded; 18 | Closed += MainWindow_Closed; 19 | } 20 | 21 | private void MainWindow_Unloaded(object sender, RoutedEventArgs e) 22 | { 23 | var appVM = this.DataContext as System.IDisposable; 24 | if (appVM != null) 25 | { 26 | appVM.Dispose(); 27 | } 28 | 29 | this.DataContext = null; 30 | } 31 | 32 | private void MainWindow_Loaded(object sender, RoutedEventArgs e) 33 | { 34 | // Reload settings about last left and right path being shown for merging 35 | Properties.Settings.Default.Reload(); 36 | 37 | string leftDirPath = Properties.Settings.Default.LeftDirPath; 38 | string rightDirPath = Properties.Settings.Default.RightDirPath; 39 | 40 | // Construct AppViewModel and attach to datacontext 41 | var appVM = Factory.ConstructAppViewModel(new AehnlichLib.Dir.DirDiffArgs(leftDirPath, rightDirPath)); 42 | 43 | this.DataContext = appVM; 44 | 45 | appVM.Initialize(leftDirPath, rightDirPath); 46 | } 47 | 48 | private void MainWindow_Closed(object sender, System.EventArgs e) 49 | { 50 | try 51 | { 52 | var appVM = DataContext as IAppViewModel; 53 | if (appVM == null) 54 | return; 55 | 56 | Properties.Settings.Default.LeftDirPath = appVM.LeftDirPath; 57 | Properties.Settings.Default.RightDirPath = appVM.RightDirPath; 58 | 59 | Properties.Settings.Default.Save(); 60 | } 61 | catch 62 | { 63 | // Make sure saving values does not crash the app shut down process 64 | } 65 | 66 | try 67 | { 68 | var appVM = DataContext as System.IDisposable; 69 | if (appVM != null) 70 | appVM.Dispose(); 71 | 72 | DataContext = null; 73 | } 74 | catch 75 | { 76 | // Make sure disposing objects does not crash the app shut down process 77 | } 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /source/Demos/Dir/AehnlichDirDemo/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 AehnlichDirDemo.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.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 | [global::System.Configuration.UserScopedSettingAttribute()] 27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 28 | [global::System.Configuration.DefaultSettingValueAttribute("")] 29 | public string LeftDirPath { 30 | get { 31 | return ((string)(this["LeftDirPath"])); 32 | } 33 | set { 34 | this["LeftDirPath"] = value; 35 | } 36 | } 37 | 38 | [global::System.Configuration.UserScopedSettingAttribute()] 39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 40 | [global::System.Configuration.DefaultSettingValueAttribute("")] 41 | public string RightDirPath { 42 | get { 43 | return ((string)(this["RightDirPath"])); 44 | } 45 | set { 46 | this["RightDirPath"] = value; 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /source/Demos/Dir/AehnlichDirDemo/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /source/Demos/Dir/AehnlichDirViewModelLib/Converters/MultiParToParConverter.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichDirViewModelLib.Converters 2 | { 3 | using System; 4 | using System.Globalization; 5 | using System.Windows.Data; 6 | 7 | /// 8 | /// Converts multiple bound objects into one array of s and returns them. 9 | /// 10 | public class MultiParToParConverter : IMultiValueConverter 11 | { 12 | /// 13 | /// Converts multiple bound objects into one array of s and returns them. 14 | /// 15 | /// 16 | /// 17 | /// 18 | /// 19 | /// 20 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 21 | { 22 | if (values == null) 23 | return Binding.DoNothing; 24 | 25 | if (values.Length < 1) 26 | return Binding.DoNothing; 27 | 28 | object[] ret = new object[values.Length]; 29 | for (int i = 0; i < values.Length; i++) 30 | { 31 | ret[i] = values[i]; 32 | } 33 | 34 | return ret; 35 | } 36 | 37 | /// 38 | /// Not implemented. 39 | /// 40 | /// 41 | /// 42 | /// 43 | /// 44 | /// 45 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 46 | { 47 | throw new NotImplementedException(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /source/Demos/Dir/AehnlichDirViewModelLib/Enums/DiffViewModeEnum.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichDirViewModelLib.Enums 2 | { 3 | /// 4 | /// Defines an enumeration of modes in which file and directory diffs can be viewed. 5 | /// 6 | public enum DiffViewModeEnum 7 | { 8 | /// 9 | /// View directories and files in one list. 10 | /// 11 | DirectoriesAndFiles = 0, 12 | 13 | /// 14 | /// View only different files and their names in one list. 15 | /// 16 | FilesOnly = 1 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/Demos/Dir/AehnlichDirViewModelLib/Interfaces/IDiffFileModeItemViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichDirViewModelLib.Interfaces 2 | { 3 | using FsDataLib.Enums; 4 | 5 | /// 6 | /// Implements an interface to a viewmodel for a directory comparison mode that is used 7 | /// to compare one directory and its contents to another directory. 8 | /// 9 | /// Each mode is based on (combination) of a set of properties: 10 | /// 1- File Length 11 | /// 2- Modification Date, and or 12 | /// 3- Byte-by-Byte Comparison 13 | /// 14 | /// The first two modes (or a combination of them) is usually very fast 15 | /// and yields the same results as the last mode (or a combination with the last mode). 16 | /// 17 | /// But the last mode is very slow by comparison which is why it makes sense to offer 18 | /// these as a user controlled option. 19 | /// 20 | public interface IDiffFileModeItemViewModel 21 | { 22 | /// 23 | /// Gets a display name of this item. 24 | /// 25 | string Name { get; } 26 | 27 | /// 28 | /// Gets a diescription of this item. 29 | /// 30 | string Description { get; } 31 | 32 | /// 33 | /// Gets a based a key value 34 | /// that is unique for the combination of file comparison modes defined in this item. 35 | /// 36 | DiffDirFileMode ModeKey { get; } 37 | 38 | /// 39 | /// Gets an based key value that is unique 40 | /// for the combination of file comparison modes defined in this item. 41 | /// 42 | uint Key { get; } 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /source/Demos/Dir/AehnlichDirViewModelLib/Interfaces/IFileDiffModeViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichDirViewModelLib.Interfaces 2 | { 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | 6 | /// 7 | /// Implements an interface to a viewmodel that defines a comparison strategy for files 8 | /// (using lastupdate, size in bytes, and/or byte-by-byte comparison) 9 | /// 10 | public interface IFileDiffModeViewModel : INotifyPropertyChanged 11 | { 12 | /// 13 | /// Gets a list of modies that can be used to compare one directory 14 | /// and its contents, to the other directory. 15 | /// 16 | List DiffFileModes { get; } 17 | 18 | /// 19 | /// Gets/sets the mode that is currently used to compare one directory 20 | /// and its contents with the other directory. 21 | /// 22 | IDiffFileModeItemViewModel DiffFileModeSelected { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /source/Demos/Dir/AehnlichDirViewModelLib/Interfaces/IListItemViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichDirViewModelLib.Interfaces 2 | { 3 | /// 4 | /// Defines an item in a list for usage/binding to an ItemsControl's ItemsSource 5 | /// (eg. ListBox, ComboBox ...) 6 | /// 7 | public interface IListItemViewModel 8 | { 9 | /// 10 | /// Gets the name of the item in the list. 11 | /// 12 | string Name { get; } 13 | 14 | /// 15 | /// Gets a unique integer key of the item in the list. 16 | /// 17 | int Key { get; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /source/Demos/Dir/AehnlichDirViewModelLib/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("AehnlichDirViewModelLib")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("AehnlichDirViewModelLib")] 12 | [assembly: AssemblyCopyright("Copyright © 2019")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("920650a5-c019-4e33-ad92-04bc77bd59b0")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /source/Demos/Dir/AehnlichDirViewModelLib/ViewModels/Base/ViewModelBase.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichDirViewModelLib.ViewModels.Base 2 | { 3 | using System; 4 | using System.ComponentModel; 5 | using System.Linq.Expressions; 6 | 7 | /// 8 | /// Implements a base class for all viewmodel classes 9 | /// that implements interface for binding. 10 | /// 11 | internal class ViewModelBase : INotifyPropertyChanged 12 | { 13 | /// 14 | /// Standard implementation of . 15 | /// 16 | public event PropertyChangedEventHandler PropertyChanged; 17 | 18 | /// 19 | /// Tell bound controls (via WPF binding) to refresh their display. 20 | /// 21 | /// Sample call: this.NotifyPropertyChanged(() => this.IsSelected); 22 | /// where 'this' is derived from 23 | /// and IsSelected is a property. 24 | /// 25 | /// 26 | /// 27 | public void NotifyPropertyChanged(Expression> property) 28 | { 29 | var lambda = (LambdaExpression)property; 30 | MemberExpression memberExpression; 31 | 32 | if (lambda.Body is UnaryExpression) 33 | { 34 | var unaryExpression = (UnaryExpression)lambda.Body; 35 | memberExpression = (MemberExpression)unaryExpression.Operand; 36 | } 37 | else 38 | { 39 | memberExpression = (MemberExpression)lambda.Body; 40 | } 41 | 42 | this.NotifyPropertyChanged(memberExpression.Member.Name); 43 | } 44 | 45 | /// 46 | /// Tell bound controls (via WPF binding) to refresh their display. 47 | /// Standard implementation through . 48 | /// 49 | /// 50 | protected virtual void NotifyPropertyChanged(string propertyName) 51 | { 52 | this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /source/Demos/Dir/AehnlichDirViewModelLib/ViewModels/Factory.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichDirViewModelLib.ViewModels 2 | { 3 | using AehnlichDirViewModelLib.Interfaces; 4 | using AehnlichLib.Dir; 5 | 6 | /// 7 | /// Implements a factory that constructs, initiates and returns internal objects. 8 | /// 9 | public static class Factory 10 | { 11 | /// 12 | /// Gets an initialized application viewmodel. 13 | /// 14 | /// Options to be used in this directory diff. 15 | /// 16 | public static IAppViewModel ConstructAppViewModel(DirDiffArgs args) 17 | { 18 | return new AppViewModel(args, new FsDataLib.Dir.DirDataSourceFactory()); 19 | } 20 | 21 | /// 22 | /// Gets a viewmodel that supports a simple list based selection from a list of modes. 23 | /// 24 | /// 25 | public static IFileDiffModeViewModel ConstructFileDiffModes() 26 | { 27 | return new FileDiffModeViewModel(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /source/Demos/Dir/AehnlichDirViewModelLib/ViewModels/ListItemViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichDirViewModelLib.ViewModels 2 | { 3 | using AehnlichDirViewModelLib.Interfaces; 4 | 5 | /// 6 | /// Models an item in a list for usage/binding to an ItemsControl's ItemsSource 7 | /// (eg. ListBox, ComboBox ...) 8 | /// 9 | internal class ListItemViewModel : IListItemViewModel 10 | { 11 | #region ctors 12 | /// 13 | /// Class constructor 14 | /// 15 | public ListItemViewModel(string name, int key) 16 | : this() 17 | { 18 | this.Name = name; 19 | this.Key = key; 20 | } 21 | 22 | /// 23 | /// Hidden class constructor 24 | /// 25 | protected ListItemViewModel() 26 | { 27 | } 28 | #endregion ctors 29 | 30 | #region properties 31 | /// 32 | /// Gets the name of the item in the list. 33 | /// 34 | public string Name { get; } 35 | 36 | /// 37 | /// Gets a unique integer key of the item in the list. 38 | /// 39 | public int Key { get; } 40 | #endregion properties 41 | } 42 | } -------------------------------------------------------------------------------- /source/Demos/Dir/AehnlichDirViewModelLib/Views/DirDiffView.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichDirViewModelLib.Views 2 | { 3 | using System.Windows.Controls; 4 | 5 | /// 6 | /// Interaction logic for DirDiffView.xaml 7 | /// 8 | public partial class DirDiffView : UserControl 9 | { 10 | #region ctors 11 | /// 12 | /// Class constructor 13 | /// 14 | public DirDiffView() 15 | { 16 | InitializeComponent(); 17 | } 18 | #endregion ctors 19 | 20 | #region methods 21 | #region Column Width A B Synchronization 22 | private void MainSplitter_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) 23 | { 24 | DiffDir.ColumnWidthA = this.TopColumnA.Width; 25 | DiffDir.ColumnWidthB = this.TopColumnB.Width; 26 | } 27 | 28 | private void MainSplitter_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e) 29 | { 30 | DiffDir.ColumnWidthA = this.TopColumnA.Width; 31 | DiffDir.ColumnWidthB = this.TopColumnB.Width; 32 | } 33 | 34 | /// 35 | /// Eventhandler for the column changed event of the DiffDirView control. 36 | /// 37 | /// The left and right column width of column A and B has changed in the control. 38 | /// -> Synchronze new column sizes with those column sizes of the surrounding control. 39 | /// 40 | /// 41 | /// 42 | private void DiffDir_ColumnWidthChanged(object sender, AehnlichViewLib.Events.ColumnWidthChangedEvent e) 43 | { 44 | this.TopColumnA.Width = e.ColumnWidthA; 45 | this.TopColumnB.Width = e.ColumnWidthB; 46 | } 47 | #endregion Column Width A B Synchronization 48 | #endregion methods 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichFileDemo/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichFileDemo/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 14 | 15 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichFileDemo/App.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichDemo 2 | { 3 | using System.Windows; 4 | 5 | /// 6 | /// Interaction logic for App.xaml 7 | /// 8 | public partial class App : Application 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichFileDemo/DemoTestFiles/ClassTemplate.txt: -------------------------------------------------------------------------------- 1 | 2 | public class 3 | { 4 | #region fields 5 | 6 | #endregion fields 7 | 8 | #region ctors 9 | 10 | #endregion ctors 11 | CTOR 12 | #region properties 13 | 14 | #endregion properties 15 | 16 | #region methods 17 | 18 | #endregion methods 19 | } -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichFileDemo/DemoTestFiles/ClassTemplate1.txt: -------------------------------------------------------------------------------- 1 | 2 | public class 3 | { 4 | #region fields 5 | #endregion fields 6 | 7 | #region ctors 8 | /// 9 | /// Class constructor 10 | /// 11 | 12 | #endregion ctors 13 | 14 | #region properties 15 | 16 | #endregion properties 17 | 18 | #region methods 19 | 20 | #endregion methods 21 | } -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichFileDemo/DemoTestFiles/Empty.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/Demos/TextFileDemo/AehnlichFileDemo/DemoTestFiles/Empty.txt -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichFileDemo/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichFileDemo/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichDemo 2 | { 3 | using AehnlichViewModelsLib.ViewModels; 4 | using System; 5 | using System.Reflection; 6 | using System.Windows; 7 | 8 | /// 9 | /// Interaction logic for MainWindow.xaml 10 | /// 11 | public partial class MainWindow : Window 12 | { 13 | /// 14 | /// class constructor 15 | /// 16 | public MainWindow() 17 | { 18 | InitializeComponent(); 19 | 20 | Loaded += MainWindow_Loaded; 21 | Closed += MainWindow_Closed; 22 | } 23 | 24 | private void MainWindow_Loaded(object sender, RoutedEventArgs e) 25 | { 26 | Loaded -= MainWindow_Loaded; 27 | 28 | string codeBase = Assembly.GetExecutingAssembly().CodeBase; 29 | UriBuilder uri = new UriBuilder(codeBase); 30 | string path = Uri.UnescapeDataString(uri.Path); 31 | var fspath = System.IO.Path.GetDirectoryName(path); 32 | 33 | ////var appVM = Factory.ConstructAppViewModel(fspath + @"\DemoTestFiles\ClassTemplate.txt", 34 | //// fspath + @"\DemoTestFiles\Empty.txt"); 35 | 36 | var appVM = Factory.ConstructAppViewModel(fspath + @"\DemoTestFiles\MyersDiff.txt", 37 | fspath + @"\DemoTestFiles\MyersDiff_V1.txt"); 38 | 39 | ////var appVM = Factory.ConstructAppViewModel(fspath + @"\DemoTestFiles\ClassTemplate.txt", 40 | //// fspath + @"\DemoTestFiles\ClassTemplate1.txt"); 41 | 42 | this.DataContext = appVM; 43 | } 44 | 45 | private void MainWindow_Closed(object sender, EventArgs e) 46 | { 47 | Closed -= MainWindow_Closed; 48 | 49 | var disposeVM = DataContext as IDisposable; 50 | 51 | if (disposeVM != null) 52 | disposeVM.Dispose(); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichFileDemo/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 AehnlichFileDemo.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.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 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichFileDemo/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichFileDemo/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichFileDemo/tilde.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dirkster99/Aehnlich/8264b5613b91014242048d91df213adf58a0df05/source/Demos/TextFileDemo/AehnlichFileDemo/tilde.ico -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/Converters/CompareTypeToBoolConverter.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.Converters 2 | { 3 | using AehnlichLib.Enums; 4 | using System; 5 | using System.Globalization; 6 | using System.Windows.Data; 7 | 8 | 9 | /// 10 | /// Converts a value into a specific bool value 11 | /// and all other values into the other bool value as configured in the properties 12 | /// of this class. 13 | /// 14 | [ValueConversion(typeof(CompareType), typeof(bool))] 15 | public class CompareTypeToBoolConverter : IValueConverter 16 | { 17 | /// 18 | /// Converts a value into a value 19 | /// 20 | /// 21 | /// 22 | /// 23 | /// 24 | /// 25 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 26 | { 27 | if (value == null) 28 | return Binding.DoNothing; 29 | 30 | if (value is CompareType) 31 | { 32 | CompareType val = (CompareType)value; 33 | if (val == CompareType.Binary) 34 | return false; 35 | 36 | return true; 37 | } 38 | 39 | return Binding.DoNothing; 40 | } 41 | 42 | /// 43 | /// Not Implemented. 44 | /// 45 | /// 46 | /// 47 | /// 48 | /// 49 | /// 50 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 51 | { 52 | return Binding.DoNothing; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/Converters/CompareTypeToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.Converters 2 | { 3 | using AehnlichLib.Enums; 4 | using System; 5 | using System.Globalization; 6 | using System.Windows; 7 | using System.Windows.Data; 8 | 9 | 10 | /// 11 | /// Converts a value into a specific bool value 12 | /// and all other values into the other bool value as configured in the properties 13 | /// of this class. 14 | /// 15 | [ValueConversion(typeof(CompareType), typeof(Visibility))] 16 | public class CompareTypeToVisibilityConverter : IValueConverter 17 | { 18 | /// 19 | /// Converts a value into a value 20 | /// 21 | /// 22 | /// 23 | /// 24 | /// 25 | /// 26 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 27 | { 28 | if (value == null) 29 | return Binding.DoNothing; 30 | 31 | if (value is CompareType) 32 | { 33 | CompareType val = (CompareType)value; 34 | if (val == CompareType.Binary) 35 | return Visibility.Collapsed; 36 | 37 | return Visibility.Visible; 38 | } 39 | 40 | return Binding.DoNothing; 41 | } 42 | 43 | /// 44 | /// Not Implemented. 45 | /// 46 | /// 47 | /// 48 | /// 49 | /// 50 | /// 51 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 52 | { 53 | return Binding.DoNothing; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/Converters/EnumMatchToBooleanConverter.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.Converters 2 | { 3 | using System; 4 | using System.Globalization; 5 | using System.Windows.Data; 6 | 7 | /// 8 | /// This converter is used to DataBind Radio Buttons in WPF 9 | /// https://www.wpftutorial.net/RadioButton.html 10 | /// 11 | public class EnumMatchToBooleanConverter : IValueConverter 12 | { 13 | /// 14 | /// Converts an enum based value to determine whether its string is equal to 15 | /// a given parameter or not. This conversion is useful for RadioButton bindings. 16 | /// 17 | /// 18 | /// 19 | /// 20 | /// 21 | /// 22 | public object Convert(object value, Type targetType, 23 | object parameter, CultureInfo culture) 24 | { 25 | if (value == null || parameter == null) 26 | return false; 27 | 28 | string checkValue = value.ToString(); 29 | string targetValue = parameter.ToString(); 30 | return checkValue.Equals(targetValue, 31 | StringComparison.InvariantCultureIgnoreCase); 32 | } 33 | 34 | /// 35 | /// Returns an enum value if the given parameter 36 | /// matches with any of the bound enum members. 37 | /// 38 | /// 39 | /// 40 | /// 41 | /// 42 | /// 43 | public object ConvertBack(object value, Type targetType, 44 | object parameter, CultureInfo culture) 45 | { 46 | if (value == null || parameter == null) 47 | return null; 48 | 49 | bool useValue = (bool)value; 50 | string targetValue = parameter.ToString(); 51 | if (useValue) 52 | return Enum.Parse(targetType, targetValue); 53 | 54 | return null; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/Converters/InlineDilaogToVisibilityPropConverter.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.Converters 2 | { 3 | using AehnlichViewModelsLib.Enums; 4 | using System; 5 | using System.Globalization; 6 | using System.Windows; 7 | using System.Windows.Data; 8 | 9 | /// 10 | /// Converts a value into a configurable 11 | /// value of type . 12 | /// 13 | [ValueConversion(typeof(InlineDialogMode), typeof(Visibility))] 14 | public sealed class InlineDilaogToVisibilityPropConverter : IValueConverter 15 | { 16 | #region constructor 17 | /// 18 | /// Class constructor 19 | /// 20 | public InlineDilaogToVisibilityPropConverter() 21 | { 22 | // set defaults 23 | NoneValue = Visibility.Collapsed; 24 | } 25 | #endregion constructor 26 | 27 | #region properties 28 | /// 29 | /// Gets/sets the value that is associated 30 | /// (converted into) with the None value. 31 | /// 32 | public Visibility NoneValue { get; set; } 33 | #endregion properties 34 | 35 | #region methods 36 | /// 37 | /// Converts a value from the enumeration into 38 | /// a value as configured in the properties of this converter. 39 | /// 40 | /// 41 | /// 42 | /// 43 | /// 44 | /// 45 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 46 | { 47 | if ((value is InlineDialogMode) == false) 48 | return null; 49 | 50 | var val = (InlineDialogMode)value; 51 | 52 | if (val == InlineDialogMode.None) 53 | return NoneValue; 54 | 55 | return Visibility.Visible; 56 | } 57 | 58 | /// 59 | /// NotImplemented 60 | /// 61 | /// 62 | /// 63 | /// 64 | /// 65 | /// 66 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 67 | { 68 | throw new NotImplementedException(); 69 | } 70 | #endregion methods 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/Converters/MultiParToParConverter.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.Converters 2 | { 3 | using System; 4 | using System.Globalization; 5 | using System.Windows.Data; 6 | 7 | /// 8 | /// Converts multiple objects and returns them in one object[] array. 9 | /// 10 | [ValueConversion(typeof(object), typeof(object[]))] 11 | public class MultiParToParConverter : IMultiValueConverter 12 | { 13 | /// 14 | /// Converts multiple objects and returns them in one object[] array. 15 | /// 16 | /// 17 | /// 18 | /// 19 | /// 20 | /// 21 | public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) 22 | { 23 | if (values == null) 24 | return Binding.DoNothing; 25 | 26 | if (values.Length < 1) 27 | return Binding.DoNothing; 28 | 29 | object[] ret = new object[values.Length]; 30 | for (int i = 0; i < values.Length; i++) 31 | { 32 | ret[i] = values[i]; 33 | } 34 | 35 | return ret; 36 | } 37 | 38 | /// 39 | /// Not implemented. 40 | /// 41 | /// 42 | /// 43 | /// 44 | /// 45 | /// 46 | public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) 47 | { 48 | throw new NotImplementedException(); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/Enums/ChangeDiffOptions.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.Enums 2 | { 3 | /// 4 | /// Enumerates different modes of matching text or binary information. 5 | /// 6 | [System.Flags] 7 | public enum ChangeDiffOptions 8 | { 9 | /// 10 | /// All differences are considered different (even white spaces tabs etc). 11 | /// 12 | None = 0, 13 | 14 | /// 15 | /// Ignores lower or upper case differences in text A or B. 16 | /// 17 | IgnoreCase = 1, 18 | 19 | /// 20 | /// Ignores white space differences in text A or B. 21 | /// 22 | IgnoreWhitespace = 2, 23 | 24 | /// 25 | /// Ignores a binary prefix in text A or B. 26 | /// 27 | IgnoreBinaryPrefix = 4 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/Enums/InlineDialogMode.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.Enums 2 | { 3 | /// 4 | /// defines the modes (kinds) of inline dialogs that are supported. 5 | /// 6 | public enum InlineDialogMode 7 | { 8 | /// 9 | /// No inline dialog is being shown. 10 | /// 11 | None, 12 | 13 | /// 14 | /// Showing the Goto Line inline dialog. 15 | /// 16 | Goto, 17 | 18 | /// 19 | /// Showing the Options inline dialog. 20 | /// 21 | Options 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/Enums/ViewSource.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.Enums 2 | { 3 | /// Models a diff (text) document which can be either A (left) or B (right) when comparing 2 documents side by side 4 | public enum ViewSource 5 | { 6 | /// Indicates document A (left) when comparing 2 documents side by side 7 | Left, 8 | 9 | /// Indicates document B (right) when comparing 2 documents side by side 10 | Right 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/Events/CaretPositionChangedEvent.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.Events 2 | { 3 | using System; 4 | 5 | /// Indicates the type of change when comunicating caret changes in a raised event. 6 | public enum CaretChangeType 7 | { 8 | /// The line and column have been changed. 9 | ColumnAndLine, 10 | 11 | /// Only the column has changed. 12 | Column, 13 | 14 | /// Only the line has changed. 15 | Line, 16 | } 17 | 18 | /// Implements an event to indicate a change in the position of a text caret within a text editor. 19 | public class CaretPositionChangedEvent : EventArgs 20 | { 21 | /// class constructor 22 | /// 23 | /// 24 | /// 25 | public CaretPositionChangedEvent(int line, int column, CaretChangeType changeType) 26 | { 27 | ChangeType = changeType; 28 | Column = column; 29 | Line = line; 30 | } 31 | 32 | /// Gets the type of change in caret position this event is indicating. 33 | public CaretChangeType ChangeType { get; } 34 | 35 | /// Gets the X coordinate at which the carret was seen last. 36 | public int Column { get; } 37 | 38 | /// Gets the Y coordinate at which the carret was seen last. 39 | public int Line { get; } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/Events/DocumentPropertyChangedEvent.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.Events 2 | { 3 | using AehnlichViewModelsLib.Enums; 4 | using System; 5 | 6 | /// Indicates the type of change when comunicating document property changes in a raised event. 7 | public enum DocumentPropertyChangeType 8 | { 9 | /// The IsDirty property of the document has changed. 10 | IsDirty, 11 | 12 | /// The document name has changed. 13 | Name 14 | } 15 | 16 | 17 | /// Implements an event to indicate a change in a document property (name, IsDirty). 18 | public class DocumentPropertyChangedEvent : EventArgs 19 | { 20 | #region ctors 21 | /// class constructor 22 | /// 23 | /// 24 | /// 25 | /// 26 | public DocumentPropertyChangedEvent(ViewSource source 27 | , bool isDirty 28 | , string filePath 29 | , DocumentPropertyChangeType changeType) 30 | :this() 31 | { 32 | Source = source; 33 | ChangeType = changeType; 34 | IsDirty = isDirty; 35 | FilePath = filePath; 36 | } 37 | 38 | /// hidden class constructor 39 | protected DocumentPropertyChangedEvent() 40 | { 41 | } 42 | #endregion ctors 43 | 44 | /// Gets the source document that has a property change. 45 | public ViewSource Source { get; } 46 | 47 | /// Gets the type of document property change indicated in this. 48 | public DocumentPropertyChangeType ChangeType { get; } 49 | 50 | /// Gets the name that is available when the event was raised. 51 | public string FilePath { get; } 52 | 53 | /// Gets whether the document was changed without saving to file system, or not, when the event was raised. 54 | public bool IsDirty { get; } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/Interfaces/IDiffLineViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.Interfaces 2 | { 3 | using AehnlichLib.Text; 4 | using AehnlichViewLib.Interfaces; 5 | using AehnlichViewModelsLib.Enums; 6 | using AehnlichViewModelsLib.ViewModels.LineInfo; 7 | using System.ComponentModel; 8 | 9 | /// 10 | /// Implements a viewmodel that provides the data necessary to show highlighting 11 | /// and text content for one line in the textual diff view. 12 | /// 13 | public interface IDiffLineViewModel : IDiffLineInfo, INotifyPropertyChanged 14 | { 15 | #region properties 16 | /// 17 | /// Gets the original text that was used when comparing this line to its 18 | /// line. 19 | /// 20 | string Text { get; } 21 | 22 | /// 23 | /// Gets the equivalent line from the left view to the right view 24 | /// and vice versa. 25 | /// 26 | DiffViewLine Counterpart { get; } 27 | #endregion properties 28 | 29 | /// 30 | /// Matches this line against its counterpart model line and 31 | /// outputs an edit script to highlight operations necessary 32 | /// to transfer this line's content into the content of the other line. 33 | /// 34 | /// 35 | /// 36 | /// 37 | EditScript GetChangeEditScript(ChangeDiffOptions changeDiffOptions, int spacesPerTab); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/Interfaces/IDiffLines.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.Interfaces 2 | { 3 | using AehnlichViewModelsLib.ViewModels; 4 | using System.Collections.Generic; 5 | 6 | /// 7 | /// Defines an interface to an object that contains a list of viewmodel 8 | /// objects that describe the difference in each line of text when compared 9 | /// to another text document. 10 | /// 11 | internal interface IDiffLines 12 | { 13 | /// 14 | /// Gets a collection of viewmodel objects that describe each line of text 15 | /// and whether they are equal or inequal and what the degree of equality is ... 16 | /// 17 | IReadOnlyCollection DocLineDiffs { get; } 18 | 19 | int[] DiffEndLines { get; } 20 | int[] DiffStartLines { get; } 21 | 22 | /// 23 | /// Maximum imaginary line number which incorporates not only real text lines 24 | /// but also imaginary line that where inserted on either side of the comparison 25 | /// view to sync both sides into a consistent display. 26 | /// 27 | int MaxImaginaryLineNumber { get; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/Interfaces/IDiffSideTextViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.ViewModels 2 | { 3 | using AehnlichViewLib.Controls.AvalonEditEx; 4 | using AehnlichViewLib.Enums; 5 | using ICSharpCode.AvalonEdit.Document; 6 | using System.ComponentModel; 7 | using System.Text; 8 | 9 | /// 10 | /// Defines an API for a text viewmodel for AvalonEdit that supports requirements for 11 | /// 1) Comparing text (with background diff highlighting) or 12 | /// 2) Editing text (without background diff highlighting) (see for more details). 13 | /// 14 | public interface IDiffSideTextViewModel : INotifyPropertyChanged 15 | { 16 | /// Gets the viewmodel of the attached AvalonEdit text editor control. 17 | TextDocument Document { get; } 18 | 19 | /// Gets the encoding of the text hosted in this viewmodel 20 | Encoding TextEncoding { get; } 21 | 22 | /// Gets/sets whether the currently shown text in the textedior has been changed 23 | /// without saving or not. 24 | bool IsDirty { get; set; } 25 | 26 | /// Gets whether the text displayed in the diff should be editable or not. 27 | bool IsReadOnly { get; } 28 | 29 | /// Gets a human readable reason why this might be readonly. 30 | string IsReadOnlyReason { get; } 31 | 32 | /// Gets the name of the file from which the content in this viewmodel was red. 33 | string FileName { get; } 34 | 35 | /// Gets a view mode indicating whether we are comparing text or editing text. 36 | DisplayMode ViewMode { get; } 37 | 38 | /// Gets the original text (not necessarily changed by editor). 39 | string OriginalText { get; } 40 | 41 | /// Gets the textbox controller that is used to drive the view 42 | /// from within the viewmodel (with event based commands like goto line x,y). 43 | TextBoxController TxtControl { get; } 44 | 45 | /// Gets the column of the text cursor position. 46 | int Column { get; } 47 | 48 | /// Gets the line of the text cursor position. 49 | int Line { get; } 50 | } 51 | } -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/Interfaces/IDiffSideViewModelParent.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.Interfaces 2 | { 3 | using AehnlichViewModelsLib.Enums; 4 | 5 | /// An Interface that is used to message document property changes back to root of a document viewmodel. 6 | internal interface IDiffSideViewModelParent 7 | { 8 | /// The parent viewmodel supports this callback method to inform the parent that the IsDirty property has changed its value. 9 | /// 10 | /// 11 | /// 12 | void IsDirtyChangedCallback(ViewSource source, bool oldValue, bool newValue); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/Interfaces/IDiffViewPosition.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.ViewModels 2 | { 3 | using System; 4 | using System.ComponentModel; 5 | 6 | /// 7 | /// Defines the public properties and methods of the diff view position object 8 | /// which can be used to locate a location in text (via columns and lines). 9 | /// 10 | public interface IDiffViewPosition : IEquatable, INotifyPropertyChanged 11 | { 12 | #region Properties 13 | /// 14 | /// Gets/sets the column of a display position. 15 | /// 16 | int Column { get; set; } 17 | 18 | /// 19 | /// Gets/sets the line of a display position. 20 | /// 21 | int Line { get; set; } 22 | #endregion Properties 23 | 24 | #region Methods 25 | /// 26 | /// Gets a number equal zero if both positions refer to the same location. 27 | /// Returns otherwise a non-zero integer value. 28 | /// 29 | /// 30 | /// 31 | int CompareTo(IDiffViewPosition position); 32 | 33 | /// 34 | /// Gets whether a the positions is equal to this position or not. 35 | /// 36 | /// 37 | /// 38 | bool Equals(object obj); 39 | 40 | /// 41 | /// Serves as the default hash function. 42 | /// 43 | /// A hash code for the current object. 44 | int GetHashCode(); 45 | #endregion Methods 46 | } 47 | } -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/Interfaces/IGotoLineControllerViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.ViewModels 2 | { 3 | using System.ComponentModel; 4 | using System.Windows.Input; 5 | 6 | /// 7 | /// Defines base properties and methods that should be implemented by all inline dialogs. 8 | /// 9 | public interface IControllerBase : INotifyPropertyChanged 10 | { 11 | /// 12 | /// Gets a command that closes the dialog via the delegate function 13 | /// that was supplied at constructor time of this object. 14 | /// 15 | ICommand CloseDialogCommand { get; } 16 | } 17 | 18 | 19 | /// 20 | /// Defines public properties and methods of the Goto Line Dialog Controller ViewModel. 21 | /// 22 | public interface IOptionsControllerViewModel : IControllerBase, INotifyPropertyChanged 23 | { 24 | 25 | } 26 | 27 | /// 28 | /// Defines public properties and methods of the Goto Line Dialog Controller ViewModel. 29 | /// 30 | public interface IGotoLineControllerViewModel : IControllerBase, INotifyPropertyChanged 31 | { 32 | /// 33 | /// Gets the minimum linenumber value. 34 | /// 35 | uint MinLineValue { get; set; } 36 | 37 | /// 38 | /// Gets the maximum linenumber value. 39 | /// 40 | uint MaxLineValue { get; set; } 41 | 42 | /// 43 | /// Gets the actual linenumber value. 44 | /// 45 | uint Value { get; set; } 46 | 47 | /// 48 | /// Gets a tool tip that hints legal values using minium and maximum as bounds. 49 | /// 50 | string GotoLineToolTip { get; } 51 | 52 | /// 53 | /// Gets a command to scroll a view to the requested line number 54 | /// via the Action that was supplied at constructor time of of the object. 55 | /// 56 | ICommand GotoThisLineCommand { get; } 57 | } 58 | } -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("AehnlichViewModelsLib")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("AehnlichViewModelsLib")] 12 | [assembly: AssemblyCopyright("Copyright © 2019")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("4cdcebd2-5062-453e-b9af-f66811c3e31a")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/ViewModels/Base/ModelBase.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.ViewModels.Base 2 | { 3 | /// 4 | /// Models a base objects that can access a service container. 5 | /// 6 | public class ModelBase 7 | { 8 | /// 9 | /// Gets an instance of the service container and retrieves the requested service coponent. 10 | /// 11 | /// 12 | /// 13 | public TServiceContract GetService() where TServiceContract : class 14 | { 15 | return ServiceLocator.ServiceContainer.Instance.GetService(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/ViewModels/Base/ViewModelBase.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.ViewModels.Base 2 | { 3 | using System; 4 | using System.ComponentModel; 5 | using System.Linq.Expressions; 6 | 7 | /// 8 | /// Implements a base class for all viewmodel classes 9 | /// that implements interface for binding. 10 | /// 11 | internal class ViewModelBase : ModelBase, INotifyPropertyChanged 12 | { 13 | /// 14 | /// Standard implementation of . 15 | /// 16 | public event PropertyChangedEventHandler PropertyChanged; 17 | 18 | /// 19 | /// Tell bound controls (via WPF binding) to refresh their display. 20 | /// 21 | /// Sample call: this.NotifyPropertyChanged(() => this.IsSelected); 22 | /// where 'this' is derived from 23 | /// and IsSelected is a property. 24 | /// 25 | /// 26 | /// 27 | public void NotifyPropertyChanged(Expression> property) 28 | { 29 | var lambda = (LambdaExpression)property; 30 | MemberExpression memberExpression; 31 | 32 | if (lambda.Body is UnaryExpression) 33 | { 34 | var unaryExpression = (UnaryExpression)lambda.Body; 35 | memberExpression = (MemberExpression)unaryExpression.Operand; 36 | } 37 | else 38 | { 39 | memberExpression = (MemberExpression)lambda.Body; 40 | } 41 | 42 | this.NotifyPropertyChanged(memberExpression.Member.Name); 43 | } 44 | 45 | /// 46 | /// Tell bound controls (via WPF binding) to refresh their display. 47 | /// Standard implementation through . 48 | /// 49 | /// 50 | protected virtual void NotifyPropertyChanged(string propertyName) 51 | { 52 | this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/ViewModels/Dialogs/DialogtTemplateSelector.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.ViewModels.Dialogs 2 | { 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | 6 | /// 7 | /// This determines the view to be shown for each viewmodel 8 | /// that is associated with the different inline dialogs. 9 | /// 10 | internal class DialogtTemplateSelector : DataTemplateSelector 11 | { 12 | /// 13 | /// Gets the view that is used to adjust options 14 | /// and settings for a particular directory comparison. 15 | /// 16 | public DataTemplate GotoLineDialog { get; set; } 17 | 18 | /// 19 | /// Gets the view that is used to display directory diff results and browse the 20 | /// directory structure. 21 | /// 22 | public DataTemplate OptionsDialog { get; set; } 23 | 24 | /// 25 | /// Returns a based on custom logic. 26 | /// 27 | /// The data object for which to select the template. 28 | /// The data-bound object. 29 | /// Returns a or null. The default value is null. 30 | public override DataTemplate SelectTemplate(object item, DependencyObject container) 31 | { 32 | if (item is GotoLineControllerViewModel) 33 | return GotoLineDialog; 34 | 35 | if (item is OptionsControllerViewModel) 36 | return OptionsDialog; 37 | 38 | return base.SelectTemplate(item, container); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/ViewModels/Factory.cs: -------------------------------------------------------------------------------- 1 | using AehnlichLib.Enums; 2 | 3 | namespace AehnlichViewModelsLib.ViewModels 4 | { 5 | /// 6 | /// Implements a factory that constructs, initiates and returns internal objects. 7 | /// 8 | public static class Factory 9 | { 10 | /// 11 | /// Gets an initialized application viewmodel. 12 | /// 13 | /// 14 | /// 15 | /// 16 | /// 17 | public static IAppViewModel ConstructAppViewModel(string fileA, string fileB, 18 | CompareType compareAs) 19 | { 20 | return new AppViewModel(fileA, fileB, compareAs); 21 | } 22 | 23 | /// 24 | /// Gets an initialized application viewmodel. 25 | /// 26 | /// 27 | /// 28 | /// 29 | public static IAppViewModel ConstructAppViewModel(string fileA, string fileB) 30 | { 31 | return new AppViewModel(fileA, fileB, CompareType.Auto); 32 | } 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/ViewModels/Suggest/ISuggestSourceViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.ViewModels.Suggest 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.ComponentModel; 6 | using System.Threading.Tasks; 7 | using System.Windows.Input; 8 | 9 | /// 10 | /// Defines a suggestion object to generate suggestions 11 | /// based on sub entries of specified string. 12 | /// 13 | public interface ISuggestSourceViewModel : IDisposable, INotifyPropertyChanged 14 | { 15 | /// 16 | /// Gets the path of file A in the comparison. 17 | /// 18 | string FilePath { get; set; } 19 | 20 | /// 21 | /// Gets whether the last query text was valid or invalid. 22 | /// 23 | bool IsTextValid { get; } 24 | 25 | /// 26 | /// Gets a collection of items that represent likely suggestions towards 27 | /// a previously entered text. 28 | /// 29 | IEnumerable ListQueryResult { get; } 30 | 31 | /// 32 | /// Gets a command that queries a sub-system in order to resolve a query 33 | /// based on a previously entered text. The entered text is expected as 34 | /// parameter of this command. 35 | /// 36 | ICommand SuggestTextChangedCommand { get; } 37 | 38 | /// 39 | /// Method returns a task that returns a list of suggestion objects 40 | /// that are associated to the string. 41 | /// 42 | /// 43 | /// 44 | Task SuggestAsync(string input); 45 | } 46 | } -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/ViewModels/Suggest/SuggestQueryResultModel.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.ViewModels.Suggest 2 | { 3 | using System.Collections.Generic; 4 | 5 | /// 6 | /// Implements a simple model to capture the result a query towards an entered text. 7 | /// 8 | public class SuggestQueryResultModel 9 | { 10 | /// 11 | /// Class constructor 12 | /// 13 | public SuggestQueryResultModel(List lst, bool validInput = true) 14 | { 15 | ResultList = lst; 16 | ValidInput = validInput; 17 | } 18 | 19 | /// 20 | /// Class constructor 21 | /// 22 | public SuggestQueryResultModel() 23 | { 24 | ResultList = new List(); 25 | ValidInput = true; 26 | } 27 | 28 | /// 29 | /// Gets the list of objects that represents a likely suggestion towards an entered text. 30 | /// 31 | public List ResultList { get; } 32 | 33 | /// 34 | /// specifies whether the entered text was considered valid or not. 35 | /// 36 | public bool ValidInput { get; } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/Views/GotoControl.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.Views 2 | { 3 | using System.Windows.Controls; 4 | 5 | /// 6 | /// Interaction logic for GotoControl.xaml 7 | /// 8 | public partial class GotoControl : UserControl 9 | { 10 | /// 11 | /// Class constructor 12 | /// 13 | public GotoControl() 14 | { 15 | InitializeComponent(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/Views/OptionsControl.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace AehnlichViewModelsLib.Views 2 | { 3 | using System.Windows.Controls; 4 | 5 | /// 6 | /// Interaction logic for OptionsControl.xaml 7 | /// 8 | public partial class OptionsControl : UserControl 9 | { 10 | /// 11 | /// Class constructor 12 | /// 13 | public OptionsControl() 14 | { 15 | InitializeComponent(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /source/Demos/TextFileDemo/AehnlichViewModelsLib/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /source/FsDataLib/Dir/DirDataSourceFactory.cs: -------------------------------------------------------------------------------- 1 | namespace FsDataLib.Dir 2 | { 3 | using FsDataLib.Interfaces.Dir; 4 | 5 | /// 6 | /// Provides factory routines to create data source objects 7 | /// that implement 8 | /// on Windows file system objects. 9 | /// 10 | public class DirDataSourceFactory : IDataSourceFactory 11 | { 12 | /// 13 | /// Creates a new provider and returns it. 14 | /// 15 | public IDataSource CreateDataSource() 16 | { 17 | return new DirDataSource(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /source/FsDataLib/Enums/FileType.cs: -------------------------------------------------------------------------------- 1 | namespace FsDataLib.Enums 2 | { 3 | /// Enumerates types that can be applicable to a given file. 4 | public enum FileType 5 | { 6 | /// The type of file is not known, yet. 7 | /// This is a default that should normally never be encountered in real life. 8 | Unknown, 9 | 10 | /// The file does not exist in file system and can those not be described in more detail. 11 | NotExisting, 12 | 13 | /// The file is a binary file (e.: image, sound, video). 14 | Binary, 15 | 16 | /// The file is a text file (e.: C# code, mark down, txt). 17 | Text, 18 | 19 | /// The file is an XML file. 20 | Xml 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /source/FsDataLib/Interfaces/Dir/IDataSourceFactory.cs: -------------------------------------------------------------------------------- 1 | namespace FsDataLib.Interfaces.Dir 2 | { 3 | /// 4 | /// Provides factory routines to create data source objects 5 | /// that implement 6 | /// on Windows file system objects. 7 | /// 8 | public interface IDataSourceFactory 9 | { 10 | /// 11 | /// Creates a new provider and returns it. 12 | /// 13 | IDataSource CreateDataSource(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /source/FsDataLib/Interfaces/Dir/IFileInfo.cs: -------------------------------------------------------------------------------- 1 | using FsDataLib.Enums; 2 | 3 | namespace FsDataLib.Interfaces.Dir 4 | { 5 | /// Defines methods/properties of an object representing a file. 6 | public interface IFileInfo : IFileSystemInfo 7 | { 8 | #region properties 9 | /// 10 | /// Gets the size, in bytes, of the current file. 11 | /// 12 | long Length { get; } 13 | 14 | /// Gets the type of file (binary, text, xml, not existing) 15 | FileType Is { get; } 16 | 17 | /// Gets a value indicating whether this FILE exists. 18 | /// true if the FILE exists; otherwise, false. 19 | bool FileExists { get; } 20 | #endregion properties 21 | 22 | #region methods 23 | 24 | #endregion methods 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /source/FsDataLib/Interfaces/Dir/IFileSystemInfo.cs: -------------------------------------------------------------------------------- 1 | namespace FsDataLib.Interfaces.Dir 2 | { 3 | /// Defines common methods/properties of an object representing a file or directory. 4 | public interface IFileSystemInfo 5 | { 6 | /// 7 | /// Gets the full path of the directory or file. 8 | /// 9 | /// Exceptions: 10 | /// T:System.IO.PathTooLongException: 11 | /// The fully qualified path and file name is 260 or more characters. 12 | /// 13 | /// T:System.Security.SecurityException: 14 | /// The caller does not have the required permission. 15 | /// 16 | /// A string containing the full path. 17 | string FullName { get; } 18 | 19 | /// 20 | /// For files, gets the name of the file. For directories, gets the name of the last 21 | /// directory in the hierarchy if a hierarchy exists. Otherwise, the Name property 22 | /// gets the name of the directory. 23 | /// 24 | /// 25 | /// A string that is the name of the parent directory, the name of the last directory 26 | /// in the hierarchy, or the name of a file, including the file name extension. 27 | /// 28 | string Name { get; } 29 | 30 | /// 31 | /// Gets the time when the current file or directory was last written to. 32 | /// 33 | /// Returns: 34 | /// The time the current file was last written. 35 | /// 36 | /// Exceptions: 37 | /// T:System.IO.IOException: 38 | /// System.IO.FileSystemInfo.Refresh cannot initialize the data. 39 | /// 40 | /// T:System.PlatformNotSupportedException: 41 | /// The current operating system is not Windows NT or later. 42 | /// 43 | /// T:System.ArgumentOutOfRangeException: 44 | /// The caller attempts to set an invalid write time. 45 | /// 46 | System.DateTime LastWriteTime { get; } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /source/FsDataLib/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("FsDataLib")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("FsDataLib")] 12 | [assembly: AssemblyCopyright("Copyright © 2019")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("6c8f39a8-965b-4f96-b0dc-5c731519ac65")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | --------------------------------------------------------------------------------