mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 02:56:09 -04:00
Don't hardcode English error message, use hresult. Fixes crashing with multiple clients open on non-English systems. (Thanks imjonnyboy)
This commit is contained in:
parent
cef936a5f4
commit
fe2353c11d
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using ClassicalSharp.Commands;
|
using ClassicalSharp.Commands;
|
||||||
|
|
||||||
namespace ClassicalSharp {
|
namespace ClassicalSharp {
|
||||||
@ -102,7 +103,9 @@ namespace ClassicalSharp {
|
|||||||
try {
|
try {
|
||||||
stream = File.Open( path, FileMode.Append, FileAccess.Write, FileShare.Read );
|
stream = File.Open( path, FileMode.Append, FileAccess.Write, FileShare.Read );
|
||||||
} catch( IOException ex ) {
|
} catch( IOException ex ) {
|
||||||
if( !ex.Message.Contains( "because it is being used by another process" ) )
|
int hresult = Marshal.GetHRForException(ex);
|
||||||
|
uint errorCode = (uint)hresult & 0xFFFF;
|
||||||
|
if( errorCode != 32 ) // ERROR_SHARING_VIOLATION
|
||||||
throw;
|
throw;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user