OpenHome.Git.ObjectRefFile.ReadId C# (CSharp) Method

ReadId() private method

private ReadId ( ) : void
return void
        internal void ReadId()
        {
            if (iFileInfo.Length != kSha1Bytes + 1) // extra one for a newline
            {
                throw (new GitException(iFileInfo.FullName + " is not " + kSha1Bytes + " in length"));
            }

            using (FileStream file = File.OpenRead(iFileInfo.FullName))
            {
                byte[] bytes = new byte[kSha1Bytes];

                int count = file.Read(bytes, 0, kSha1Bytes);

                if (count != kSha1Bytes)
                {
                    throw (new GitException("Unable to read " + iFileInfo.FullName));
                }

                try
                {
                    iId = Encoding.ASCII.GetString(bytes);
                }
                catch (Exception e)
                {
                    throw (new GitException(iFileInfo.FullName + " does not contain a sha1 object id", e));
                }
            }
        }