i was able to get the copyto method to work but there has got to be a
better way to do this any ideas?
public byte[] DOS_TIMESTAMP
{
get
{
DateTime dt = DateTime.Now;
string sec = Convert.ToString(6,2).PadLeft(5,'0');
string min = Convert.ToString(37, 2).PadRight(6, '0');
string hrs = Convert.ToString(23, 2).PadRight(5, '0');
string day = Convert.ToString(dt.Day - 1,
2).PadRight(5,'0');
string mon = Convert.ToString(dt.Month,
2).PadRight(4,'0');
string year = Convert.ToString(dt.Year - 1980,
2).PadRight(7,'0');
string date = day + mon + year;
string time = hrs + min + sec;
string dtstamp = time.Substring(8, 8) + " " +
time.Substring(0, 8) + " " +
Reverse(date.Substring(0, 8)) + " " +
Reverse(date.Substring(8, 8));
bool[] dtarr = new bool[32];
for(int i = 0;i<32;i++)
{
dtarr = dtstamp.ToString() == "1" ? true :
false;
}
BitArray[] ba = new BitArray[4];
ba[0] = new BitArray(new bool[8] { dtarr[0], dtarr[1],
dtarr[2], dtarr[3], dtarr[4], dtarr[5], dtarr[6], dtarr[7]});
ba[1] = new BitArray(new bool[8] { dtarr[8] ,dtarr[9],
dtarr[10], dtarr[11], dtarr[12], dtarr[13], dtarr[14], dtarr[15] });
ba[2] = new BitArray(new bool[8] { dtarr[16],dtarr[17],
dtarr[18], dtarr[19], dtarr[20], dtarr[21], dtarr[22], dtarr[23] });
ba[3] = new BitArray(new bool[8] { dtarr[24],dtarr[25],
dtarr[26], dtarr[27], dtarr[28], dtarr[29], dtarr[30], dtarr[31]});
byte[] barrdt1 = new byte[1];
byte[] barrdt2 = new byte[1];
byte[] barrdt3 = new byte[1];
byte[] barrdt4 = new byte[1];
ba[0].CopyTo(barrdt1, 0);
ba[1].CopyTo(barrdt2, 0);
ba[2].CopyTo(barrdt3, 0);
ba[3].CopyTo(barrdt4, 0);
byte[] barrdt = new byte[4];
barrdt[0] = barrdt1[0];
barrdt[1] = barrdt2[0];
barrdt[2] = barrdt3[0];
barrdt[3] = barrdt4[0];
return barrdt;
}
}