GetCTime() static private method

static private GetCTime ( System.DateTime dateTime ) : int
dateTime System.DateTime
return int
コード例 #1
0
        public void WriteHeader(byte[] outBuffer)
        {
            if (outBuffer == null)
            {
                throw new ArgumentNullException("outBuffer");
            }
            int i = 0;

            i = TarHeader.GetNameBytes(this.Name, outBuffer, i, 100);
            i = TarHeader.GetOctalBytes((long)this.mode, outBuffer, i, 8);
            i = TarHeader.GetOctalBytes((long)this.UserId, outBuffer, i, 8);
            i = TarHeader.GetOctalBytes((long)this.GroupId, outBuffer, i, 8);
            long value = this.Size;

            i = TarHeader.GetLongOctalBytes(value, outBuffer, i, 12);
            i = TarHeader.GetLongOctalBytes((long)TarHeader.GetCTime(this.ModTime), outBuffer, i, 12);
            int offset = i;

            for (int j = 0; j < 8; j++)
            {
                outBuffer[i++] = 32;
            }
            outBuffer[i++] = this.TypeFlag;
            i = TarHeader.GetNameBytes(this.LinkName, outBuffer, i, 100);
            i = TarHeader.GetAsciiBytes(this.Magic, 0, outBuffer, i, 6);
            i = TarHeader.GetNameBytes(this.Version, outBuffer, i, 2);
            i = TarHeader.GetNameBytes(this.UserName, outBuffer, i, 32);
            i = TarHeader.GetNameBytes(this.GroupName, outBuffer, i, 32);
            if (this.TypeFlag == 51 || this.TypeFlag == 52)
            {
                i = TarHeader.GetOctalBytes((long)this.DevMajor, outBuffer, i, 8);
                i = TarHeader.GetOctalBytes((long)this.DevMinor, outBuffer, i, 8);
            }
            while (i < outBuffer.Length)
            {
                outBuffer[i++] = 0;
            }
            this.checksum = TarHeader.ComputeCheckSum(outBuffer);
            TarHeader.GetCheckSumOctalBytes((long)this.checksum, outBuffer, offset, 8);
            this.isChecksumValid = true;
        }