Exemplo n.º 1
0
 internal profile(int fbID, int id, string name, scheduleUser[] schedules)
 {
     FacebookID = fbID;
     ID = id;
     username = name;
     scheduleList = schedules;
     scheduleIndex = 0;
     Console.WriteLine("Internal intialization for user profile");
 }
Exemplo n.º 2
0
 //public byte[] toBArray(){
 //    Console.WriteLine("Convert from user profile to byte array");
 //    return Vsync.Msg.toBArray(FacebookID, id,username, scheduleList);
 //}
 //public profile(byte[] ba){
 //    object[] obs = Msg.BArrayToObjects(ba);
 //    int idx = 0;
 //    FacebookID = (int)obs[idx++];
 //    ID = (int)obs[idx++];
 //    username = (string) obs[idx++];
 //    scheduleList = new scheduleUser[obs.Length - idx];
 //    scheduleIndex = 0;
 //    while (idx < obs.Length){
 //        scheduleList[scheduleIndex++] = (scheduleUser) obs[idx++];
 //    }
 //    Console.WriteLine("Convert from byte array to user profile");
 //}
 public void addScheduleToList(scheduleUser sche)
 {
     if (scheduleList == null){
         scheduleList = new scheduleUser[16];
         scheduleIndex = 0;
     }else if (scheduleIndex + 1 == scheduleList.Length){
         scheduleUser[] temp = new scheduleUser[scheduleList.Length * 2];
         for (int i = 0; i < scheduleList.Length; i++){
             temp[i] = scheduleList[i];
         }
         scheduleIndex = scheduleList.Length;
         scheduleList = temp;
     }
     scheduleList[scheduleIndex++] = sche;
     Console.WriteLine(scheduleIndex);
     Console.WriteLine(scheduleList[0]);
     Console.WriteLine("Add schedule to user's schedule list");
 }