ScrewTurn.Wiki.FilesStorageProvider.GetFileRetrievalCount C# (CSharp) Method

GetFileRetrievalCount() private method

Gets the number of times a file was retrieved.
private GetFileRetrievalCount ( string fullName ) : int
fullName string The full name of the file.
return int
        private int GetFileRetrievalCount(string fullName)
        {
            if(fullName == null) throw new ArgumentNullException("fullName");
            if(fullName.Length == 0) throw new ArgumentException("Full Name cannot be empty", "fullName");

            lock(this) {
                // Format
                // /Full/Path/To/File.txt|DownloadCount

                string[] lines = File.ReadAllLines(GetFullPath(FileDownloadsFile));

                string lowercaseFullName = fullName.ToLowerInvariant();

                string[] fields;
                foreach(string line in lines) {
                    fields = line.Split('|');
                    if(fields[0].ToLowerInvariant() == lowercaseFullName) {
                        int res = 0;
                        if(int.TryParse(fields[1], out res)) return res;
                        else return 0;
                    }
                }
            }

            return 0;
        }