├── .gitattributes
├── .gitignore
├── Authorization
├── Authorization.csproj
├── Client.cs
├── FodyWeavers.xml
├── Properties
│ └── AssemblyInfo.cs
└── packages.config
├── CHANGELOG.txt
├── README.md
├── ToolsV3.sln
├── ToolsV3
├── API
│ ├── CommandlineManager.cs
│ ├── Core.cs
│ ├── Flag.cs
│ ├── GameManager.cs
│ ├── GameProperty.cs
│ ├── Mod.cs
│ ├── Updater.cs
│ └── Utils.cs
├── AboutWindow.xaml
├── AboutWindow.xaml.cs
├── App.config
├── App.xaml
├── App.xaml.cs
├── ChangelogWindow.xaml
├── ChangelogWindow.xaml.cs
├── FlagsWindow.xaml
├── FlagsWindow.xaml.cs
├── FodyWeavers.xml
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── ModManagerWindow.xaml
├── ModManagerWindow.xaml.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Resources
│ └── favicon.ico
├── SettingsWindow.xaml
├── SettingsWindow.xaml.cs
├── ToolsV3.csproj
├── favicon.ico
└── packages.config
└── Updater
├── App.config
├── FodyWeavers.xml
├── Options.cs
├── Program.cs
├── Properties
└── AssemblyInfo.cs
├── Updater.csproj
└── packages.config
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | project.fragment.lock.json
46 | artifacts/
47 |
48 | *_i.c
49 | *_p.c
50 | *_i.h
51 | *.ilk
52 | *.meta
53 | *.obj
54 | *.pch
55 | *.pdb
56 | *.pgc
57 | *.pgd
58 | *.rsp
59 | *.sbr
60 | *.tlb
61 | *.tli
62 | *.tlh
63 | *.tmp
64 | *.tmp_proj
65 | *.log
66 | *.vspscc
67 | *.vssscc
68 | .builds
69 | *.pidb
70 | *.svclog
71 | *.scc
72 |
73 | # Chutzpah Test files
74 | _Chutzpah*
75 |
76 | # Visual C++ cache files
77 | ipch/
78 | *.aps
79 | *.ncb
80 | *.opendb
81 | *.opensdf
82 | *.sdf
83 | *.cachefile
84 | *.VC.db
85 | *.VC.VC.opendb
86 |
87 | # Visual Studio profiler
88 | *.psess
89 | *.vsp
90 | *.vspx
91 | *.sap
92 |
93 | # TFS 2012 Local Workspace
94 | $tf/
95 |
96 | # Guidance Automation Toolkit
97 | *.gpState
98 |
99 | # ReSharper is a .NET coding add-in
100 | _ReSharper*/
101 | *.[Rr]e[Ss]harper
102 | *.DotSettings.user
103 |
104 | # JustCode is a .NET coding add-in
105 | .JustCode
106 |
107 | # TeamCity is a build add-in
108 | _TeamCity*
109 |
110 | # DotCover is a Code Coverage Tool
111 | *.dotCover
112 |
113 | # NCrunch
114 | _NCrunch_*
115 | .*crunch*.local.xml
116 | nCrunchTemp_*
117 |
118 | # MightyMoose
119 | *.mm.*
120 | AutoTest.Net/
121 |
122 | # Web workbench (sass)
123 | .sass-cache/
124 |
125 | # Installshield output folder
126 | [Ee]xpress/
127 |
128 | # DocProject is a documentation generator add-in
129 | DocProject/buildhelp/
130 | DocProject/Help/*.HxT
131 | DocProject/Help/*.HxC
132 | DocProject/Help/*.hhc
133 | DocProject/Help/*.hhk
134 | DocProject/Help/*.hhp
135 | DocProject/Help/Html2
136 | DocProject/Help/html
137 |
138 | # Click-Once directory
139 | publish/
140 |
141 | # Publish Web Output
142 | *.[Pp]ublish.xml
143 | *.azurePubxml
144 | # TODO: Comment the next line if you want to checkin your web deploy settings
145 | # but database connection strings (with potential passwords) will be unencrypted
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
150 | # checkin your Azure Web App publish settings, but sensitive information contained
151 | # in these scripts will be unencrypted
152 | PublishScripts/
153 |
154 | # NuGet Packages
155 | *.nupkg
156 | # The packages folder can be ignored because of Package Restore
157 | **/packages/*
158 | # except build/, which is used as an MSBuild target.
159 | !**/packages/build/
160 | # Uncomment if necessary however generally it will be regenerated when needed
161 | #!**/packages/repositories.config
162 | # NuGet v3's project.json files produces more ignoreable files
163 | *.nuget.props
164 | *.nuget.targets
165 |
166 | # Microsoft Azure Build Output
167 | csx/
168 | *.build.csdef
169 |
170 | # Microsoft Azure Emulator
171 | ecf/
172 | rcf/
173 |
174 | # Windows Store app package directories and files
175 | AppPackages/
176 | BundleArtifacts/
177 | Package.StoreAssociation.xml
178 | _pkginfo.txt
179 |
180 | # Visual Studio cache files
181 | # files ending in .cache can be ignored
182 | *.[Cc]ache
183 | # but keep track of directories ending in .cache
184 | !*.[Cc]ache/
185 |
186 | # Others
187 | ClientBin/
188 | ~$*
189 | *~
190 | *.dbmdl
191 | *.dbproj.schemaview
192 | *.jfm
193 | *.pfx
194 | *.publishsettings
195 | node_modules/
196 | orleans.codegen.cs
197 |
198 | # Since there are multiple workflows, uncomment next line to ignore bower_components
199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
200 | #bower_components/
201 |
202 | # RIA/Silverlight projects
203 | Generated_Code/
204 |
205 | # Backup & report files from converting an old project file
206 | # to a newer Visual Studio version. Backup files are not needed,
207 | # because we have git ;-)
208 | _UpgradeReport_Files/
209 | Backup*/
210 | UpgradeLog*.XML
211 | UpgradeLog*.htm
212 |
213 | # SQL Server files
214 | *.mdf
215 | *.ldf
216 |
217 | # Business Intelligence projects
218 | *.rdl.data
219 | *.bim.layout
220 | *.bim_*.settings
221 |
222 | # Microsoft Fakes
223 | FakesAssemblies/
224 |
225 | # GhostDoc plugin setting file
226 | *.GhostDoc.xml
227 |
228 | # Node.js Tools for Visual Studio
229 | .ntvs_analysis.dat
230 |
231 | # Visual Studio 6 build log
232 | *.plg
233 |
234 | # Visual Studio 6 workspace options file
235 | *.opt
236 |
237 | # Visual Studio LightSwitch build output
238 | **/*.HTMLClient/GeneratedArtifacts
239 | **/*.DesktopClient/GeneratedArtifacts
240 | **/*.DesktopClient/ModelManifest.xml
241 | **/*.Server/GeneratedArtifacts
242 | **/*.Server/ModelManifest.xml
243 | _Pvt_Extensions
244 |
245 | # Paket dependency manager
246 | .paket/paket.exe
247 | paket-files/
248 |
249 | # FAKE - F# Make
250 | .fake/
251 |
252 | # JetBrains Rider
253 | .idea/
254 | *.sln.iml
255 |
256 | # CodeRush
257 | .cr/
258 |
259 | # Python Tools for Visual Studio (PTVS)
260 | __pycache__/
261 | *.pyc
--------------------------------------------------------------------------------
/Authorization/Authorization.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {5413ADB6-C9EC-4F06-AF9E-07B54EFED7BE}
8 | Library
9 | Properties
10 | Authorization
11 | Authorization
12 | v4.5.2
13 | 512
14 |
15 |
16 |
17 |
18 |
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 | ..\packages\Costura.Fody.1.6.2\lib\dotnet\Costura.dll
38 | False
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | Ten projekt zawiera odwołania do pakietów NuGet, których nie ma na tym komputerze. Użyj przywracania pakietów NuGet, aby je pobrać. Aby uzyskać więcej informacji, zobacz http://go.microsoft.com/fwlink/?LinkID=322105. Brakujący plik: {0}.
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/Authorization/Client.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 Authorization
8 | {
9 | public static class Client
10 | {
11 | public static string Id { get; } = @"b404bf5fdda2641a7e99";
12 | public static string Secret { get; } = @"4774613c60dc75393c65a3a3f0a2cbd74d170d4b";
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Authorization/FodyWeavers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Authorization/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Ogólne informacje o zestawie są kontrolowane poprzez następujący
6 | // zestaw atrybutów. Zmień wartości tych atrybutów, aby zmodyfikować informacje
7 | // powiązane z zestawem.
8 | [assembly: AssemblyTitle("Authorization")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Authorization")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Ustawienie elementu ComVisible na wartość false sprawia, że typy w tym zestawie są niewidoczne
18 | // dla składników COM. Jeśli potrzebny jest dostęp do typu w tym zestawie z
19 | // COM, ustaw wartość true dla atrybutu ComVisible tego typu.
20 | [assembly: ComVisible(false)]
21 |
22 | // Następujący identyfikator GUID jest identyfikatorem biblioteki typów w przypadku udostępnienia tego projektu w modelu COM
23 | [assembly: Guid("5413adb6-c9ec-4f06-af9e-07b54efed7be")]
24 |
25 | // Informacje o wersji zestawu zawierają następujące cztery wartości:
26 | //
27 | // Wersja główna
28 | // Wersja pomocnicza
29 | // Numer kompilacji
30 | // Rewizja
31 | //
32 | // Możesz określić wszystkie wartości lub użyć domyślnych numerów kompilacji i poprawki
33 | // przy użyciu symbolu „*”, tak jak pokazano poniżej:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Authorization/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/CHANGELOG.txt:
--------------------------------------------------------------------------------
1 | [Changelog]
2 |
3 | Version 3.0.0
4 | * Complete visual overhaul
5 | * Complete backend rewrite (way more stable, functional, extensible)
6 |
7 | [Changelogs for older releases below, not applicable to 3.x+]
8 |
9 | Version 2.2.3
10 | * Updated main window
11 | * Updated game edition display
12 | * Updated toolstip items order
13 | * Updated changelog window
14 | * Improved program launch speed
15 | * Fixed shortcuts not enabling/disabling the mods for singleplayer
16 | * Fixed bypass intro not working with auto-close after launch
17 | * Fixed other bugs
18 |
19 | Version 2.2.2
20 | * Added intro bypass launch option
21 | * Added changelog viewer
22 | * Updated mod manager
23 | * Updated shortcut creator
24 | * Updated migration tool downloader
25 | * Updated credits
26 | * Updated status bar
27 | * Fixed bugs
28 |
29 | Version 2.2.1
30 | * Updated update tool
31 | * Fixed self-update
32 | * Fixed updater not downloading
33 | * Fixed label text when GTA not found
34 | * Fixed links (sorry, using GDrive instead of FTP server right now)
35 |
36 | Version 2.2.0
37 | * Added mod manager
38 | * Added self-updating
39 | * Added unexpected crash handling
40 | * Updated settings window
41 | * Improved program speed
42 | * Fixed bugs
43 |
44 | Version 2.1.0
45 | * ScriptHookV checker on startup can now be toggled
46 | * Added exit after game launch option (AKA stealth mode)
47 | * Added update button in settings menu
48 | * Updated shortcut icon
49 | * Updated "about" message
50 | * Fixed "normal" game launch shortcut
51 | * Fixed patch version retrieve for steam edition of GTA
52 | * Fixed shortcuts not running the game
53 |
54 | Version 2.0.2
55 | * Added full support for steam edition of GTA!
56 | * Game version is now shown
57 | * Added shortcut creation tool
58 | * Updated migration tool
59 | * Fixed ScriptHookV checker
60 | * Fixed GTA Online launch
61 | * Fixed crash when commandline.txt didn't exist
62 |
63 | v1.0.0.1
64 | * Initial release
65 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ToolsV 3
2 | ToolsV is the ultimate standalone launcher, mod manager and toolpack for GTA V.
3 | It features an automatic updater so you won't miss any additions.
4 |
5 | ### Highlighted features (not everything is implemented, yet)
6 | * Pre-configured game start modes
7 | * Singleplayer with mods
8 | * Singleplayer wthout mods
9 | * Direct online (without mods)
10 | * Normal (does not change anything)
11 | * Built-in mod manager
12 | * Enable/disable particular mods
13 | * Commandline editor
14 | * Toggle any available flag via ToolsV's interface
15 | * Game information viewer
16 | * Installation directory path
17 | * Patch version
18 | * Language
19 | * Edition (Steam/Rockstar)
20 | * Mod detection status
21 | * Shortcut creator
22 | * Create shortcuts to individual configurations
23 | Example: launch online, with safe mode and file verification enabled
24 | * Automatic ScriptHookV checker
25 | * Warning when version is not compatible
26 |
27 | ### Screenshots
28 | #### Main window
29 |
30 |
31 | ### Releases
32 | All releases are available on the [GitHub releases page](https://github.com/Frioo/ToolsV/releases/).
33 | You can find the latest binary [here](https://github.com/Frioo/ToolsV/releases/latest).
34 |
35 | ### ToolsV 1.X/2.X
36 | Older versions of ToolsV are still available, but they are not stable nor optimized.
37 | Any support will be dropped after ToolsV 3.0 is published.
38 | [Downloads](https://mega.nz/#F!ApMHzSoC!pXO_Uonbehx8qwFZ3Rn9aw)
39 |
40 | # Contact
41 | You can contact me via email (thehdplayerpl@gmail.com)
42 | or
43 | by joining my [Discord server](https://discord.gg/4JM9p2D) (doesn't require an account)
44 |
--------------------------------------------------------------------------------
/ToolsV3.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27130.2024
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToolsV3", "ToolsV3\ToolsV3.csproj", "{BEA7DD6F-3B57-4317-BF05-28C2B6E4EAC6}"
7 | ProjectSection(ProjectDependencies) = postProject
8 | {5413ADB6-C9EC-4F06-AF9E-07B54EFED7BE} = {5413ADB6-C9EC-4F06-AF9E-07B54EFED7BE}
9 | EndProjectSection
10 | EndProject
11 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authorization", "Authorization\Authorization.csproj", "{5413ADB6-C9EC-4F06-AF9E-07B54EFED7BE}"
12 | EndProject
13 | Global
14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
15 | Debug|Any CPU = Debug|Any CPU
16 | Release|Any CPU = Release|Any CPU
17 | EndGlobalSection
18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
19 | {BEA7DD6F-3B57-4317-BF05-28C2B6E4EAC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20 | {BEA7DD6F-3B57-4317-BF05-28C2B6E4EAC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
21 | {BEA7DD6F-3B57-4317-BF05-28C2B6E4EAC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
22 | {BEA7DD6F-3B57-4317-BF05-28C2B6E4EAC6}.Release|Any CPU.Build.0 = Release|Any CPU
23 | {5413ADB6-C9EC-4F06-AF9E-07B54EFED7BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24 | {5413ADB6-C9EC-4F06-AF9E-07B54EFED7BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
25 | {5413ADB6-C9EC-4F06-AF9E-07B54EFED7BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
26 | {5413ADB6-C9EC-4F06-AF9E-07B54EFED7BE}.Release|Any CPU.Build.0 = Release|Any CPU
27 | EndGlobalSection
28 | GlobalSection(SolutionProperties) = preSolution
29 | HideSolutionNode = FALSE
30 | EndGlobalSection
31 | GlobalSection(ExtensibilityGlobals) = postSolution
32 | SolutionGuid = {2A73CFBB-1D6F-4A6E-B558-FD5D1458E9DF}
33 | EndGlobalSection
34 | EndGlobal
35 |
--------------------------------------------------------------------------------
/ToolsV3/API/CommandlineManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace ToolsV3.API
9 | {
10 | public class CommandlineManager
11 | {
12 | private GameManager Manager { get; }
13 |
14 | public CommandlineManager(GameManager manager)
15 | {
16 | this.Manager = manager;
17 | RemoveMultiplayerFlag();
18 | }
19 |
20 | public void RemoveMultiplayerFlag()
21 | {
22 | RemoveCommandlineArgument("-goStraightToMP");
23 | }
24 |
25 | public void SetCommandLineArgument(Flag flag)
26 | {
27 | File.AppendAllLines(Manager.CommandlinePath, new List { flag.FlagCode }.AsEnumerable());
28 | }
29 |
30 | public void SetCommandlineArguments(List enabledFlags)
31 | {
32 | List flags = new List();
33 | for (int i = 0; i < enabledFlags.Count; i++)
34 | {
35 | flags.Add(enabledFlags[i].FlagCode);
36 | }
37 | File.WriteAllText(Manager.CommandlinePath, String.Empty);
38 | File.AppendAllLines(Manager.CommandlinePath, flags.AsEnumerable());
39 | }
40 |
41 | public void RemoveCommandlineArgument(string flagCode)
42 | {
43 | List flags = GetCommandlineArguments();
44 | for (int i = 0; i < flags.Count; i++)
45 | {
46 | if (flags[i].FlagCode.Equals(flagCode))
47 | {
48 | flags.RemoveAt(i);
49 | }
50 | }
51 | SetCommandlineArguments(flags);
52 | }
53 |
54 | public List GetCommandlineArguments()
55 | {
56 | List res = new List();
57 | List all = this.GetAllFlags();
58 | string path = Manager.InstallFolder + @"\commandline.txt";
59 | if (!File.Exists(path))
60 | {
61 | File.Create(path);
62 | return res;
63 | }
64 |
65 |
66 | List args = File.ReadAllLines(path).ToList();
67 | foreach (string arg in args)
68 | {
69 | var query = from element in all
70 | where element.FlagCode.Equals(arg)
71 | select element;
72 |
73 | foreach (var f in query)
74 | {
75 | f.IsEnabled = true;
76 | res.Add(f);
77 | Utils.Log(f.FlagCode);
78 | }
79 | }
80 | return res;
81 | }
82 |
83 | public List GetAllFlags()
84 | {
85 | List flags = new List();
86 | //flags.Add(new Flag("-verify", "verifies game files integrity and checks for updates"));
87 | //flags.Add(new Flag("-safemode", "starts the game with minimal settings but doesn't save them"));
88 | flags.Add(new Flag("-ignoreprofile", "ignores current profile settings"));
89 | flags.Add(new Flag("-useMinimumSettings", "starts the game with minimal settings"));
90 | flags.Add(new Flag("-useAutoSettings", "game uses automatic settings"));
91 | flags.Add(new Flag("-DX10", "forces DirectX 10.0"));
92 | flags.Add(new Flag("-DX10_1", "forces DirectX 10.1"));
93 | flags.Add(new Flag("-DX11", "forces DirectX 11.0"));
94 | flags.Add(new Flag("-noChunkedDownload", "forces downloading all updates at once instead of parts"));
95 | flags.Add(new Flag("-benchmark", "runs a system performance test"));
96 | flags.Add(new Flag("-goStraightToMP", "automatically loads online mode"));
97 | //flags.Add(new Flag("-StraightIntoFreemode", "load GTA online freemode"));
98 | flags.Add(new Flag("-windowed", "forces the game to run in a window"));
99 | flags.Add(new Flag("-fullscreen", "forces fullscreen mode"));
100 | flags.Add(new Flag("-borderless", "hides window borders"));
101 | flags.Add(new Flag("-disallowResizeWindow", "locks window size"));
102 | // TODO: add language switcher
103 |
104 | return flags;
105 | }
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/ToolsV3/API/Core.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net.Http;
3 | using System.Threading.Tasks;
4 |
5 | namespace ToolsV3.API
6 | {
7 | public static class Core
8 | {
9 | public static void Initialize()
10 | {
11 | Utils.Log("Core: initialize");
12 | Updater.Initialize();
13 | }
14 |
15 | public static void Save()
16 | {
17 | Utils.Log("Core: save properties");
18 | Properties.Settings.Default.Save();
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/ToolsV3/API/Flag.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 ToolsV3.API
8 | {
9 | public class Flag
10 | {
11 | public string FlagCode { get; set; }
12 | public string Description { get; set; }
13 | public bool IsEnabled { get; set; }
14 |
15 | public Flag(string code, string description)
16 | {
17 | this.FlagCode = code;
18 | this.Description = description;
19 | this.IsEnabled = false;
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/ToolsV3/API/GameManager.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Win32;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Diagnostics;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Text.RegularExpressions;
8 | using System.Windows;
9 | using ToolsV3.API;
10 |
11 | namespace ToolsV3
12 | {
13 | public class GameManager
14 | {
15 | private static string GTA_REGISTRY_PATH = @"SOFTWARE\WOW6432Node\Rockstar Games\Grand Theft Auto V";
16 | private static string STEAM_REGISTRY_PATH_x86 = @"Software\Valve\Steam";
17 | private static string STEAM_REGISTRY_PATH_x64 = @"SOFTWARE\WOW6432Node\Valve\Steam";
18 |
19 | public string InstallFolder { get; }
20 | public string ModStorageFolder { get; }
21 | public string PatchVersion { get; }
22 | public string Language { get; }
23 | public string CommandlinePath { get; }
24 | public bool IsSteam { get; }
25 | public bool IsModded { get; }
26 | public List GameProperties { get; }
27 |
28 | public GameManager()
29 | {
30 | var s = new Stopwatch();
31 | s.Start();
32 | Utils.Log("Initializing GTA manager...");
33 |
34 | var gamePath = GetSteamGameInstallationFolder();
35 | if (gamePath.Equals(string.Empty))
36 | {
37 | gamePath = GetRockstarGameInstallationFolder();
38 | if (!gamePath.Equals(string.Empty))
39 | {
40 | this.IsSteam = false;
41 | this.InstallFolder = gamePath;
42 | }
43 | else
44 | {
45 | // game detection failed
46 | // TODO: prompt user to manually select directory
47 | this.IsSteam = true;
48 | this.InstallFolder = string.Empty;
49 | }
50 | }
51 | else
52 | {
53 | this.IsSteam = true;
54 | this.InstallFolder = gamePath;
55 | }
56 |
57 | if (string.IsNullOrEmpty(this.InstallFolder))
58 | {
59 | MainWindow.ShowInitErrorAndExit();
60 | }
61 |
62 | // game directory is found, all good
63 | var edition = IsSteam ? "Steam" : "Rockstar Warehouse";
64 | Utils.Log($"Game found! Edition: {edition}");
65 | Utils.Log($"Installation folder: {InstallFolder}");
66 |
67 | var gtaFileVersionInfo = FileVersionInfo.GetVersionInfo(InstallFolder + @"\GTA5.exe");
68 | this.PatchVersion = gtaFileVersionInfo.ProductVersion;
69 | this.Language = gtaFileVersionInfo.Language;
70 |
71 | if (File.Exists(this.InstallFolder + @"\commandline.txt"))
72 | {
73 | this.CommandlinePath = this.InstallFolder + @"\commandline.txt";
74 | }
75 | else
76 | {
77 | File.Create(this.InstallFolder + @"\commandline.txt");
78 | this.CommandlinePath = this.CommandlinePath + @"\commandline.txt";
79 | Utils.Log("Commandline.txt doesn't exitst, creating...");
80 | }
81 |
82 | if (!Directory.Exists(this.InstallFolder + Utils.MOD_STORAGE_FOLDER_ENDPOINT))
83 | {
84 | Utils.Log("ToolsV mods folder doesn't exist, creating...");
85 | Directory.CreateDirectory(this.InstallFolder + Utils.MOD_STORAGE_FOLDER_ENDPOINT);
86 | }
87 | this.ModStorageFolder = this.InstallFolder + Utils.MOD_STORAGE_FOLDER_ENDPOINT;
88 |
89 | if (Directory.Exists(this.InstallFolder + Utils.MOD_FOLDER_ENDPOINT))
90 | {
91 | if (GetMods(false).Count > 0)
92 | {
93 | this.IsModded = true;
94 | }
95 | }
96 | if (!IsModded && GetMods(false).Count != 0 || GetModdedRpfs().Count != 0)
97 | {
98 | this.IsModded = true;
99 | }
100 | this.GameProperties = GetGameProperties();
101 |
102 | s.Stop();
103 | Utils.Log("Patch version: " + PatchVersion);
104 | Utils.Log("Language: " + Language);
105 | Utils.Log("Enabled mods: " + GetMods(false).Count);
106 | Utils.Log("Total mods: " + GetMods(true).Count);
107 | Utils.Log("RPF mods: " + GetModdedRpfs().Count);
108 | Utils.Log($"Game installation initialized in {Math.Round(s.Elapsed.TotalMilliseconds / 1000, 3)} seconds");
109 | s.Reset();
110 | }
111 |
112 | public void StartGame()
113 | {
114 | if (IsSteam)
115 | {
116 | Process.Start("steam://rungameid/271590");
117 | }
118 | else
119 | {
120 | Process.Start(InstallFolder + @"\PlayGTAV.exe");
121 | }
122 | }
123 |
124 | #region mod management
125 | public void EnableMods()
126 | {
127 | Utils.Log("Enabling all mods...");
128 | var files = Directory.GetFiles(this.ModStorageFolder).ToList();
129 | for (int i = 0; i < files.Count; i++)
130 | {
131 | File.Move(files[i], files[i].Replace(this.ModStorageFolder, this.InstallFolder));
132 | }
133 | }
134 |
135 | public void EnableMods(List modsToEnable)
136 | {
137 | Utils.Log($"Enabling {modsToEnable.Count} mods...");
138 | for (int i = 0; i < modsToEnable.Count; i++)
139 | {
140 | Utils.Log($"moving {modsToEnable[i].Filename}");
141 | var mod = modsToEnable[i];
142 | var dst = string.Empty;
143 | switch (mod.Type)
144 | {
145 | case Utils.ModType.NATIVE:
146 | {
147 | dst = InstallFolder + @"\" + mod.Filename;
148 | break;
149 | }
150 | case Utils.ModType.SCRIPT:
151 | {
152 | dst = InstallFolder + Utils.SCRIPT_FOLDER_ENDPOINT + @"\" + mod.Filename;
153 | break;
154 | }
155 | }
156 | var src = ModStorageFolder + @"\" + modsToEnable[i].Filename;
157 | Utils.Log($"source: {src}{Environment.NewLine}destination: {dst}");
158 | File.Move(src, dst);
159 | }
160 | }
161 |
162 | public void EnableMod(Mod mod)
163 | {
164 | Utils.Log($"Enabling {mod.Filename}...");
165 | var src = ModStorageFolder + @"\" + mod.Filename;
166 | var dst = InstallFolder + @"\" + mod.Filename;
167 | Utils.Log($"source: {src}{Environment.NewLine}destination: {dst}");
168 | File.Move(src, dst);
169 | }
170 |
171 | public void DisableMods()
172 | {
173 | Utils.Log("Disabling all mods...");
174 | var mods = this.GetModFiles();
175 | for (int i = 0; i < mods.Count; i++)
176 | {
177 | Utils.Log($"moving {mods[i].Filename}");
178 | File.Move(InstallFolder + @"\" + mods[i].Filename, this.ModStorageFolder + @"\" + mods[i].Filename);
179 | }
180 | }
181 |
182 | public void DisableMods(List modsToDisable)
183 | {
184 | Utils.Log($"Disabling {modsToDisable.Count} mods...");
185 | for (int i = 0; i < modsToDisable.Count; i++)
186 | {
187 | Utils.Log($"moving {modsToDisable[i].Filename}");
188 | var mod = modsToDisable[i];
189 | var src = string.Empty;
190 | switch (mod.Type)
191 | {
192 | case Utils.ModType.NATIVE:
193 | {
194 | src = InstallFolder + @"\" + mod.Filename;
195 | break;
196 | }
197 | case Utils.ModType.SCRIPT:
198 | {
199 | src = InstallFolder + Utils.SCRIPT_FOLDER_ENDPOINT + @"\" + mod.Filename;
200 | break;
201 | }
202 | }
203 | var dst = ModStorageFolder + @"\" + mod.Filename;
204 | Utils.Log($"source: {src}{Environment.NewLine}destination: {dst}");
205 | File.Move(src, dst);
206 | }
207 | }
208 |
209 | public void DisableMod(Mod mod)
210 | {
211 | Utils.Log($"Disabling {mod.Filename}...");
212 | var src = InstallFolder + @"\" + mod.Filename;
213 | var dst = ModStorageFolder + @"\" + mod.Filename;
214 | Utils.Log($"source: {src}{Environment.NewLine}destination: {dst}");
215 | File.Move(src, dst);
216 | }
217 |
218 | public List GetMods(bool includeDisabled)
219 | {
220 | var mods = GetModFiles();
221 | mods.AddRange(GetScriptFiles());
222 | if (!includeDisabled) return mods;
223 | var disabledModFiles = Directory.GetFiles(this.ModStorageFolder);
224 | for (int i = 0; i < disabledModFiles.Length; i++)
225 | {
226 | var filename = disabledModFiles[i].Replace(this.ModStorageFolder, string.Empty);
227 | var type = filename.Contains(".dll") && !filename.ToLower().Contains(@"scripthookv") &&
228 | !filename.ToLower().Contains(@"dsound") && !filename.ToLower().Contains(@"dinput8")
229 | ? Utils.ModType.SCRIPT
230 | : Utils.ModType.NATIVE;
231 | mods.Add(new Mod(disabledModFiles[i], type, ModStorageFolder, false));
232 | }
233 |
234 | return mods;
235 | }
236 |
237 | private List GetModFiles()
238 | {
239 | var files = Directory.GetFiles(this.InstallFolder);
240 | var result = new List();
241 | for (int i = 0; i < files.Length; i++)
242 | {
243 | var filename = files[i].Replace(this.InstallFolder + @"\", String.Empty);
244 | if (filename.ToLower().Contains(@".asi") || filename.ToLower().Contains(@"scripthookv.dll") || filename.ToLower().Contains("dsound") || filename.ToLower().Contains(@"dinput8.dll"))
245 | {
246 | var mod = new Mod(files[i], Utils.ModType.NATIVE, this.InstallFolder, true);
247 | result.Add(mod);
248 | }
249 | }
250 | return result;
251 | }
252 |
253 | private List GetScriptFiles()
254 | {
255 | var res = new List();
256 | var path = this.InstallFolder + Utils.SCRIPT_FOLDER_ENDPOINT + @"\";
257 | // scripts folder doesn't exist, therefore no scripts can be returned
258 | if (!Directory.Exists(path)) return res;
259 |
260 | // scripts folder exists
261 | var files = Directory.GetFiles(path);
262 | for (int i = 0; i < files.Length; i++)
263 | {
264 | if (files[i].EndsWith("dll") || files[i].EndsWith("cs") || files[i].EndsWith("lua"))
265 | {
266 | var mod = new Mod(files[i].Replace(path, string.Empty), Utils.ModType.SCRIPT, true);
267 | res.Add(mod);
268 | }
269 | }
270 |
271 | return res;
272 | }
273 |
274 | private List GetModdedRpfs()
275 | {
276 | // if no modded RPFs are detected just return an empty list (also occurs when mods folder doesn't exist)
277 | if (!IsModded || !Directory.Exists(InstallFolder + Utils.MOD_FOLDER_ENDPOINT)) return new List();
278 |
279 | var moddedRpfPaths = Directory.GetFiles(this.InstallFolder + Utils.MOD_FOLDER_ENDPOINT);
280 | var moddedRpfList = new List();
281 | for (int i = 0; i < moddedRpfPaths.Length; i++)
282 | {
283 | var moddedRpf = new Mod(moddedRpfPaths[i], Utils.ModType.RPF, this.InstallFolder, true);
284 | moddedRpfList.Add(moddedRpf);
285 | }
286 | return moddedRpfList;
287 | }
288 | #endregion
289 |
290 | #region version management
291 | public bool IsScriptHookInstalled()
292 | {
293 | return File.Exists(this.InstallFolder + @"\ScriptHookV.dll");
294 | }
295 |
296 | public string GetScriptHookVersion()
297 | {
298 | return !IsScriptHookInstalled() ? string.Empty : FileVersionInfo.GetVersionInfo(this.InstallFolder + @"\ScriptHookV.dll").ProductVersion;
299 | }
300 |
301 | public bool IsScriptHookCompatible()
302 | {
303 | if (!IsScriptHookInstalled()) return true;
304 |
305 | var hookFilePath = this.InstallFolder + @"\ScriptHookV.dll";
306 | var hookVersion = Utils.ExtractVersion(FileVersionInfo.GetVersionInfo(hookFilePath).ProductVersion);
307 | return Utils.ExtractVersion(this.PatchVersion) <= hookVersion;
308 | }
309 | #endregion
310 |
311 | private List GetGameProperties()
312 | {
313 | var properties = new List
314 | {
315 | new GameProperty("Install folder", this.InstallFolder),
316 | new GameProperty("Patch version", this.PatchVersion),
317 | new GameProperty("Language", Language),
318 | new GameProperty("Edition", IsSteam ? "Steam" : "Rockstar Warehouse"),
319 | new GameProperty("Vanilla", IsModded ? "No" : "Yes")
320 | };
321 | return properties;
322 | }
323 |
324 | private static string GetRockstarGameInstallationFolder()
325 | {
326 | try
327 | {
328 | var installFolder = Registry.LocalMachine.OpenSubKey(GTA_REGISTRY_PATH).GetValue("InstallFolder")
329 | .ToString();
330 | return installFolder;
331 | }
332 | catch (Exception ex)
333 | {
334 | MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
335 | }
336 |
337 | return string.Empty;
338 | }
339 |
340 | private static string GetSteamGameInstallationFolder()
341 | {
342 | var matches = new List();
343 | var gameFolders = GetSteamGameFolders();
344 |
345 | foreach (var gameFolder in gameFolders)
346 | {
347 | try
348 | {
349 | matches.AddRange(Directory.GetDirectories(gameFolder, "Grand Theft Auto V"));
350 | }
351 | catch (Exception ex)
352 | {
353 | // :(
354 | Utils.Log($"GameManager: GetSteamInstallationFolder -> {ex.Message}");
355 | MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
356 | }
357 | }
358 |
359 | foreach (var match in matches)
360 | {
361 | if (File.Exists(match + @"\GTA5.exe"))
362 | {
363 | return match;
364 | }
365 | }
366 |
367 | return string.Empty;
368 | }
369 |
370 | private static string GetSteamClientInstallationFolder()
371 | {
372 | var steamKey32Bit = Registry.CurrentUser.OpenSubKey(STEAM_REGISTRY_PATH_x86);
373 | var steamKey64Bit = Registry.LocalMachine.OpenSubKey(STEAM_REGISTRY_PATH_x64);
374 |
375 | if (steamKey32Bit != null)
376 | {
377 | var path32 = steamKey32Bit.GetValue("SteamPath").ToString();
378 | return path32;
379 | }
380 | else if (steamKey64Bit != null)
381 | {
382 | var path64 = steamKey64Bit.GetValue("InstallPath").ToString();
383 | return path64;
384 | }
385 | else
386 | {
387 | Utils.Log($"GameManager: GetSteamClientInstallationFolder -> steam is not installed");
388 | MessageBox.Show("Steam does not appear to be installed.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
389 | Environment.Exit(0);
390 | }
391 |
392 | return string.Empty;
393 | }
394 |
395 | private static List GetSteamGameFolders()
396 | {
397 | var steamFolder = GetSteamClientInstallationFolder();
398 | var configFile = steamFolder + @"\config\config.vdf";
399 | var res = new List();
400 | if (Directory.Exists(steamFolder + @"/steamapps/common"))
401 | {
402 | res.Add(steamFolder + @"/steamapps/common");
403 | }
404 |
405 | var regex = new Regex("BaseInstallFolder[^\"]*\"\\s*\"([^\"]*)\"");
406 | using (var reader = new StreamReader(configFile))
407 | {
408 | string line;
409 | while ((line = reader.ReadLine()) != null)
410 | {
411 | var match = regex.Match(line);
412 | if (match.Success)
413 | {
414 | res.Add(Regex.Unescape(match.Groups[1].Value) + @"/steamapps/common");
415 | }
416 | }
417 | }
418 | return res;
419 | }
420 | }
421 | }
422 |
--------------------------------------------------------------------------------
/ToolsV3/API/GameProperty.cs:
--------------------------------------------------------------------------------
1 |
2 |
3 | namespace ToolsV3.API
4 | {
5 | public class GameProperty
6 | {
7 | public string Description { get; }
8 | public string Value { get; }
9 |
10 | public GameProperty(string description, string value)
11 | {
12 | this.Description = description;
13 | this.Value = value;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/ToolsV3/API/Mod.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 ToolsV3
8 | {
9 | public class Mod
10 | {
11 | public string Filename { get; }
12 | public Utils.ModType Type { get; set; }
13 | public bool IsEnabled { get; set; }
14 |
15 | public Mod(string filename, Utils.ModType type, bool enabled)
16 | {
17 | this.Filename = filename;
18 | this.Type = type;
19 | this.IsEnabled = enabled;
20 | }
21 |
22 | public Mod(string filePath, Utils.ModType type, string installPath, bool enabled)
23 | {
24 | this.Filename = filePath.Replace(installPath + @"\", String.Empty);
25 | this.Type = type;
26 | this.IsEnabled = enabled;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/ToolsV3/API/Updater.cs:
--------------------------------------------------------------------------------
1 | using MahApps.Metro.Controls;
2 | using MahApps.Metro.Controls.Dialogs;
3 | using Newtonsoft.Json.Linq;
4 | using System;
5 | using System.Diagnostics;
6 | using System.Net.Http;
7 | using System.Web;
8 | using System.Threading.Tasks;
9 | using System.Reflection;
10 |
11 | namespace ToolsV3.API
12 | {
13 | public static class Updater
14 | {
15 | public static readonly string VERSION_TAG = AssemblyName.GetAssemblyName(Utils.ExecutableFilePath).Version.ToString();
16 | private static readonly string CHANGELOG_URL = @"https://pastebin.com/raw/RvxX60E4";
17 | private static readonly string GITHUB_API_URL = @"https://api.github.com/";
18 | private static readonly string GITHUB_API_RATE_LIMIT_URL = GITHUB_API_URL + @"rate_limit";
19 | private static readonly string GITHUB_REPO_URL = @"repos/Frioo/ToolsV/";
20 | private static readonly string GITHUB_TAGS_URL = GITHUB_API_URL + GITHUB_REPO_URL + @"tags";
21 | private static readonly string GITHUB_LATEST_RELEASE_URL = GITHUB_API_URL + GITHUB_REPO_URL + @"releases/latest";
22 | private static string GITHUB_RELEASE_BY_TAG(string tag)
23 | {
24 | return UrlWithQuery(GITHUB_API_URL + GITHUB_REPO_URL + @"releases/tags/" + tag);
25 | }
26 | private static readonly string UPDATE_FILE_ENDPOINT = @"\ToolsV.exe";
27 | private static MetroWindow View { get; set; }
28 |
29 | private static HttpClient client = new HttpClient();
30 |
31 |
32 | public static void Initialize()
33 | {
34 | client.DefaultRequestHeaders.Add("User-Agent", "ToolsV");
35 | Utils.Log($"ToolsV version: {VERSION_TAG}");
36 | }
37 |
38 | public static void OpenDownloadSites()
39 | {
40 | Process.Start(@"https://github.com/Frioo/ToolsV/releases");
41 | }
42 |
43 | public static async Task GetChangelog()
44 | {
45 | string changelog = "";
46 |
47 | try
48 | {
49 | Utils.Log("Core: download changelog");
50 | Utils.Log("downloading changelog...");
51 | changelog = await client.GetStringAsync(CHANGELOG_URL);
52 | Utils.Log("changelog downloaded successfully");
53 | }
54 | catch (Exception e)
55 | {
56 | Utils.Log("downloading changelog failed");
57 | Utils.Log(e.Message);
58 | changelog = "Unable to download changelog";
59 | }
60 |
61 | return changelog;
62 | }
63 |
64 | public static async Task GetIsLatest()
65 | {
66 | var isLatest = true;
67 | try
68 | {
69 | Utils.Log("Updater: check for update");
70 | var latest = await GetLatestTag();
71 | isLatest = Utils.ExtractVersion(latest) <= Utils.ExtractVersion(VERSION_TAG);
72 | Utils.Log(Utils.ExtractVersion(latest).ToString());
73 | Utils.Log(isLatest ? "no updates found" : "newer version is available");
74 | }
75 | catch (Exception ex)
76 | {
77 | Utils.Log("update check failed");
78 | Utils.Log(ex.Message);
79 | }
80 |
81 | return isLatest;
82 | }
83 |
84 | public static async Task GetLatestTag()
85 | {
86 | await CheckApiRate();
87 | string latestTag = "";
88 | try
89 | {
90 | Utils.Log("Updater: get latest tag");
91 | JArray tags = JArray.Parse(await client.GetStringAsync(UrlWithQuery(GITHUB_TAGS_URL)));
92 | latestTag = tags[0].ToObject().GetValue("name").ToString();
93 | Utils.Log($"latest tag: {latestTag}");
94 | }
95 | catch(Exception e)
96 | {
97 | Utils.Log(e.StackTrace);
98 | }
99 |
100 | return latestTag;
101 | }
102 |
103 | public static async Task CheckApiRate()
104 | {
105 | Utils.Log("Updater: check API rate");
106 | JObject rate = JObject.Parse(await client.GetStringAsync(UrlWithQuery(GITHUB_API_RATE_LIMIT_URL)));
107 | string limit = rate["resources"]["core"]["limit"].ToString();
108 | string remaining = rate["resources"]["core"]["remaining"].ToString();
109 | Utils.Log($"API rate: {remaining}/{limit}");
110 | return $"{remaining}/{limit}";
111 | }
112 |
113 | private static string UrlWithQuery(string url)
114 | {
115 | var builder = new UriBuilder(url);
116 | var query = HttpUtility.ParseQueryString(builder.Query);
117 | query["client_id"] = Authorization.Client.Id;
118 | query["client_secret"] = Authorization.Client.Secret;
119 | builder.Query = query.ToString();
120 | return builder.ToString();
121 | }
122 |
123 | #region dialogs
124 | public static async Task ShowUpdateAvailableDialog(MetroWindow window, string latestVersion)
125 | {
126 | var res = await window.ShowMessageAsync("Update available", "A newer version of ToolsV is available, would you like to download it?\n" +
127 | "Current version: " + Updater.VERSION_TAG +
128 | "\nLatest version: " + latestVersion, MessageDialogStyle.AffirmativeAndNegative);
129 | if (res == MessageDialogResult.Affirmative)
130 | {
131 | View = window;
132 | Utils.Log("Update dialog: opening download pages...");
133 | OpenDownloadSites();
134 | }
135 | else
136 | {
137 | Utils.Log("Update dialog: update postponed");
138 | }
139 | }
140 |
141 | public static async Task ShowNoUpdateAvailableDialog(MetroWindow window)
142 | {
143 | var res = await window.ShowMessageAsync("No updates found", "You have the latest version of ToolsV.\n" +
144 | "Current version: " + Updater.VERSION_TAG, MessageDialogStyle.Affirmative);
145 | }
146 | #endregion
147 | }
148 | }
149 |
--------------------------------------------------------------------------------
/ToolsV3/API/Utils.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.IO;
3 | using System.Linq;
4 | using System.Reflection;
5 | using System.Text.RegularExpressions;
6 |
7 | namespace ToolsV3
8 | {
9 | public static class Utils
10 | {
11 | private static string TAG = @"ToolsV:Log -> ";
12 | public static string MOD_FOLDER_ENDPOINT = @"\mods";
13 | public static string SCRIPT_FOLDER_ENDPOINT = @"\scripts";
14 | public static string MOD_STORAGE_FOLDER_ENDPOINT = @"\ToolsV\Mods";
15 | public static string ExecutableDirectory
16 | {
17 | get
18 | {
19 | return Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
20 | }
21 | }
22 | public static string ExecutableFilePath
23 | {
24 | get
25 | {
26 | return Assembly.GetEntryAssembly().Location;
27 | }
28 | }
29 | public static string UpdaterFilePath
30 | {
31 | get
32 | {
33 | return ExecutableDirectory + @"\Updater.exe";
34 | }
35 | }
36 |
37 | public static string GITHUB_REPO_PAGE_URL = @"https://github.com/Frioo/ToolsV";
38 | public static string GTA5MODS_PAGE_URL =
39 | @"https://www.gta5-mods.com/tools/toolsv-launcher-mod-manager-toolpack";
40 |
41 | public enum LaunchMode
42 | {
43 | NORMAL = 1,
44 | SINGLEPLAYER_WITH_MODS = 2,
45 | SINGLEPLAYER_WITHOUT_MODS = 3,
46 | ONLINE = 4
47 | }
48 |
49 | public enum ModType
50 | {
51 | NATIVE = 1,
52 | SCRIPT = 2,
53 | RPF = 3
54 | }
55 |
56 | public static void Log(string text)
57 | {
58 | Debug.WriteLine(TAG + text);
59 | }
60 |
61 | public static string GetExecutableDirectory()
62 | {
63 | string path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
64 | Log($"Utils: detected executable directory: {path}");
65 | return path;
66 | }
67 |
68 | public static string GetExecutablePath()
69 | {
70 | string path = Assembly.GetEntryAssembly().Location;
71 | Log($"Utils: detected executable path: {path}");
72 | return path;
73 | }
74 |
75 | public static string GetProgramVersion()
76 | {
77 | return Assembly.GetExecutingAssembly().GetName().Version.ToString();
78 | }
79 |
80 | public static int ExtractVersion(string tag)
81 | {
82 | return int.Parse(string.Join(string.Empty, Regex.Matches(tag, @"\d+").OfType().Select(m => m.Value)));
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/ToolsV3/AboutWindow.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | Notice
34 |
35 |
36 | I am working on this software in my free time, and as I'm not affiliated with Rockstar Games in any way,
37 | I can't ensure full compatibility with all game installations.
38 | If you experience any issues, or have any suggestions, open an issue on the GitHub issues page (click link below).
39 | Thank you.
40 |
41 |
42 |
43 |
44 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/ToolsV3/AboutWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Shapes;
15 |
16 | namespace ToolsV3
17 | {
18 |
19 | public partial class AboutWindow : Window
20 | {
21 | public AboutWindow()
22 | {
23 | InitializeComponent();
24 | Setup();
25 | }
26 |
27 | private void Setup()
28 | {
29 | VersionLabel.Content = $"version {Utils.GetProgramVersion()}";
30 | }
31 |
32 | private void GitHubLink_Click(object sender, RoutedEventArgs e)
33 | {
34 | Process.Start(Utils.GITHUB_REPO_PAGE_URL);
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/ToolsV3/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | True
15 |
16 |
17 | False
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/ToolsV3/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/ToolsV3/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace ToolsV3
10 | {
11 | ///
12 | /// Logika interakcji dla klasy App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/ToolsV3/ChangelogWindow.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
14 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/ToolsV3/ChangelogWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using ToolsV3.API;
4 |
5 | namespace ToolsV3
6 | {
7 | ///
8 | /// Logika interakcji dla klasy ChangelogWindow.xaml
9 | ///
10 | public partial class ChangelogWindow : Window
11 | {
12 | public ChangelogWindow()
13 | {
14 | InitializeComponent();
15 | }
16 |
17 | private void Window_Initialized(object sender, EventArgs e)
18 | {
19 |
20 | }
21 |
22 | private async void Window_Loaded(object sender, RoutedEventArgs e)
23 | {
24 | ChangelogTextBox.Text = await Updater.GetChangelog();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/ToolsV3/FlagsWindow.xaml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/ToolsV3/FlagsWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using MahApps.Metro.Controls;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Collections.ObjectModel;
5 | using System.Diagnostics;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows;
10 | using System.Windows.Controls;
11 | using System.Windows.Data;
12 | using System.Windows.Documents;
13 | using System.Windows.Input;
14 | using System.Windows.Media;
15 | using System.Windows.Media.Imaging;
16 | using System.Windows.Shapes;
17 | using ToolsV3.API;
18 |
19 | namespace ToolsV3
20 | {
21 | public partial class FlagsWindow : MetroWindow
22 | {
23 | private GameManager gameManager;
24 | private CommandlineManager cmdManager;
25 | private ObservableCollection flags = new ObservableCollection(); // the collection we will edit and use as data source.
26 | private List savedFlags = new List(); // list of flags already saved in commandline.txt file
27 | private List pendingFlags = new List(); // list of flags pending to be saved
28 | private List availableFlags = new List(); // list of all flags (used for comparison)
29 |
30 | public FlagsWindow(GameManager m)
31 | {
32 | InitializeComponent();
33 | gameManager = m;
34 | cmdManager = new CommandlineManager(m);
35 | Setup();
36 | }
37 |
38 | private void Setup()
39 | {
40 | // add elements to the datagrid
41 | this.availableFlags = cmdManager.GetAllFlags();
42 | this.savedFlags = cmdManager.GetCommandlineArguments();
43 | for (int i = 0; i < availableFlags.Count; i++)
44 | {
45 | Flag f = availableFlags[i];
46 | for (int j = 0; j < savedFlags.Count; j++)
47 | {
48 | if (savedFlags[j].FlagCode.Equals(availableFlags[i].FlagCode))
49 | {
50 | f = savedFlags[j];
51 | }
52 | }
53 | flags.Add(f);
54 | }
55 | FlagsDataGrid.DataContext = flags;
56 | }
57 |
58 | private void FlagsDataGrid_TargetUpdated(object sender, DataTransferEventArgs e)
59 | {
60 | DataGrid dg = sender as DataGrid;
61 | if (dg.SelectedIndex != -1)
62 | {
63 | Flag selected = dg.SelectedItem as Flag;
64 | Utils.Log("Flag updated: " + selected.FlagCode);
65 | Utils.Log("Enabled: " + selected.IsEnabled);
66 | if (!selected.IsEnabled && savedFlags.Contains(selected))
67 | {
68 | pendingFlags.Remove(selected);
69 | }
70 | else if (selected.IsEnabled && !savedFlags.Contains(selected) && !pendingFlags.Contains(selected))
71 | {
72 | pendingFlags.Add(selected);
73 | }
74 | }
75 | }
76 |
77 | private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
78 | {
79 | Utils.Log("Saving flags to " + gameManager.CommandlinePath);
80 | List final = new List();
81 | List currentFlags = flags.ToList();
82 | for (int i = 0; i < currentFlags.Count; i++)
83 | {
84 | if (currentFlags[i].IsEnabled)
85 | {
86 | final.Add(currentFlags[i]);
87 | }
88 | }
89 | cmdManager.SetCommandlineArguments(final);
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/ToolsV3/FodyWeavers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/ToolsV3/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
15 |
16 |
17 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 | Normal
106 | Singleplayer (with mods)
107 | Singleplayer (without mods)
108 | Online (without mods)
109 |
110 | Verify files
111 | Safe mode
112 | Singleplayer offline
113 | Multiplayer freemode
114 |
115 |
116 | Show all flags
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
--------------------------------------------------------------------------------
/ToolsV3/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using MahApps.Metro.Controls;
2 | using MahApps.Metro.Controls.Dialogs;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Collections.ObjectModel;
6 | using System.Diagnostics;
7 | using System.IO;
8 | using System.Reflection;
9 | using System.Threading.Tasks;
10 | using System.Windows;
11 | using System.Windows.Controls;
12 | using ToolsV3.API;
13 |
14 | namespace ToolsV3
15 | {
16 | public partial class MainWindow : MetroWindow
17 | {
18 | public GameManager Manager = new GameManager();
19 | public CommandlineManager CommandlineManager;
20 | public ObservableCollection GameProperties = new ObservableCollection();
21 | public Utils.LaunchMode SelectedLaunchMode = Utils.LaunchMode.NORMAL;
22 |
23 | public MainWindow()
24 | {
25 | InitializeComponent();
26 | Core.Initialize();
27 | Setup();
28 | CheckForUpdateAsync();
29 | }
30 |
31 | private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
32 | {
33 | if (Properties.Settings.Default.CheckScriptHookOnStartup)
34 | {
35 | CheckScriptHookVersion();
36 | }
37 | }
38 |
39 | private void Setup()
40 | {
41 | // throw error if GTA is not installed
42 | if (IsAnyNullOrEmpty(Manager))
43 | {
44 | ShowInitErrorAndExit();
45 | Environment.Exit(0);
46 | }
47 |
48 | // add game properties to the datagrid
49 | foreach (var property in Manager.GameProperties)
50 | {
51 | GameProperties.Add(property);
52 | }
53 | GameInfoDataGrid.DataContext = GameProperties;
54 | CommandlineManager = new CommandlineManager(Manager);
55 | SetCheckboxStates();
56 | if (!Manager.IsScriptHookInstalled())
57 | {
58 | Utils.Log("ScriptHookV not installed, disabling menu item...");
59 | itemScriptHookChecker.IsEnabled = false;
60 | }
61 | Utils.Log("MainWindow: setup complete");
62 | }
63 |
64 | private async void CheckForUpdateAsync()
65 | {
66 | if (await Updater.GetIsLatest()) return;
67 | var latest = await Updater.GetLatestTag();
68 | await Updater.ShowUpdateAvailableDialog(this, latest);
69 | Utils.Log("Current version: " + Updater.VERSION_TAG);
70 | Utils.Log("Latest: " + latest);
71 | }
72 |
73 | private async Task CheckScriptHookVersion()
74 | {
75 | if (!Manager.IsScriptHookCompatible()) await ShowScriptHookOutdatedWarningDialog();
76 | }
77 |
78 | public void HandleLaunchModeChange(object sender, RoutedEventArgs e)
79 | {
80 | var selectedRadio = sender as RadioButton;
81 | switch (selectedRadio.Name)
82 | {
83 | case "NormalRadio":
84 | SelectedLaunchMode = Utils.LaunchMode.NORMAL;
85 | break;
86 |
87 | case "SingleplayerWithModsRadio":
88 | SelectedLaunchMode = Utils.LaunchMode.SINGLEPLAYER_WITH_MODS;
89 | break;
90 |
91 | case "SingleplayerNoModsRadio":
92 | SelectedLaunchMode = Utils.LaunchMode.SINGLEPLAYER_WITHOUT_MODS;
93 | break;
94 |
95 | case "OnlineRadio":
96 | SelectedLaunchMode = Utils.LaunchMode.ONLINE;
97 | break;
98 |
99 | default:
100 | SelectedLaunchMode = Utils.LaunchMode.NORMAL;
101 | break;
102 | }
103 | Utils.Log("Selected launch mode: " + SelectedLaunchMode);
104 | }
105 |
106 | #region MenuItem clicks
107 | private void ItemInstallationFolder_Click(object sender, RoutedEventArgs e)
108 | {
109 | Process.Start(Manager.InstallFolder);
110 | }
111 |
112 | private async void ItemModsFolder_Click(object sender, RoutedEventArgs e)
113 | {
114 | string path = Manager.InstallFolder + @"\mods";
115 | if (Directory.Exists(path))
116 | {
117 | Process.Start(path);
118 | }
119 | else
120 | {
121 | await ShowModsFolderErrorDialog();
122 | }
123 | }
124 |
125 | private void ItemSettings_Click(object sender, RoutedEventArgs e)
126 | {
127 | new SettingsWindow().Show();
128 | }
129 |
130 | private void ItemAbout_Click(object sender, RoutedEventArgs e)
131 | {
132 | new AboutWindow().Show();
133 | }
134 |
135 | private void ItemModManager_Click(object sender, RoutedEventArgs e)
136 | {
137 | new ModManagerWindow(Manager).Show();
138 | }
139 | #endregion
140 |
141 | #region other methods
142 | // check whether any field of given object is empty/null
143 | public static bool IsAnyNullOrEmpty(object o)
144 | {
145 | foreach (PropertyInfo pi in o.GetType().GetProperties())
146 | {
147 | if (pi.PropertyType == typeof(string))
148 | {
149 | string value = (string)pi.GetValue(o);
150 | if (string.IsNullOrEmpty(value))
151 | {
152 | return true;
153 | }
154 | }
155 | }
156 | return false;
157 | }
158 |
159 | private void SetCheckboxStates()
160 | {
161 | List flags = CommandlineManager.GetCommandlineArguments();
162 | for (int i = 0; i < flags.Count; i++)
163 | {
164 | if (flags[i].FlagCode.Equals("-verify"))
165 | {
166 | VerifyCheckbox.SetCurrentValue(CheckBox.IsCheckedProperty, true);
167 | }
168 | else if (flags[i].FlagCode.Equals("-safemode"))
169 | {
170 | SafeCheckbox.SetCurrentValue(CheckBox.IsCheckedProperty, true);
171 | }
172 | else if (flags[i].FlagCode.Equals("-scOfflineOnly"))
173 | {
174 | SPOfflineCheckbox.SetCurrentValue(CheckBox.IsCheckedProperty, true);
175 | }
176 | else if (flags[i].FlagCode.Equals("-StraightIntoFreemode"))
177 | {
178 | MPFreemodeCheckbox.SetCurrentValue(CheckBox.IsCheckedProperty, true);
179 | }
180 | }
181 | }
182 |
183 | public async Task ShowScriptHookUpToDateDialog()
184 | {
185 | await this.ShowMessageAsync("ScriptHookV is up-to-date",
186 | $"ScriptHookV is compatible with game patch version." +
187 | $"{Environment.NewLine}" +
188 | $"Patch version: {Manager.PatchVersion}" +
189 | $"{Environment.NewLine}" +
190 | $"ScriptHookV version: {Manager.GetScriptHookVersion()}",
191 | MessageDialogStyle.Affirmative);
192 | }
193 |
194 | public async Task ShowScriptHookOutdatedWarningDialog()
195 | {
196 | await this.ShowMessageAsync("ScriptHookV is outdated",
197 | $"ScriptHookV version is not compatible with installed patch." +
198 | $"{Environment.NewLine}" +
199 | $"GTA patch version: {Manager.PatchVersion}" +
200 | $"{Environment.NewLine}" +
201 | $"ScriptHookV version: {Manager.GetScriptHookVersion()}",
202 | MessageDialogStyle.Affirmative);
203 | }
204 |
205 | public void ShowScriptHookOutdatedWarningDialogAlt()
206 | {
207 | MessageBox.Show($"ScriptHookV is not compatible with installed game patch." +
208 | $"{Environment.NewLine}" +
209 | $"Game patch version: {Manager.PatchVersion}" +
210 | $"{Environment.NewLine}" +
211 | $"ScriptHookV version: {Manager.GetScriptHookVersion()}", "ScriptHookV is outdated",
212 | MessageBoxButton.OK, MessageBoxImage.Warning);
213 | }
214 |
215 | public async Task ShowModsFolderErrorDialog()
216 | {
217 | var res = await this.ShowMessageAsync("Error", "Mods folder does not exist. Would you like to create one?", MessageDialogStyle.AffirmativeAndNegative);
218 | if (res == MessageDialogResult.Affirmative)
219 | {
220 | Directory.CreateDirectory(Manager.InstallFolder + @"\mods");
221 | Process.Start(Manager.InstallFolder + @"\mods");
222 | }
223 | }
224 |
225 | public static void ShowInitErrorAndExit()
226 | {
227 | MessageBox.Show($"GTA V does not appear to be installed.{Environment.NewLine}If you are certain it is, please review GTA V registry keys on your system.",
228 | "Error", MessageBoxButton.OK, MessageBoxImage.Error);
229 | Environment.Exit(0);
230 | }
231 | #endregion
232 |
233 | private void ShowAllFlagsLink_Click(object sender, RoutedEventArgs e)
234 | {
235 | new FlagsWindow(Manager).ShowDialog();
236 | }
237 |
238 | private void LaunchGameTile_Click(object sender, RoutedEventArgs e)
239 | {
240 | Utils.Log("MainWindow: launch game");
241 | Utils.Log("selected launch mode: " + SelectedLaunchMode.ToString());
242 | if (this.SelectedLaunchMode.Equals(Utils.LaunchMode.NORMAL))
243 | {
244 | // do not move mods
245 | CommandlineManager.RemoveMultiplayerFlag();
246 | }
247 | else if (this.SelectedLaunchMode.Equals(Utils.LaunchMode.SINGLEPLAYER_WITHOUT_MODS))
248 | {
249 | // disable mods
250 | Manager.DisableMods();
251 | CommandlineManager.RemoveMultiplayerFlag();
252 | }
253 | else if (this.SelectedLaunchMode.Equals(Utils.LaunchMode.SINGLEPLAYER_WITH_MODS))
254 | {
255 | // enable mods
256 | Manager.EnableMods();
257 | CommandlineManager.RemoveMultiplayerFlag();
258 | }
259 | else if (this.SelectedLaunchMode.Equals(Utils.LaunchMode.ONLINE))
260 | {
261 | // disable mods
262 | Manager.DisableMods();
263 | CommandlineManager.SetCommandLineArgument(new Flag("-goStraightToMP", String.Empty));
264 | }
265 | Manager.StartGame();
266 | if (Properties.Settings.Default.QuitAfterGameLaunch)
267 | {
268 | Environment.Exit(0);
269 | }
270 | }
271 |
272 | private void QuickFlagChangeCheckbox_Checked(object sender, RoutedEventArgs e)
273 | {
274 | if ((sender as CheckBox).Name.Equals(VerifyCheckbox.Name))
275 | {
276 | if ((bool) (sender as CheckBox).GetValue(CheckBox.IsCheckedProperty))
277 | {
278 | CommandlineManager.SetCommandLineArgument(new Flag("-verify", String.Empty));
279 | }
280 | else
281 | {
282 | CommandlineManager.RemoveCommandlineArgument("-verify");
283 | }
284 | }
285 | else if ((sender as CheckBox).Name.Equals(SafeCheckbox.Name))
286 | {
287 | if ((bool)(sender as CheckBox).GetValue(CheckBox.IsCheckedProperty))
288 | {
289 | CommandlineManager.SetCommandLineArgument(new Flag("-safemode", String.Empty));
290 | }
291 | else
292 | {
293 | CommandlineManager.RemoveCommandlineArgument("-safemode");
294 | }
295 | }
296 | else if ((sender as CheckBox).Name.Equals(SPOfflineCheckbox.Name))
297 | {
298 | if ((bool)(sender as CheckBox).GetValue(CheckBox.IsCheckedProperty))
299 | {
300 | CommandlineManager.SetCommandLineArgument(new Flag("-scOfflineOnly", String.Empty));
301 | }
302 | else
303 | {
304 | CommandlineManager.RemoveCommandlineArgument("-scOfflineOnly");
305 | }
306 | }
307 | else if ((sender as CheckBox).Name.Equals(MPFreemodeCheckbox.Name))
308 | {
309 | if ((bool)(sender as CheckBox).GetValue(CheckBox.IsCheckedProperty))
310 | {
311 | CommandlineManager.SetCommandLineArgument(new Flag("-StraightIntoFreemode", String.Empty));
312 | }
313 | else
314 | {
315 | CommandlineManager.RemoveCommandlineArgument("-StraightIntoFreemode");
316 | }
317 | }
318 | }
319 |
320 | private void DonateButton_Click(object sender, RoutedEventArgs e)
321 | {
322 | Process.Start("https://www.patreon.com/Frio");
323 | }
324 |
325 | private async void ItemScriptHookChecker_OnClick(object sender, RoutedEventArgs e)
326 | {
327 | if (!Manager.IsScriptHookCompatible())
328 | {
329 | await ShowScriptHookOutdatedWarningDialog();
330 | }
331 | else
332 | {
333 | await ShowScriptHookUpToDateDialog();
334 | }
335 | }
336 | }
337 | }
338 |
--------------------------------------------------------------------------------
/ToolsV3/ModManagerWindow.xaml:
--------------------------------------------------------------------------------
1 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/ToolsV3/ModManagerWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using MahApps.Metro.Controls;
2 | using System.Collections.Generic;
3 | using System.Collections.ObjectModel;
4 | using System.Windows.Controls;
5 | using System.Windows.Data;
6 |
7 | namespace ToolsV3
8 | {
9 | public partial class ModManagerWindow : MetroWindow
10 | {
11 | private readonly GameManager _gameManager;
12 | private readonly ObservableCollection _mods = new ObservableCollection();
13 | private readonly List _modsToDisable = new List();
14 | private readonly List _modsToEnable = new List();
15 |
16 | public ModManagerWindow(GameManager m)
17 | {
18 | InitializeComponent();
19 | _gameManager = m;
20 | Setup();
21 | }
22 |
23 | private void Setup()
24 | {
25 | var allMods = _gameManager.GetMods(true);
26 | for (int i = 0; i < allMods.Count; i++) _mods.Add(allMods[i]);
27 | ModsDataGrid.DataContext = _mods;
28 | }
29 |
30 | private void ModWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
31 | {
32 | Utils.Log("Saving mods...");
33 | _gameManager.DisableMods(_modsToDisable);
34 | _gameManager.EnableMods(_modsToEnable);
35 | }
36 |
37 | private void ModsDataGrid_TargetUpdated(object sender, DataTransferEventArgs e)
38 | {
39 | var dg = sender as DataGrid;
40 | if (dg != null && dg.SelectedIndex == -1) return;
41 | if (!(dg.SelectedItem is Mod selected)) return;
42 | Utils.Log("Mod updated: " + selected.Filename);
43 | Utils.Log("Enabled: " + selected.IsEnabled);
44 | if (!selected.IsEnabled && !_modsToDisable.Contains(selected))
45 | {
46 | if (_modsToEnable.Contains(selected)) _modsToEnable.Remove(selected);
47 | _modsToDisable.Add(selected);
48 | }
49 | else if (selected.IsEnabled && !_modsToEnable.Contains(selected))
50 | {
51 | if (_modsToDisable.Contains(selected)) _modsToDisable.Remove(selected);
52 | _modsToEnable.Add(selected);
53 | }
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/ToolsV3/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // Ogólne informacje o zestawie są kontrolowane poprzez następujący
8 | // zestaw atrybutów. Zmień wartości tych atrybutów, aby zmodyfikować informacje
9 | // powiązane z zestawem.
10 | [assembly: AssemblyTitle("ToolsV3")]
11 | [assembly: AssemblyDescription("The ultimate launcher & toolkit for GTA V")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("ToolsV3")]
15 | [assembly: AssemblyCopyright("Copyright © Adam Żbikowski 2017")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Ustawienie elementu ComVisible na wartość false sprawia, że typy w tym zestawie są niewidoczne
20 | // dla składników COM. Jeśli potrzebny jest dostęp do typu w tym zestawie z
21 | // COM, ustaw wartość true dla atrybutu ComVisible tego typu.
22 | [assembly: ComVisible(false)]
23 |
24 | //Aby rozpocząć kompilację aplikacji możliwych do zlokalizowania, ustaw
25 | //Kultura_używana_podczas_kodowania w pliku csproj
26 | //w grupie . Jeśli na przykład jest używany język angielski (USA)
27 | //w plikach źródłowych ustaw dla elementu wartość en-US. Następnie usuń komentarz dla
28 | //poniższego atrybutu NeutralResourceLanguage. Zaktualizuj wartość „en-US” w
29 | //poniższej linii tak, aby dopasować ustawienie UICulture w pliku projektu.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //gdzie znajdują się słowniki zasobów specyficznych dla motywów
36 | //(używane, jeśli nie można odnaleźć zasobu na stronie,
37 | // lub słowniki zasobów aplikacji)
38 | ResourceDictionaryLocation.SourceAssembly //gdzie znajduje się słownik zasobów ogólnych
39 | //(używane, jeśli nie można odnaleźć zasobu na stronie,
40 | // aplikacji lub słowników zasobów specyficznych dla motywów)
41 | )]
42 |
43 |
44 | // Informacje o wersji zestawu zawierają następujące cztery wartości:
45 | //
46 | // Wersja główna
47 | // Wersja pomocnicza
48 | // Numer kompilacji
49 | // Rewizja
50 | //
51 | // Możesz określić wszystkie wartości lub użyć domyślnych numerów kompilacji i poprawki
52 | // przy użyciu symbolu „*”, tak jak pokazano poniżej:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("3.0.1.3")]
55 | [assembly: AssemblyFileVersion("3.0.1.3")]
56 |
--------------------------------------------------------------------------------
/ToolsV3/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Ten kod został wygenerowany przez narzędzie.
4 | // Wersja wykonawcza:4.0.30319.42000
5 | //
6 | // Zmiany w tym pliku mogą spowodować nieprawidłowe zachowanie i zostaną utracone, jeśli
7 | // kod zostanie ponownie wygenerowany.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ToolsV3.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// Klasa zasobu wymagająca zdefiniowania typu do wyszukiwania zlokalizowanych ciągów itd.
17 | ///
18 | // Ta klasa została automatycznie wygenerowana za pomocą klasy StronglyTypedResourceBuilder
19 | // przez narzędzie, takie jak ResGen lub Visual Studio.
20 | // Aby dodać lub usunąć składową, edytuj plik ResX, a następnie ponownie uruchom narzędzie ResGen
21 | // z opcją /str lub ponownie utwórz projekt VS.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Zwraca buforowane wystąpienie ResourceManager używane przez tę klasę.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ToolsV3.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Przesłania właściwość CurrentUICulture bieżącego wątku dla wszystkich
51 | /// przypadków przeszukiwania zasobów za pomocą tej klasy zasobów wymagającej zdefiniowania typu.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/ToolsV3/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
--------------------------------------------------------------------------------
/ToolsV3/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Ten kod został wygenerowany przez narzędzie.
4 | // Wersja wykonawcza:4.0.30319.42000
5 | //
6 | // Zmiany w tym pliku mogą spowodować nieprawidłowe zachowanie i zostaną utracone, jeśli
7 | // kod zostanie ponownie wygenerowany.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace ToolsV3.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.5.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 |
26 | [global::System.Configuration.UserScopedSettingAttribute()]
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | [global::System.Configuration.DefaultSettingValueAttribute("True")]
29 | public bool CheckScriptHookOnStartup {
30 | get {
31 | return ((bool)(this["CheckScriptHookOnStartup"]));
32 | }
33 | set {
34 | this["CheckScriptHookOnStartup"] = value;
35 | }
36 | }
37 |
38 | [global::System.Configuration.UserScopedSettingAttribute()]
39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
40 | [global::System.Configuration.DefaultSettingValueAttribute("False")]
41 | public bool QuitAfterGameLaunch {
42 | get {
43 | return ((bool)(this["QuitAfterGameLaunch"]));
44 | }
45 | set {
46 | this["QuitAfterGameLaunch"] = value;
47 | }
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/ToolsV3/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | True
7 |
8 |
9 | False
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ToolsV3/Resources/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Frioo/ToolsV/f16b075d819abdd2efbc490a085bf6d4c9ed2cd9/ToolsV3/Resources/favicon.ico
--------------------------------------------------------------------------------
/ToolsV3/SettingsWindow.xaml:
--------------------------------------------------------------------------------
1 |
13 |
14 |
15 |
16 | ToolsV
17 |
18 |
19 |
20 |
22 | Check ScriptHookV version on startup
23 |
24 |
26 | Close ToolsV after GTA launch
27 |
28 |
29 |
30 |
31 |
35 |
39 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/ToolsV3/SettingsWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Diagnostics;
3 | using System.Runtime.CompilerServices;
4 | using MahApps.Metro.Controls;
5 | using MahApps.Metro.Controls.Dialogs;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using ToolsV3.API;
10 |
11 | namespace ToolsV3
12 | {
13 | public partial class SettingsWindow : MetroWindow
14 | {
15 | public SettingsWindow()
16 | {
17 | InitializeComponent();
18 | SetCheckBoxStates();
19 | }
20 |
21 | private async void CheckForUpdateButton_Click(object sender, RoutedEventArgs e)
22 | {
23 | if (!await Updater.GetIsLatest())
24 | {
25 | var latest = await Updater.GetLatestTag();
26 | await Updater.ShowUpdateAvailableDialog(this, latest);
27 | Utils.Log("Current version: " + Updater.VERSION_TAG);
28 | Utils.Log("Latest: " + latest);
29 | }
30 | else
31 | {
32 | await Updater.ShowNoUpdateAvailableDialog(this);
33 | }
34 | }
35 |
36 | private void VisitWebsiteButton_Click(object sender, RoutedEventArgs e)
37 | {
38 | Process.Start(Utils.GTA5MODS_PAGE_URL);
39 | }
40 |
41 | private void ScriptHookCheckBox_StateChanged(object sender, RoutedEventArgs e)
42 | {
43 | Properties.Settings.Default.CheckScriptHookOnStartup = ScriptHookCheckbox.IsChecked.Value;
44 | }
45 |
46 | private void AutoCloseCheckBox_StateChanged(object sender, RoutedEventArgs e)
47 | {
48 | Properties.Settings.Default.QuitAfterGameLaunch = (sender as CheckBox).IsChecked.Value;
49 | }
50 |
51 | private void ViewChangelogButton_Click(object sender, RoutedEventArgs e)
52 | {
53 | new ChangelogWindow().Show();
54 | }
55 |
56 | private void SetCheckBoxStates()
57 | {
58 | this.AutoCloseCheckbox.IsChecked = Properties.Settings.Default.QuitAfterGameLaunch;
59 | this.ScriptHookCheckbox.IsChecked = Properties.Settings.Default.CheckScriptHookOnStartup;
60 | }
61 |
62 | private void SettingsWindow_OnClosing(object sender, CancelEventArgs e)
63 | {
64 | Utils.Log("SettingsWindow: saving settings...");
65 | Properties.Settings.Default.Save();
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/ToolsV3/ToolsV3.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {BEA7DD6F-3B57-4317-BF05-28C2B6E4EAC6}
8 | WinExe
9 | ToolsV3
10 | ToolsV3
11 | v4.5.2
12 | 512
13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 4
15 | true
16 |
17 |
18 | publish\
19 | true
20 | Disk
21 | false
22 | Foreground
23 | 7
24 | Days
25 | false
26 | false
27 | true
28 | 0
29 | 1.0.0.%2a
30 | false
31 | false
32 | true
33 |
34 |
35 | AnyCPU
36 | true
37 | full
38 | false
39 | bin\Debug\
40 | DEBUG;TRACE
41 | prompt
42 | 4
43 |
44 |
45 | AnyCPU
46 | pdbonly
47 | true
48 | bin\Release\
49 | TRACE
50 | prompt
51 | 4
52 |
53 |
54 | favicon.ico
55 |
56 |
57 |
58 |
59 |
60 |
61 | false
62 |
63 |
64 | false
65 |
66 |
67 | toolsv.pfx
68 |
69 |
70 | FD3E43AF1E7E314979178E7D023C8DA0728AFECF
71 |
72 |
73 | toolsv.pfx
74 |
75 |
76 |
77 | ..\Authorization\bin\Debug\Authorization.dll
78 |
79 |
80 | ..\packages\Costura.Fody.1.6.2\lib\dotnet\Costura.dll
81 | False
82 |
83 |
84 | ..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll
85 |
86 |
87 | ..\packages\MahApps.Metro.IconPacks.1.9.1\lib\net45\MahApps.Metro.IconPacks.dll
88 |
89 |
90 | ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll
91 |
92 |
93 |
94 |
95 |
96 | ..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 | 4.0
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 | MSBuild:Compile
114 | Designer
115 |
116 |
117 | AboutWindow.xaml
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 | ChangelogWindow.xaml
128 |
129 |
130 | ModManagerWindow.xaml
131 |
132 |
133 | SettingsWindow.xaml
134 |
135 |
136 | Designer
137 | MSBuild:Compile
138 |
139 |
140 | Designer
141 | MSBuild:Compile
142 |
143 |
144 | Designer
145 | MSBuild:Compile
146 |
147 |
148 | MSBuild:Compile
149 | Designer
150 |
151 |
152 | App.xaml
153 | Code
154 |
155 |
156 |
157 | FlagsWindow.xaml
158 |
159 |
160 | MainWindow.xaml
161 | Code
162 |
163 |
164 | Designer
165 | MSBuild:Compile
166 |
167 |
168 | Designer
169 | MSBuild:Compile
170 |
171 |
172 |
173 |
174 | Code
175 |
176 |
177 | True
178 | True
179 | Resources.resx
180 |
181 |
182 | True
183 | Settings.settings
184 | True
185 |
186 |
187 | ResXFileCodeGenerator
188 | Resources.Designer.cs
189 | Designer
190 |
191 |
192 |
193 | SettingsSingleFileGenerator
194 | Settings.Designer.cs
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 | False
213 | Microsoft .NET Framework 4.5.2 %28x86 i x64%29
214 | true
215 |
216 |
217 | False
218 | .NET Framework 3.5 SP1
219 | false
220 |
221 |
222 |
223 |
224 |
225 |
226 | Ten projekt zawiera odwołania do pakietów NuGet, których nie ma na tym komputerze. Użyj przywracania pakietów NuGet, aby je pobrać. Aby uzyskać więcej informacji, zobacz http://go.microsoft.com/fwlink/?LinkID=322105. Brakujący plik: {0}.
227 |
228 |
229 |
230 |
231 |
232 |
--------------------------------------------------------------------------------
/ToolsV3/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Frioo/ToolsV/f16b075d819abdd2efbc490a085bf6d4c9ed2cd9/ToolsV3/favicon.ico
--------------------------------------------------------------------------------
/ToolsV3/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Updater/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Updater/FodyWeavers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Updater/Options.cs:
--------------------------------------------------------------------------------
1 | using CommandLine;
2 | using System;
3 |
4 | namespace Updater
5 | {
6 | class Options
7 | {
8 | [Option('o', "old", HelpText = "Path to previous release (executable).", Required = true)]
9 | public string OldFilePath { get; set; }
10 |
11 | [Option('n', "new", HelpText = "Path to the latest release (executable).", Required = true)]
12 | public string NewFilePath { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Updater/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 | using System.Reflection;
5 |
6 | namespace Updater
7 | {
8 | class Program
9 | {
10 | static void Main(string[] args)
11 | {
12 | var options = new Options();
13 | if (CommandLine.Parser.Default.ParseArguments(args, options))
14 | {
15 | string currentDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
16 | string oldFileName = options.OldFilePath.Replace(currentDir + @"\", string.Empty)
17 | .Replace(@".exe", string.Empty);
18 | string newFileName = options.NewFilePath.Replace(currentDir + @"\", string.Empty);
19 | Console.WriteLine($"Current path: {currentDir}");
20 | KillProcessByName(@"ToolsV3", options.OldFilePath);
21 | try
22 | {
23 | Console.WriteLine("Deleting old executable...");
24 | File.SetAttributes(options.OldFilePath, FileAttributes.Normal);
25 | File.Delete(options.OldFilePath);
26 | }
27 | catch (Exception ex)
28 | {
29 | Console.WriteLine($"Error: {ex.Message}");
30 | }
31 | Console.WriteLine($"Launching updated program: {newFileName}");
32 | Process.Start(options.NewFilePath);
33 | }
34 | Console.ReadKey(false);
35 | Environment.Exit(0);
36 | }
37 |
38 | private static void KillProcess(string filename)
39 | {
40 | var spi = new ProcessStartInfo
41 | {
42 | FileName = "taskkill",
43 | Arguments = $"/f /im {filename}",
44 | UseShellExecute = true,
45 | CreateNoWindow = true
46 | };
47 | Process.Start(spi)?.WaitForExit();
48 | }
49 |
50 | private static void KillProcessByName(string processName, string filePath)
51 | {
52 | Console.WriteLine($"Looking for process: {processName}");
53 | var results = Process.GetProcessesByName(processName);
54 | if (results.Length < 1) return;
55 | foreach (var proc in results)
56 | {
57 | if (!proc.MainModule.FileName.Equals(filePath)) continue;
58 | Console.WriteLine($"Killing process {proc.ProcessName}...");
59 | proc.Kill();
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Updater/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Ogólne informacje o zestawie są kontrolowane poprzez następujący
6 | // zestaw atrybutów. Zmień wartości tych atrybutów, aby zmodyfikować informacje
7 | // powiązane z zestawem.
8 | [assembly: AssemblyTitle("Updater")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Updater")]
13 | [assembly: AssemblyCopyright("Copyright © 2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Ustawienie elementu ComVisible na wartość false sprawia, że typy w tym zestawie są niewidoczne
18 | // dla składników COM. Jeśli potrzebny jest dostęp do typu w tym zestawie z
19 | // COM, ustaw wartość true dla atrybutu ComVisible tego typu.
20 | [assembly: ComVisible(false)]
21 |
22 | // Następujący identyfikator GUID jest identyfikatorem biblioteki typów w przypadku udostępnienia tego projektu w modelu COM
23 | [assembly: Guid("5d3aba24-3856-494f-a77a-7834d1e1d1ea")]
24 |
25 | // Informacje o wersji zestawu zawierają następujące cztery wartości:
26 | //
27 | // Wersja główna
28 | // Wersja pomocnicza
29 | // Numer kompilacji
30 | // Rewizja
31 | //
32 | // Możesz określić wszystkie wartości lub użyć domyślnych numerów kompilacji i poprawki
33 | // przy użyciu symbolu „*”, tak jak pokazano poniżej:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Updater/Updater.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {5D3ABA24-3856-494F-A77A-7834D1E1D1EA}
8 | Exe
9 | Updater
10 | Updater
11 | v4.5.2
12 | 512
13 | true
14 |
15 |
16 |
17 |
18 |
19 | AnyCPU
20 | true
21 | full
22 | false
23 | bin\Debug\
24 | DEBUG;TRACE
25 | prompt
26 | 4
27 |
28 |
29 | AnyCPU
30 | pdbonly
31 | true
32 | bin\Release\
33 | TRACE
34 | prompt
35 | 4
36 |
37 |
38 |
39 | ..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll
40 |
41 |
42 | ..\packages\Costura.Fody.1.6.2\lib\dotnet\Costura.dll
43 | False
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | Ten projekt zawiera odwołania do pakietów NuGet, których nie ma na tym komputerze. Użyj przywracania pakietów NuGet, aby je pobrać. Aby uzyskać więcej informacji, zobacz http://go.microsoft.com/fwlink/?LinkID=322105. Brakujący plik: {0}.
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/Updater/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------