private String appointmentsSerialize() { //make a serialized list of all appointments to send to a new host when it request after joining String response = " SequentialNum:&@[" + SequentialNumber.getNextSequentialNumber() + "]#! " + "\n"; foreach (Appointment appointment in appointmentsList) { response += appointment.serialize(); } return(response); }
private String appointmentsSerialize() { //make a serialized list of all appointments to send to a new host when it request after joining String response = " SequentialNum:&@[" + SequentialNumber.getNextSequentialNumber() + "]#! " + "\n" + " LogicalClock:&@[" + LogicalClock.nextLogicalClock() + "]#! " + "\n"; //For Mutual Exclusion //the clock has modified here before sending sync string foreach (Appointment appointment in appointmentsList) { response += appointment.serialize(); } return(response); }
private void updateLocalDatabase() { //Write the current calendar's appointments on a file in hard disk after each change List <String> aLines = new List <String>(); aLines.Add(" HPN Calendar Network Version TUMS " + "\n"); aLines.Add(" Modify:&@[" + this.getLastModifiedString() + "]#! " + "\n"); aLines.Add(" SequentialNum:&@[" + SequentialNumber.getNextSequentialNumber() + "]#! " + "\n"); aLines.Add(" Appointments:&@[" + this.appointmentsList.Count + "]#! " + "\n"); foreach (Appointment appointment in this.appointmentsList) { aLines.Add(appointment.serialize()); } try { this.databaseFile.writeFile(aLines); } catch (System.IO.IOException e) { Console.WriteLine("Problem in writing to database file : " + e.Message); } }