OpenHome.Git.Pack.Pack C# (CSharp) 메소드

Pack() 개인적인 메소드

private Pack ( string aIndexPath ) : System
aIndexPath string
리턴 System
        internal Pack(string aIndexPath)
        {
            iIndexPath = aIndexPath;

            iPackPath = Path.ChangeExtension(iIndexPath, ".pack");

            using (FileStream index = File.OpenRead(iIndexPath))
            {
                try
                {
                    BinaryReader reader = new BinaryReader(index);

                    uint signature = reader.ReadUInt32();

                    if (signature != kGitIndexSignature)
                    {
                        throw (new GitException("Pack index file " + iIndexPath + " has an invalid signature"));
                    }

                    uint version = reader.ReadUInt32();

                    if (version != kGitIndexVersion)
                    {
                        throw (new GitException("Pack index file " + iIndexPath + " has an incomaptible version"));
                    }

                    iIndexFanout = reader.ReadBytes(256 * 4);

                    iObjectCount = GetEntry(iIndexFanout, 255);

                    iIndexSha1 = reader.ReadBytes((int)(iObjectCount * 20));
                    //iIndexCrc = reader.ReadBytes((int)(iObjectCount * 4));
                    iIndexOffset = reader.ReadBytes((int)(iObjectCount * 4));
                    //iChecksumPack = reader.ReadBytes(20);
                    //iChecksumIndex = reader.ReadBytes(20);
                }
                catch (GitException)
                {
                    throw;
                }
                catch (Exception e)
                {
                    throw (new GitException("Unable to read " + iIndexPath, e));
                }
            }

            using (FileStream pack = File.OpenRead(iPackPath))
            {
                try
                {
                    BinaryReader reader = new BinaryReader(pack);

                    ReadSignature(reader);
                    ReadVersion(reader);

                    uint count = ReadItemCount(reader);

                    if (count == iObjectCount)
                    {
                        return;
                    }
                }
                catch (Exception e)
                {
                    throw (new GitException("Unable to read " + iPackPath, e));
                }

                throw (new GitException("Pack file " + iPackPath + " and index file " + iIndexPath + " containt unequal numbers of objects"));
            }
        }