Esempio n. 1
0
        //Data
        public ServerForm()
        {
            InitializeComponent();
            //generateInitialState();
            //return;

            var xml = File.ReadAllText("initial.state.xml");
            logF("file loaded {0} length", xml.Length);
            serverData = Util.XmlDeserializeFromString<ServerData>(xml);
            log(Util.XmlSerializeToString(serverData));
            certificate = new X509Certificate2("cert_key.p12", "sirs");

            Thread t = new Thread(new ThreadStart(listen));
            t.Start();
        }
Esempio n. 2
0
 public void generateInitialState()
 {
     string u1 = "rui";
     string pw1 = "ruisirs";
     string c1 = "Rui's calendar";
     UserData ud1 = registerUser(u1, pw1);
     SecureCalendar sc1 = registerCalendar(u1, pw1, ud1);
     sc1.name = c1;
     string u2 = "ricardo";
     string pw2 = "ricardoinesc";
     string c2 = "Ricardo's calendar";
     UserData ud2 = registerUser(u2, pw2);
     SecureCalendar sc2 = registerCalendar(u2, pw2, ud2);
     ServerData sd = new ServerData() { };
     sd.calendars.Add(sc1);
     sd.calendars.Add(sc2);
     sd.users.Add(ud1);
     sd.users.Add(ud2);
     serverData = sd;
     log("Initial State generated");
     log(Util.XmlSerializeToString(sd));
 }