fCraft.Logger.CheckForCommonErrors C# (CSharp) Method

CheckForCommonErrors() public static method

public static CheckForCommonErrors ( [ ex ) : bool
ex [
return bool
        public static bool CheckForCommonErrors( [CanBeNull] Exception ex )
        {
            if ( ex == null )
                throw new ArgumentNullException( "ex" );
            string message = null;
            try {
                if ( ( ex is FileNotFoundException && ex.Message.Contains( "Version=3.5" ) ) || ( ex is FileNotFoundException && ex.Message.Contains( "Version=3.5" ) ) ) {
                    message = "Your crash was likely caused by using a wrong version of .NET or Mono runtime. " +
                              "Please update to Microsoft .NET Framework 4 (Windows) OR Mono 2.8+ (Linux, Unix, Mac OS X).";
                    return true;
                } else if ( ex.Message.Contains( "libMonoPosixHelper" ) ||
                           ex is EntryPointNotFoundException && ex.Message.Contains( "CreateZStream" ) ) {
                    message = "800Craft could not locate Mono's compression functionality. " +
                              "Please make sure that you have zlib (sometimes called \"libz\" or just \"z\") installed. " +
                              "Some versions of Mono may also require \"libmono-posix-2.0-cil\" package to be installed.";
                    return true;
                } else if ( ex is MissingMemberException || ex is TypeLoadException ) {
                    message = "Something is incompatible with the current revision of 800Craft. " +
                              "If you installed third-party modifications, " +
                              "make sure to use the correct revision (as specified by mod developers). " +
                              "If your own modifications stopped working, your may need to make some updates.";
                    return true;
                } else if ( ex is UnauthorizedAccessException ) {
                    message = "800Craft was blocked from accessing a file or resource. " +
                              "Make sure that correct permissions are set for the 800Craft files, folders, and processes.";
                    return true;
                } else if ( ex is OutOfMemoryException ) {
                    message = "800Craft ran out of memory. Make sure there is enough RAM to run.";
                    return true;
                } else if ( ex is SystemException && ex.Message == "Can't find current process" ) {
                    // Ignore Mono-specific bug in MonitorProcessorUsage()
                    return true;
                } else if ( ex is InvalidOperationException && ex.StackTrace.Contains( "MD5CryptoServiceProvider" ) ) {
                    message = "Some Windows settings are preventing 800Craft from doing player name verification. " +
                              "See http://support.microsoft.com/kb/811833";
                    return true;
                } else if ( ex.StackTrace.Contains( "__Error.WinIOError" ) ) {
                    message = "A filesystem-related error has occured. Make sure that only one instance of 800Craft is running, " +
                              "and that no other processes are using server's files or directories.";
                    return true;
                } else if ( ex.Message.Contains( "UNSTABLE" ) ) {
                    return true;
                } else {
                    return false;
                }
            } finally {
                if ( message != null ) {
                    Log( LogType.Warning, message );
                }
            }
        }