TileCook.DiskCache.Delete C# (CSharp) Method

Delete() public method

public Delete ( Coord coord, string format ) : void
coord Coord
format string
return void
        public void Delete(Coord coord, string format)
        {
            string path = this.buildPath(coord, format);
            int i = 0;
            while (true)
            {
                try
                {
                    File.Delete(path);
                    break;
                }
                catch (IOException e)
                {
                    //is file being written? check for ERROR_SHARING_VIOLATION (HRESULT = -2147024864)
                    //.NET 4.5 required to access HResult directly
                    if (e.HResult == -2147024864 && i <= ACCESS_POLL_COUNT)
                    {
                        i++;
                        Thread.Sleep(ACCESS_POLL_INTERVAL);
                    }
                    else
                    {
                        throw;
                    }
                }
            }
        }