├── .gitattributes
├── .gitignore
├── CHANGELOG.md
├── LICENSE-INI-Parser.md
├── LICENSE-Json.NET.md
├── LICENSE-MOONSHARP.md
├── LICENSE-Octokit.NET.md
├── LICENSE-Xdelta-sharp.md
├── LICENSE-ZLIB.md
├── LICENSE.md
├── ModMyFactory
├── ModMyFactory.sln
├── ModMyFactory
│ ├── App.config
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── BooleanToStringJsonConverter.cs
│ ├── Colors_dark.xaml
│ ├── Colors_light.xaml
│ ├── CommandLine.cs
│ ├── Controls
│ │ ├── DefaultExpandedExpander.cs
│ │ ├── DragDropReadyListBox.cs
│ │ ├── DragDropReadyListBoxItem.cs
│ │ ├── ExtendedTextBox.cs
│ │ ├── FormattingTextBlock.cs
│ │ ├── InlineList.cs
│ │ ├── LayoutRoundingWindow.cs
│ │ ├── NumericUpDown.xaml
│ │ └── NumericUpDown.xaml.cs
│ ├── DirectoryOption.cs
│ ├── Export
│ │ ├── ExportMode.cs
│ │ ├── ExportTemplate.cs
│ │ ├── ModExportTemplate.cs
│ │ ├── ModpackExport.cs
│ │ └── ModpackExportTemplate.cs
│ ├── ExtendedVersion.cs
│ ├── FactorioCollection.cs
│ ├── FactorioUpdate
│ │ ├── CriticalUpdaterException.cs
│ │ ├── FactorioUpdater.cs
│ │ ├── FileUpdateAction.cs
│ │ ├── FileUpdateInfo.cs
│ │ ├── UpdatePackageInfo.cs
│ │ └── UpdaterErrorType.cs
│ ├── GameCompatibleVersion.cs
│ ├── GameVersionConverter.cs
│ ├── GlobalCredentials.cs
│ ├── Helpers
│ │ ├── CollectionExtensions.cs
│ │ ├── DirectoryInfoExtensions.cs
│ │ ├── EnumarableExtensions.cs
│ │ ├── FileHelper.cs
│ │ ├── FileInfoExtensions.cs
│ │ ├── FileSystemInfoExtensions.cs
│ │ ├── GitHubClientExtensions.cs
│ │ ├── INIHelper.cs
│ │ ├── JsonHelper.cs
│ │ ├── ModHelper.cs
│ │ ├── PercievedFileType.cs
│ │ ├── ProcessExtensions.cs
│ │ ├── RegistryHelper.cs
│ │ ├── SecureStringHelper.cs
│ │ ├── ShellHelper.cs
│ │ ├── SteamHelper.cs
│ │ ├── StreamExtensions.cs
│ │ ├── StringExtensions.cs
│ │ ├── StringHelper.cs
│ │ ├── TaskHelper.cs
│ │ └── WindowExtensions.cs
│ ├── IO
│ │ ├── Junction.cs
│ │ └── JunctionInfo.cs
│ ├── Images
│ │ ├── Add.png
│ │ ├── AddDocument.png
│ │ ├── AddFolder.png
│ │ ├── Close.png
│ │ ├── Configure.png
│ │ ├── Delete.png
│ │ ├── Dependency.png
│ │ ├── DependencyWarning.png
│ │ ├── Document.png
│ │ ├── Download.png
│ │ ├── Downloads.png
│ │ ├── Empty_Thumbnail.png
│ │ ├── Experimental.png
│ │ ├── ExportPackage.png
│ │ ├── Factorio.png
│ │ ├── Factorio_Icon.ico
│ │ ├── Factorio_Modpack_Icon.ico
│ │ ├── Folder.png
│ │ ├── Help.png
│ │ ├── ImportPackage.png
│ │ ├── Information.png
│ │ ├── Installed.png
│ │ ├── Inverted_small.png
│ │ ├── Lang
│ │ │ ├── de.png
│ │ │ ├── en.png
│ │ │ ├── ko.png
│ │ │ ├── pt.png
│ │ │ ├── ru.png
│ │ │ └── zh.png
│ │ ├── Link.png
│ │ ├── Lock.png
│ │ ├── Lock_blue.png
│ │ ├── MMF_Icon.ico
│ │ ├── Menu.png
│ │ ├── NewPackage.png
│ │ ├── OpenFolder.png
│ │ ├── Optional.png
│ │ ├── Optional_small.png
│ │ ├── Package.png
│ │ ├── Refresh.png
│ │ ├── Refresh_blue.png
│ │ ├── RenameActive.png
│ │ ├── RenameInactive.png
│ │ ├── Run.png
│ │ ├── Search.png
│ │ ├── Settings.png
│ │ ├── Settings_blue.png
│ │ ├── Settings_gray.png
│ │ ├── Themes.png
│ │ ├── Themes
│ │ │ ├── dark.png
│ │ │ └── light.png
│ │ ├── Update.png
│ │ ├── Warning.png
│ │ ├── WebDestination.png
│ │ └── modmyfactory.png
│ ├── InstanceStartedEventArgs.cs
│ ├── Lang
│ │ ├── CultureEntry.cs
│ │ ├── Strings.de.xaml
│ │ ├── Strings.en.xaml
│ │ ├── Strings.ko.xaml
│ │ ├── Strings.pt.xaml
│ │ ├── Strings.ru.xaml
│ │ └── Strings.zh.xaml
│ ├── MVVM
│ │ ├── Converters
│ │ │ ├── AdvancedVisibilityConverter.cs
│ │ │ ├── FactorioVersionConverter.cs
│ │ │ ├── InverseBooleanConverter.cs
│ │ │ ├── LoadTimeConverter.cs
│ │ │ ├── LocalizedNameConverter.cs
│ │ │ ├── ModInfoSorterModeConverter.cs
│ │ │ ├── MultiplyConverter.cs
│ │ │ ├── RemoveFileExtensionConverter.cs
│ │ │ ├── SystemIconConverter.cs
│ │ │ └── ThemeNameConverter.cs
│ │ ├── MenuItemProperties.cs
│ │ ├── Selectors
│ │ │ ├── ComboBoxTemplateSelector.cs
│ │ │ ├── ModSettingTemplateSelector.cs
│ │ │ └── ModUpdateTemplateSelector.cs
│ │ └── Sorters
│ │ │ ├── CultureEntrySorter.cs
│ │ │ ├── FactorioOnlineVersionSorter.cs
│ │ │ ├── FactorioVersionSorter.cs
│ │ │ ├── ModDependencySorter.cs
│ │ │ ├── ModInfoSorter.cs
│ │ │ ├── ModInfoSorterMode.cs
│ │ │ ├── ModReferenceSorter.cs
│ │ │ ├── ModReleaseSorter.cs
│ │ │ ├── ModSettingSorter.cs
│ │ │ ├── ModSorter.cs
│ │ │ ├── ModUpdateInfoSorter.cs
│ │ │ ├── ModpackSorter.cs
│ │ │ └── UpdateTargetSorter.cs
│ ├── ManagerMode.cs
│ ├── MessageType.cs
│ ├── ModCollection.cs
│ ├── ModManager.cs
│ ├── ModMyFactory.csproj
│ ├── ModSettings
│ │ ├── LoadTime.cs
│ │ ├── LoadTimeJsonConverter.cs
│ │ ├── ModSettingInfo.cs
│ │ ├── ModSettingsManager.cs
│ │ ├── Serialization
│ │ │ ├── BinaryFile.cs
│ │ │ ├── BinaryVersion.cs
│ │ │ ├── ModSettingValueTemplate.cs
│ │ │ └── ModSettingsExportTemplate.cs
│ │ ├── SettingType.cs
│ │ ├── SettingTypeExtensions.cs
│ │ ├── SettingTypeJsonConverter.cs
│ │ ├── SettingValue.cs
│ │ ├── SettingValueArrayJsonConverter.cs
│ │ └── SettingValueJsonConverter.cs
│ ├── ModTemplateList.cs
│ ├── Models
│ │ ├── CopyOrMoveType.cs
│ │ ├── FactorioFile.cs
│ │ ├── FactorioFolder.cs
│ │ ├── FactorioSteamVersion.cs
│ │ ├── FactorioVersion.cs
│ │ ├── IHasLocale.cs
│ │ ├── IHasModSettings.cs
│ │ ├── ILocale.cs
│ │ ├── IModReference.cs
│ │ ├── InfoFile.cs
│ │ ├── LatestFactorioVersion.cs
│ │ ├── LocaleType.cs
│ │ ├── Mod.cs
│ │ ├── ModDependency.cs
│ │ ├── ModDependencyInfo.cs
│ │ ├── ModFile.cs
│ │ ├── ModFileCollection.cs
│ │ ├── ModFile_ScriptLoaders.cs
│ │ ├── ModLocale.cs
│ │ ├── ModReference.cs
│ │ ├── ModSettings
│ │ │ ├── BooleanModSetting.cs
│ │ │ ├── FloatingPointListModSetting.cs
│ │ │ ├── FloatingPointModSetting.cs
│ │ │ ├── ILimitedModSetting.cs
│ │ │ ├── IListModSetting.cs
│ │ │ ├── IModSetting.cs
│ │ │ ├── IModSettingProxy.cs
│ │ │ ├── IStringModSetting.cs
│ │ │ ├── IntegerListModSetting.cs
│ │ │ ├── IntegerModSetting.cs
│ │ │ ├── LimitedModSetting.cs
│ │ │ ├── LimitedModSettingProxy.cs
│ │ │ ├── ListModSetting.cs
│ │ │ ├── ListModSettingProxy.cs
│ │ │ ├── ModSetting.cs
│ │ │ ├── ModSettingProxy.cs
│ │ │ ├── StringListModSetting.cs
│ │ │ └── StringModSetting.cs
│ │ ├── ModSettingsProxy.cs
│ │ ├── ModTemplate.cs
│ │ ├── ModUpdateInfo.cs
│ │ ├── ModVersionUpdateInfo.cs
│ │ ├── Mod_Adding.cs
│ │ ├── Mod_Loading.cs
│ │ ├── Modpack.cs
│ │ ├── ModpackReference.cs
│ │ ├── ModpackTemplate.cs
│ │ ├── SettingsData.cs
│ │ ├── SpecialFactorioVersion.cs
│ │ ├── UpdateSearchResult.cs
│ │ └── UpdateTarget.cs
│ ├── ModpackCollection.cs
│ ├── ModpackTemplateList.cs
│ ├── Program.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ ├── Resources.Designer.cs
│ │ ├── Resources.resx
│ │ ├── Settings.Designer.cs
│ │ └── Settings.settings
│ ├── Resources
│ │ └── updater.exe
│ ├── Settings.cs
│ ├── SingleOrArrayJsonConverter.cs
│ ├── Theme.cs
│ ├── TwoPartVersionConverter.cs
│ ├── VersionComparer.cs
│ ├── ViewModels
│ │ ├── AboutPageViewModel.cs
│ │ ├── AboutViewModel.cs
│ │ ├── ChangelogPageViewModel.cs
│ │ ├── CopyOrMoveViewModel.cs
│ │ ├── DependencyDownloadViewModel.cs
│ │ ├── LinkPropertiesViewModel.cs
│ │ ├── MainViewModel.cs
│ │ ├── MainViewModel_DependencyDownload.cs
│ │ ├── MainViewModel_ModUpdate.cs
│ │ ├── MainViewModel_ModpackExport.cs
│ │ ├── MainViewModel_ModpackImport.cs
│ │ ├── ModSettingsViewModel.cs
│ │ ├── ModUpdateViewModel.cs
│ │ ├── ModpackExportViewModel.cs
│ │ ├── OnlineModsViewModel.cs
│ │ ├── ProgressViewModel.cs
│ │ ├── SettingsViewModel.cs
│ │ ├── UpdateListViewModel.cs
│ │ ├── VersionListViewModel.cs
│ │ └── VersionManagementViewModel.cs
│ ├── Views
│ │ ├── AboutPage.xaml
│ │ ├── AboutPage.xaml.cs
│ │ ├── AboutWindow.xaml
│ │ ├── AboutWindow.xaml.cs
│ │ ├── ChangelogPage.xaml
│ │ ├── ChangelogPage.xaml.cs
│ │ ├── CopyOrMoveMessageWindow.xaml
│ │ ├── CopyOrMoveMessageWindow.xaml.cs
│ │ ├── DependencyDownloadWindow.xaml
│ │ ├── DependencyDownloadWindow.xaml.cs
│ │ ├── LinkPropertiesWindow.xaml
│ │ ├── LinkPropertiesWindow.xaml.cs
│ │ ├── LoginWindow.xaml
│ │ ├── LoginWindow.xaml.cs
│ │ ├── MainWindow.xaml
│ │ ├── MainWindow.xaml.cs
│ │ ├── ModSettingsWindow.xaml
│ │ ├── ModSettingsWindow.xaml.cs
│ │ ├── ModUpdateWindow.xaml
│ │ ├── ModUpdateWindow.xaml.cs
│ │ ├── ModpackExportWindow.xaml
│ │ ├── ModpackExportWindow.xaml.cs
│ │ ├── OnlineModsWindow.xaml
│ │ ├── OnlineModsWindow.xaml.cs
│ │ ├── ProgressWindow.xaml
│ │ ├── ProgressWindow.xaml.cs
│ │ ├── SettingsWindow.xaml
│ │ ├── SettingsWindow.xaml.cs
│ │ ├── UpdateListWindow.xaml
│ │ ├── UpdateListWindow.xaml.cs
│ │ ├── UpdateNotificationWindow.xaml
│ │ ├── UpdateNotificationWindow.xaml.cs
│ │ ├── VersionListWindow.xaml
│ │ ├── VersionListWindow.xaml.cs
│ │ ├── VersionManagementWindow.xaml
│ │ └── VersionManagementWindow.xaml.cs
│ ├── Web
│ │ ├── ApiAuthentication.cs
│ │ ├── AuthenticationApi
│ │ │ └── AuthenticationInfo.cs
│ │ ├── FactorioOnlineVersion.cs
│ │ ├── FactorioWebsite.cs
│ │ ├── ModApi
│ │ │ ├── ApiPage.cs
│ │ │ ├── ExtendedModInfo.cs
│ │ │ ├── InfoFile.cs
│ │ │ ├── LicenseInfo.cs
│ │ │ ├── ModInfo.cs
│ │ │ ├── ModRelease.cs
│ │ │ ├── PageInfo.cs
│ │ │ └── PageLinks.cs
│ │ ├── ModWebsite.cs
│ │ ├── UpdateApi
│ │ │ ├── Package.cs
│ │ │ ├── UpdateInfo.cs
│ │ │ ├── UpdateInfoTemplate.cs
│ │ │ ├── UpdateStep.cs
│ │ │ └── UpdateStepTemplate.cs
│ │ ├── UpdateWebsite.cs
│ │ └── WebHelper.cs
│ ├── Win32
│ │ ├── AdvApi32.cs
│ │ ├── ChangeNotifyEventId.cs
│ │ ├── ChangeNotifyFlags.cs
│ │ ├── DeviceType.cs
│ │ ├── FileAccessRights.cs
│ │ ├── FileFlags.cs
│ │ ├── GenericAccessRights.cs
│ │ ├── IOControlCode.cs
│ │ ├── IOMethod.cs
│ │ ├── Kernel32.cs
│ │ ├── Luid.cs
│ │ ├── Privilege.cs
│ │ ├── PrivilegeName.cs
│ │ ├── Shell32.cs
│ │ ├── StandardAccessRights.cs
│ │ ├── TokenPrivileges.cs
│ │ ├── User32.cs
│ │ ├── WindowLongIndex.cs
│ │ └── WindowStyles.cs
│ ├── WindowInfo.cs
│ ├── Xdelta
│ │ └── xdelta.dll
│ ├── Zlib
│ │ ├── Crc32Checksum.cs
│ │ ├── Crc32ChecksumGenerator.cs
│ │ ├── zlib32.dll
│ │ └── zlib64.dll
│ ├── app.manifest
│ └── packages.config
└── Updater
│ ├── App.config
│ ├── Program.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── Updater.csproj
│ └── app.manifest
└── README.md
/LICENSE-INI-Parser.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2008 Ricardo Amores Hernández
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.
--------------------------------------------------------------------------------
/LICENSE-Json.NET.md:
--------------------------------------------------------------------------------
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
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/LICENSE-MOONSHARP.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014-2016, Marco Mastropaolo
2 | All rights reserved.
3 |
4 | Parts of the string library are based on the KopiLua project (https://github.com/NLua/KopiLua)
5 | Copyright (c) 2012 LoDC
6 |
7 | Visual Studio Code debugger code is based on code from Microsoft vscode-mono-debug project (https://github.com/Microsoft/vscode-mono-debug).
8 | Copyright (c) Microsoft Corporation - released under MIT license.
9 |
10 | Remote Debugger icons are from the Eclipse project (https://www.eclipse.org/).
11 | Copyright of The Eclipse Foundation
12 |
13 | The MoonSharp icon is (c) Isaac, 2014-2015
14 |
15 | Redistribution and use in source and binary forms, with or without
16 | modification, are permitted provided that the following conditions are met:
17 |
18 | * Redistributions of source code must retain the above copyright notice, this
19 | list of conditions and the following disclaimer.
20 |
21 | * Redistributions in binary form must reproduce the above copyright notice,
22 | this list of conditions and the following disclaimer in the documentation
23 | and/or other materials provided with the distribution.
24 |
25 | * Neither the name of the {organization} nor the names of its
26 | contributors may be used to endorse or promote products derived from
27 | this software without specific prior written permission.
28 |
29 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
30 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
32 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
33 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
35 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
37 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/LICENSE-Octokit.NET.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2012 GitHub, Inc.
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of
4 | this software and associated documentation files (the "Software"), to deal in
5 | the Software without restriction, including without limitation the rights to
6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7 | the Software, and to permit persons to whom the Software is furnished to do so,
8 | subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/LICENSE-ZLIB.md:
--------------------------------------------------------------------------------
1 | Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
2 |
3 | This software is provided 'as-is', without any express or implied
4 | warranty. In no event will the authors be held liable for any damages
5 | arising from the use of this software.
6 |
7 | Permission is granted to anyone to use this software for any purpose,
8 | including commercial applications, and to alter it and redistribute it
9 | freely, subject to the following restrictions:
10 |
11 | 1. The origin of this software must not be misrepresented; you must not
12 | claim that you wrote the original software. If you use this software
13 | in a product, an acknowledgment in the product documentation would be
14 | appreciated but is not required.
15 | 2. Altered source versions must be plainly marked as such, and must not be
16 | misrepresented as being the original software.
17 | 3. This notice may not be removed or altered from any source distribution.
18 |
19 | Jean-loup Gailly Mark Adler
20 | jloup@gzip.org madler@alumni.caltech.edu
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016-2019 Mathis Rech
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.25428.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ModMyFactory", "ModMyFactory\ModMyFactory.csproj", "{216F1F9C-696E-4238-AA75-0DDDED89342C}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Updater", "Updater\Updater.csproj", "{B7018FDD-C8E7-41AE-B84F-CCBA7ED61620}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {216F1F9C-696E-4238-AA75-0DDDED89342C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {216F1F9C-696E-4238-AA75-0DDDED89342C}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {216F1F9C-696E-4238-AA75-0DDDED89342C}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {216F1F9C-696E-4238-AA75-0DDDED89342C}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {B7018FDD-C8E7-41AE-B84F-CCBA7ED61620}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {B7018FDD-C8E7-41AE-B84F-CCBA7ED61620}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {B7018FDD-C8E7-41AE-B84F-CCBA7ED61620}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {B7018FDD-C8E7-41AE-B84F-CCBA7ED61620}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {9723E86A-9EFF-498A-A6F8-F5D4D6BBC5B3}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/BooleanToStringJsonConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Newtonsoft.Json;
3 | using Newtonsoft.Json.Linq;
4 |
5 | namespace ModMyFactory
6 | {
7 | sealed class BooleanToStringJsonConverter : JsonConverter
8 | {
9 | public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
10 | {
11 | JToken token = JToken.FromObject(((bool)value).ToString().ToLower());
12 | token.WriteTo(writer);
13 | }
14 |
15 | public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
16 | {
17 | JToken token = JToken.Load(reader);
18 | string value = token.Value();
19 | return bool.Parse(value);
20 | }
21 |
22 | public override bool CanConvert(Type objectType)
23 | {
24 | return objectType == typeof(bool);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/Colors_dark.xaml:
--------------------------------------------------------------------------------
1 |
3 |
4 | #2d2d30
5 | #242424
6 | #505050
7 | #636363
8 | #454545
9 | #007acc
10 | #ECECEC
11 | #B0B0B0
12 | LightSkyBlue
13 | #ee4650
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/Colors_light.xaml:
--------------------------------------------------------------------------------
1 |
3 |
4 | White
5 | White
6 | LightGray
7 | DarkGray
8 | #5087CEFA
9 | LightSkyBlue
10 | Black
11 | DimGray
12 | #007acc
13 | Red
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/Controls/DefaultExpandedExpander.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 |
4 | namespace ModMyFactory.Controls
5 | {
6 | class DefaultExpandedExpander : Expander
7 | {
8 | static DefaultExpandedExpander()
9 | {
10 | IsExpandedProperty.OverrideMetadata(typeof(DefaultExpandedExpander), new FrameworkPropertyMetadata(true));
11 | }
12 |
13 | public DefaultExpandedExpander()
14 | {
15 | IsExpanded = true;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/Controls/DragDropReadyListBox.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Controls;
3 |
4 | namespace ModMyFactory.Controls
5 | {
6 | public class DragDropReadyListBox : ListBox
7 | {
8 | protected override DependencyObject GetContainerForItemOverride()
9 | {
10 | return new DragDropReadyListBoxItem();
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/Controls/DragDropReadyListBoxItem.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 | using System.Windows.Input;
3 |
4 | namespace ModMyFactory.Controls
5 | {
6 | public class DragDropReadyListBoxItem : ListBoxItem
7 | {
8 | protected override void OnMouseDown(MouseButtonEventArgs e)
9 | {
10 | if (IsSelected)
11 | e.Handled = true;
12 | else
13 | base.OnMouseDown(e);
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/Controls/InlineList.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Collections.ObjectModel;
3 | using System.Collections.Specialized;
4 | using System.Windows.Controls;
5 | using System.Windows.Documents;
6 |
7 | namespace ModMyFactory.Controls
8 | {
9 | class InlineList : Control
10 | {
11 | private class InlineCollectionWrapper : ObservableCollection
12 | { }
13 |
14 |
15 | private object anchor;
16 |
17 | public ICollection Inlines { get; }
18 |
19 | public InlineList()
20 | {
21 | var inlines = new InlineCollectionWrapper();
22 | inlines.CollectionChanged += OnInlineCollectionChanged;
23 | Inlines = inlines;
24 | }
25 |
26 | void OnInlineCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
27 | {
28 | TextBlock textBlock = anchor as TextBlock;
29 | if (textBlock != null)
30 | {
31 | switch (e.Action)
32 | {
33 | case NotifyCollectionChangedAction.Add:
34 | textBlock.Inlines.AddRange(e.NewItems);
35 | break;
36 | case NotifyCollectionChangedAction.Remove:
37 | foreach (var item in e.OldItems)
38 | textBlock.Inlines.Remove((Inline)item);
39 | break;
40 | case NotifyCollectionChangedAction.Reset:
41 | if (e.NewItems != null)
42 | {
43 | textBlock.Inlines.AddRange(e.NewItems);
44 | }
45 | if (e.OldItems != null)
46 | {
47 | foreach (var item in e.OldItems)
48 | textBlock.Inlines.Remove((Inline)item);
49 | }
50 | break;
51 | }
52 | }
53 | }
54 |
55 | public override void OnApplyTemplate()
56 | {
57 | base.OnApplyTemplate();
58 |
59 | anchor = Template?.FindName("PART_ContentHost", this);
60 | TextBlock textBlock = anchor as TextBlock;
61 | textBlock?.Inlines.AddRange(Inlines);
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/Controls/NumericUpDown.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
30 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/DirectoryOption.cs:
--------------------------------------------------------------------------------
1 | namespace ModMyFactory
2 | {
3 | enum DirectoryOption
4 | {
5 | AppData = 0,
6 | ApplicationDirectory = 1,
7 | Custom = 2,
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/Export/ExportMode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ModMyFactory.Export
4 | {
5 | [Flags]
6 | enum ExportMode
7 | {
8 | ///
9 | /// Value mask.
10 | ///
11 | Mask = 0x0000FFFF,
12 |
13 | ///
14 | /// The mod is included in the pack.
15 | ///
16 | Included = 0x00010000,
17 |
18 | ///
19 | /// Download a newer version if available even if the mod is included.
20 | ///
21 | DownloadNewer = 0x00020000,
22 |
23 | //------------------------------------------------------------------------------------------------
24 |
25 | ///
26 | /// Use format version 1 handling. Deprecated.
27 | ///
28 | Version1 = 0,
29 |
30 | ///
31 | /// Download the newest available version.
32 | ///
33 | NewestVersion = 1,
34 |
35 | ///
36 | /// Download a specific version.
37 | ///
38 | SpecificVersion = 2,
39 |
40 | ///
41 | /// Download the latest available version that is compatible with a specific version of Factorio.
42 | ///
43 | FactorioVersion = 3,
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/Export/ExportTemplate.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using Newtonsoft.Json;
3 |
4 | namespace ModMyFactory.Export
5 | {
6 | [JsonObject(MemberSerialization.OptOut)]
7 | sealed class ExportTemplate
8 | {
9 | //---------------------------------------------------- Deprecated ------------------------------------------------------------
10 |
11 | [DefaultValue(false)]
12 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
13 | public bool IncludesVersionInfo { get; }
14 |
15 | public ExportTemplate(bool includesVersionInfo, ModExportTemplate[] mods, ModpackExportTemplate[] modpacks)
16 | : this(includesVersionInfo, mods, modpacks, 1)
17 | { }
18 |
19 | //----------------------------------------------------------------------------------------------------------------------------
20 |
21 |
22 |
23 |
24 | [DefaultValue(1)]
25 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
26 | public int Version { get; }
27 |
28 | public ModExportTemplate[] Mods { get; }
29 |
30 | public ModpackExportTemplate[] Modpacks { get; }
31 |
32 | [JsonConstructor]
33 | private ExportTemplate(bool includesVersionInfo, ModExportTemplate[] mods, ModpackExportTemplate[] modpacks, int version)
34 | {
35 | IncludesVersionInfo = includesVersionInfo;
36 | Mods = mods;
37 | Modpacks = modpacks;
38 | Version = version;
39 | }
40 |
41 | public ExportTemplate(ModExportTemplate[] mods, ModpackExportTemplate[] modpacks)
42 | : this(false, mods, modpacks, 2)
43 | { }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/FactorioCollection.cs:
--------------------------------------------------------------------------------
1 | using ModMyFactory.Helpers;
2 | using ModMyFactory.Models;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Collections.ObjectModel;
6 | using System.Linq;
7 |
8 | namespace ModMyFactory
9 | {
10 | sealed class FactorioCollection : ObservableCollection
11 | {
12 | public static FactorioCollection Load()
13 | {
14 | FactorioVersion.ResetUniqueNames();
15 |
16 | var installedVersions = FactorioVersion.LoadInstalledVersions();
17 | if (App.Instance.Settings.LoadSteamVersion)
18 | {
19 | if (FactorioSteamVersion.TryLoad(out var steamVersion))
20 | {
21 | installedVersions.Add(steamVersion);
22 | }
23 | else
24 | {
25 | App.Instance.Settings.LoadSteamVersion = false;
26 | App.Instance.Settings.Save();
27 | }
28 | }
29 |
30 | return new FactorioCollection(installedVersions);
31 | }
32 |
33 | public FactorioCollection()
34 | : base()
35 | {
36 | this.Add(new LatestFactorioVersion(this));
37 | }
38 |
39 | public FactorioCollection(IEnumerable collection)
40 | : base(collection)
41 | {
42 | this.Add(new LatestFactorioVersion(this));
43 | }
44 |
45 | public FactorioCollection(List list)
46 | : base(list)
47 | {
48 | this.Add(new LatestFactorioVersion(this));
49 | }
50 |
51 | public bool Contains(string name)
52 | {
53 | return this.Any(item => item.Name == name);
54 | }
55 |
56 | public FactorioVersion Find(string name)
57 | {
58 | return this.FirstOrDefault(item => item.Name == name);
59 | }
60 |
61 | public FactorioVersion Find(Version version, bool exact = true)
62 | {
63 | if (exact)
64 | {
65 | return this.FirstOrDefault(item => item.Version == version);
66 | }
67 | else
68 | {
69 | return this.Where(item => (item.Version.Major == version.Major) && (item.Version.Minor == version.Minor))
70 | .MaxBy(item => item.Version, new VersionComparer());
71 | }
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/FactorioUpdate/CriticalUpdaterException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace ModMyFactory.FactorioUpdate
4 | {
5 | ///
6 | /// This exception is thrown if the Factorio updater encounters a critical error.
7 | ///
8 | class CriticalUpdaterException : Exception
9 | {
10 | ///
11 | /// The type of error the updater encountered.
12 | ///
13 | public UpdaterErrorType ErrorType { get; }
14 |
15 | public CriticalUpdaterException(UpdaterErrorType errorType, Exception innerException)
16 | : base("The updater encountered a critical error.", innerException)
17 | {
18 | ErrorType = errorType;
19 | }
20 |
21 | public CriticalUpdaterException(UpdaterErrorType errorType)
22 | : this(errorType, null)
23 | { }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/FactorioUpdate/FileUpdateAction.cs:
--------------------------------------------------------------------------------
1 | namespace ModMyFactory
2 | {
3 | enum FileUpdateAction
4 | {
5 | Added,
6 | Removed,
7 | Differs,
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/FactorioUpdate/FileUpdateInfo.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Converters;
3 |
4 | namespace ModMyFactory.FactorioUpdate
5 | {
6 | [JsonObject(MemberSerialization.OptOut)]
7 | sealed class FileUpdateInfo
8 | {
9 | [JsonProperty("file")]
10 | public string Path { get; }
11 |
12 | [JsonProperty("action"), JsonConverter(typeof(StringEnumConverter), true)]
13 | public FileUpdateAction Action { get; }
14 |
15 | [JsonProperty("old_crc")]
16 | public uint OldCrc { get; }
17 |
18 | [JsonProperty("crc")]
19 | public uint NewCrc { get; }
20 |
21 | [JsonConstructor]
22 | public FileUpdateInfo(string path, FileUpdateAction action, uint oldCrc, uint newCrc)
23 | {
24 | Path = path;
25 | Action = action;
26 | OldCrc = oldCrc;
27 | NewCrc = newCrc;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/FactorioUpdate/UpdatePackageInfo.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace ModMyFactory.FactorioUpdate
4 | {
5 | [JsonObject(MemberSerialization.OptIn)]
6 | sealed class UpdatePackageInfo
7 | {
8 | [JsonProperty("type")]
9 | public string Type { get; }
10 |
11 | [JsonProperty("apiVersion")]
12 | public int ApiVersion { get; }
13 |
14 | [JsonProperty("files")]
15 | public FileUpdateInfo[] UpdatedFiles { get; }
16 |
17 | public string PackageDirectory { get; set; }
18 |
19 | [JsonConstructor]
20 | public UpdatePackageInfo(string type, int apiVersion, FileUpdateInfo[] updatedFiles)
21 | {
22 | Type = type;
23 | ApiVersion = apiVersion;
24 | UpdatedFiles = updatedFiles;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/FactorioUpdate/UpdaterErrorType.cs:
--------------------------------------------------------------------------------
1 | namespace ModMyFactory.FactorioUpdate
2 | {
3 | ///
4 | /// Specifies the type of error the Factorio updater encounters.
5 | ///
6 | enum UpdaterErrorType
7 | {
8 | ///
9 | /// The provided archive is not a valid update package.
10 | ///
11 | PackageInvalid,
12 |
13 | ///
14 | /// The updater could not find a file specified in the update package.
15 | ///
16 | FileNotFound,
17 |
18 | ///
19 | /// A file has a different CRC32 checksum than provided by the update package.
20 | ///
21 | ChecksumMismatch,
22 |
23 | ///
24 | /// The resulting Factorio installation is corrupt.
25 | ///
26 | InstallationCorrupt,
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/GameVersionConverter.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Linq;
3 | using System;
4 |
5 | namespace ModMyFactory
6 | {
7 | class GameVersionConverter : JsonConverter
8 | {
9 | public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
10 | {
11 | JToken token = JToken.FromObject(((GameCompatibleVersion)value).ToString().ToLower());
12 | token.WriteTo(writer);
13 | }
14 |
15 | public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
16 | {
17 | JToken token = JToken.Load(reader);
18 | string value = token.Value();
19 | return GameCompatibleVersion.Parse(value);
20 | }
21 |
22 | public override bool CanConvert(Type objectType)
23 | {
24 | return objectType == typeof(GameCompatibleVersion);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/Helpers/CollectionExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace ModMyFactory.Helpers
5 | {
6 | static class CollectionExtensions
7 | {
8 | public static void ForEach(this ICollection source, Action body)
9 | {
10 | foreach (T item in source)
11 | {
12 | body.Invoke(item);
13 | }
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/Helpers/FileHelper.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 |
3 | namespace ModMyFactory.Helpers
4 | {
5 | static class FileHelper
6 | {
7 | ///
8 | /// Determines if a given path is pointing to a directory.
9 | ///
10 | /// The path to check.
11 | /// Return true if the given path is pointing to a directory, returns false if it is pointing to a file.
12 | public static bool IsDirectory(string path)
13 | {
14 | var attributes = File.GetAttributes(path);
15 | return attributes.HasFlag(FileAttributes.Directory);
16 | }
17 |
18 | ///
19 | /// Creates a FileSystemInfo object from a given path.
20 | /// If the path is pointing to a directory a DirectoryInfo object is created, if it is pointing to a file a FileInfo object is created.
21 | ///
22 | /// The path of the file system object to create.
23 | /// Returns a FIleSystemInfo object that was created from the given path.
24 | public static FileSystemInfo CreateFileOrDirectory(string path)
25 | {
26 | if (IsDirectory(path))
27 | return new DirectoryInfo(path);
28 | else
29 | return new FileInfo(path);
30 | }
31 |
32 | ///
33 | /// Checks if a path exists.
34 | ///
35 | public static bool PathExists(string path)
36 | {
37 | if (File.Exists(path)) return true;
38 | if (Directory.Exists(path)) return true;
39 | return false;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/Helpers/FileInfoExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using System.Threading.Tasks;
3 | using ModMyFactory.Zlib;
4 |
5 | namespace ModMyFactory.Helpers
6 | {
7 | static class FileInfoExtensions
8 | {
9 | ///
10 | /// Gets the name of the file without the extension.
11 | ///
12 | public static string NameWithoutExtension(this FileInfo file)
13 | {
14 | return Path.GetFileNameWithoutExtension(file.Name);
15 | }
16 |
17 | ///
18 | /// Calculates the CRC checksum of the file.
19 | ///
20 | public static uint CalculateCrc(this FileInfo file)
21 | {
22 | using (var stream = file.Open(FileMode.Open, FileAccess.Read, FileShare.None))
23 | {
24 | return Crc32Checksum.Generate(stream);
25 | }
26 | }
27 |
28 | ///
29 | /// Moves the file to a new location.
30 | ///
31 | public static async Task MoveToAsync(this FileInfo file, string destination)
32 | {
33 | await Task.Run(() => file.MoveTo(destination));
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/Helpers/GitHubClientExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using System.Threading.Tasks;
3 | using Octokit;
4 |
5 | namespace ModMyFactory.Helpers
6 | {
7 | static class GitHubClientExtensions
8 | {
9 | public static async Task GetPreReleaseAsync(this GitHubClient client, string owner, string name)
10 | {
11 | var releases = await client.Repository.Release.GetAll(owner, name);
12 | return releases.Where(release => release.Prerelease).MaxBy(release => new ExtendedVersion(release.TagName));
13 | }
14 |
15 | public static async Task GetLatestReleaseAsync(this GitHubClient client, string owner, string name, bool includePreReleases)
16 | {
17 | var latest = await client.Repository.Release.GetLatest(owner, name);
18 | if (!includePreReleases) return latest;
19 |
20 | var latestPre = await GetPreReleaseAsync(client, owner, name);
21 | return new ExtendedVersion(latestPre.TagName) > new ExtendedVersion(latest.TagName) ? latestPre : latest;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/Helpers/INIHelper.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using IniParser;
3 | using IniParser.Model;
4 |
5 | namespace ModMyFactory.Helpers
6 | {
7 | static class INIHelper
8 | {
9 | public static IniData ReadINI(string content)
10 | {
11 | #pragma warning disable CS0618
12 | var parser = new StringIniParser();
13 | #pragma warning restore CS0618
14 | return parser.ParseString(content);
15 | }
16 |
17 | public static IniData ReadINI(Stream stream)
18 | {
19 | using (var reader = new StreamReader(stream))
20 | {
21 | var parser = new StreamIniDataParser();
22 | return parser.ReadData(reader);
23 | }
24 | }
25 |
26 | public static IniData ReadINI(FileInfo file)
27 | {
28 | var parser = new FileIniDataParser();
29 | return parser.ReadFile(file.FullName);
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/Helpers/JsonHelper.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using Newtonsoft.Json;
3 |
4 | namespace ModMyFactory.Helpers
5 | {
6 | static class JsonHelper
7 | {
8 | private static readonly JsonSerializerSettings DefaultSettings;
9 |
10 | static JsonHelper()
11 | {
12 | DefaultSettings = new JsonSerializerSettings()
13 | {
14 | DefaultValueHandling = DefaultValueHandling.Include,
15 | DateFormatHandling = DateFormatHandling.IsoDateFormat,
16 | DateParseHandling = DateParseHandling.DateTime,
17 | DateTimeZoneHandling = DateTimeZoneHandling.Utc
18 | };
19 | }
20 |
21 | public static void Serialize(T value, FileInfo file)
22 | {
23 | using (var writer = file.CreateText())
24 | {
25 | string json = JsonConvert.SerializeObject(value, Formatting.Indented, DefaultSettings);
26 | writer.Write(json);
27 | }
28 | }
29 |
30 | public static string Serialize(T value)
31 | {
32 | return JsonConvert.SerializeObject(value, Formatting.Indented, DefaultSettings);
33 | }
34 |
35 | public static T Deserialize(FileInfo file)
36 | {
37 | using (var reader = file.OpenText())
38 | {
39 | string json = reader.ReadToEnd();
40 | return JsonConvert.DeserializeObject(json, DefaultSettings);
41 | }
42 | }
43 |
44 | public static T Deserialize(string json)
45 | {
46 | return JsonConvert.DeserializeObject(json, DefaultSettings);
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/Helpers/ModHelper.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Threading.Tasks;
3 | using System.Windows;
4 | using ModMyFactory.ViewModels;
5 | using ModMyFactory.Views;
6 | using ModMyFactory.Web;
7 | using ModMyFactory.Web.ModApi;
8 |
9 | namespace ModMyFactory.Helpers
10 | {
11 | static class ModHelper
12 | {
13 | public static async Task> FetchMods(Window progressOwner, ModCollection installedMods)
14 | {
15 | var progressWindow = new ProgressWindow() { Owner = progressOwner };
16 | var progressViewModel = (ProgressViewModel)progressWindow.ViewModel;
17 | progressViewModel.ActionName = App.Instance.GetLocalizedResourceString("FetchingModsAction");
18 | progressViewModel.CanCancel = false;
19 | progressViewModel.IsIndeterminate = true;
20 |
21 | Task> fetchModsTask = ModWebsite.GetModsAsync(installedMods);
22 |
23 | Task closeWindowTask = fetchModsTask.ContinueWith(t => progressWindow.Dispatcher.Invoke(progressWindow.Close));
24 | progressWindow.ShowDialog();
25 |
26 | List modInfos = await fetchModsTask;
27 | await closeWindowTask;
28 |
29 | return modInfos;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/Helpers/PercievedFileType.cs:
--------------------------------------------------------------------------------
1 | namespace ModMyFactory.Helpers
2 | {
3 | enum PercievedFileType
4 | {
5 | None,
6 | Folder,
7 | Text,
8 | Image,
9 | Audio,
10 | Video,
11 | Compressed,
12 | Document,
13 | System,
14 | Application,
15 | Gamemedia,
16 | Contacts,
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/ModMyFactory/ModMyFactory/Helpers/ProcessExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Threading.Tasks;
4 |
5 | namespace ModMyFactory.Helpers
6 | {
7 | static class ProcessExtensions
8 | {
9 | public static Task WaitForExitAsync(this Process process)
10 | {
11 | process.EnableRaisingEvents = true;
12 |
13 | var completionSource = new TaskCompletionSource