From e7ffbc2352a18d7b114f4d43c2d5beda21207827 Mon Sep 17 00:00:00 2001 From: BigETI Date: Sat, 29 Dec 2018 02:00:04 +0100 Subject: [PATCH] Fixed file access flags. Added return key to connect to a selected server. --- .vs/SAMPLauncherNET/v15/.suo | Bin 312832 -> 312320 bytes SAMPLauncherNET/Properties/AssemblyInfo.cs | 4 ++-- .../SAMPLauncherNET/Core/PluginProvider.cs | 2 +- .../Source/SAMPLauncherNET/Core/SAMP.cs | 8 ++++---- .../SAMPLauncherNET/Core/SAMPCTLProvider.cs | 4 ++-- .../Core/ServerListConnector.cs | 4 ++-- .../Source/SAMPLauncherNET/Core/Utils.cs | 2 +- .../SAMPLauncherNET/UI/Forms/MainForm.cs | 12 ++++++++++-- 8 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.vs/SAMPLauncherNET/v15/.suo b/.vs/SAMPLauncherNET/v15/.suo index 01cef5d10c4143af3091db732ee59197dc7ebd65..e4e79b419aa452b731d8d999883922cbd65662b2 100644 GIT binary patch delta 8921 zcmdT}4_wq$w&&d6Z(x7{5fKqlCmfX!a2Nqm35P$rtf7%&PhB)IHB>}Gbk$5pGuMbE zBvu5P>+SWB6xo%H=EWGa>K+UZ_?yI-^c|Shi zx&QAy_ndRjIrriy@8j6gr_vhl)$;{;dHoymMxdj!vr|?R;0L&Y9l%y#_knzW;al@b zc4P0S-=^2K6=FTj)czvYd;byL-wxK+C~E@x3NNoOH=sAZGL6)JTOI0Ma@NVH@B#jc zd>B$Eumo5K^aCP*;lL;$0C*f&00e0>)d9Y8hWk(&sy(9i>pc&-cYzon7SOck)WN>9 zklPESX}?tm480e*PSBNubOqoKk4`hcJ;)j^5JPNxXr95CZFsHlaA*7naKhsbmE40`AN3ZV(bx^TzG4MR_ zQ{ZPnI3V?SF4`YPY6BhuN`S|JI{~@yb4aE9w;|mHYzKZ0^aln5KL)&kWq|Cr1!*m? z6IcVvJd-R&;VD2)D8CRa+Li0H@Fs8q^=~148+ZqJACMCq>P|mE`eA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$7V}NU0Z6ND<>|e873}r(BG-+CzTLr7y+YYDOg!k}6Yu(~LA~M^ z;`Y28gOzxPT!?&$Slq!M=rz)}qSjp&6?+R&;^ce$;hPGm=H9s^+(H26vcxo3Kq;|; zwR4A>(G#NkH+-}F^C6zdzMCpmxqnE`(M5*GmaJ z^%f?(rOkVZ{P4Et#%{-X(w@~u$x)rWoy3ff_)595ldt9CsTZ^`;doX{^1k9m7q)d5 zwzx%O&54@JU%c4K6Z9vC2Rc-2a28hF=-T9#7bX>zl`FGH<&JK?$Uh>>OHGemlJ(~* zrad}uXT-oAXK-y2!xpbb5-Fm3c$!|cvHzV2K}4qc!>q?&-L}Z_A?1y+Z=Y95zeb0lRC zvyU2?mOjFMdBlDb2^pqD?P$ridDbUqSh;TDW{F tURy(wjnppr8If9;F APIIO { if (File.Exists(ServerListAPIPath)) { - using (FileStream stream = File.Open(ServerListAPIPath, FileMode.Open)) + using (FileStream stream = File.Open(ServerListAPIPath, FileMode.Open, FileAccess.Read)) { APIDataContract[] api_arr = (APIDataContract[])(apiSerializer.ReadObject(stream)); foreach (APIDataContract apidc in api_arr) @@ -310,7 +310,7 @@ public static PluginDataContract[] PluginsDataIO { if (File.Exists(PluginsDataPath)) { - using (FileStream stream = File.Open(PluginsDataPath, FileMode.Open)) + using (FileStream stream = File.Open(PluginsDataPath, FileMode.Open, FileAccess.Read)) { pluginsData = pluginsDataSerializer.ReadObject(stream) as PluginDataContract[]; } @@ -366,7 +366,7 @@ public static string Chatlog string ret = ""; try { - using (FileStream fs = File.Open(ChatlogPath, FileMode.Open)) + using (FileStream fs = File.Open(ChatlogPath, FileMode.Open, FileAccess.Read)) { using (StreamReader sr = new StreamReader(fs, Encoding.Default)) { @@ -392,7 +392,7 @@ public static string SavedPositions string ret = ""; try { - using (FileStream fs = File.Open(SavedPositionsPath, FileMode.Open)) + using (FileStream fs = File.Open(SavedPositionsPath, FileMode.Open, FileAccess.Read)) { using (StreamReader sr = new StreamReader(fs, Encoding.Default)) { diff --git a/SAMPLauncherNET/Source/SAMPLauncherNET/Core/SAMPCTLProvider.cs b/SAMPLauncherNET/Source/SAMPLauncherNET/Core/SAMPCTLProvider.cs index 0acd586..b9b1bbc 100644 --- a/SAMPLauncherNET/Source/SAMPLauncherNET/Core/SAMPCTLProvider.cs +++ b/SAMPLauncherNET/Source/SAMPLauncherNET/Core/SAMPCTLProvider.cs @@ -81,7 +81,7 @@ public static bool Update() { try { - using (FileStream stream = File.Open(SAMPCTLInfoPath, FileMode.Open)) + using (FileStream stream = File.Open(SAMPCTLInfoPath, FileMode.Open, FileAccess.Read)) { lastReleaseInfo = serializer.ReadObject(stream) as GitHubLatestReleaseDataContract; } @@ -148,7 +148,7 @@ public static bool Update() { if (File.Exists(SAMPCTLDownloadPath)) { - using (FileStream archive_file_stream = File.Open(SAMPCTLDownloadPath, FileMode.Open)) + using (FileStream archive_file_stream = File.Open(SAMPCTLDownloadPath, FileMode.Open, FileAccess.Read)) { using (GZipInputStream gzip_stream = new GZipInputStream(archive_file_stream)) { diff --git a/SAMPLauncherNET/Source/SAMPLauncherNET/Core/ServerListConnector.cs b/SAMPLauncherNET/Source/SAMPLauncherNET/Core/ServerListConnector.cs index 5e62ceb..660675d 100644 --- a/SAMPLauncherNET/Source/SAMPLauncherNET/Core/ServerListConnector.cs +++ b/SAMPLauncherNET/Source/SAMPLauncherNET/Core/ServerListConnector.cs @@ -184,7 +184,7 @@ public Dictionary ServerListIO switch (serverListType) { case EServerListType.Favourites: - using (FileStream stream = File.Open(Endpoint, FileMode.Open)) + using (FileStream stream = File.Open(Endpoint, FileMode.Open, FileAccess.Read)) { FavouriteDataContract[] favourites = (FavouriteDataContract[])(favouriteListJSONSerializer.ReadObject(stream)); foreach (FavouriteDataContract fdc in favourites) @@ -221,7 +221,7 @@ public Dictionary ServerListIO } break; case EServerListType.LegacyFavourites: - using (FileStream stream = File.Open(Endpoint, FileMode.Open)) + using (FileStream stream = File.Open(Endpoint, FileMode.Open, FileAccess.Read)) { using (BinaryReader reader = new BinaryReader(stream)) { diff --git a/SAMPLauncherNET/Source/SAMPLauncherNET/Core/Utils.cs b/SAMPLauncherNET/Source/SAMPLauncherNET/Core/Utils.cs index 6c713a4..89a5bb3 100644 --- a/SAMPLauncherNET/Source/SAMPLauncherNET/Core/Utils.cs +++ b/SAMPLauncherNET/Source/SAMPLauncherNET/Core/Utils.cs @@ -211,7 +211,7 @@ public static bool IsFileAvailable(string path) bool ret = true; try { - using (File.Open(path, FileMode.Open)) + using (File.Open(path, FileMode.Open, FileAccess.Read)) { // } diff --git a/SAMPLauncherNET/Source/SAMPLauncherNET/UI/Forms/MainForm.cs b/SAMPLauncherNET/Source/SAMPLauncherNET/UI/Forms/MainForm.cs index 8396b5a..e6a69d4 100644 --- a/SAMPLauncherNET/Source/SAMPLauncherNET/UI/Forms/MainForm.cs +++ b/SAMPLauncherNET/Source/SAMPLauncherNET/UI/Forms/MainForm.cs @@ -2281,9 +2281,17 @@ private void apiGridView_DoubleClick(object sender, EventArgs e) /// Key event arguments private void serversGridView_KeyUp(object sender, KeyEventArgs e) { - if (e.KeyCode == Keys.Delete) + switch (e.KeyCode) { - RemoveSelectionFromFavourites(false); + case Keys.Delete: + RemoveSelectionFromFavourites(false); + break; + case Keys.Return: + if (SelectedServer != null) + { + Connect(quitWhenDone: closeWhenLaunchedCheckBox.Checked, createSessionLog: createSessionsLogCheckBox.Checked); + } + break; } }