Git.Core.Object.ParseTreeEntry C# (CSharp) Method

ParseTreeEntry() protected static method

protected static ParseTreeEntry ( byte input, int &pos, byte &mode, string &name, byte &id ) : bool
input byte
pos int
mode byte
name string
id byte
return bool
        protected static bool ParseTreeEntry(byte[] input, ref int pos, out byte[] mode, out string name, out byte[] id)
        {
            if ((char) input[pos] == '4') {
                //Console.WriteLine ("mode = new byte [5];");
                mode = new byte [5];
            } else {
                //Console.WriteLine ("mode = new byte [6];");
                mode = new byte [6];
            }

            id = new byte [20];
            name = null;

            if (input.Length <= 27)
                throw new ArgumentException ("The data is not a tree entry, the size is to small");

            Array.Copy (input, pos, mode, 0, mode.Length);
            //Console.WriteLine (new GitFileMode (mode).ToString ());
            pos += (mode.Length + 1);

            if (!ParseString (input, ref pos, out name))
                return false;

            pos++;

            Array.Copy (input, pos, id, 0, 20);

            pos += 19;

            return true;
        }