Skip to content

Commit

Permalink
Fixed file access flags. Added return key to connect to a selected se…
Browse files Browse the repository at this point in the history
…rver.
  • Loading branch information
BigETI committed Dec 29, 2018
1 parent 5ff5809 commit e7ffbc2
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 14 deletions.
Binary file modified .vs/SAMPLauncherNET/v15/.suo
Binary file not shown.
4 changes: 2 additions & 2 deletions SAMPLauncherNET/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.6.6")]
[assembly: AssemblyFileVersion("1.0.6.6")]
[assembly: AssemblyVersion("1.0.6.7")]
[assembly: AssemblyFileVersion("1.0.6.7")]
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private static string GetDownloadURL(string infoPath, string githubAPIURL, ref G
{
try
{
using (FileStream stream = File.Open(infoPath, FileMode.Open))
using (FileStream stream = File.Open(infoPath, FileMode.Open, FileAccess.Read))
{
lastReleaseInfo = serializer.ReadObject(stream) as GitHubLatestReleaseDataContract;
}
Expand Down
8 changes: 4 additions & 4 deletions SAMPLauncherNET/Source/SAMPLauncherNET/Core/SAMP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public static List<ServerListConnector> 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)
Expand Down Expand Up @@ -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[];
}
Expand Down Expand Up @@ -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))
{
Expand All @@ -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))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public Dictionary<string, Server> 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)
Expand Down Expand Up @@ -221,7 +221,7 @@ public Dictionary<string, Server> 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))
{
Expand Down
2 changes: 1 addition & 1 deletion SAMPLauncherNET/Source/SAMPLauncherNET/Core/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
//
}
Expand Down
12 changes: 10 additions & 2 deletions SAMPLauncherNET/Source/SAMPLauncherNET/UI/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2281,9 +2281,17 @@ private void apiGridView_DoubleClick(object sender, EventArgs e)
/// <param name="e">Key event arguments</param>
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;
}
}

Expand Down

0 comments on commit e7ffbc2

Please sign in to comment.