fCraft.BlockDB.CheckAlignment C# (CSharp) Method

CheckAlignment() private method

private CheckAlignment ( ) : void
return void
        private void CheckAlignment()
        {
            FileInfo fi = new FileInfo( FileName );
            if ( fi.Exists ) {
                long length = fi.Length;
                if ( length % sizeof( BlockDBEntry ) != 0 ) {
                    Logger.Log( LogType.Error,
                                "BlockDB: Misaligned data detected in \"{0}\". " +
                                "This might have been caused by a power outage or ungraceful shutdown. Attempting recovery.",
                                fi.Name );
                    using ( FileStream fs = File.OpenWrite( fi.FullName ) ) {
                        fs.SetLength( length - ( length % sizeof( BlockDBEntry ) ) );
                    }
                }
            }
        }