├── .gitattributes
├── .github
├── CONTRIBUTING.md
└── FUNDING.yml
├── .gitignore
├── CHANGELOG.md
├── DONATING.md
├── LICENSE.txt
├── README.md
├── Rakefile
├── SyncTrayzor.png
├── build
├── 7za.exe
├── CsprojResxWriter.rb
├── TxClient.rb
└── vswhere.exe
├── chocolatey
├── synctrayzor.nuspec
└── tools
│ ├── VERIFICATION.txt
│ └── chocolateyinstall.ps1
├── installer
├── certnotes.txt
├── common.iss
├── dotNet472Setup.exe
├── icon.bmp
├── x64
│ ├── installer-x64.iss
│ ├── ucrt
│ │ ├── api-ms-win-core-console-l1-1-0.dll
│ │ ├── api-ms-win-core-console-l1-2-0.dll
│ │ ├── api-ms-win-core-datetime-l1-1-0.dll
│ │ ├── api-ms-win-core-debug-l1-1-0.dll
│ │ ├── api-ms-win-core-errorhandling-l1-1-0.dll
│ │ ├── api-ms-win-core-file-l1-1-0.dll
│ │ ├── api-ms-win-core-file-l1-2-0.dll
│ │ ├── api-ms-win-core-file-l2-1-0.dll
│ │ ├── api-ms-win-core-handle-l1-1-0.dll
│ │ ├── api-ms-win-core-heap-l1-1-0.dll
│ │ ├── api-ms-win-core-interlocked-l1-1-0.dll
│ │ ├── api-ms-win-core-libraryloader-l1-1-0.dll
│ │ ├── api-ms-win-core-localization-l1-2-0.dll
│ │ ├── api-ms-win-core-memory-l1-1-0.dll
│ │ ├── api-ms-win-core-namedpipe-l1-1-0.dll
│ │ ├── api-ms-win-core-processenvironment-l1-1-0.dll
│ │ ├── api-ms-win-core-processthreads-l1-1-0.dll
│ │ ├── api-ms-win-core-processthreads-l1-1-1.dll
│ │ ├── api-ms-win-core-profile-l1-1-0.dll
│ │ ├── api-ms-win-core-rtlsupport-l1-1-0.dll
│ │ ├── api-ms-win-core-string-l1-1-0.dll
│ │ ├── api-ms-win-core-synch-l1-1-0.dll
│ │ ├── api-ms-win-core-synch-l1-2-0.dll
│ │ ├── api-ms-win-core-sysinfo-l1-1-0.dll
│ │ ├── api-ms-win-core-timezone-l1-1-0.dll
│ │ ├── api-ms-win-core-util-l1-1-0.dll
│ │ ├── api-ms-win-crt-conio-l1-1-0.dll
│ │ ├── api-ms-win-crt-convert-l1-1-0.dll
│ │ ├── api-ms-win-crt-environment-l1-1-0.dll
│ │ ├── api-ms-win-crt-filesystem-l1-1-0.dll
│ │ ├── api-ms-win-crt-heap-l1-1-0.dll
│ │ ├── api-ms-win-crt-locale-l1-1-0.dll
│ │ ├── api-ms-win-crt-math-l1-1-0.dll
│ │ ├── api-ms-win-crt-multibyte-l1-1-0.dll
│ │ ├── api-ms-win-crt-private-l1-1-0.dll
│ │ ├── api-ms-win-crt-process-l1-1-0.dll
│ │ ├── api-ms-win-crt-runtime-l1-1-0.dll
│ │ ├── api-ms-win-crt-stdio-l1-1-0.dll
│ │ ├── api-ms-win-crt-string-l1-1-0.dll
│ │ ├── api-ms-win-crt-time-l1-1-0.dll
│ │ ├── api-ms-win-crt-utility-l1-1-0.dll
│ │ └── ucrtbase.dll
│ └── vc++
│ │ ├── concrt140.dll
│ │ ├── msvcp140.dll
│ │ ├── vccorlib140.dll
│ │ └── vcruntime140.dll
└── x86
│ ├── installer-x86.iss
│ ├── ucrt
│ ├── API-MS-Win-core-xstate-l2-1-0.dll
│ ├── api-ms-win-core-console-l1-1-0.dll
│ ├── api-ms-win-core-console-l1-2-0.dll
│ ├── api-ms-win-core-datetime-l1-1-0.dll
│ ├── api-ms-win-core-debug-l1-1-0.dll
│ ├── api-ms-win-core-errorhandling-l1-1-0.dll
│ ├── api-ms-win-core-file-l1-1-0.dll
│ ├── api-ms-win-core-file-l1-2-0.dll
│ ├── api-ms-win-core-file-l2-1-0.dll
│ ├── api-ms-win-core-handle-l1-1-0.dll
│ ├── api-ms-win-core-heap-l1-1-0.dll
│ ├── api-ms-win-core-interlocked-l1-1-0.dll
│ ├── api-ms-win-core-libraryloader-l1-1-0.dll
│ ├── api-ms-win-core-localization-l1-2-0.dll
│ ├── api-ms-win-core-memory-l1-1-0.dll
│ ├── api-ms-win-core-namedpipe-l1-1-0.dll
│ ├── api-ms-win-core-processenvironment-l1-1-0.dll
│ ├── api-ms-win-core-processthreads-l1-1-0.dll
│ ├── api-ms-win-core-processthreads-l1-1-1.dll
│ ├── api-ms-win-core-profile-l1-1-0.dll
│ ├── api-ms-win-core-rtlsupport-l1-1-0.dll
│ ├── api-ms-win-core-string-l1-1-0.dll
│ ├── api-ms-win-core-synch-l1-1-0.dll
│ ├── api-ms-win-core-synch-l1-2-0.dll
│ ├── api-ms-win-core-sysinfo-l1-1-0.dll
│ ├── api-ms-win-core-timezone-l1-1-0.dll
│ ├── api-ms-win-core-util-l1-1-0.dll
│ ├── api-ms-win-crt-conio-l1-1-0.dll
│ ├── api-ms-win-crt-convert-l1-1-0.dll
│ ├── api-ms-win-crt-environment-l1-1-0.dll
│ ├── api-ms-win-crt-filesystem-l1-1-0.dll
│ ├── api-ms-win-crt-heap-l1-1-0.dll
│ ├── api-ms-win-crt-locale-l1-1-0.dll
│ ├── api-ms-win-crt-math-l1-1-0.dll
│ ├── api-ms-win-crt-multibyte-l1-1-0.dll
│ ├── api-ms-win-crt-private-l1-1-0.dll
│ ├── api-ms-win-crt-process-l1-1-0.dll
│ ├── api-ms-win-crt-runtime-l1-1-0.dll
│ ├── api-ms-win-crt-stdio-l1-1-0.dll
│ ├── api-ms-win-crt-string-l1-1-0.dll
│ ├── api-ms-win-crt-time-l1-1-0.dll
│ ├── api-ms-win-crt-utility-l1-1-0.dll
│ └── ucrtbase.dll
│ └── vc++
│ ├── concrt140.dll
│ ├── msvcp140.dll
│ ├── vccorlib140.dll
│ └── vcruntime140.dll
├── lib
├── Itenso.Windows.Controls.ListViewLayout.dll
├── Itenso.Windows.Controls.ListViewLayout.pdb
├── x64
│ └── Interop.NETWORKLIST.dll
└── x86
│ └── Interop.NETWORKLIST.dll
├── readme
└── screenshot.png
├── security
├── README.md
├── syncthing_releases_cert.asc
└── synctrayzor_releases_cert.asc
├── server
├── survey.php
└── version_check.php
└── src
├── ChecksumUtil
├── App.config
├── ChecksumUtil.csproj
├── Program.cs
└── Properties
│ └── AssemblyInfo.cs
├── PortableInstaller
├── App.config
├── PortableInstaller.csproj
├── Program.cs
└── Properties
│ └── AssemblyInfo.cs
├── ProcessRunner
├── App.config
├── GlobalSuppressions.cs
├── Options.cs
├── ProcessRunner.csproj
├── Program.cs
└── Properties
│ └── AssemblyInfo.cs
├── SyncTrayzor.sln
└── SyncTrayzor
├── App.Installer.config.xslt
├── App.config
├── App.xaml
├── App.xaml.cs
├── Bootstrapper.cs
├── Design
├── DummyFileTransfersTrayViewModel.cs
└── ViewModelLocator.cs
├── FodyWeavers.xml
├── GlobalSuppressions.cs
├── Icons
├── alert_tray.ico
├── alert_tray.svg
├── default.ico
├── default.svg
├── default_tray.ico
├── paused_tray.ico
├── paused_tray.svg
├── stopped.ico
├── stopped.svg
├── syncing_2.ico
├── syncing_2.svg
├── syncing_3.ico
├── syncing_3.svg
├── syncing_4.ico
└── syncing_4.svg
├── Localization
├── CustomPluralLocalizationFormatter.cs
├── LocExtension.cs
├── LocalizeConverters.cs
└── Localizer.cs
├── NotifyIcon
├── BalloonConductor.cs
├── ConnectedEventDebouncer.cs
├── NotifyIconManager.cs
├── NotifyIconResolutionUtilities.cs
├── NotifyIconViewModel.cs
└── TaskbarIconResources.xaml
├── Pages
├── AboutView.xaml
├── AboutViewModel.cs
├── BarAlerts
│ ├── AlertSeverity.cs
│ ├── AlertSeverityToBackgroundColorConverter.cs
│ ├── BarAlertsView.xaml
│ ├── BarAlertsViewModel.cs
│ ├── ConflictsAlertView.xaml
│ ├── ConflictsAlertViewModel.cs
│ ├── FailedTransfersAlertView.xaml
│ ├── FailedTransfersAlertViewModel.cs
│ ├── IBarAlert.cs
│ ├── IntelXeGraphicsAlertView.xaml
│ ├── IntelXeGraphicsAlertViewModel.cs
│ ├── PausedDevicesFromMeteringView.xaml
│ ├── PausedDevicesFromMeteringView.xaml.cs
│ └── PausedDevicesFromMeteringViewModel.cs
├── ConflictResolution
│ ├── ConflictOptionViewModel.cs
│ ├── ConflictResolutionView.xaml
│ ├── ConflictResolutionViewModel.cs
│ ├── ConflictViewModel.cs
│ ├── MultipleConflictsResolutionView.xaml
│ ├── MultipleConflictsResolutionViewModel.cs
│ ├── SingleConflictResolutionView.xaml
│ └── SingleConflictResolutionViewModel.cs
├── ConsoleView.xaml
├── ConsoleViewModel.cs
├── NewVersionAlertToastView.xaml
├── NewVersionAlertToastViewModel.cs
├── NewVersionAlertView.xaml
├── NewVersionAlertViewModel.cs
├── NewVersionInstalledToastView.xaml
├── NewVersionInstalledToastViewModel.cs
├── Settings
│ ├── KeyValueStringParser.cs
│ ├── SettingItem.cs
│ ├── SettingsView.xaml
│ ├── SettingsViewModel.cs
│ ├── SyncthingAddressValidator.cs
│ ├── SyncthingCommandLineFlagsValidator.cs
│ └── SyncthingEnvironmentalVariablesValidator.cs
├── ShellView.xaml
├── ShellViewModel.cs
├── ThirdPartyComponentsView.xaml
├── ThirdPartyComponentsViewModel.cs
├── Tray
│ ├── FileTransferViewModel.cs
│ ├── FileTransfersTrayView.xaml
│ ├── FileTransfersTrayViewModel.cs
│ ├── NetworkGraphView.xaml
│ └── NetworkGraphViewModel.cs
├── UnhandledExceptionView.xaml
├── UnhandledExceptionViewModel.cs
├── ViewerView.xaml
└── ViewerViewModel.cs
├── Properties
├── AssemblyInfo.cs
├── Resources.Designer.cs
└── Resources.resx
├── Resources
└── Licenses
│ ├── BouncyCastle.txt
│ ├── CEF.txt
│ ├── CefSharp.txt
│ ├── FluentValidation.txt
│ ├── Fody.txt
│ ├── Json.NET.txt
│ ├── ListViewLayoutManager.txt
│ ├── LongPath.txt
│ ├── Mono.Options.txt
│ ├── NLog.txt
│ ├── NotifyIcon.txt
│ ├── OxyPlot.txt
│ ├── RestEase.txt
│ ├── Rx.txt
│ ├── SmartFormat.txt
│ ├── Stylet.txt
│ ├── Syncthing.txt
│ └── WindowsAPICodePack.txt
├── Services
├── AlertsManager.cs
├── ApplicationState.cs
├── ApplicationWindowState.cs
├── AssemblyProvider.cs
├── AutostartProvider.cs
├── CommandLineOptionsParser.cs
├── Config
│ ├── AppSettings.cs
│ ├── ApplicationPathsProvider.cs
│ ├── ConfigFolderCleaner.cs
│ ├── Configuration.cs
│ ├── ConfigurationProvider.cs
│ ├── EnvironmentalVariableCollection.cs
│ ├── FolderConfiguration.cs
│ ├── IconAnimationMode.cs
│ ├── LogLevel.cs
│ ├── PathConfiguration.cs
│ ├── SyncTrayzorVariant.cs
│ ├── SyncthingPriorityLevel.cs
│ └── WindowPlacement.cs
├── ConfigurationApplicator.cs
├── Conflicts
│ ├── ConflictFileManager.cs
│ └── ConflictFileWatcher.cs
├── DirectoryWatcher.cs
├── DonationManager.cs
├── FileWatcher.cs
├── FilesystemProvider.cs
├── FocusWindowProvider.cs
├── GraphicsCardDetector.cs
├── Ipc
│ ├── IpcCommsClient.cs
│ ├── IpcCommsClientFactory.cs
│ └── IpcCommsServer.cs
├── MemoryUsageLogger.cs
├── Metering
│ ├── MeteredNetworkManager.cs
│ └── NetworkCostManager.cs
├── PathTransformer.cs
├── ProcessStartProvider.cs
├── UpdateManagement
│ ├── IUpdateNotificationApi.cs
│ ├── IUpdateVariantHandler.cs
│ ├── InstalledUpdateVariantHandler.cs
│ ├── InstallerCertificateVerifier.cs
│ ├── PortableUpdateVariantHandler.cs
│ ├── Release.cs
│ ├── UpdateChecker.cs
│ ├── UpdateCheckerFactory.cs
│ ├── UpdateDownloader.cs
│ ├── UpdateManager.cs
│ ├── UpdateNotificationClient.cs
│ ├── UpdateNotificationClientFactory.cs
│ ├── UpdateNotificationResponse.cs
│ └── UpdatePromptProvider.cs
├── UserActivityMonitor.cs
└── WatchedFolderMonitor.cs
├── SyncTrayzor.csproj
├── SyncTrayzor.ruleset
├── Syncthing
├── ApiClient
│ ├── Config.cs
│ ├── ConfigSavedEvent.cs
│ ├── Connections.cs
│ ├── DebugFacilitiesSettings.cs
│ ├── DefaultingStringEnumConverter.cs
│ ├── DeviceConnectedEvent.cs
│ ├── DeviceDisconnectedEvent.cs
│ ├── DevicePausedEvent.cs
│ ├── DeviceRejectedEvent.cs
│ ├── DeviceResumedEvent.cs
│ ├── DownloadProgressEvent.cs
│ ├── Event.cs
│ ├── EventConverter.cs
│ ├── EventType.cs
│ ├── FolderErrorsEvent.cs
│ ├── FolderRejectedEvent.cs
│ ├── FolderStatus.cs
│ ├── FolderSummaryEvent.cs
│ ├── GenericEvent.cs
│ ├── IEventVisitor.cs
│ ├── ISyncthingApi.cs
│ ├── ISyncthingApiClient.cs
│ ├── ItemChangedActionType.cs
│ ├── ItemChangedItemType.cs
│ ├── ItemFinishedEvent.cs
│ ├── ItemStartedEvent.cs
│ ├── JsonCreationConverter.cs
│ ├── LocalIndexUpdatedEvent.cs
│ ├── RemoteIndexUpdatedEvent.cs
│ ├── StartupCompleteEvent.cs
│ ├── StateChangedEvent.cs
│ ├── SyncthingApiClient.cs
│ ├── SyncthingApiClientFactory.cs
│ ├── SyncthingHttpClientHandler.cs
│ ├── SyncthingVersion.cs
│ └── SystemInfo.cs
├── DeviceRejectedEventArgs.cs
├── Devices
│ ├── Device.cs
│ ├── DeviceConnectedEventArgs.cs
│ ├── DeviceDisconnectedEventArgs.cs
│ ├── DevicePausedEventArgs.cs
│ ├── DeviceResumedEventArgs.cs
│ ├── SyncthingAddressParser.cs
│ └── SyncthingDeviceManager.cs
├── EventWatcher
│ ├── ConfigSavedEventArgs.cs
│ ├── DeviceConnectedEventArgs.cs
│ ├── DeviceDisconnectedEventArgs.cs
│ ├── DevicePausedEventArgs.cs
│ ├── DeviceRejectedEventArgs.cs
│ ├── DeviceResumedEventArgs.cs
│ ├── FolderErrorsChangedEventArgs.cs
│ ├── FolderRejectedEventArgs.cs
│ ├── FolderStatusChangedEventArgs.cs
│ ├── ItemDownloadProgressChangedEventArgs.cs
│ ├── ItemFinishedEventArgs.cs
│ ├── ItemStartedEventArgs.cs
│ ├── ItemStateChangedEventArgs.cs
│ ├── SyncStateChangedEventArgs.cs
│ ├── SyncthingEventWatcher.cs
│ └── SyncthingEventWatcherFactory.cs
├── FolderRejectedEventArgs.cs
├── Folders
│ ├── Folder.cs
│ ├── FolderError.cs
│ ├── FolderErrorsChangedEventArgs.cs
│ ├── FolderStateTransformer.cs
│ ├── FolderStatusChangedEventArgs.cs
│ ├── FolderSyncState.cs
│ ├── FolderSyncStateChangedEventArgs.cs
│ └── SyncthingFolderManager.cs
├── FreePortFinder.cs
├── MessageLoggedEventArgs.cs
├── SyncthingCapabilities.cs
├── SyncthingConnectionStats.cs
├── SyncthingConnectionsWatcher.cs
├── SyncthingConnectionsWatcherFactory.cs
├── SyncthingDidNotStartCorrectlyException.cs
├── SyncthingManager.cs
├── SyncthingPoller.cs
├── SyncthingProcessRunner.cs
├── SyncthingState.cs
├── SyncthingStateChangedEventArgs.cs
├── SyncthingVersionInformation.cs
├── TransferHistory
│ ├── FailingTransfer.cs
│ ├── FileTransfer.cs
│ ├── FileTransferChangedEventArgs.cs
│ ├── FileTransferStatus.cs
│ ├── FolderSynchronizationFinishedEventArgs.cs
│ └── SyncthingTransferHistory.cs
└── TransientWrapper.cs
├── Utils
├── AtomicFileStream.cs
├── Buffer.cs
├── ChecksumFileUtilities.cs
├── DotNetVersionFinder.cs
├── EnumerableExtensions.cs
├── FluentModelValidator.cs
├── FormatUtils.cs
├── LimitedConcurrencyTaskScheduler.cs
├── ListExtensions.cs
├── ObservableQueue.cs
├── Options.cs
├── PathEx.cs
├── PgpClearsignUtilities.cs
├── RecycleBinDeleter.cs
├── SafeSyncthingExtensions.cs
├── SemaphoreSlimExtensions.cs
├── ShellTools.cs
├── StreamExtensions.cs
├── StringExtensions.cs
├── SynchronizedEventDispatcher.cs
├── SynchronizedEventSubscriber.cs
└── UriExtensions.cs
├── Xaml
├── ActivateBehaviour.cs
├── BoringListView.xaml
├── CollapsingRowDefinitionBehaviour.cs
├── CultureAwareBinding.cs
├── DetachingBehaviour.cs
├── GridLengthToAbsoluteConverter.cs
├── GridViewSortByBehaviour.cs
├── LogMessageListToStringConverter.cs
├── MouseWheelGesture.cs
├── NoSizeBelowScreenBehaviour.cs
├── PassiveListView.xaml
├── PopupConductorBehaviour.cs
├── RemoveMnemonicsConverter.cs
├── Resources.xaml
├── ScrollToEndBehaviour.cs
├── TextBoxUtilities.cs
├── UacImageSource.cs
└── WindowPlacementBehaviour.cs
├── app.manifest
└── idle.ico
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.cs eol=crlf
2 | *.xaml eol=crlf
3 | *.sln eol=crlf
4 | *.csproj eol=crlf
5 | *.resx eol=crlf
6 | *.settings eol=crlf
7 | *.config eol=crlf
8 |
--------------------------------------------------------------------------------
/.github/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | Contributing to SyncTrayzor
2 | ===========================
3 |
4 | When opening an issue, you **must** include the SyncTrayzor version and Syncthing version.
5 | For crashes, please provide the full stack trace that SyncTrayzor gave you in its 'Oops! Something went badly wrong' window.
6 |
7 | If you're multi-lingual? SyncTrayzor needs you! Please read [Localization](https://github.com/canton7/SyncTrayzor/wiki/Localization).
8 |
9 | Want to make a code contribution? Fantastic, and thank you! Please read [Contributing](https://github.com/canton7/SyncTrayzor/wiki/Contributing) first.
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | custom: ['https://github.com/canton7/synctrayzor/blob/develop/DONATING.md#donating']
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | #Visual Studio files
2 | .vs
3 | *.[Oo]bj
4 | *.user
5 | *.aps
6 | *.pch
7 | *.vspscc
8 | *.vssscc
9 | *_i.c
10 | *_p.c
11 | *.ncb
12 | *.suo
13 | *.tlb
14 | *.tlh
15 | *.bak
16 | *.[Cc]ache
17 | *.ilk
18 | *.log
19 | *.lib
20 | *.sbr
21 | *.sdf
22 | *.opensdf
23 | *.unsuccessfulbuild
24 | ipch/
25 | obj/
26 | [Bb]in
27 | [Dd]ebug/
28 | [Rr]elease*/
29 |
30 | #Project files
31 | [Bb]uild/
32 | !/build
33 |
34 | #NuGet
35 | packages/
36 | *.nupkg
37 |
38 | #Installer
39 | SyncTrayzorSetup*.exe
40 | SyncTrayzorPortable*
41 | syncthing-*.exe
42 | syncthing.exe
43 |
44 | *.gjq
45 | *.tmp
46 | Coverage
47 | SyncTrayzorPortable
48 | deploy
49 | *.pfx
50 | *.pvk
51 | /src/SyncTrayzor/Icons/*.png
52 | security/private_key.asc
53 | chocolatey/tools/LICENSE.txt
54 |
--------------------------------------------------------------------------------
/DONATING.md:
--------------------------------------------------------------------------------
1 | Donating
2 | ========
3 |
4 | Syncthing and SyncTrayzor are free software, and you don't need to pay a penny to use them.
5 | However, if you find them useful, please consider giving a small amount to one of the causes below.
6 |
7 | Syncthing
8 | ---------
9 |
10 | SyncTrayzor is just the wrapper around [Syncthing](https://syncthing.net), which makes it look and behave like a native Windows application.
11 | The heavy lifting is being done by Syncthing.
12 |
13 | While development is done for free by a fantastic team, running the infrastructure which lets your devices find and talk to each other costs money, as does hosting things like the [website](https://syncthing.net) and [forum](https://forum.syncthing.net).
14 | If you make use of these, I kindly ask that you consider sending a small amount towards funding Syncthing's running costs and future development.
15 | Donations are handled by the Syncthing Foundation, whose accounts are public.
16 |
17 | [Donate to Syncthing](https://syncthing.net/donations/).
18 |
19 |
20 | SyncTrayzor Charity Fundraiser
21 | ------------------------------
22 |
23 | I've put a lot of my free time into writing and maintaining SyncTrayzor.
24 | If you use it and appreciate it, I'd be very grateful if you could show your thanks by
25 | donating a small amount (the price of a beer) to charity.
26 |
27 | I've been running charity fundraisers for many years, and very kind people from all over the world have helped raise thousands for people who really need it, which is absolutely amazing.
28 |
29 | Please consider [donating to the current appeal](https://synctrayzor.antonymale.co.uk/fundraiser).
30 |
31 |
32 | Buy me a beer
33 | -------------
34 |
35 | If you want to buy me a coffee (or beer!), you'll absolutely make my day.
36 | Thank you!
37 |
38 | I'm on [Ko-fi](https://ko-fi.com/canton7) or [PayPal](https://www.paypal.com/donate?hosted_button_id=92FADFBYS42MU).
39 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015-2021 Antony Male
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
13 | all 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
21 | THE SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/SyncTrayzor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/SyncTrayzor.png
--------------------------------------------------------------------------------
/build/7za.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/build/7za.exe
--------------------------------------------------------------------------------
/build/vswhere.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/build/vswhere.exe
--------------------------------------------------------------------------------
/chocolatey/tools/VERIFICATION.txt:
--------------------------------------------------------------------------------
1 | VERIFICATION
2 | Verification is intended to assist the Chocolatey moderators and community
3 | in verifying that this package's contents are trustworthy.
4 |
5 | This package is published by the developer of SyncTrayzor.
6 | Binaries are identical to the setup binaries available at the GitHub release page:
7 | https://github.com/canton7/SyncTrayzor/releases
--------------------------------------------------------------------------------
/installer/certnotes.txt:
--------------------------------------------------------------------------------
1 | http://blogs.msdn.com/b/httpcontext/archive/2012/05/24/how-to-digitally-sign-a-strong-named-assembly.aspx
2 | http://www.jayway.com/2014/09/03/creating-self-signed-certificates-with-makecert-exe-for-development/
3 |
4 | admin console:
5 |
6 | makecert -r -pe -n "CN=TheCN" -a sha256 -cy authority -sky signature -sv MyCA.pvk MyCA.cer
7 | pvk2pfx -pvk MyCA.pvk -spc MyCA.cer -pfx MyCA.pfx
8 |
9 | Optional: Install MyCA.pfx into cert store by double-clicking it
10 |
11 | appears to need cmd: git bash won't work
12 | signtool sign /f MyCA.pfx /v theFileToSign.exe
13 |
14 | http://stackoverflow.com/questions/24060009/checking-digital-signature-on-exe
15 |
16 | signtool verify /v theFileToSign.exe
17 |
18 | Check that SHA1 hash matches 'Thumbprint' of cert
--------------------------------------------------------------------------------
/installer/dotNet472Setup.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/dotNet472Setup.exe
--------------------------------------------------------------------------------
/installer/icon.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/icon.bmp
--------------------------------------------------------------------------------
/installer/x64/installer-x64.iss:
--------------------------------------------------------------------------------
1 | #define Arch "x64"
2 | #define AppId "{c004dcef-b848-46a5-9c30-4dbf736396fa}"
3 |
4 | #include "../common.iss"
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-console-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-console-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-console-l1-2-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-console-l1-2-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-datetime-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-datetime-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-debug-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-debug-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-errorhandling-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-errorhandling-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-file-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-file-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-file-l1-2-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-file-l1-2-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-file-l2-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-file-l2-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-handle-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-handle-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-heap-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-heap-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-interlocked-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-interlocked-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-libraryloader-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-libraryloader-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-localization-l1-2-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-localization-l1-2-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-memory-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-memory-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-namedpipe-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-namedpipe-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-processenvironment-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-processenvironment-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-processthreads-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-processthreads-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-processthreads-l1-1-1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-processthreads-l1-1-1.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-profile-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-profile-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-rtlsupport-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-rtlsupport-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-string-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-string-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-synch-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-synch-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-synch-l1-2-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-synch-l1-2-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-sysinfo-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-sysinfo-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-timezone-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-timezone-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-core-util-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-core-util-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-crt-conio-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-crt-conio-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-crt-convert-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-crt-convert-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-crt-environment-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-crt-environment-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-crt-filesystem-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-crt-filesystem-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-crt-heap-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-crt-heap-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-crt-locale-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-crt-locale-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-crt-math-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-crt-math-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-crt-multibyte-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-crt-multibyte-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-crt-private-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-crt-private-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-crt-process-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-crt-process-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-crt-runtime-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-crt-runtime-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-crt-stdio-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-crt-stdio-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-crt-string-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-crt-string-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-crt-time-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-crt-time-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/api-ms-win-crt-utility-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/api-ms-win-crt-utility-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x64/ucrt/ucrtbase.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/ucrt/ucrtbase.dll
--------------------------------------------------------------------------------
/installer/x64/vc++/concrt140.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/vc++/concrt140.dll
--------------------------------------------------------------------------------
/installer/x64/vc++/msvcp140.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/vc++/msvcp140.dll
--------------------------------------------------------------------------------
/installer/x64/vc++/vccorlib140.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/vc++/vccorlib140.dll
--------------------------------------------------------------------------------
/installer/x64/vc++/vcruntime140.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x64/vc++/vcruntime140.dll
--------------------------------------------------------------------------------
/installer/x86/installer-x86.iss:
--------------------------------------------------------------------------------
1 | #define Arch "x86"
2 | #define AppId "{c9bab27b-d754-4b62-ad8c-3509e1cac15c}"
3 |
4 | #include "../common.iss"
5 |
--------------------------------------------------------------------------------
/installer/x86/ucrt/API-MS-Win-core-xstate-l2-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/API-MS-Win-core-xstate-l2-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-console-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-console-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-console-l1-2-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-console-l1-2-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-datetime-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-datetime-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-debug-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-debug-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-errorhandling-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-errorhandling-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-file-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-file-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-file-l1-2-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-file-l1-2-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-file-l2-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-file-l2-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-handle-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-handle-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-heap-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-heap-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-interlocked-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-interlocked-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-libraryloader-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-libraryloader-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-localization-l1-2-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-localization-l1-2-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-memory-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-memory-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-namedpipe-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-namedpipe-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-processenvironment-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-processenvironment-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-processthreads-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-processthreads-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-processthreads-l1-1-1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-processthreads-l1-1-1.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-profile-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-profile-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-rtlsupport-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-rtlsupport-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-string-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-string-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-synch-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-synch-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-synch-l1-2-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-synch-l1-2-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-sysinfo-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-sysinfo-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-timezone-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-timezone-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-core-util-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-core-util-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-crt-conio-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-crt-conio-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-crt-convert-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-crt-convert-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-crt-environment-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-crt-environment-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-crt-filesystem-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-crt-filesystem-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-crt-heap-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-crt-heap-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-crt-locale-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-crt-locale-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-crt-math-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-crt-math-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-crt-multibyte-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-crt-multibyte-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-crt-private-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-crt-private-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-crt-process-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-crt-process-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-crt-runtime-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-crt-runtime-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-crt-stdio-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-crt-stdio-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-crt-string-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-crt-string-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-crt-time-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-crt-time-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/api-ms-win-crt-utility-l1-1-0.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/api-ms-win-crt-utility-l1-1-0.dll
--------------------------------------------------------------------------------
/installer/x86/ucrt/ucrtbase.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/ucrt/ucrtbase.dll
--------------------------------------------------------------------------------
/installer/x86/vc++/concrt140.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/vc++/concrt140.dll
--------------------------------------------------------------------------------
/installer/x86/vc++/msvcp140.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/vc++/msvcp140.dll
--------------------------------------------------------------------------------
/installer/x86/vc++/vccorlib140.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/vc++/vccorlib140.dll
--------------------------------------------------------------------------------
/installer/x86/vc++/vcruntime140.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/installer/x86/vc++/vcruntime140.dll
--------------------------------------------------------------------------------
/lib/Itenso.Windows.Controls.ListViewLayout.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/lib/Itenso.Windows.Controls.ListViewLayout.dll
--------------------------------------------------------------------------------
/lib/Itenso.Windows.Controls.ListViewLayout.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/lib/Itenso.Windows.Controls.ListViewLayout.pdb
--------------------------------------------------------------------------------
/lib/x64/Interop.NETWORKLIST.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/lib/x64/Interop.NETWORKLIST.dll
--------------------------------------------------------------------------------
/lib/x86/Interop.NETWORKLIST.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/lib/x86/Interop.NETWORKLIST.dll
--------------------------------------------------------------------------------
/readme/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/readme/screenshot.png
--------------------------------------------------------------------------------
/server/survey.php:
--------------------------------------------------------------------------------
1 | setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
23 | $db->exec('PRAGMA foreign_keys = ON;');
24 |
25 | if (!$exists)
26 | {
27 | $db->exec("CREATE TABLE IF NOT EXISTS responses (
28 | id INTEGER PRIMARY KEY,
29 | date TEXT NOT NULL,
30 | version TEXT NOT NULL,
31 | ip TEXT NOT NULL,
32 | comment TEXT
33 | );");
34 | $db->exec("CREATE TABLE IF NOT EXISTS checklist (
35 | id INTEGER PRIMARY KEY,
36 | response_id INTEGER NOT NULL REFERENCES responses(id),
37 | key TEXT NOT NULL
38 | );");
39 | }
40 |
41 | $data = json_decode(file_get_contents('php://input'), true);
42 | $stmt = $db->prepare("INSERT INTO responses(date, ip, version, comment) VALUES (CURRENT_TIMESTAMP, :ip, :version, :comment);");
43 | $stmt->execute(array(
44 | 'ip' => $_SERVER['REMOTE_ADDR'],
45 | 'version' => $data['version'],
46 | 'comment' => $data['comment']));
47 | $responseId = $db->lastInsertId();
48 |
49 | $stmt = $db->prepare("INSERT INTO CHECKLIST (response_id, key) VALUES (:response_id, :key);");
50 |
51 | foreach ($data['checklist'] as $key => $value)
52 | {
53 | if ($value)
54 | {
55 | $stmt->execute(array('response_id' => $responseId, 'key' => $key));
56 | }
57 | }
58 | }
59 | catch (Exception $e)
60 | {
61 | $loggable_error = $e->getMessage() . "\n" . $e->getTraceAsString();
62 | file_put_contents("survey_errors.txt", $loggable_error, FILE_APPEND);
63 | }
--------------------------------------------------------------------------------
/src/ChecksumUtil/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/ChecksumUtil/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("ChecksumUtil")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ChecksumUtil")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
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("d796924f-d24e-4059-81e5-e450cb63dbd7")]
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("0.0.0.0")]
36 | [assembly: AssemblyFileVersion("0.0.0.0")]
37 |
--------------------------------------------------------------------------------
/src/PortableInstaller/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/PortableInstaller/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("PortableInstaller")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("PortableInstaller")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
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("1803ab89-4148-4dfc-ae7b-b4191bd6281c")]
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("0.0.0.0")]
36 | [assembly: AssemblyFileVersion("0.0.0.0")]
37 |
--------------------------------------------------------------------------------
/src/ProcessRunner/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/ProcessRunner/GlobalSuppressions.cs:
--------------------------------------------------------------------------------
1 |
2 | // This file is used by Code Analysis to maintain SuppressMessage
3 | // attributes that are applied to this project.
4 | // Project-level suppressions either have no target or are given
5 | // a specific target and scoped to a namespace, type, member, etc.
6 |
7 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "Imported library", Scope = "member", Target = "~M:Mono.Options.OptionSet.ActionOption.#ctor(System.String,System.String,System.Int32,System.Action{Mono.Options.OptionValueCollection},System.Boolean)")]
8 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "Imported library", Scope = "member", Target = "~M:Mono.Options.OptionSet.ActionOption`1.#ctor(System.String,System.String,System.Action{`0})")]
9 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0016:Use 'throw' expression", Justification = "Imported library", Scope = "member", Target = "~M:Mono.Options.OptionSet.ActionOption`2.#ctor(System.String,System.String,Mono.Options.OptionAction{`0,`1})")]
10 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0018:Inline variable declaration", Justification = "Imported library", Scope = "member", Target = "~M:Mono.Options.OptionSet.AddSource(Mono.Options.OptionSet.ArgumentEnumerator,System.String)~System.Boolean")]
11 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0018:Inline variable declaration", Justification = "Imported library", Scope = "member", Target = "~M:Mono.Options.OptionSet.Parse(System.String,Mono.Options.OptionContext)~System.Boolean")]
12 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0019:Use pattern matching", Justification = "Imported library", Scope = "member", Target = "~M:Mono.Options.OptionSet.WriteOptionDescriptions(System.IO.TextWriter)")]
--------------------------------------------------------------------------------
/src/ProcessRunner/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("SyncTrayzor ProcessRunner")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SyncTrayzor")]
13 | [assembly: AssemblyCopyright("Copyright © Antony Male 2015")]
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("36988a78-a078-4de7-b23f-8a39646ee687")]
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.20.0")]
35 | [assembly: AssemblyVersion("0.0.0.0")]
36 | [assembly: AssemblyFileVersion("0.0.0.0")]
37 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/App.Installer.config.xslt:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 | true
7 | Installed
8 |
9 | %APPDATA%\SyncTrayzor\logs
10 | %APPDATA%\SyncTrayzor\config.xml
11 | %APPDATA%\SyncTrayzor\config-backups
12 | %LOCALAPPDATA%\SyncTrayzor\cef\cache
13 | %APPDATA%\SyncTrayzor\syncthing.exe
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace SyncTrayzor
4 | {
5 | ///
6 | /// Interaction logic for App.xaml
7 | ///
8 | public partial class App : Application
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Design/ViewModelLocator.cs:
--------------------------------------------------------------------------------
1 | namespace SyncTrayzor.Design
2 | {
3 | public class ViewModelLocator
4 | {
5 | public DummyFileTransfersTrayViewModel FileTransfersTrayViewModel => new DummyFileTransfersTrayViewModel();
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/FodyWeavers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Icons/alert_tray.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/src/SyncTrayzor/Icons/alert_tray.ico
--------------------------------------------------------------------------------
/src/SyncTrayzor/Icons/default.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/src/SyncTrayzor/Icons/default.ico
--------------------------------------------------------------------------------
/src/SyncTrayzor/Icons/default_tray.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/src/SyncTrayzor/Icons/default_tray.ico
--------------------------------------------------------------------------------
/src/SyncTrayzor/Icons/paused_tray.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/src/SyncTrayzor/Icons/paused_tray.ico
--------------------------------------------------------------------------------
/src/SyncTrayzor/Icons/stopped.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/src/SyncTrayzor/Icons/stopped.ico
--------------------------------------------------------------------------------
/src/SyncTrayzor/Icons/syncing_2.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/src/SyncTrayzor/Icons/syncing_2.ico
--------------------------------------------------------------------------------
/src/SyncTrayzor/Icons/syncing_3.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/src/SyncTrayzor/Icons/syncing_3.ico
--------------------------------------------------------------------------------
/src/SyncTrayzor/Icons/syncing_4.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/src/SyncTrayzor/Icons/syncing_4.ico
--------------------------------------------------------------------------------
/src/SyncTrayzor/NotifyIcon/BalloonConductor.cs:
--------------------------------------------------------------------------------
1 | using Hardcodet.Wpf.TaskbarNotification;
2 | using Stylet;
3 | using System.Threading.Tasks;
4 |
5 | namespace SyncTrayzor.NotifyIcon
6 | {
7 | public class BalloonConductor : IChildDelegate
8 | {
9 | private readonly TaskbarIcon taskbarIcon;
10 | private readonly object child;
11 | private readonly object view;
12 | private readonly TaskCompletionSource tcs;
13 |
14 | public BalloonConductor(TaskbarIcon taskbarIcon, object child, object view, TaskCompletionSource tcs)
15 | {
16 | this.taskbarIcon = taskbarIcon;
17 | this.child = child;
18 | this.view = view;
19 | this.tcs = tcs;
20 |
21 | if (this.child is IChild childAsIChild)
22 | childAsIChild.Parent = this;
23 | }
24 |
25 | public void CloseItem(object item, bool? dialogResult = null)
26 | {
27 | if (item != this.child)
28 | return;
29 |
30 | if (this.taskbarIcon.CustomBalloon.Child != this.view)
31 | return;
32 |
33 | this.tcs.TrySetResult(dialogResult);
34 | this.taskbarIcon.CloseBalloon();
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/BarAlerts/AlertSeverity.cs:
--------------------------------------------------------------------------------
1 | namespace SyncTrayzor.Pages.BarAlerts
2 | {
3 | public enum AlertSeverity
4 | {
5 | Info,
6 | Warning,
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/BarAlerts/AlertSeverityToBackgroundColorConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Globalization;
4 | using System.Windows.Data;
5 | using System.Windows.Media;
6 |
7 | namespace SyncTrayzor.Pages.BarAlerts
8 | {
9 | public class AlertSeverityToBackgroundColorConverter : IValueConverter
10 | {
11 | public static readonly AlertSeverityToBackgroundColorConverter Instance = new AlertSeverityToBackgroundColorConverter();
12 |
13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
14 | {
15 | if (!(value is AlertSeverity))
16 | return null;
17 |
18 | var severity = (AlertSeverity)value;
19 |
20 | switch (severity)
21 | {
22 | case AlertSeverity.Info:
23 | return new SolidColorBrush(Color.FromArgb(125, 135, 206, 250));
24 |
25 | case AlertSeverity.Warning:
26 | return new SolidColorBrush(Color.FromArgb(125, 255, 255, 0));
27 |
28 | default:
29 | Debug.Assert(false);
30 | return null;
31 | }
32 | }
33 |
34 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
35 | {
36 | return null;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/BarAlerts/BarAlertsView.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/BarAlerts/ConflictsAlertView.xaml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/BarAlerts/ConflictsAlertViewModel.cs:
--------------------------------------------------------------------------------
1 | using Stylet;
2 | using System;
3 |
4 | namespace SyncTrayzor.Pages.BarAlerts
5 | {
6 | public class ConflictsAlertViewModel : PropertyChangedBase, IBarAlert
7 | {
8 | public event EventHandler OpenConflictResolverClicked;
9 |
10 | public AlertSeverity Severity => AlertSeverity.Warning;
11 |
12 | public int NumConflicts { get; }
13 |
14 | public ConflictsAlertViewModel(int numConflicts)
15 | {
16 | this.NumConflicts = numConflicts;
17 | }
18 |
19 | public void OpenConflictResolver()
20 | {
21 | this.OpenConflictResolverClicked?.Invoke(this, EventArgs.Empty);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/BarAlerts/FailedTransfersAlertView.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/BarAlerts/FailedTransfersAlertViewModel.cs:
--------------------------------------------------------------------------------
1 | using Stylet;
2 | using System.Collections.Generic;
3 |
4 | namespace SyncTrayzor.Pages.BarAlerts
5 | {
6 | public class FailedTransfersAlertViewModel : Screen, IBarAlert
7 | {
8 | public AlertSeverity Severity => AlertSeverity.Warning;
9 |
10 | public BindableCollection FailingFolders { get; } = new BindableCollection();
11 |
12 | public FailedTransfersAlertViewModel(IEnumerable failingFolders)
13 | {
14 | this.FailingFolders.AddRange(failingFolders);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/BarAlerts/IBarAlert.cs:
--------------------------------------------------------------------------------
1 | namespace SyncTrayzor.Pages.BarAlerts
2 | {
3 | public interface IBarAlert
4 | {
5 | AlertSeverity Severity { get; }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/BarAlerts/IntelXeGraphicsAlertView.xaml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/BarAlerts/IntelXeGraphicsAlertViewModel.cs:
--------------------------------------------------------------------------------
1 | using Stylet;
2 | using SyncTrayzor.Services.Config;
3 |
4 | namespace SyncTrayzor.Pages.BarAlerts
5 | {
6 | public class IntelXeGraphicsAlertViewModel : Screen, IBarAlert
7 | {
8 | private readonly IConfigurationProvider configurationProvider;
9 |
10 | public AlertSeverity Severity => AlertSeverity.Info;
11 |
12 | public IntelXeGraphicsAlertViewModel(IConfigurationProvider configurationProvider)
13 | {
14 | this.configurationProvider = configurationProvider;
15 | }
16 |
17 | public void Dismiss()
18 | {
19 | this.configurationProvider.AtomicLoadAndSave(config => config.HideIntelXeWarningMessage = true);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/BarAlerts/PausedDevicesFromMeteringView.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/BarAlerts/PausedDevicesFromMeteringView.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 |
3 | namespace SyncTrayzor.Pages.BarAlerts
4 | {
5 | ///
6 | /// Interaction logic for PausedDevicesFromMeteringView.xaml
7 | ///
8 | public partial class PausedDevicesFromMeteringView : UserControl
9 | {
10 | public PausedDevicesFromMeteringView()
11 | {
12 | InitializeComponent();
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/BarAlerts/PausedDevicesFromMeteringViewModel.cs:
--------------------------------------------------------------------------------
1 | using Stylet;
2 | using System.Collections.Generic;
3 |
4 | namespace SyncTrayzor.Pages.BarAlerts
5 | {
6 | public class PausedDevicesFromMeteringViewModel : Screen, IBarAlert
7 | {
8 | public AlertSeverity Severity => AlertSeverity.Info;
9 |
10 | public BindableCollection PausedDeviceNames { get; } = new BindableCollection();
11 |
12 | public PausedDevicesFromMeteringViewModel(IEnumerable pausedDeviceNames)
13 | {
14 | this.PausedDeviceNames.AddRange(pausedDeviceNames);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/ConflictResolution/ConflictOptionViewModel.cs:
--------------------------------------------------------------------------------
1 | using Stylet;
2 | using SyncTrayzor.Services.Conflicts;
3 | using SyncTrayzor.Utils;
4 | using System;
5 | using System.IO;
6 |
7 | namespace SyncTrayzor.Pages.ConflictResolution
8 | {
9 | public class ConflictOptionViewModel : PropertyChangedBase
10 | {
11 | public ConflictOption ConflictOption { get; }
12 |
13 | public string FileName => Path.GetFileName(this.ConflictOption.FilePath);
14 |
15 | public DateTime DateCreated => this.ConflictOption.Created;
16 | public DateTime LastModified => this.ConflictOption.LastModified;
17 | public string Size => FormatUtils.BytesToHuman(this.ConflictOption.SizeBytes, 1);
18 | public string ModifiedBy => this.ConflictOption.Device?.Name;
19 |
20 | public ConflictOptionViewModel(ConflictOption conflictOption)
21 | {
22 | this.ConflictOption = conflictOption;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/ConflictResolution/MultipleConflictsResolutionViewModel.cs:
--------------------------------------------------------------------------------
1 | using Stylet;
2 | using SyncTrayzor.Utils;
3 | using System.Collections.Generic;
4 |
5 | namespace SyncTrayzor.Pages.ConflictResolution
6 | {
7 | public class MultipleConflictsResolutionViewModel : Screen
8 | {
9 | public List Conflicts { get; set; }
10 |
11 | public ConflictResolutionViewModel Delegate { get; set; }
12 |
13 | public void ChooseOriginal()
14 | {
15 | foreach (var conflict in this.Conflicts)
16 | {
17 | this.Delegate.ChooseOriginal(conflict);
18 | }
19 | }
20 |
21 | public void ChooseNewest()
22 | {
23 | foreach(var conflict in this.Conflicts)
24 | {
25 | var newestOption = conflict.ConflictOptions.MaxBy(x => x.DateCreated);
26 | if (newestOption.DateCreated > conflict.LastModified)
27 | this.Delegate.ChooseConflictFile(conflict, newestOption);
28 | else
29 | this.Delegate.ChooseOriginal(conflict);
30 | }
31 | }
32 |
33 | public void ChooseNewestConflict()
34 | {
35 | foreach (var conflict in this.Conflicts)
36 | {
37 | var newestOption = conflict.ConflictOptions.MaxBy(x => x.DateCreated);
38 | this.Delegate.ChooseConflictFile(conflict, newestOption);
39 | }
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/ConflictResolution/SingleConflictResolutionViewModel.cs:
--------------------------------------------------------------------------------
1 | using Stylet;
2 |
3 | namespace SyncTrayzor.Pages.ConflictResolution
4 | {
5 | public class SingleConflictResolutionViewModel : Screen
6 | {
7 | public ConflictViewModel Conflict { get; set; }
8 |
9 | public ConflictResolutionViewModel Delegate { get; set; }
10 |
11 | public void ShowFileInFolder()
12 | {
13 | this.Delegate.ShowFileInFolder(this.Conflict);
14 | }
15 |
16 | public void ChooseOriginal()
17 | {
18 | this.Delegate.ChooseOriginal(this.Conflict);
19 | }
20 |
21 | public void ChooseConflictFile(ConflictOptionViewModel conflictOption)
22 | {
23 | this.Delegate.ChooseConflictFile(this.Conflict, conflictOption);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/NewVersionAlertToastViewModel.cs:
--------------------------------------------------------------------------------
1 | using Stylet;
2 | using System;
3 |
4 | namespace SyncTrayzor.Pages
5 | {
6 | public class NewVersionAlertToastViewModel : Screen
7 | {
8 | public bool CanInstall { get; set; }
9 | public Version Version { get; set; }
10 | public bool ShowUacBadge { get; set; }
11 |
12 | public bool DontRemindMe { get; private set; }
13 | public bool ShowMoreDetails { get; private set; }
14 |
15 | public NewVersionAlertToastViewModel()
16 | {
17 | }
18 |
19 | public void Download()
20 | {
21 | this.RequestClose(true);
22 | }
23 |
24 | public void Install()
25 | {
26 | this.RequestClose(true);
27 | }
28 |
29 | public void RemindLater()
30 | {
31 | this.RequestClose(false);
32 | }
33 |
34 | public void DontRemind()
35 | {
36 | this.DontRemindMe = true;
37 | this.RequestClose(false);
38 | }
39 |
40 | public void DisplayMoreDetails()
41 | {
42 | this.ShowMoreDetails = true;
43 | this.RequestClose(false);
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/NewVersionAlertViewModel.cs:
--------------------------------------------------------------------------------
1 | using Stylet;
2 | using System;
3 |
4 | namespace SyncTrayzor.Pages
5 | {
6 | public class NewVersionAlertViewModel : Screen
7 | {
8 | public bool CanInstall { get; set; }
9 | public Version Version { get; set; }
10 | public string Changelog { get; set; }
11 | public bool ShowUacBadge { get; set; }
12 |
13 | public bool DontRemindMe { get; private set; }
14 |
15 | public void Download()
16 | {
17 | this.RequestClose(true);
18 | }
19 |
20 | public void Install()
21 | {
22 | this.RequestClose(true);
23 | }
24 |
25 | public void RemindLater()
26 | {
27 | this.RequestClose(false);
28 | }
29 |
30 | public void DontRemind()
31 | {
32 | this.DontRemindMe = true;
33 | this.RequestClose(false);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/NewVersionInstalledToastView.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/NewVersionInstalledToastViewModel.cs:
--------------------------------------------------------------------------------
1 | using Stylet;
2 | using System;
3 |
4 | namespace SyncTrayzor.Pages
5 | {
6 | public class NewVersionInstalledToastViewModel : Screen
7 | {
8 | public Version Version { get; set; }
9 | public string VersionString => this.Version.ToString(3);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/Settings/SyncthingAddressValidator.cs:
--------------------------------------------------------------------------------
1 | using FluentValidation;
2 | using SyncTrayzor.Properties;
3 | using System;
4 |
5 | namespace SyncTrayzor.Pages.Settings
6 | {
7 | public class SyncthingAddressValidator : AbstractValidator>
8 | {
9 | public SyncthingAddressValidator()
10 | {
11 | RuleFor(x => x.Value).NotEmpty().WithMessage(Resources.SettingsView_Validation_NotShouldBeEmpty);
12 | RuleFor(x => x.Value).Must(str =>
13 | {
14 | // URI seems to think https://http://something is valid...
15 | if (str.StartsWith("http:") || str.StartsWith("https:"))
16 | return false;
17 |
18 | str = "http://" + str;
19 | return Uri.TryCreate(str, UriKind.Absolute, out var uri) && uri.IsWellFormedOriginalString() && uri.PathAndQuery == "/" && uri.Fragment == "";
20 | }).WithMessage(Resources.SettingsView_Validation_InvalidUrl);
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/Settings/SyncthingCommandLineFlagsValidator.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using FluentValidation;
3 | using SyncTrayzor.Localization;
4 | using SyncTrayzor.Properties;
5 |
6 | namespace SyncTrayzor.Pages.Settings
7 | {
8 | public class SyncthingCommandLineFlagsValidator : AbstractValidator>
9 | {
10 | // This dups stuff from SyncthingProcessRunner
11 | private static readonly string[] forbiddenArgs = new[] { "-no-browser", "-no-restart", "-gui-apikey", "-gui-address", "-home" };
12 |
13 | public SyncthingCommandLineFlagsValidator()
14 | {
15 | RuleFor(x => x.Value).Must(str =>
16 | {
17 | return KeyValueStringParser.TryParse(str, out var result, mustHaveValue: false);
18 | }).WithMessage(Resources.SettingsView_Validation_SyncthingCommandLineFlagsMustHaveFormat);
19 |
20 | RuleFor(x => x.Value).SetValidator(new IndividualFlagsValidator());
21 | }
22 |
23 | private class IndividualFlagsValidator : AbstractValidator
24 | {
25 | public IndividualFlagsValidator()
26 | {
27 | this.RuleFor(x => x).Custom((str, ctx) =>
28 | {
29 | KeyValueStringParser.TryParse(str, out var result, mustHaveValue: false);
30 |
31 | if (!result.All(flag => flag.Key.StartsWith("-")))
32 | ctx.AddFailure(Resources.SettingsView_Validation_SyncthingCommandLineFlagsMustBeginWithHyphen);
33 |
34 | var firstFailure = result.Select(flag => flag.Key).FirstOrDefault(key => forbiddenArgs.Contains(key));
35 | if (firstFailure != null)
36 | ctx.AddFailure(Localizer.F(Resources.SettingsView_Validation_SyncthingCommandLineFlagIsNotAllowed, firstFailure));
37 | });
38 | }
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/Settings/SyncthingEnvironmentalVariablesValidator.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using FluentValidation;
3 | using SyncTrayzor.Properties;
4 |
5 | namespace SyncTrayzor.Pages.Settings
6 | {
7 | public class SyncthingEnvironmentalVariablesValidator : AbstractValidator>
8 | {
9 | public SyncthingEnvironmentalVariablesValidator()
10 | {
11 | RuleFor(x => x.Value).Must(str =>
12 | {
13 | return KeyValueStringParser.TryParse(str, out var result);
14 | }).WithMessage(Resources.SettingsView_Validation_SyncthingEnvironmentalVariablesMustHaveFormat);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/Tray/NetworkGraphView.xaml:
--------------------------------------------------------------------------------
1 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Pages/UnhandledExceptionView.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Resources/Licenses/BouncyCastle.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2000 - 2011 The Legion of the Bouncy Castle Inc. (http://www.bouncycastle.org)
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/src/SyncTrayzor/Resources/Licenses/CEF.txt:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2008-2014 Marshall A. Greenblatt. Portions Copyright (c)
2 | // 2006-2009 Google Inc. All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the name Chromium Embedded
15 | // Framework nor the names of its contributors may be used to endorse
16 | // or promote products derived from this software without specific prior
17 | // written permission.
18 | //
19 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
--------------------------------------------------------------------------------
/src/SyncTrayzor/Resources/Licenses/CefSharp.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/src/SyncTrayzor/Resources/Licenses/CefSharp.txt
--------------------------------------------------------------------------------
/src/SyncTrayzor/Resources/Licenses/Fody.txt:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright (c) 2012 Simon Cropp and contributors
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
13 | all 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
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/src/SyncTrayzor/Resources/Licenses/Json.NET.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2007 James Newton-King
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | 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, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Resources/Licenses/Mono.Options.txt:
--------------------------------------------------------------------------------
1 | Authors:
2 | Jonathan Pryor
3 | Federico Di Gregorio
4 | Rolf Bjarne Kvinge
5 |
6 | Copyright (C) 2008 Novell (http://www.novell.com)
7 | Copyright (C) 2009 Federico Di Gregorio.
8 | Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
9 |
10 | Permission is hereby granted, free of charge, to any person obtaining
11 | a copy of this software and associated documentation files (the
12 | "Software"), to deal in the Software without restriction, including
13 | without limitation the rights to use, copy, modify, merge, publish,
14 | distribute, sublicense, and/or sell copies of the Software, and to
15 | permit persons to whom the Software is furnished to do so, subject to
16 | the following conditions:
17 |
18 | The above copyright notice and this permission notice shall be
19 | included in all copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/src/SyncTrayzor/Resources/Licenses/NLog.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2004-2016 Jaroslaw Kowalski
2 |
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions
7 | are met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Jaroslaw Kowalski nor the names of its
17 | contributors may be used to endorse or promote products derived from this
18 | software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 | THE POSSIBILITY OF SUCH DAMAGE.
31 |
32 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Resources/Licenses/OxyPlot.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 OxyPlot contributors
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a
6 | copy of this software and associated documentation files (the
7 | "Software"), to deal in the Software without restriction, including
8 | without limitation the rights to use, copy, modify, merge, publish,
9 | distribute, sublicense, and/or sell copies of the Software, and to
10 | permit persons to whom the Software is furnished to do so, subject to
11 | the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included
14 | in all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/src/SyncTrayzor/Resources/Licenses/RestEase.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Antony Male
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
13 | all 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
21 | THE SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Resources/Licenses/SmartFormat.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2012 - Scott Rippey
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Resources/Licenses/Stylet.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Antony Male
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
13 | all 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
21 | THE SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Services/AssemblyProvider.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Reflection;
4 |
5 | namespace SyncTrayzor.Services
6 | {
7 | public interface IAssemblyProvider
8 | {
9 | Version Version { get; }
10 | Version FullVersion { get; }
11 | string Location { get; }
12 | ProcessorArchitecture ProcessorArchitecture { get; }
13 | Stream GetManifestResourceStream(string path);
14 | }
15 |
16 | public class AssemblyProvider : IAssemblyProvider
17 | {
18 | private readonly Assembly assembly;
19 |
20 | public AssemblyProvider()
21 | {
22 | this.assembly = Assembly.GetExecutingAssembly();
23 |
24 | // Don't include the revision in this version
25 | var version = this.assembly.GetName().Version;
26 | this.Version = new Version(version.Major, version.Minor, version.Build);
27 | }
28 |
29 | public Version Version { get; }
30 |
31 | public Version FullVersion => this.assembly.GetName().Version;
32 |
33 | public string Location => this.assembly.Location;
34 |
35 | public ProcessorArchitecture ProcessorArchitecture => this.assembly.GetName().ProcessorArchitecture;
36 |
37 | public Stream GetManifestResourceStream(string path)
38 | {
39 | return this.assembly.GetManifestResourceStream(path);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Services/Config/EnvironmentalVariableCollection.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 | using System.Xml;
4 | using System.Xml.Linq;
5 | using System.Xml.Schema;
6 | using System.Xml.Serialization;
7 |
8 | namespace SyncTrayzor.Services.Config
9 | {
10 | public class EnvironmentalVariableCollection : Dictionary, IXmlSerializable
11 | {
12 | public EnvironmentalVariableCollection()
13 | {
14 | }
15 |
16 | public EnvironmentalVariableCollection(IEnumerable> source)
17 | {
18 | foreach (var kvp in source)
19 | {
20 | this.Add(kvp.Key, kvp.Value);
21 | }
22 | }
23 |
24 | public XmlSchema GetSchema()
25 | {
26 | return null;
27 | }
28 |
29 | public void ReadXml(XmlReader reader)
30 | {
31 | // Used to use XElement.Load(reader.ReadSubtree()), but that effectively closed the reader
32 | // and nothing else would get parsed.
33 | var root = XElement.Parse(reader.ReadOuterXml());
34 | foreach (var element in root.Elements("Item"))
35 | {
36 | this.Add(element.Element("Key").Value, element.Element("Value").Value);
37 | }
38 | }
39 |
40 | public void WriteXml(XmlWriter writer)
41 | {
42 | var elements = this.Select(item =>
43 | {
44 | return new XElement("Item",
45 | new XElement("Key", item.Key),
46 | new XElement("Value", item.Value)
47 | );
48 | });
49 | foreach (var element in elements)
50 | {
51 | element.WriteTo(writer);
52 | }
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Services/Config/FolderConfiguration.cs:
--------------------------------------------------------------------------------
1 | namespace SyncTrayzor.Services.Config
2 | {
3 | public class FolderConfiguration
4 | {
5 | public string ID { get; set; }
6 | public bool IsWatched { get; set; }
7 | public bool NotificationsEnabled { get; set; }
8 |
9 | public FolderConfiguration()
10 | {
11 | }
12 |
13 | public FolderConfiguration(string id, bool isWatched, bool notificationsEnabled)
14 | {
15 | this.ID = id;
16 | this.IsWatched = isWatched;
17 | this.NotificationsEnabled = notificationsEnabled;
18 | }
19 |
20 | public FolderConfiguration(FolderConfiguration other)
21 | {
22 | this.ID = other.ID;
23 | this.IsWatched = other.IsWatched;
24 | this.NotificationsEnabled = other.NotificationsEnabled;
25 | }
26 |
27 | public override string ToString()
28 | {
29 | return $"";
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Services/Config/IconAnimationMode.cs:
--------------------------------------------------------------------------------
1 | namespace SyncTrayzor.Services.Config
2 | {
3 | public enum IconAnimationMode
4 | {
5 | Disabled,
6 | Syncing,
7 | DataTransferring,
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Services/Config/LogLevel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace SyncTrayzor.Services.Config
8 | {
9 | public enum LogLevel
10 | {
11 | Info,
12 | Debug,
13 | Trace,
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Services/Config/PathConfiguration.cs:
--------------------------------------------------------------------------------
1 | using System.Xml.Serialization;
2 |
3 | namespace SyncTrayzor.Services.Config
4 | {
5 | [XmlRoot("PathConfiguration")]
6 | public class PathConfiguration
7 | {
8 | public string LogFilePath { get; set; }
9 | public string ConfigurationFilePath { get; set; }
10 | public string ConfigurationFileBackupPath { get; set; }
11 | public string CefCachePath { get; set; }
12 | public string SyncthingPath { get; set; }
13 | public string SyncthingHomePath { get; set; }
14 |
15 | public PathConfiguration()
16 | {
17 | this.LogFilePath = @"logs";
18 | this.ConfigurationFilePath = @"data\config.xml";
19 | this.ConfigurationFileBackupPath = @"data\config-backups";
20 | this.CefCachePath = @"data\cef\cache";
21 | this.SyncthingPath = @"data\syncthing.exe";
22 | this.SyncthingHomePath = @"data\syncthing";
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Services/Config/SyncTrayzorVariant.cs:
--------------------------------------------------------------------------------
1 | namespace SyncTrayzor.Services.Config
2 | {
3 | public enum SyncTrayzorVariant
4 | {
5 | Installed,
6 | Portable
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Services/Config/SyncthingPriorityLevel.cs:
--------------------------------------------------------------------------------
1 | namespace SyncTrayzor.Services.Config
2 | {
3 | public enum SyncthingPriorityLevel
4 | {
5 | AboveNormal,
6 | BelowNormal,
7 | Idle,
8 | Normal,
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Services/DonationManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using Stylet;
4 | using SyncTrayzor.Services.Config;
5 |
6 | namespace SyncTrayzor.Services
7 | {
8 | // Implementing INPC is hacky, but convenient
9 | public interface IDonationManager : INotifyPropertyChanged, IDisposable
10 | {
11 | bool HaveDonated { get; }
12 |
13 | void Donate();
14 | }
15 |
16 | public class DonationManager : PropertyChangedBase, IDonationManager
17 | {
18 | // Not in the app.config, in case some sysadmin wants to change it
19 | private const string donateUrl = "https://synctrayzor.antonymale.co.uk/donate";
20 |
21 | private readonly IConfigurationProvider configurationProvider;
22 | private readonly IProcessStartProvider processStartProvider;
23 |
24 | public bool HaveDonated { get; private set; }
25 |
26 | public DonationManager(IConfigurationProvider configurationProvider, IProcessStartProvider processStartProvider)
27 | {
28 | this.configurationProvider = configurationProvider;
29 | this.processStartProvider = processStartProvider;
30 |
31 | this.HaveDonated = this.configurationProvider.Load().HaveDonated;
32 | this.configurationProvider.ConfigurationChanged += this.ConfigurationChanged;
33 | }
34 |
35 | private void ConfigurationChanged(object sender, ConfigurationChangedEventArgs e)
36 | {
37 | this.HaveDonated = e.NewConfiguration.HaveDonated;
38 | }
39 |
40 | public void Donate()
41 | {
42 | this.processStartProvider.StartDetached(donateUrl);
43 | this.configurationProvider.AtomicLoadAndSave(x => x.HaveDonated = true);
44 | }
45 |
46 | public void Dispose()
47 | {
48 | this.configurationProvider.ConfigurationChanged -= this.ConfigurationChanged;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Services/FocusWindowProvider.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using System.Windows;
3 |
4 | namespace SyncTrayzor.Services
5 | {
6 | public interface IFocusWindowProvider
7 | {
8 | bool TryFocus();
9 | }
10 |
11 | public class FocusWindowProvider : IFocusWindowProvider
12 | {
13 | private readonly Application application;
14 |
15 | public FocusWindowProvider(Application application)
16 | {
17 | this.application = application;
18 | }
19 |
20 | public bool TryFocus()
21 | {
22 | var window = this.application.Windows.OfType().FirstOrDefault(x => x.DataContext is TViewModel);
23 | if (window != null)
24 | {
25 | window.Focus();
26 | return true;
27 | }
28 | return false;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Services/GraphicsCardDetector.cs:
--------------------------------------------------------------------------------
1 | using NLog;
2 | using System;
3 | using System.Management;
4 |
5 | namespace SyncTrayzor.Services
6 | {
7 | public class GraphicsCardDetector
8 | {
9 | private static readonly Logger logger = LogManager.GetCurrentClassLogger();
10 |
11 | private bool? _isIntelXe;
12 | public bool IsIntelXe
13 | {
14 | get
15 | {
16 | if (this._isIntelXe == null)
17 | this._isIntelXe = GetIsIntelXe();
18 | return this._isIntelXe.Value;
19 | }
20 | }
21 |
22 | private static bool GetIsIntelXe()
23 | {
24 | // ManagedObjectEnumerator.MoveNext can throw a COMException if WMI isn't started.
25 | // We also want to ignore other potential problems. If we hit something, assume they're not
26 | // using Intel Xe Graphics.
27 | try
28 | {
29 | var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_VideoController");
30 | foreach (ManagementObject obj in searcher.Get())
31 | {
32 | if (obj["CurrentBitsPerPixel"] != null && obj["CurrentHorizontalResolution"] != null)
33 | {
34 | string name = obj["Name"]?.ToString();
35 | if (name.IndexOf("Intel", StringComparison.OrdinalIgnoreCase) >= 0 &&
36 | name.IndexOf(" Xe ", StringComparison.OrdinalIgnoreCase) >= 0)
37 | {
38 | logger.Info($"Graphics card: {name}");
39 | return true;
40 | }
41 | }
42 | }
43 | }
44 | catch { }
45 |
46 | return false;
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Services/MemoryUsageLogger.cs:
--------------------------------------------------------------------------------
1 | using NLog;
2 | using SyncTrayzor.Utils;
3 | using System;
4 | using System.Diagnostics;
5 | using System.Timers;
6 |
7 | namespace SyncTrayzor.Services
8 | {
9 | public class MemoryUsageLogger
10 | {
11 | private static readonly Logger logger = LogManager.GetCurrentClassLogger();
12 | private static readonly TimeSpan pollInterval = TimeSpan.FromMinutes(5);
13 |
14 | private readonly Timer timer;
15 | private readonly Process process;
16 |
17 | public bool Enabled
18 | {
19 | get => this.timer.Enabled;
20 | set => this.timer.Enabled = value;
21 | }
22 |
23 | public MemoryUsageLogger()
24 | {
25 | this.process = Process.GetCurrentProcess();
26 |
27 | this.timer = new Timer()
28 | {
29 | AutoReset = true,
30 | Interval = pollInterval.TotalMilliseconds,
31 | };
32 | this.timer.Elapsed += (o, e) =>
33 | {
34 | logger.Info("Working Set: {0}. Private Memory Size: {1}. GC Total Memory: {2}",
35 | FormatUtils.BytesToHuman(this.process.WorkingSet64), FormatUtils.BytesToHuman(this.process.PrivateMemorySize64),
36 | FormatUtils.BytesToHuman(GC.GetTotalMemory(true)));
37 | };
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Services/PathTransformer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text.RegularExpressions;
4 | using Pri.LongPath;
5 |
6 | namespace SyncTrayzor.Services
7 | {
8 | public interface IPathTransformer
9 | {
10 | string MakeAbsolute(string input);
11 | }
12 |
13 | public class PathTransformer : IPathTransformer
14 | {
15 | private static readonly Regex varRegex = new Regex(@"%(\w+)%");
16 | private readonly Dictionary specials;
17 | private readonly string basePath;
18 |
19 | public PathTransformer(IAssemblyProvider assemblyProvider)
20 | {
21 | this.basePath = Path.GetDirectoryName(assemblyProvider.Location);
22 |
23 | this.specials = new Dictionary()
24 | {
25 | // This is legacy, in case it's managed to slip through the configuration
26 | ["EXEPATH"] = this.basePath,
27 | };
28 | }
29 |
30 | public string MakeAbsolute(string input)
31 | {
32 | if (String.IsNullOrWhiteSpace(input))
33 | return input;
34 |
35 | var transformed = varRegex.Replace(input, match =>
36 | {
37 | var name = match.Groups[1].Value;
38 | if (this.specials.ContainsKey(name))
39 | return this.specials[name];
40 | return Environment.GetEnvironmentVariable(name);
41 | });
42 |
43 | if (!Path.IsPathRooted(transformed))
44 | transformed = Path.Combine(this.basePath, transformed);
45 |
46 | return transformed;
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Services/UpdateManagement/IUpdateNotificationApi.cs:
--------------------------------------------------------------------------------
1 | using RestEase;
2 | using System.Threading.Tasks;
3 |
4 | namespace SyncTrayzor.Services.UpdateManagement
5 | {
6 | public interface IUpdateNotificationApi
7 | {
8 | [Get("")]
9 | Task FetchUpdateAsync(string version, string arch, string variant);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Services/UpdateManagement/IUpdateVariantHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 |
3 | namespace SyncTrayzor.Services.UpdateManagement
4 | {
5 | public interface IUpdateVariantHandler
6 | {
7 | string VariantName { get; }
8 | bool CanAutoInstall { get; }
9 | bool RequiresUac { get; }
10 |
11 | Task TryHandleUpdateAvailableAsync(VersionCheckResults checkResult);
12 | void AutoInstall(string pathToRestartApplication);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Services/UpdateManagement/Release.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Services.UpdateManagement
4 | {
5 | public class Release
6 | {
7 | public Version Version { get; }
8 | public string DownloadUrl { get; }
9 | public string Body { get; }
10 |
11 | public Release(Version version, string downloadUrl, string body)
12 | {
13 | this.Version = version;
14 | this.DownloadUrl = downloadUrl;
15 | this.Body = body;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Services/UpdateManagement/UpdateCheckerFactory.cs:
--------------------------------------------------------------------------------
1 | namespace SyncTrayzor.Services.UpdateManagement
2 | {
3 | public interface IUpdateCheckerFactory
4 | {
5 | IUpdateChecker CreateUpdateChecker(string baseUrl, string variant);
6 | }
7 |
8 | public class UpdateCheckerFactory : IUpdateCheckerFactory
9 | {
10 | private readonly IAssemblyProvider assemblyProvider;
11 | private readonly IUpdateNotificationClientFactory updateNotificationClientFactory;
12 |
13 | public UpdateCheckerFactory(IAssemblyProvider assemblyProvider, IUpdateNotificationClientFactory updateNotificationClientFactory)
14 | {
15 | this.assemblyProvider = assemblyProvider;
16 | this.updateNotificationClientFactory = updateNotificationClientFactory;
17 | }
18 |
19 | public IUpdateChecker CreateUpdateChecker(string baseUrl, string variant)
20 | {
21 | return new UpdateChecker(this.assemblyProvider.Version, this.assemblyProvider.ProcessorArchitecture, variant, this.updateNotificationClientFactory.CreateUpdateNotificationClient(baseUrl));
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Services/UpdateManagement/UpdateNotificationClient.cs:
--------------------------------------------------------------------------------
1 | using NLog;
2 | using RestEase;
3 | using System.Threading.Tasks;
4 |
5 | namespace SyncTrayzor.Services.UpdateManagement
6 | {
7 | public interface IUpdateNotificationClient
8 | {
9 | Task FetchUpdateAsync(string version, string arch, string variant);
10 | }
11 |
12 | public class UpdateNotificationClient : IUpdateNotificationClient
13 | {
14 | private static readonly Logger logger = LogManager.GetCurrentClassLogger();
15 |
16 | private readonly IUpdateNotificationApi api;
17 |
18 | public UpdateNotificationClient(string url)
19 | {
20 | this.api = RestClient.For(url);
21 | }
22 |
23 | public async Task FetchUpdateAsync(string version, string arch, string variant)
24 | {
25 | var updates = await this.api.FetchUpdateAsync(version, arch, variant);
26 | logger.Debug("Fetched updates response: {0}", updates);
27 | return updates;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Services/UpdateManagement/UpdateNotificationClientFactory.cs:
--------------------------------------------------------------------------------
1 | namespace SyncTrayzor.Services.UpdateManagement
2 | {
3 | public interface IUpdateNotificationClientFactory
4 | {
5 | IUpdateNotificationClient CreateUpdateNotificationClient(string url);
6 | }
7 |
8 | public class UpdateNotificationClientFactory : IUpdateNotificationClientFactory
9 | {
10 | public IUpdateNotificationClient CreateUpdateNotificationClient(string url)
11 | {
12 | return new UpdateNotificationClient(url);
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/ConfigSavedEvent.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace SyncTrayzor.Syncthing.ApiClient
4 | {
5 | public class ConfigSavedEvent : Event
6 | {
7 | [JsonProperty("data")]
8 | public Config Data { get; set; }
9 |
10 | public override bool IsValid => this.Data != null;
11 |
12 | public override void Visit(IEventVisitor visitor)
13 | {
14 | visitor.Accept(this);
15 | }
16 |
17 | public override string ToString()
18 | {
19 | return $"";
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/Connections.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System;
3 | using System.Collections.Generic;
4 |
5 | namespace SyncTrayzor.Syncthing.ApiClient
6 | {
7 | public class ItemConnectionData
8 | {
9 | [JsonProperty("at")]
10 | public DateTime At { get; set; }
11 |
12 | [JsonProperty("inBytesTotal")]
13 | public long InBytesTotal { get; set; }
14 |
15 | [JsonProperty("outBytesTotal")]
16 | public long OutBytesTotal { get; set; }
17 |
18 | [JsonProperty("address")]
19 | public string Address { get; set; }
20 |
21 | [JsonProperty("clientVersion")]
22 | public string ClientVersion { get; set; }
23 |
24 | [JsonProperty("connected")]
25 | public bool Connected { get; set; }
26 |
27 | [JsonProperty("paused")]
28 | public bool Paused { get; set; }
29 |
30 | [JsonProperty("type")]
31 | public string Type { get; set; }
32 | }
33 |
34 | public class Connections
35 | {
36 | [JsonProperty("total")]
37 | public ItemConnectionData Total { get; set; }
38 |
39 | [JsonProperty("connections")]
40 | public Dictionary DeviceConnections { get; set; }
41 |
42 | public Connections()
43 | {
44 | this.DeviceConnections = new Dictionary();
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/DebugFacilitiesSettings.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using Newtonsoft.Json;
5 |
6 | namespace SyncTrayzor.Syncthing.ApiClient
7 | {
8 | public class DebugFacilitiesSettings
9 | {
10 | [JsonProperty("enabled")]
11 | public List Enabled { get; set; }
12 |
13 | [JsonProperty("facilities")]
14 | public Dictionary Facilities { get; set; }
15 |
16 | public override string ToString()
17 | {
18 | var facilities = String.Join(",", this.Facilities?.Select(kvp => $"{kvp.Key}={kvp.Value}"));
19 | var enabled = (this.Enabled == null) ? String.Empty : String.Join(",", this.Enabled);
20 | return $"";
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/DefaultingStringEnumConverter.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Converters;
3 | using System;
4 |
5 | namespace SyncTrayzor.Syncthing.ApiClient
6 | {
7 | public class DefaultingStringEnumConverter : StringEnumConverter
8 | {
9 | public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
10 | {
11 | try
12 | {
13 | return base.ReadJson(reader, objectType, existingValue, serializer);
14 | }
15 | // It seems we can get both...
16 | catch (ArgumentException)
17 | {
18 | return ReadDefaultEnumValue(objectType);
19 | }
20 | catch (JsonSerializationException e) when (e.InnerException is ArgumentException)
21 | {
22 | return ReadDefaultEnumValue(objectType);
23 | }
24 | }
25 |
26 | private static object ReadDefaultEnumValue(Type objectType)
27 | {
28 | // Failed to convert enum
29 | foreach (var element in Enum.GetValues(objectType))
30 | {
31 | return element;
32 | }
33 |
34 | // No values? Highly unusual, but keep the compiler happy
35 | throw new ArgumentException($"Enum type {objectType.Name} does not have any values");
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/DeviceConnectedEvent.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace SyncTrayzor.Syncthing.ApiClient
4 | {
5 | public class DeviceConnectedEventData
6 | {
7 | [JsonProperty("addr")]
8 | public string Address { get; set; }
9 |
10 | [JsonProperty("id")]
11 | public string Id { get; set; }
12 | }
13 |
14 | public class DeviceConnectedEvent : Event
15 | {
16 | [JsonProperty("data")]
17 | public DeviceConnectedEventData Data { get; set; }
18 |
19 | public override bool IsValid => this.Data != null &&
20 | !string.IsNullOrWhiteSpace(this.Data.Address) &&
21 | !string.IsNullOrWhiteSpace(this.Data.Id);
22 |
23 | public override void Visit(IEventVisitor visitor)
24 | {
25 | visitor.Accept(this);
26 | }
27 |
28 | public override string ToString()
29 | {
30 | return $"";
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/DeviceDisconnectedEvent.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace SyncTrayzor.Syncthing.ApiClient
4 | {
5 | public class DeviceDisconnectedEventData
6 | {
7 | [JsonProperty("error")]
8 | public string Error { get; set; }
9 |
10 | [JsonProperty("id")]
11 | public string Id { get; set; }
12 | }
13 |
14 | public class DeviceDisconnectedEvent : Event
15 | {
16 | [JsonProperty("data")]
17 | public DeviceDisconnectedEventData Data { get; set; }
18 |
19 | public override bool IsValid => this.Data != null &&
20 | !string.IsNullOrWhiteSpace(this.Data.Id);
21 |
22 | public override void Visit(IEventVisitor visitor)
23 | {
24 | visitor.Accept(this);
25 | }
26 |
27 | public override string ToString()
28 | {
29 | return $"";
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/DevicePausedEvent.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace SyncTrayzor.Syncthing.ApiClient
4 | {
5 | public class DevicePausedEventData
6 | {
7 | [JsonProperty("device")]
8 | public string DeviceId { get; set; }
9 | }
10 |
11 | public class DevicePausedEvent : Event
12 | {
13 | [JsonProperty("data")]
14 | public DevicePausedEventData Data { get; set; }
15 |
16 | public override bool IsValid => this.Data != null &&
17 | !string.IsNullOrWhiteSpace(this.Data.DeviceId);
18 |
19 | public override void Visit(IEventVisitor visitor)
20 | {
21 | visitor.Accept(this);
22 | }
23 |
24 | public override string ToString()
25 | {
26 | return $"";
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/DeviceRejectedEvent.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | namespace SyncTrayzor.Syncthing.ApiClient
3 | {
4 | public class DeviceRejectedEventData
5 | {
6 | [JsonProperty("address")]
7 | public string Address { get; set; }
8 |
9 | [JsonProperty("device")]
10 | public string DeviceId { get; set; }
11 | }
12 |
13 | public class DeviceRejectedEvent : Event
14 | {
15 | [JsonProperty("data")]
16 | public DeviceRejectedEventData Data { get; set; }
17 |
18 | public override bool IsValid => this.Data != null &&
19 | !string.IsNullOrWhiteSpace(this.Data.Address) &&
20 | !string.IsNullOrWhiteSpace(this.Data.DeviceId);
21 |
22 | public override void Visit(IEventVisitor visitor)
23 | {
24 | visitor.Accept(this);
25 | }
26 |
27 | public override string ToString()
28 | {
29 | return $"";
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/DeviceResumedEvent.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace SyncTrayzor.Syncthing.ApiClient
4 | {
5 | public class DeviceResumedEventData
6 | {
7 | [JsonProperty("device")]
8 | public string DeviceId { get; set; }
9 | }
10 |
11 | public class DeviceResumedEvent : Event
12 | {
13 | [JsonProperty("data")]
14 | public DevicePausedEventData Data { get; set; }
15 |
16 | public override bool IsValid => this.Data != null &&
17 | !string.IsNullOrEmpty(this.Data.DeviceId);
18 |
19 | public override void Visit(IEventVisitor visitor)
20 | {
21 | visitor.Accept(this);
22 | }
23 |
24 | public override string ToString()
25 | {
26 | return $"";
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/Event.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System;
3 |
4 | namespace SyncTrayzor.Syncthing.ApiClient
5 | {
6 | public abstract class Event
7 | {
8 | [JsonProperty("id")]
9 | public int Id { get; set; }
10 |
11 | [JsonProperty("type")]
12 | public EventType Type { get; set; }
13 |
14 | [JsonProperty("time")]
15 | public DateTime Time { get; set; }
16 |
17 | public abstract bool IsValid { get; }
18 |
19 | public abstract void Visit(IEventVisitor visitor);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/EventType.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace SyncTrayzor.Syncthing.ApiClient
4 | {
5 | [JsonConverter(typeof(DefaultingStringEnumConverter))]
6 | public enum EventType
7 | {
8 | Unknown,
9 |
10 | StartupComplete,
11 | DeviceConnected,
12 | DeviceDisconnected,
13 | RemoteIndexUpdated,
14 | LocalIndexUpdated,
15 | ItemStarted,
16 | ItemFinished,
17 | StateChanged,
18 | FolderRejected,
19 | DeviceRejected,
20 | ConfigSaved,
21 | DownloadProgress,
22 | FolderSummary,
23 | FolderErrors,
24 | DevicePaused,
25 | DeviceResumed,
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/FolderErrorsEvent.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System;
3 | using System.Collections.Generic;
4 |
5 | namespace SyncTrayzor.Syncthing.ApiClient
6 | {
7 | public class FolderErrorData
8 | {
9 | [JsonProperty("error")]
10 | public string Error { get; set; }
11 |
12 | [JsonProperty("path")]
13 | public string Path { get; set; }
14 |
15 | public override string ToString()
16 | {
17 | return $"";
18 | }
19 | }
20 |
21 | public class FolderErrorsEventData
22 | {
23 | [JsonProperty("folder")]
24 | public string Folder { get; set; }
25 |
26 | [JsonProperty("errors")]
27 | public List Errors { get; set; }
28 | }
29 |
30 | public class FolderErrorsEvent : Event
31 | {
32 | [JsonProperty("data")]
33 | public FolderErrorsEventData Data { get; set; }
34 |
35 | public override bool IsValid => this.Data != null &&
36 | !string.IsNullOrWhiteSpace(this.Data.Folder) &&
37 | this.Data.Errors != null;
38 |
39 | public override void Visit(IEventVisitor visitor)
40 | {
41 | visitor.Accept(this);
42 | }
43 |
44 | public override string ToString()
45 | {
46 | return $"";
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/FolderRejectedEvent.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace SyncTrayzor.Syncthing.ApiClient
4 | {
5 | public class FolderRejectedEventData
6 | {
7 | [JsonProperty("device")]
8 | public string DeviceId { get; set; }
9 |
10 | [JsonProperty("folder")]
11 | public string FolderId { get; set; }
12 | }
13 |
14 | public class FolderRejectedEvent : Event
15 | {
16 | [JsonProperty("data")]
17 | public FolderRejectedEventData Data { get; set; }
18 |
19 | public override bool IsValid => this.Data != null &&
20 | !string.IsNullOrWhiteSpace(this.Data.DeviceId) &&
21 | !string.IsNullOrWhiteSpace(this.Data.FolderId);
22 |
23 | public override void Visit(IEventVisitor visitor)
24 | {
25 | visitor.Accept(this);
26 | }
27 |
28 | public override string ToString()
29 | {
30 | return $"";
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/FolderSummaryEvent.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace SyncTrayzor.Syncthing.ApiClient
4 | {
5 | public class FolderSummaryEventData
6 | {
7 | [JsonProperty("folder")]
8 | public string Folder { get; set; }
9 |
10 | [JsonProperty("summary")]
11 | public FolderStatus Summary { get; set; }
12 | }
13 |
14 | public class FolderSummaryEvent : Event
15 | {
16 | [JsonProperty("data")]
17 | public FolderSummaryEventData Data { get; set; }
18 |
19 | public override bool IsValid => this.Data != null &&
20 | !string.IsNullOrWhiteSpace(this.Data.Folder);
21 |
22 | public override void Visit(IEventVisitor visitor)
23 | {
24 | visitor.Accept(this);
25 | }
26 |
27 | public override string ToString()
28 | {
29 | return $"";
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/GenericEvent.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Linq;
3 |
4 | namespace SyncTrayzor.Syncthing.ApiClient
5 | {
6 | public class GenericEvent : Event
7 | {
8 | public override bool IsValid => true;
9 |
10 | public override void Visit(IEventVisitor visitor)
11 | {
12 | visitor.Accept(this);
13 | }
14 |
15 | [JsonProperty("data")]
16 | public JToken Data { get; set; }
17 |
18 | public override string ToString()
19 | {
20 | return $"";
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/IEventVisitor.cs:
--------------------------------------------------------------------------------
1 | namespace SyncTrayzor.Syncthing.ApiClient
2 | {
3 | public interface IEventVisitor
4 | {
5 | void Accept(GenericEvent evt);
6 | void Accept(RemoteIndexUpdatedEvent evt);
7 | void Accept(LocalIndexUpdatedEvent evt);
8 | void Accept(StateChangedEvent evt);
9 | void Accept(ItemStartedEvent evt);
10 | void Accept(ItemFinishedEvent evt);
11 | void Accept(StartupCompleteEvent evt);
12 | void Accept(DeviceConnectedEvent evt);
13 | void Accept(DeviceDisconnectedEvent evt);
14 | void Accept(DownloadProgressEvent evt);
15 | void Accept(ConfigSavedEvent evt);
16 | void Accept(FolderSummaryEvent evt);
17 | void Accept(FolderErrorsEvent evt);
18 | void Accept(DevicePausedEvent evt);
19 | void Accept(DeviceResumedEvent evt);
20 | void Accept(DeviceRejectedEvent evt);
21 | void Accept(FolderRejectedEvent evt);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/ISyncthingApi.cs:
--------------------------------------------------------------------------------
1 | using RestEase;
2 | using System.Collections.Generic;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 |
6 | namespace SyncTrayzor.Syncthing.ApiClient
7 | {
8 | public interface ISyncthingApi
9 | {
10 | [Header("X-API-Key")]
11 | string ApiKey { get; set; }
12 |
13 | [Get("/rest/events")]
14 | Task> FetchEventsAsync(int since, string events, CancellationToken cancellationToken);
15 |
16 | [Get("/rest/events")]
17 | Task> FetchEventsLimitAsync(int since, int limit, string events, CancellationToken cancellationToken);
18 |
19 | [Get("/rest/system/config")]
20 | Task FetchConfigAsync();
21 |
22 | [Post("/rest/system/shutdown")]
23 | Task ShutdownAsync();
24 |
25 | [Post("/rest/db/scan")]
26 | Task ScanAsync(string folder, string sub);
27 |
28 | [Get("/rest/system/status")]
29 | Task FetchSystemInfoAsync(CancellationToken cancellationToken);
30 |
31 | [Get("/rest/system/connections")]
32 | Task FetchConnectionsAsync(CancellationToken cancellationToken);
33 |
34 | [Get("/rest/system/version")]
35 | Task FetchVersionAsync(CancellationToken cancellationToken);
36 |
37 | [Post("/rest/system/restart")]
38 | Task RestartAsync();
39 |
40 | [Get("/rest/db/status")]
41 | Task FetchFolderStatusAsync(string folder, CancellationToken cancellationToken);
42 |
43 | [Get("/rest/system/debug")]
44 | Task FetchDebugFacilitiesAsync();
45 |
46 | [Post("/rest/system/debug")]
47 | Task SetDebugFacilitiesAsync(string enable, string disable);
48 |
49 | [Post("/rest/system/pause")]
50 | Task PauseDeviceAsync(string device);
51 |
52 | [Post("/rest/system/resume")]
53 | Task ResumeDeviceAsync(string device);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/ISyncthingApiClient.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Threading;
3 | using System.Threading.Tasks;
4 |
5 | namespace SyncTrayzor.Syncthing.ApiClient
6 | {
7 | public interface ISyncthingApiClient
8 | {
9 | Task ShutdownAsync();
10 | Task> FetchEventsAsync(int since, int limit, CancellationToken cancellationToken);
11 | Task> FetchEventsAsync(int since, CancellationToken cancellationToken);
12 | Task FetchConfigAsync();
13 | Task ScanAsync(string folderId, string subPath);
14 | Task FetchSystemInfoAsync(CancellationToken cancellationToken);
15 | Task FetchConnectionsAsync(CancellationToken cancellationToken);
16 | Task FetchVersionAsync(CancellationToken cancellationToken);
17 | Task RestartAsync();
18 | Task FetchFolderStatusAsync(string folderId, CancellationToken cancellationToken);
19 | Task FetchDebugFacilitiesAsync();
20 | Task SetDebugFacilitiesAsync(IEnumerable enable, IEnumerable disable);
21 | Task PauseDeviceAsync(string deviceId);
22 | Task ResumeDeviceAsync(string deviceId);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/ItemChangedActionType.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace SyncTrayzor.Syncthing.ApiClient
4 | {
5 | [JsonConverter(typeof(DefaultingStringEnumConverter))]
6 | public enum ItemChangedActionType
7 | {
8 | Unknown,
9 |
10 | Update,
11 | Delete,
12 | Metadata,
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/ItemChangedItemType.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace SyncTrayzor.Syncthing.ApiClient
4 | {
5 | [JsonConverter(typeof(DefaultingStringEnumConverter))]
6 | public enum ItemChangedItemType
7 | {
8 | Unknown,
9 |
10 | File,
11 | Dir,
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/ItemStartedEvent.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace SyncTrayzor.Syncthing.ApiClient
4 | {
5 | public class ItemStartedEventData
6 | {
7 | [JsonProperty("item")]
8 | public string Item { get; set; }
9 |
10 | [JsonProperty("folder")]
11 | public string Folder { get; set; }
12 |
13 | [JsonProperty("type")]
14 | public ItemChangedItemType Type { get; set; }
15 |
16 | [JsonProperty("action")]
17 | public ItemChangedActionType Action { get; set; }
18 | }
19 |
20 | public class ItemStartedEvent : Event
21 | {
22 | [JsonProperty("data")]
23 | public ItemStartedEventData Data { get; set; }
24 |
25 | public override bool IsValid => this.Data != null &&
26 | !string.IsNullOrWhiteSpace(this.Data.Item) &&
27 | !string.IsNullOrWhiteSpace(this.Data.Folder) &&
28 | this.Data.Type != ItemChangedItemType.Unknown &&
29 | this.Data.Action != ItemChangedActionType.Unknown;
30 |
31 | public override void Visit(IEventVisitor visitor)
32 | {
33 | visitor.Accept(this);
34 | }
35 |
36 | public override string ToString()
37 | {
38 | return $"";
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/LocalIndexUpdatedEvent.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace SyncTrayzor.Syncthing.ApiClient
4 | {
5 | public class LocalIndexUpdatedEventData
6 | {
7 | [JsonProperty("folder")]
8 | public string Folder { get; set; }
9 |
10 | [JsonProperty("items")]
11 | public int Items { get; set; }
12 |
13 | [JsonProperty("version")]
14 | public long Version { get; set; }
15 | }
16 |
17 | public class LocalIndexUpdatedEvent : Event
18 | {
19 | [JsonProperty("data")]
20 | public LocalIndexUpdatedEventData Data { get; set; }
21 |
22 | public override bool IsValid => this.Data != null &&
23 | !string.IsNullOrWhiteSpace(this.Data.Folder) &&
24 | this.Data.Items >= 0;
25 |
26 | public override void Visit(IEventVisitor visitor)
27 | {
28 | visitor.Accept(this);
29 | }
30 |
31 | public override string ToString()
32 | {
33 | return $"";
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/RemoteIndexUpdatedEvent.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace SyncTrayzor.Syncthing.ApiClient
4 | {
5 | public class RemoteIndexUpdatedEventData
6 | {
7 | [JsonProperty("device")]
8 | public string Device { get; set; }
9 |
10 | [JsonProperty("folder")]
11 | public string Folder { get; set; }
12 |
13 | [JsonProperty("items")]
14 | public long Items { get; set; }
15 | }
16 |
17 | public class RemoteIndexUpdatedEvent : Event
18 | {
19 | [JsonProperty("data")]
20 | public RemoteIndexUpdatedEventData Data { get; set; }
21 |
22 | public override bool IsValid => this.Data != null &&
23 | !string.IsNullOrWhiteSpace(this.Data.Device) &&
24 | !string.IsNullOrWhiteSpace(this.Data.Folder) &&
25 | this.Data.Items >= 0;
26 |
27 | public override void Visit(IEventVisitor visitor)
28 | {
29 | visitor.Accept(this);
30 | }
31 |
32 | public override string ToString()
33 | {
34 | return $"";
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/StartupCompleteEvent.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace SyncTrayzor.Syncthing.ApiClient
4 | {
5 | public class StartupCompleteEvent : Event
6 | {
7 | [JsonProperty("myID")]
8 | public string MyID { get; set; }
9 |
10 | public override bool IsValid => !string.IsNullOrWhiteSpace(this.MyID);
11 |
12 | public override void Visit(IEventVisitor visitor)
13 | {
14 | visitor.Accept(this);
15 | }
16 |
17 | public override string ToString()
18 | {
19 | return $"";
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/StateChangedEvent.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using System;
3 |
4 | namespace SyncTrayzor.Syncthing.ApiClient
5 | {
6 | public class StateChangedEventData
7 | {
8 | [JsonProperty("folder")]
9 | public string Folder { get; set; }
10 |
11 | [JsonProperty("from")]
12 | public string From { get; set; }
13 |
14 | [JsonProperty("to")]
15 | public string To { get; set; }
16 |
17 | [JsonProperty("duration")]
18 | public double DurationSeconds { get; set; }
19 |
20 | public TimeSpan Duration
21 | {
22 | get => TimeSpan.FromSeconds(this.DurationSeconds);
23 | set => this.DurationSeconds = value.TotalSeconds;
24 | }
25 | }
26 |
27 | public class StateChangedEvent : Event
28 | {
29 | [JsonProperty("data")]
30 | public StateChangedEventData Data { get; set; }
31 |
32 | public override bool IsValid => this.Data != null &&
33 | !string.IsNullOrWhiteSpace(this.Data.Folder) &&
34 | !string.IsNullOrWhiteSpace(this.Data.From) &&
35 | !string.IsNullOrWhiteSpace(this.Data.To) &&
36 | this.Data.Duration >= TimeSpan.Zero;
37 |
38 | public override void Visit(IEventVisitor visitor)
39 | {
40 | visitor.Accept(this);
41 | }
42 |
43 | public override string ToString()
44 | {
45 | return $"";
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/SyncthingHttpClientHandler.cs:
--------------------------------------------------------------------------------
1 | using NLog;
2 | using System.Net.Http;
3 | using System.Threading;
4 | using System.Threading.Tasks;
5 |
6 | namespace SyncTrayzor.Syncthing.ApiClient
7 | {
8 | public class SyncthingHttpClientHandler : WebRequestHandler
9 | {
10 | private static readonly Logger logger = LogManager.GetCurrentClassLogger();
11 |
12 | public SyncthingHttpClientHandler()
13 | {
14 | // We expect Syncthing to return invalid certs
15 | this.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
16 | }
17 |
18 | protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
19 | {
20 | var response = await base.SendAsync(request, cancellationToken);
21 | if (response.IsSuccessStatusCode)
22 | {
23 | if (logger.IsTraceEnabled)
24 | {
25 | var content = (await response.Content.ReadAsStringAsync()).Trim();
26 | logger.Trace(content);
27 | }
28 | }
29 | else
30 | {
31 | logger.Warn("Non-successful status code. {0} {1}", response, (await response.Content.ReadAsStringAsync()).Trim());
32 | }
33 |
34 | return response;
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/SyncthingVersion.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace SyncTrayzor.Syncthing.ApiClient
4 | {
5 | public class SyncthingVersion
6 | {
7 | [JsonProperty("arch")]
8 | public string Arch { get; set; }
9 |
10 | [JsonProperty("longVersion")]
11 | public string LongVersion { get; set; }
12 |
13 | [JsonProperty("os")]
14 | public string OS { get; set; }
15 |
16 | [JsonProperty("version")]
17 | public string Version { get; set; }
18 |
19 | public override string ToString()
20 | {
21 | return $"";
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/ApiClient/SystemInfo.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace SyncTrayzor.Syncthing.ApiClient
4 | {
5 | public class SystemInfo
6 | {
7 | [JsonProperty("alloc")]
8 | public long AllocatedMemoryInUse { get; set; }
9 |
10 | [JsonProperty("cpuPercent")]
11 | public float CpuPercent { get; set; }
12 |
13 | // Ignore extAnnounceOK for now
14 |
15 | [JsonProperty("goroutines")]
16 | public long GoRoutines { get; set; }
17 |
18 | [JsonProperty("myID")]
19 | public string MyID { get; set; }
20 |
21 | [JsonProperty("pathSeparator")]
22 | public string PathSeparator { get; set; }
23 |
24 | [JsonProperty("sys")]
25 | public long AllocatedMemoryTotal { get; set; }
26 |
27 | [JsonProperty("tilde")]
28 | public string Tilde { get; set; }
29 |
30 | public override string ToString()
31 | {
32 | return $"";
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/DeviceRejectedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Syncthing
4 | {
5 | public class DeviceRejectedEventArgs : EventArgs
6 | {
7 | public string DeviceId { get; }
8 | public string Address { get; }
9 |
10 | public DeviceRejectedEventArgs(string deviceId, string address)
11 | {
12 | this.DeviceId = deviceId;
13 | this.Address = address;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/Devices/DeviceConnectedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Syncthing.Devices
4 | {
5 | public class DeviceConnectedEventArgs : EventArgs
6 | {
7 | public Device Device { get; }
8 |
9 | public DeviceConnectedEventArgs(Device device)
10 | {
11 | this.Device = device;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/Devices/DeviceDisconnectedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Syncthing.Devices
4 | {
5 | public class DeviceDisconnectedEventArgs : EventArgs
6 | {
7 | public Device Device { get; }
8 |
9 | public DeviceDisconnectedEventArgs(Device device)
10 | {
11 | this.Device = device;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/Devices/DevicePausedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Syncthing.Devices
4 | {
5 | public class DevicePausedEventArgs : EventArgs
6 | {
7 | public Device Device { get; }
8 |
9 | public DevicePausedEventArgs(Device device)
10 | {
11 | this.Device = device;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/Devices/DeviceResumedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Syncthing.Devices
4 | {
5 | public class DeviceResumedEventArgs : EventArgs
6 | {
7 | public Device Device { get; }
8 |
9 | public DeviceResumedEventArgs(Device device)
10 | {
11 | this.Device = device;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/EventWatcher/ConfigSavedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using SyncTrayzor.Syncthing.ApiClient;
2 | using System;
3 |
4 | namespace SyncTrayzor.Syncthing.EventWatcher
5 | {
6 | public class ConfigSavedEventArgs : EventArgs
7 | {
8 | public Config Config { get; }
9 |
10 | public ConfigSavedEventArgs(Config config)
11 | {
12 | this.Config = config;
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/EventWatcher/DeviceConnectedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Syncthing.EventWatcher
4 | {
5 | public class DeviceConnectedEventArgs : EventArgs
6 | {
7 | public string DeviceId { get; }
8 | public string Address { get; }
9 |
10 | public DeviceConnectedEventArgs(string deviceId, string address)
11 | {
12 | this.DeviceId = deviceId;
13 | this.Address = address;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/EventWatcher/DeviceDisconnectedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Syncthing.EventWatcher
4 | {
5 | public class DeviceDisconnectedEventArgs : EventArgs
6 | {
7 | public string DeviceId { get; }
8 | public string Error { get; }
9 |
10 | public DeviceDisconnectedEventArgs(string deviceId, string error)
11 | {
12 | this.DeviceId = deviceId;
13 | this.Error = error;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/EventWatcher/DevicePausedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Syncthing.EventWatcher
4 | {
5 | public class DevicePausedEventArgs : EventArgs
6 | {
7 | public string DeviceId { get; }
8 |
9 | public DevicePausedEventArgs(string deviceId)
10 | {
11 | this.DeviceId = deviceId;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/EventWatcher/DeviceRejectedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Syncthing.EventWatcher
4 | {
5 | public class DeviceRejectedEventArgs : EventArgs
6 | {
7 | public string DeviceId { get; }
8 | public string Address { get; }
9 |
10 | public DeviceRejectedEventArgs(string deviceId, string address)
11 | {
12 | this.DeviceId = deviceId;
13 | this.Address = address;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/EventWatcher/DeviceResumedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Syncthing.EventWatcher
4 | {
5 | public class DeviceResumedEventArgs : EventArgs
6 | {
7 | public string DeviceId { get; }
8 |
9 | public DeviceResumedEventArgs(string deviceId)
10 | {
11 | this.DeviceId = deviceId;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/EventWatcher/FolderErrorsChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using SyncTrayzor.Syncthing.ApiClient;
2 | using System;
3 | using System.Collections.Generic;
4 |
5 | namespace SyncTrayzor.Syncthing.EventWatcher
6 | {
7 | public class FolderErrorsChangedEventArgs : EventArgs
8 | {
9 | public string FolderId { get; }
10 |
11 | public List Errors { get; }
12 |
13 | public FolderErrorsChangedEventArgs(string folderId, List errors)
14 | {
15 | this.FolderId = folderId;
16 | this.Errors = errors;
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/EventWatcher/FolderRejectedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Syncthing.EventWatcher
4 | {
5 | public class FolderRejectedEventArgs : EventArgs
6 | {
7 | public string DeviceId { get; }
8 | public string FolderId { get; }
9 |
10 | public FolderRejectedEventArgs(string deviceId, string folderId)
11 | {
12 | this.DeviceId = deviceId;
13 | this.FolderId = folderId;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/EventWatcher/FolderStatusChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using SyncTrayzor.Syncthing.ApiClient;
2 | using System;
3 |
4 | namespace SyncTrayzor.Syncthing.EventWatcher
5 | {
6 | public class FolderStatusChangedEventArgs : EventArgs
7 | {
8 | public string FolderId { get; }
9 |
10 | public FolderStatus FolderStatus { get; }
11 |
12 | public FolderStatusChangedEventArgs(string folderId, FolderStatus folderStatus)
13 | {
14 | this.FolderId = folderId;
15 | this.FolderStatus = folderStatus;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/EventWatcher/ItemDownloadProgressChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | namespace SyncTrayzor.Syncthing.EventWatcher
2 | {
3 | public class ItemDownloadProgressChangedEventArgs : ItemStateChangedEventArgs
4 | {
5 | public long BytesDone { get; }
6 | public long BytesTotal { get; }
7 |
8 | public ItemDownloadProgressChangedEventArgs(string folder, string item, long bytesDone, long bytesTotal)
9 | : base(folder, item)
10 | {
11 | this.BytesDone = bytesDone;
12 | this.BytesTotal = bytesTotal;
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/EventWatcher/ItemFinishedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using SyncTrayzor.Syncthing.ApiClient;
2 |
3 | namespace SyncTrayzor.Syncthing.EventWatcher
4 | {
5 | public class ItemFinishedEventArgs : ItemStateChangedEventArgs
6 | {
7 | public ItemChangedActionType Action { get; }
8 | public ItemChangedItemType ItemType { get; }
9 | public string Error { get; private set; }
10 |
11 | public ItemFinishedEventArgs(string folder, string item, ItemChangedActionType action, ItemChangedItemType itemType, string error)
12 | : base(folder, item)
13 | {
14 | this.Action = action;
15 | this.ItemType = itemType;
16 | this.Error = error;
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/EventWatcher/ItemStartedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using SyncTrayzor.Syncthing.ApiClient;
2 |
3 | namespace SyncTrayzor.Syncthing.EventWatcher
4 | {
5 | public class ItemStartedEventArgs : ItemStateChangedEventArgs
6 | {
7 | public ItemChangedActionType Action { get; }
8 | public ItemChangedItemType ItemType { get; }
9 |
10 | public ItemStartedEventArgs(string folder, string item, ItemChangedActionType action, ItemChangedItemType itemType)
11 | : base(folder, item)
12 | {
13 | this.Action = action;
14 | this.ItemType = itemType;
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/EventWatcher/ItemStateChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Syncthing.EventWatcher
4 | {
5 | public class ItemStateChangedEventArgs : EventArgs
6 | {
7 | public string Folder { get; }
8 | public string Item { get; }
9 |
10 | public ItemStateChangedEventArgs(string folder, string item)
11 | {
12 | this.Folder = folder;
13 | this.Item = item;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/EventWatcher/SyncStateChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Syncthing.EventWatcher
4 | {
5 | public class SyncStateChangedEventArgs : EventArgs
6 | {
7 | public string FolderId { get; }
8 | public string PrevSyncState { get; }
9 | public string SyncState { get; }
10 |
11 | public SyncStateChangedEventArgs(string folderId, string prevSyncState, string syncState)
12 | {
13 | this.FolderId = folderId;
14 | this.PrevSyncState = prevSyncState;
15 | this.SyncState = syncState;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/EventWatcher/SyncthingEventWatcherFactory.cs:
--------------------------------------------------------------------------------
1 | using SyncTrayzor.Syncthing.ApiClient;
2 |
3 | namespace SyncTrayzor.Syncthing.EventWatcher
4 | {
5 | public interface ISyncthingEventWatcherFactory
6 | {
7 | ISyncthingEventWatcher CreateEventWatcher(SynchronizedTransientWrapper apiClient);
8 | }
9 |
10 | public class SyncthingEventWatcherFactory : ISyncthingEventWatcherFactory
11 | {
12 | public ISyncthingEventWatcher CreateEventWatcher(SynchronizedTransientWrapper apiClient)
13 | {
14 | return new SyncthingEventWatcher(apiClient);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/FolderRejectedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using SyncTrayzor.Syncthing.Devices;
2 | using SyncTrayzor.Syncthing.Folders;
3 | using System;
4 |
5 | namespace SyncTrayzor.Syncthing
6 | {
7 | public class FolderRejectedEventArgs : EventArgs
8 | {
9 | public Device Device { get; }
10 | public Folder Folder { get; }
11 |
12 | public FolderRejectedEventArgs(Device device, Folder folder)
13 | {
14 | this.Device = device;
15 | this.Folder = folder;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/Folders/FolderError.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Syncthing.Folders
4 | {
5 | public class FolderError : IEquatable
6 | {
7 | public string Error { get; }
8 | public string Path { get; }
9 |
10 | public FolderError(string error, string path)
11 | {
12 | this.Error = error;
13 | this.Path = path;
14 | }
15 |
16 | public bool Equals(FolderError other)
17 | {
18 | if (ReferenceEquals(this, other))
19 | return true;
20 | if (ReferenceEquals(other, null))
21 | return false;
22 |
23 | return this.Error == other.Error &&
24 | this.Path == other.Path;
25 | }
26 |
27 | public override bool Equals(object obj)
28 | {
29 | return this.Equals(obj as FolderError);
30 | }
31 |
32 | public override int GetHashCode()
33 | {
34 | unchecked
35 | {
36 | int hash = 17;
37 | hash = hash * 23 + this.Error.GetHashCode();
38 | hash = hash * 23 + this.Path.GetHashCode();
39 | return hash;
40 | }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/Folders/FolderErrorsChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace SyncTrayzor.Syncthing.Folders
5 | {
6 | public class FolderErrorsChangedEventArgs : EventArgs
7 | {
8 | public string FolderId { get; }
9 | public IReadOnlyList Errors { get; }
10 |
11 | public FolderErrorsChangedEventArgs(string folderId, List folderErrors)
12 | {
13 | this.FolderId = folderId;
14 | this.Errors = folderErrors.AsReadOnly();
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/Folders/FolderStateTransformer.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using NLog;
3 |
4 | namespace SyncTrayzor.Syncthing.Folders
5 | {
6 | public static class FolderStateTransformer
7 | {
8 | private static readonly Logger logger = LogManager.GetCurrentClassLogger();
9 |
10 | private static readonly Dictionary folderSyncStateLookup = new Dictionary()
11 | {
12 | { "syncing", FolderSyncState.Syncing },
13 | { "scanning", FolderSyncState.Scanning },
14 | { "idle", FolderSyncState.Idle },
15 | { "error", FolderSyncState.Error },
16 | };
17 |
18 | public static FolderSyncState SyncStateFromString(string state)
19 | {
20 | if (folderSyncStateLookup.TryGetValue(state, out var syncState))
21 | return syncState;
22 |
23 | logger.Warn($"Unknown folder sync state {state}. Defaulting to Idle");
24 |
25 | // Default
26 | return FolderSyncState.Idle;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/Folders/FolderStatusChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using SyncTrayzor.Syncthing.ApiClient;
2 | using System;
3 |
4 | namespace SyncTrayzor.Syncthing.Folders
5 | {
6 | public class FolderStatusChangedEventArgs : EventArgs
7 | {
8 | public string FolderId { get; }
9 |
10 | public FolderStatus FolderStatus { get; }
11 |
12 | public FolderStatusChangedEventArgs(string folderId, FolderStatus folderStatus)
13 | {
14 | this.FolderId = folderId;
15 | this.FolderStatus = folderStatus;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/Folders/FolderSyncState.cs:
--------------------------------------------------------------------------------
1 | namespace SyncTrayzor.Syncthing.Folders
2 | {
3 | public enum FolderSyncState
4 | {
5 | Syncing,
6 | Scanning,
7 | Idle,
8 | Error,
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/Folders/FolderSyncStateChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Syncthing.Folders
4 | {
5 | public class FolderSyncStateChangedEventArgs : EventArgs
6 | {
7 | public string FolderId { get; }
8 | public FolderSyncState PrevSyncState { get; }
9 | public FolderSyncState SyncState { get; }
10 |
11 | public FolderSyncStateChangedEventArgs(string folderId, FolderSyncState prevSyncState, FolderSyncState syncState)
12 | {
13 | this.FolderId = folderId;
14 | this.PrevSyncState = prevSyncState;
15 | this.SyncState = syncState;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/FreePortFinder.cs:
--------------------------------------------------------------------------------
1 | using NLog;
2 | using System;
3 | using System.Net;
4 | using System.Net.Sockets;
5 |
6 | namespace SyncTrayzor.Syncthing
7 | {
8 | public interface IFreePortFinder
9 | {
10 | int FindFreePort(int startingPort);
11 | }
12 |
13 | public class FreePortFinder : IFreePortFinder
14 | {
15 | private static readonly Logger logger = LogManager.GetCurrentClassLogger();
16 |
17 | public int FindFreePort(int startingPort)
18 | {
19 | Exception lastException = null;
20 |
21 | for (int i = startingPort; i < 65535; i++)
22 | {
23 | try
24 | {
25 | var listener = new TcpListener(IPAddress.Loopback, i);
26 | listener.Start();
27 | listener.Stop();
28 |
29 | logger.Debug("Found free port: {0}", i);
30 | return i;
31 | }
32 | catch (SocketException e)
33 | {
34 | lastException = e;
35 | }
36 | }
37 |
38 | throw lastException;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/MessageLoggedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Syncthing
4 | {
5 | public class MessageLoggedEventArgs : EventArgs
6 | {
7 | public string LogMessage { get; }
8 |
9 | public MessageLoggedEventArgs(string logMessage)
10 | {
11 | this.LogMessage = logMessage;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/SyncthingCapabilities.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Syncthing
4 | {
5 | public interface ISyncthingCapabilities
6 | {
7 | bool SupportsDebugFacilities { get; }
8 | bool SupportsDevicePauseResume { get; }
9 | }
10 |
11 | public class SyncthingCapabilities : ISyncthingCapabilities
12 | {
13 | private static readonly Version debugFacilitiesIntroduced = new Version(0, 12, 0);
14 | private static readonly Version devicePauseResumeIntroduced = new Version(0, 12, 0);
15 |
16 | public Version SyncthingVersion { get; set; } = new Version(0, 0, 0);
17 |
18 | public bool SupportsDebugFacilities => this.SyncthingVersion >= debugFacilitiesIntroduced;
19 | public bool SupportsDevicePauseResume => this.SyncthingVersion >= devicePauseResumeIntroduced;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/SyncthingConnectionStats.cs:
--------------------------------------------------------------------------------
1 | namespace SyncTrayzor.Syncthing
2 | {
3 | public class SyncthingConnectionStats
4 | {
5 | public long InBytesTotal { get; }
6 | public long OutBytesTotal { get; }
7 | public double InBytesPerSecond { get; }
8 | public double OutBytesPerSecond { get; }
9 |
10 | public SyncthingConnectionStats(long inBytesTotal, long outBytesTotal, double inBytesPerSecond, double outBytesPerSecond)
11 | {
12 | this.InBytesTotal = inBytesTotal;
13 | this.OutBytesTotal = outBytesTotal;
14 | this.InBytesPerSecond = inBytesPerSecond;
15 | this.OutBytesPerSecond = outBytesPerSecond;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/SyncthingConnectionsWatcherFactory.cs:
--------------------------------------------------------------------------------
1 | using SyncTrayzor.Syncthing.ApiClient;
2 |
3 | namespace SyncTrayzor.Syncthing
4 | {
5 | public interface ISyncthingConnectionsWatcherFactory
6 | {
7 | ISyncthingConnectionsWatcher CreateConnectionsWatcher(SynchronizedTransientWrapper apiClient);
8 | }
9 |
10 | public class SyncthingConnectionsWatcherFactory : ISyncthingConnectionsWatcherFactory
11 | {
12 | public ISyncthingConnectionsWatcher CreateConnectionsWatcher(SynchronizedTransientWrapper apiClient)
13 | {
14 | return new SyncthingConnectionsWatcher(apiClient);
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/SyncthingDidNotStartCorrectlyException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Syncthing
4 | {
5 | public class SyncthingDidNotStartCorrectlyException : Exception
6 | {
7 | public SyncthingDidNotStartCorrectlyException(string message)
8 | : base(message)
9 | { }
10 |
11 | public SyncthingDidNotStartCorrectlyException(string message, Exception innerException)
12 | : base(message, innerException)
13 | { }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/SyncthingState.cs:
--------------------------------------------------------------------------------
1 | namespace SyncTrayzor.Syncthing
2 | {
3 | public enum SyncthingState
4 | {
5 | Stopped,
6 | Starting,
7 | Running,
8 | Stopping,
9 | Restarting
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/SyncthingStateChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Syncthing
4 | {
5 | public class SyncthingStateChangedEventArgs : EventArgs
6 | {
7 | public SyncthingState OldState { get; }
8 | public SyncthingState NewState { get; }
9 |
10 | public SyncthingStateChangedEventArgs(SyncthingState oldState, SyncthingState newState)
11 | {
12 | this.OldState = oldState;
13 | this.NewState = newState;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/SyncthingVersionInformation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text.RegularExpressions;
3 |
4 | namespace SyncTrayzor.Syncthing
5 | {
6 | public class SyncthingVersionInformation
7 | {
8 | private static readonly Regex versionParseRegex = new Regex(@"\d+\.\d+\.\d+");
9 |
10 | public string ShortVersion { get; }
11 | public string LongVersion { get; }
12 | public Version ParsedVersion { get; }
13 |
14 | public SyncthingVersionInformation(string shortVersion, string longVersion)
15 | {
16 | this.ShortVersion = shortVersion;
17 | this.LongVersion = longVersion;
18 |
19 | var parsedVersion = new Version(0, 0, 0);
20 |
21 | var match = versionParseRegex.Match(shortVersion);
22 | if (match.Success)
23 | Version.TryParse(match.Value, out parsedVersion);
24 |
25 | this.ParsedVersion = parsedVersion;
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/TransferHistory/FailingTransfer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Syncthing.TransferHistory
4 | {
5 | public class FailingTransfer : IEquatable
6 | {
7 | public string FolderId { get; }
8 | public string Path { get; }
9 | public string Error { get; }
10 |
11 | public FailingTransfer(string folderId, string path, string error)
12 | {
13 | this.FolderId = folderId;
14 | this.Path = path;
15 | this.Error = error;
16 | }
17 |
18 | public override bool Equals(object obj)
19 | {
20 | return this.Equals(obj as FailingTransfer);
21 | }
22 |
23 | public bool Equals(FailingTransfer other)
24 | {
25 | if (ReferenceEquals(other, null))
26 | return false;
27 | if (ReferenceEquals(this, other))
28 | return true;
29 |
30 | return this.FolderId == other.FolderId && this.Path == other.Path;
31 | }
32 |
33 | public override int GetHashCode()
34 | {
35 | unchecked
36 | {
37 | int hash = 17;
38 | hash = hash * 31 + this.FolderId.GetHashCode();
39 | hash = hash * 31 + this.Path.GetHashCode();
40 | return hash;
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/TransferHistory/FileTransferChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Syncthing.TransferHistory
4 | {
5 | public class FileTransferChangedEventArgs : EventArgs
6 | {
7 | public FileTransfer FileTransfer { get; }
8 |
9 | public FileTransferChangedEventArgs(FileTransfer fileTransfer)
10 | {
11 | this.FileTransfer = fileTransfer;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/TransferHistory/FileTransferStatus.cs:
--------------------------------------------------------------------------------
1 | namespace SyncTrayzor.Syncthing.TransferHistory
2 | {
3 | public enum FileTransferStatus
4 | {
5 | Started,
6 | InProgress,
7 | Completed
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Syncthing/TransferHistory/FolderSynchronizationFinishedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using SyncTrayzor.Syncthing.Folders;
2 | using System;
3 | using System.Collections.Generic;
4 |
5 | namespace SyncTrayzor.Syncthing.TransferHistory
6 | {
7 | public class FolderSynchronizationFinishedEventArgs : EventArgs
8 | {
9 | public Folder Folder { get; }
10 | public IReadOnlyList FileTransfers { get; }
11 |
12 | public FolderSynchronizationFinishedEventArgs(Folder folder, List fileTransfers)
13 | {
14 | this.Folder = folder;
15 | this.FileTransfers = fileTransfers.AsReadOnly();
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Utils/AtomicFileStream.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Runtime.InteropServices;
4 |
5 | namespace SyncTrayzor.Utils
6 | {
7 | public class AtomicFileStream : FileStream
8 | {
9 | private const string DefaultTempFileSuffix = ".tmp";
10 |
11 | private readonly string path;
12 | private readonly string tempPath;
13 |
14 | public AtomicFileStream(string path)
15 | : this(path, TempFilePath(path))
16 | {
17 | }
18 |
19 | public AtomicFileStream(string path, string tempPath)
20 | : base(tempPath, FileMode.Create, FileAccess.ReadWrite)
21 | {
22 | this.path = path ?? throw new ArgumentNullException("path");
23 | this.tempPath = tempPath ?? throw new ArgumentNullException("tempPath");
24 | }
25 |
26 | private static string TempFilePath(string path)
27 | {
28 | return path + DefaultTempFileSuffix;
29 | }
30 |
31 | protected override void Dispose(bool disposing)
32 | {
33 | base.Dispose(disposing);
34 |
35 | bool success = NativeMethods.MoveFileEx(this.tempPath, this.path, MoveFileFlags.ReplaceExisting | MoveFileFlags.WriteThrough);
36 | if (!success)
37 | Marshal.ThrowExceptionForHR(Marshal.GetLastWin32Error());
38 | }
39 |
40 | [Flags]
41 | private enum MoveFileFlags
42 | {
43 | None = 0,
44 | ReplaceExisting = 1,
45 | CopyAllowed = 2,
46 | DelayUntilReboot = 4,
47 | WriteThrough = 8,
48 | CreateHardlink = 16,
49 | FailIfNotTrackable = 32,
50 | }
51 |
52 | private static class NativeMethods
53 | {
54 | [DllImport("Kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
55 | public static extern bool MoveFileEx(
56 | [In] string lpExistingFileName,
57 | [In] string lpNewFileName,
58 | [In] MoveFileFlags dwFlags);
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Utils/DotNetVersionFinder.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Win32;
2 | using System;
3 | using System.Collections.Generic;
4 |
5 | namespace SyncTrayzor.Utils
6 | {
7 | public static class DotNetVersionFinder
8 | {
9 | // See https://msdn.microsoft.com/en-us/library/hh925568.aspx#net_d
10 |
11 | private static readonly Dictionary versionMapping = new Dictionary()
12 | {
13 | { 378389, "4.5" },
14 | { 378675, "4.5.1 on Windows 8.1 or Windows Server 2012 R2" },
15 | { 378758, "4.5.1 on WIndows 8, Windows 7 SPI1, or Windows Vista SP2" },
16 | { 379893, "4.5.2" },
17 | { 393295, "4.6 on Windows 10" },
18 | { 393297, "4.6 on non-Windows 10" },
19 | { 394254, "4.6.1 on Windows 10 November Update systems" },
20 | { 394271, "4.6.1 on non-Windows 10 November Update systems" },
21 | { 394802, "4.6.2 on Windows 10 Anniversary Update systems" },
22 | { 394806, "4.6.2 on non-Windows 10 Anniversary Update systems" },
23 | { 460798, "4.7 on Windows 10 Creators Update systems" },
24 | };
25 |
26 | public static string FindDotNetVersion()
27 | {
28 | try
29 | {
30 | using (var ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey("SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full\\"))
31 | {
32 | int releaseKey = Convert.ToInt32(ndpKey.GetValue("Release"));
33 | return $"{DescriptionForReleaseKey(releaseKey)} ({releaseKey})";
34 | }
35 | }
36 | catch (Exception e)
37 | {
38 | return $"Unknown ({e.Message})";
39 | }
40 | }
41 |
42 | private static string DescriptionForReleaseKey(int releaseKey)
43 | {
44 | if (!versionMapping.TryGetValue(releaseKey, out var description))
45 | description = "Unknown";
46 |
47 | return description;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Utils/EnumerableExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace SyncTrayzor.Utils
5 | {
6 | public static class EnumerableExtensions
7 | {
8 | // From https://github.com/morelinq/MoreLINQ/blob/master/MoreLinq/MaxBy.cs
9 | public static TSource MaxBy(this IEnumerable source, Func selector, IComparer comparer = null)
10 | {
11 | if (source == null)
12 | throw new ArgumentNullException(nameof(source));
13 | if (selector == null)
14 | throw new ArgumentNullException(nameof(selector));
15 | if (comparer == null)
16 | comparer = Comparer.Default;
17 |
18 | using (var sourceIterator = source.GetEnumerator())
19 | {
20 | if (!sourceIterator.MoveNext())
21 | {
22 | throw new InvalidOperationException("Sequence contains no elements");
23 | }
24 | var max = sourceIterator.Current;
25 | var maxKey = selector(max);
26 | while (sourceIterator.MoveNext())
27 | {
28 | var candidate = sourceIterator.Current;
29 | var candidateProjected = selector(candidate);
30 | if (comparer.Compare(candidateProjected, maxKey) > 0)
31 | {
32 | max = candidate;
33 | maxKey = candidateProjected;
34 | }
35 | }
36 | return max;
37 | }
38 | }
39 |
40 | public static IEnumerable DistinctBy(this IEnumerable source, Func keySelector)
41 | {
42 | var knownKeys = new HashSet();
43 | foreach (var element in source)
44 | {
45 | if (knownKeys.Add(keySelector(element)))
46 | yield return element;
47 | }
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Utils/FluentModelValidator.cs:
--------------------------------------------------------------------------------
1 | using FluentValidation;
2 | using Stylet;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Threading.Tasks;
6 |
7 | namespace SyncTrayzor.Utils
8 | {
9 | public class FluentModelValidator : IModelValidator
10 | {
11 | private readonly IValidator validator;
12 | private T subject;
13 |
14 | public FluentModelValidator(IValidator validator)
15 | {
16 | this.validator = validator;
17 | }
18 |
19 | public void Initialize(object subject)
20 | {
21 | this.subject = (T)subject;
22 | }
23 |
24 | public async Task> ValidatePropertyAsync(string propertyName)
25 | {
26 | // If someone's calling us synchronously, and ValidationAsync does not complete synchronously,
27 | // we'll deadlock unless we continue on another thread.
28 | var result = await this.validator.ValidateAsync(this.subject, options => options.IncludeProperties(propertyName))
29 | .ConfigureAwait(false);
30 | return result.Errors.Select(x => x.ErrorMessage);
31 | }
32 |
33 | public async Task>> ValidateAllPropertiesAsync()
34 | {
35 | // If someone's calling us synchronously, and ValidationAsync does not complete synchronously,
36 | // we'll deadlock unless we continue on another thread.
37 | return (await this.validator.ValidateAsync(this.subject).ConfigureAwait(false))
38 | .Errors.GroupBy(x => x.PropertyName)
39 | .ToDictionary(x => x.Key, x => x.Select(failure => failure.ErrorMessage));
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Utils/FormatUtils.cs:
--------------------------------------------------------------------------------
1 | using SyncTrayzor.Localization;
2 | using SyncTrayzor.Properties;
3 | using System;
4 |
5 | namespace SyncTrayzor.Utils
6 | {
7 | public static class FormatUtils
8 | {
9 | private static readonly string[] sizes = { "B", "KiB", "MiB", "GiB" };
10 |
11 | public static string BytesToHuman(double bytes, int decimalPlaces = 0)
12 | {
13 | // http://stackoverflow.com/a/281679/1086121
14 | int order = 0;
15 | while (bytes >= 1024 && order + 1 < sizes.Length)
16 | {
17 | order++;
18 | bytes = bytes / 1024;
19 | }
20 | var placesFmtString = (order > 0) ? new String('0', decimalPlaces) : String.Empty;
21 | return String.Format("{0:0." + placesFmtString + "}{1}", bytes, sizes[order]);
22 | }
23 |
24 | public static string TimeSpanToTimeAgo(TimeSpan timeSpan)
25 | {
26 | if (timeSpan.TotalDays > 365)
27 | {
28 | int years = (int)Math.Ceiling((float)timeSpan.Days / 365);
29 | return Localizer.F(Resources.TimeAgo_Years, years);
30 | }
31 |
32 | if (timeSpan.TotalDays > 1.0)
33 | return Localizer.F(Resources.TimeAgo_Days, (int)timeSpan.TotalDays);
34 |
35 | if (timeSpan.TotalHours > 1.0)
36 | return Localizer.F(Resources.TimeAgo_Hours, (int)timeSpan.TotalHours);
37 |
38 | if (timeSpan.TotalMinutes > 1.0)
39 | return Localizer.F(Resources.TimeAgo_Minutes, (int)timeSpan.TotalMinutes);
40 |
41 | return Resources.TimeAgo_JustNow;
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/src/SyncTrayzor/Utils/ListExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace SyncTrayzor.Utils
4 | {
5 | public static class ListExtensions
6 | {
7 | public static void Replace(this List list, IEnumerable newValues)
8 | {
9 | list.Clear();
10 | list.AddRange(newValues);
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Utils/ObservableQueue.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using System.Collections.Specialized;
4 |
5 | namespace SyncTrayzor.Utils
6 | {
7 | public class ObservableQueue : IEnumerable, INotifyCollectionChanged
8 | {
9 | private readonly Queue queue = new Queue();
10 |
11 | public event NotifyCollectionChangedEventHandler CollectionChanged;
12 |
13 | public int Count => this.queue.Count;
14 |
15 | public void Enqueue(T item)
16 | {
17 | this.queue.Enqueue(item);
18 | this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item, this.queue.Count - 1));
19 | }
20 |
21 | public T Dequeue()
22 | {
23 | T item = this.queue.Dequeue();
24 | this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, item, 0));
25 | return item;
26 | }
27 |
28 | private void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
29 | {
30 | this.CollectionChanged?.Invoke(this, e);
31 | }
32 |
33 | public IEnumerator GetEnumerator()
34 | {
35 | return this.queue.GetEnumerator();
36 | }
37 |
38 | IEnumerator IEnumerable.GetEnumerator()
39 | {
40 | return this.queue.GetEnumerator();
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Utils/PathEx.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Runtime.InteropServices;
4 | using System.Text;
5 |
6 | namespace SyncTrayzor.Utils
7 | {
8 | public static class PathEx
9 | {
10 | ///
11 | /// Converts a short path to a long path.
12 | ///
13 | /// A path that may contain short path elements (~1).
14 | /// The long path. Null or empty if the input is null or empty.
15 | // Adapted from http://pinvoke.net/default.aspx/kernel32/GetLongPathName.html
16 | public static string GetLongPathName(string shortPath)
17 | {
18 | if (String.IsNullOrWhiteSpace(shortPath))
19 | return shortPath;
20 |
21 | var builder = new StringBuilder(255);
22 | int result = NativeMethods.GetLongPathName(shortPath, builder, builder.Capacity);
23 | if (result > 0 && result < builder.Capacity)
24 | {
25 | return builder.ToString(0, result);
26 | }
27 | else
28 | {
29 | if (result > 0)
30 | {
31 | builder = new StringBuilder(result);
32 | result = NativeMethods.GetLongPathName(shortPath, builder, builder.Capacity);
33 | return builder.ToString(0, result);
34 | }
35 | else
36 | {
37 | throw new FileNotFoundException($"File {shortPath} not found");
38 | }
39 | }
40 | }
41 |
42 | private class NativeMethods
43 | {
44 | [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
45 | [return: MarshalAs(UnmanagedType.U4)]
46 | public static extern int GetLongPathName(
47 | [MarshalAs(UnmanagedType.LPTStr)] string lpszShortPath,
48 | [MarshalAs(UnmanagedType.LPTStr)] StringBuilder lpszLongPath,
49 | [MarshalAs(UnmanagedType.U4)] int cchBuffer);
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Utils/SafeSyncthingExtensions.cs:
--------------------------------------------------------------------------------
1 | using Stylet;
2 | using SyncTrayzor.Localization;
3 | using SyncTrayzor.Properties;
4 | using SyncTrayzor.Syncthing;
5 | using System.ComponentModel;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace SyncTrayzor.Utils
10 | {
11 | public static class SafeSyncthingExtensions
12 | {
13 | public static async Task StartWithErrorDialogAsync(this ISyncthingManager syncthingManager, IWindowManager windowManager)
14 | {
15 | try
16 | {
17 | await syncthingManager.StartAsync();
18 | }
19 | catch (Win32Exception e)
20 | {
21 | if (e.ErrorCode != -2147467259)
22 | throw;
23 |
24 | // Possibly "This program is blocked by group policy. For more information, contact your system administrator" caused
25 | // by e.g. CryptoLocker?
26 | windowManager.ShowMessageBox(
27 | Localizer.F(Resources.Dialog_SyncthingBlockedByGroupPolicy_Message, e.Message, syncthingManager.ExecutablePath),
28 | Resources.Dialog_SyncthingBlockedByGroupPolicy_Title,
29 | MessageBoxButton.OK, icon: MessageBoxImage.Error);
30 | }
31 | catch (SyncthingDidNotStartCorrectlyException e)
32 | {
33 | windowManager.ShowMessageBox(
34 | Localizer.F(Resources.Dialog_SyncthingDidNotStart_Message, e.Message),
35 | Resources.Dialog_SyncthingDidNotStart_Title,
36 | MessageBoxButton.OK, icon: MessageBoxImage.Error);
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Utils/SemaphoreSlimExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using System.Threading.Tasks;
4 |
5 | namespace SyncTrayzor.Utils
6 | {
7 | public static class SemaphoreSlimExtensions
8 | {
9 | private class SemaphoreSlimLock : IDisposable
10 | {
11 | private readonly SemaphoreSlim semaphore;
12 | public SemaphoreSlimLock(SemaphoreSlim semaphore)
13 | {
14 | this.semaphore = semaphore;
15 | }
16 |
17 | public void Dispose()
18 | {
19 | this.semaphore.Release();
20 | }
21 | }
22 |
23 | public static IDisposable WaitDisposable(this SemaphoreSlim semaphore)
24 | {
25 | semaphore.Wait();
26 | return new SemaphoreSlimLock(semaphore);
27 | }
28 |
29 | public static async Task WaitAsyncDisposable(this SemaphoreSlim semaphore)
30 | {
31 | await semaphore.WaitAsync().ConfigureAwait(false);
32 | return new SemaphoreSlimLock(semaphore);
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Utils/StreamExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Threading.Tasks;
4 |
5 | namespace SyncTrayzor.Utils
6 | {
7 | public struct CopyToAsyncProgress
8 | {
9 | public long BytesRead { get; }
10 | public long TotalBytesToRead { get; }
11 | public int ProgressPercent { get; }
12 |
13 | public CopyToAsyncProgress(long bytesRead, long totalBytesToRead)
14 | : this()
15 | {
16 | this.BytesRead = bytesRead;
17 | this.TotalBytesToRead = totalBytesToRead;
18 |
19 | if (this.TotalBytesToRead > 0)
20 | this.ProgressPercent = (int)((this.BytesRead * 100) / this.TotalBytesToRead);
21 | else
22 | this.ProgressPercent = -1;
23 | }
24 | }
25 |
26 | public static class StreamExtensions
27 | {
28 | public static async Task CopyToAsync(this Stream source, Stream destination, IProgress progress)
29 | {
30 | var buffer = new byte[81920];
31 | var totalBytesToRead = source.CanSeek ? source.Length : -1;
32 | long totalBytesRead = 0;
33 | int bytesRead;
34 |
35 | while ((bytesRead = await source.ReadAsync(buffer, 0, buffer.Length).ConfigureAwait(false)) != 0)
36 | {
37 | await destination.WriteAsync(buffer, 0, bytesRead).ConfigureAwait(false);
38 | totalBytesRead += bytesRead;
39 | progress.Report(new CopyToAsyncProgress(totalBytesRead, totalBytesToRead));
40 | }
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Utils/SynchronizedEventDispatcher.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 |
4 | namespace SyncTrayzor.Utils
5 | {
6 | public class SynchronizedEventDispatcher
7 | {
8 | private readonly object sender;
9 | private readonly SynchronizationContext synchronizationContext;
10 |
11 | public SynchronizedEventDispatcher(object sender)
12 | : this(sender, SynchronizationContext.Current)
13 | {
14 | if (SynchronizationContext.Current == null)
15 | throw new ArgumentNullException("Implicit SynchronizationContext.Current cannot be null");
16 | }
17 |
18 | public SynchronizedEventDispatcher(object sender, SynchronizationContext synchronizationContext)
19 | {
20 | this.sender = sender;
21 | this.synchronizationContext = synchronizationContext;
22 | }
23 |
24 | public void Raise(EventHandler eventHandler)
25 | {
26 | if (eventHandler != null)
27 | this.Post(_ => eventHandler(this.sender, EventArgs.Empty), null);
28 | }
29 |
30 | public void Raise(EventHandler eventHandler, T eventArgs)
31 | {
32 | if (eventHandler != null)
33 | this.Post(_ => eventHandler(this.sender, eventArgs), null);
34 | }
35 |
36 | public void Raise(EventHandler eventHandler, Func eventArgs)
37 | {
38 | if (eventHandler != null)
39 | this.Post(_ => eventHandler(this.sender, eventArgs()), null);
40 | }
41 |
42 | private void Post(SendOrPostCallback callback, object state)
43 | {
44 | if (this.synchronizationContext != null)
45 | this.synchronizationContext.Post(callback, state);
46 | else
47 | callback(state);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Utils/SynchronizedEventSubscriber.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading;
6 | using System.Threading.Tasks;
7 |
8 | namespace SyncTrayzor.Utils
9 | {
10 | public class SynchronizedEventSubscriber
11 | {
12 | private readonly SynchronizationContext synchronizationContext;
13 |
14 | public SynchronizedEventSubscriber(bool allowNoSynchronization = false)
15 | : this(SynchronizationContext.Current, allowNoSynchronization)
16 | { }
17 |
18 | public SynchronizedEventSubscriber(SynchronizationContext synchronizationContext, bool allowNoSynchronization = false)
19 | {
20 | if (!allowNoSynchronization && synchronizationContext == null)
21 | throw new ArgumentException("synchronizationContext must be non-null if allowNoSynchronizationContext is false");
22 |
23 | this.synchronizationContext = synchronizationContext;
24 | }
25 |
26 | public EventHandler Subscribe(EventHandler forwarder)
27 | {
28 | return (o, e) => this.Post(_ => forwarder(o, e), null);
29 | }
30 |
31 | public EventHandler Subscribe(EventHandler forwarder)
32 | {
33 | return (o, e) => this.Post(_ => forwarder(o, e), null);
34 | }
35 |
36 | private void Post(SendOrPostCallback callback, object state)
37 | {
38 | if (this.synchronizationContext != null)
39 | this.synchronizationContext.Post(callback, state);
40 | else
41 | callback(state);
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Utils/UriExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SyncTrayzor.Utils
4 | {
5 | public static class UriExtensions
6 | {
7 | public static Uri NormalizeZeroHost(this Uri uri)
8 | {
9 | if (uri.Host == "0.0.0.0")
10 | {
11 | var builder = new UriBuilder(uri)
12 | {
13 | Host = "127.0.0.1"
14 | };
15 | uri = builder.Uri;
16 | }
17 | return uri;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Xaml/ActivateBehaviour.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 |
4 | namespace SyncTrayzor.Xaml
5 | {
6 | public class ActivateBehaviour : DetachingBehaviour
7 | {
8 | private IDisposable registration;
9 |
10 |
11 | public IObservable ActivateObservable
12 | {
13 | get => (IObservable)GetValue(ActivateObservableProperty);
14 | set => SetValue(ActivateObservableProperty, value);
15 | }
16 |
17 | public static readonly DependencyProperty ActivateObservableProperty =
18 | DependencyProperty.Register("ActivateObservable", typeof(IObservable), typeof(ActivateBehaviour), new PropertyMetadata(null, (d, e) =>
19 | {
20 | ((ActivateBehaviour)d).ObservableChanged(e.NewValue as IObservable);
21 | }));
22 |
23 | private void ObservableChanged(IObservable newValue)
24 | {
25 | this.registration?.Dispose();
26 | this.registration = newValue?.Subscribe(_ => this.Activate());
27 | }
28 |
29 | private void Activate()
30 | {
31 | if (this.AssociatedObject.WindowState == WindowState.Minimized)
32 | this.AssociatedObject.WindowState = WindowState.Normal;
33 | this.AssociatedObject.Activate();
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Xaml/CultureAwareBinding.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Windows.Data;
3 |
4 | namespace SyncTrayzor.Xaml
5 | {
6 | // See http://stackoverflow.com/a/14163432/1086121
7 | public class CultureAwareBinding : Binding
8 | {
9 | public CultureAwareBinding()
10 | {
11 | this.ConverterCulture = Thread.CurrentThread.CurrentCulture;
12 | }
13 |
14 | public CultureAwareBinding(string path)
15 | : base(path)
16 | {
17 | this.ConverterCulture = Thread.CurrentThread.CurrentCulture;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Xaml/DetachingBehaviour.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Data;
4 | using Microsoft.Xaml.Behaviors;
5 |
6 | namespace SyncTrayzor.Xaml
7 | {
8 | // Adapted from http://dotnetbyexample.blogspot.co.uk/2011/04/safe-event-detachment-pattern-for.html
9 | public abstract class DetachingBehaviour : Behavior where T : FrameworkElement
10 | {
11 | protected override void OnAttached()
12 | {
13 | base.OnAttached();
14 | this.AssociatedObject.Initialized += this.AssociatedObjectInitialized;
15 | this.AssociatedObject.Unloaded += this.AssociatedObjectUnloaded;
16 | }
17 |
18 | protected override void OnDetaching()
19 | {
20 | base.OnDetaching();
21 | this.Cleanup();
22 | }
23 |
24 | private bool isCleanedUp;
25 | private void Cleanup()
26 | {
27 | if (!this.isCleanedUp)
28 | {
29 | this.isCleanedUp = true;
30 |
31 | this.AssociatedObject.Initialized -= AssociatedObjectInitialized;
32 | this.AssociatedObject.Unloaded -= AssociatedObjectUnloaded;
33 | BindingOperations.ClearAllBindings(this); // This was a surprise...
34 | this.DetachHandlers();
35 | }
36 | }
37 |
38 | private void AssociatedObjectInitialized(object sender, EventArgs e)
39 | {
40 | this.AttachHandlers();
41 | }
42 |
43 | private void AssociatedObjectUnloaded(object sender, RoutedEventArgs e)
44 | {
45 | this.Cleanup();
46 | }
47 |
48 | protected virtual void AttachHandlers() { }
49 | protected virtual void DetachHandlers() { }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Xaml/GridLengthToAbsoluteConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Data;
4 |
5 | namespace SyncTrayzor.Xaml
6 | {
7 | public class GridLengthToAbsoluteConverter : IValueConverter
8 | {
9 | public static readonly GridLengthToAbsoluteConverter Instance = new GridLengthToAbsoluteConverter();
10 |
11 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
12 | {
13 | if (value == null)
14 | return null;
15 |
16 | try
17 | {
18 | return new GridLength(System.Convert.ToDouble(value));
19 | }
20 | catch
21 | {
22 | return null;
23 | }
24 | }
25 |
26 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
27 | {
28 | if (!(value is GridLength))
29 | return null;
30 |
31 | return ((GridLength)value).Value;
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Xaml/LogMessageListToStringConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Windows.Data;
5 |
6 | namespace SyncTrayzor.Xaml
7 | {
8 | public class LogMessageListToStringConverter : IValueConverter
9 | {
10 | private readonly StringBuilder sb = new StringBuilder();
11 |
12 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
13 | {
14 | var list = value as IEnumerable;
15 | if (list == null)
16 | return null;
17 |
18 | foreach (var elem in list)
19 | {
20 | this.sb.AppendLine(elem);
21 | }
22 |
23 | var str = this.sb.ToString();
24 | this.sb.Clear();
25 | return str;
26 | }
27 |
28 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
29 | {
30 | throw new NotImplementedException();
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Xaml/MouseWheelGesture.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Input;
2 |
3 | namespace SyncTrayzor.Xaml
4 | {
5 | // Adapted from http://stackoverflow.com/a/7527482/1086121
6 | public class MouseWheelGesture : MouseGesture
7 | {
8 | private readonly WheelDirection direction;
9 |
10 | public static MouseWheelGesture CtrlDown => new MouseWheelGesture(ModifierKeys.Control, WheelDirection.Down);
11 |
12 | public static MouseWheelGesture CtrlUp => new MouseWheelGesture(ModifierKeys.Control, WheelDirection.Up);
13 |
14 | public MouseWheelGesture(ModifierKeys modifiers, WheelDirection direction)
15 | : base(MouseAction.WheelClick, modifiers)
16 | {
17 | this.direction = direction;
18 | }
19 |
20 | public override bool Matches(object targetElement, InputEventArgs inputEventArgs)
21 | {
22 | if (!base.Matches(targetElement, inputEventArgs))
23 | return false;
24 |
25 | if (!(inputEventArgs is MouseWheelEventArgs))
26 | return false;
27 |
28 | var args = (MouseWheelEventArgs)inputEventArgs;
29 |
30 | switch (this.direction)
31 | {
32 | case WheelDirection.None:
33 | return args.Delta == 0;
34 | case WheelDirection.Up:
35 | return args.Delta > 0;
36 | case WheelDirection.Down:
37 | return args.Delta < 0;
38 | default:
39 | return false;
40 | }
41 | }
42 |
43 | public enum WheelDirection
44 | {
45 | None,
46 | Up,
47 | Down,
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Xaml/NoSizeBelowScreenBehaviour.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Data;
4 |
5 | namespace SyncTrayzor.Xaml
6 | {
7 | public class NoSizeBelowScreenBehaviour : DetachingBehaviour
8 | {
9 | private const int taskbarHeight = 40; // Max height
10 |
11 | private bool haveSet = false;
12 |
13 | private static readonly DependencyProperty WindowLeftProperty =
14 | DependencyProperty.Register("WindowTop", typeof(double), typeof(NoSizeBelowScreenBehaviour), new PropertyMetadata(Double.NaN, (d, e) =>
15 | {
16 | ((NoSizeBelowScreenBehaviour)d).ScreenTopChanged((double)e.NewValue);
17 | }));
18 |
19 | private void ScreenTopChanged(double topValue)
20 | {
21 | // This is set twice in succession when loaded - the first time the height is NaN, the second time it isn't
22 | // We only want to set this once, one the second time that top is set
23 |
24 | if (!Double.IsNaN(this.AssociatedObject.Height) && !Double.IsNaN(topValue) && !this.haveSet)
25 | {
26 | this.AssociatedObject.MaxHeight = SystemParameters.VirtualScreenHeight - topValue - taskbarHeight;
27 | this.haveSet = true;
28 | }
29 | }
30 |
31 | protected override void AttachHandlers()
32 | {
33 | var topBinding = new Binding("WindowTop")
34 | {
35 | Source = this,
36 | Mode = BindingMode.TwoWay,
37 | };
38 | BindingOperations.SetBinding(this.AssociatedObject, Window.TopProperty, topBinding);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Xaml/PopupConductorBehaviour.cs:
--------------------------------------------------------------------------------
1 | using Stylet;
2 | using System;
3 | using System.Windows;
4 | using System.Windows.Controls.Primitives;
5 |
6 | namespace SyncTrayzor.Xaml
7 | {
8 | public class PopupConductorBehaviour : DetachingBehaviour
9 | {
10 | public object DataContext
11 | {
12 | get => GetValue(DataContextProperty);
13 | set => SetValue(DataContextProperty, value);
14 | }
15 |
16 | public static readonly DependencyProperty DataContextProperty =
17 | DependencyProperty.Register("DataContext", typeof(object), typeof(PopupConductorBehaviour), new PropertyMetadata(null));
18 |
19 | protected override void AttachHandlers()
20 | {
21 | this.AssociatedObject.Opened += this.Opened;
22 | this.AssociatedObject.Closed += this.Closed;
23 | }
24 |
25 | protected override void DetachHandlers()
26 | {
27 | this.AssociatedObject.Opened -= this.Opened;
28 | this.AssociatedObject.Closed -= this.Closed;
29 | }
30 |
31 | private void Opened(object sender, EventArgs e)
32 | {
33 | if (this.DataContext is IScreenState screenState)
34 | screenState.Activate();
35 | }
36 |
37 | private void Closed(object sender, EventArgs e)
38 | {
39 | if (this.DataContext is IScreenState screenState)
40 | screenState.Close();
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Xaml/RemoveMnemonicsConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Data;
3 |
4 | namespace SyncTrayzor.Xaml
5 | {
6 | public class RemoveMnemonicsConverter : IValueConverter
7 | {
8 | public static RemoveMnemonicsConverter Instance = new RemoveMnemonicsConverter();
9 |
10 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
11 | {
12 | var val = value as string;
13 | if (val == null)
14 | return null;
15 |
16 | return val.Replace("_", "__");
17 | }
18 |
19 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
20 | {
21 | var val = value as string;
22 | if (val == null)
23 | return null;
24 |
25 | return val.Replace("__", "_");
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Xaml/ScrollToEndBehaviour.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Controls;
3 |
4 | namespace SyncTrayzor.Xaml
5 | {
6 | public class ScrollToEndBehaviour : DetachingBehaviour
7 | {
8 | protected override void AttachHandlers()
9 | {
10 | this.AssociatedObject.TextChanged += this.SomethingChanged;
11 | this.AssociatedObject.SizeChanged += this.SomethingChanged;
12 |
13 | this.AssociatedObject.ScrollToEnd();
14 | }
15 |
16 | protected override void DetachHandlers()
17 | {
18 | this.AssociatedObject.TextChanged -= this.SomethingChanged;
19 | this.AssociatedObject.SizeChanged -= this.SomethingChanged;
20 | }
21 |
22 | private void SomethingChanged(object sender, EventArgs e)
23 | {
24 | this.AssociatedObject.ScrollToEnd();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/Xaml/TextBoxUtilities.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Controls;
4 |
5 | namespace SyncTrayzor.Xaml
6 | {
7 | public static class TextBoxUtilities
8 | {
9 | public static readonly DependencyProperty AlwaysScrollToEndProperty =
10 | DependencyProperty.RegisterAttached("AlwaysScrollToEnd", typeof(bool), typeof(TextBoxUtilities), new PropertyMetadata(false, AlwaysScrollToEndChanged));
11 |
12 | private static void AlwaysScrollToEndChanged(object sender, DependencyPropertyChangedEventArgs e)
13 | {
14 | if (sender is TextBox tb)
15 | {
16 | bool alwaysScrollToEnd = (e.NewValue != null) && (bool)e.NewValue;
17 | if (alwaysScrollToEnd)
18 | {
19 | tb.ScrollToEnd();
20 | tb.TextChanged += TextChanged;
21 | }
22 | else
23 | {
24 | tb.TextChanged -= TextChanged;
25 | }
26 | }
27 | else
28 | {
29 | throw new InvalidOperationException("The attached AlwaysScrollToEnd property can only be applied to TextBox instances.");
30 | }
31 | }
32 |
33 | public static bool GetAlwaysScrollToEnd(TextBox textBox)
34 | {
35 | if (textBox == null)
36 | {
37 | throw new ArgumentNullException("textBox");
38 | }
39 |
40 | return (bool)textBox.GetValue(AlwaysScrollToEndProperty);
41 | }
42 |
43 | public static void SetAlwaysScrollToEnd(TextBox textBox, bool alwaysScrollToEnd)
44 | {
45 | if (textBox == null)
46 | {
47 | throw new ArgumentNullException("textBox");
48 | }
49 |
50 | textBox.SetValue(AlwaysScrollToEndProperty, alwaysScrollToEnd);
51 | }
52 |
53 | private static void TextChanged(object sender, TextChangedEventArgs e)
54 | {
55 | ((TextBox)sender).ScrollToEnd();
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/SyncTrayzor/idle.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canton7/SyncTrayzor/d7788138f336ec1c673914152b24c7dc98f32bbc/src/SyncTrayzor/idle.ico
--------------------------------------------------------------------------------