static void Main(string[] args) { string host = "localhost"; if (args.Length >= 1) { host = args[0]; } string connection = "Server=" + host + ";Port=5432;Username=postgres;Password=postpass;Database=postgres"; Database db = new Database(connection); ResetDatabase(db); Exercise.getAllExercises(db); UserManager manager = new UserManager(db); var us = manager.getUser("*****@*****.**", Util.hash("bob" + "*****@*****.**")); ProgressStatistics st = new ProgressStatistics(); for (int i = 0; i < 200; i++) { st.AddDataPoint(DateTime.Now + TimeSpan.FromMinutes(i), (i / 200.0) * Math.Sin(i * 0.1)); } st.Finish(); var fout = new FileStream("output.pdf", FileMode.Create); st.MakePdf("One-Rep-Max over time", fout); //using (UserDataAccess ac = new UserDataAccess(db, us)) { // for(int d = 0; d < 50; ++d) { // WorkoutSession session = new WorkoutSession(); // session.workoutItems = new List<WorkoutItem>(); // session.uuid = Guid.NewGuid().ToString(); // session.date = DateTime.Now + TimeSpan.FromDays(d - 25); // session.primaryGroup = ((BodyPart)(1 + Util.rand(6))).ToString(); // session.secondaryGroup = "this does not matter"; // for (int i = 0; i < 6; i++) { // WorkoutItem item = new WorkoutItem(); // item.ex = Exercise.globalExercises.randomElement(); // item.oneRepMax = Util.rand(0.0, 50.0); // item.sets = new List<WorkoutSet>(); // item.uuid = Guid.NewGuid().ToString(); // item.difficulty = 2; // for(int j = 0; j < (3 + Util.rand(3)); j++) { // WorkoutSet set = new WorkoutSet(); // set.percent1RM = 75; // set.uuid = Guid.NewGuid().ToString(); // set.reps = 10; // set.repsCompleted = 10; // set.doneWithRest = true; // set.restTime = TimeSpan.FromSeconds(4); // item.sets.Add(set); // } // session.workoutItems.Add(item); // } // ac.AddDay(session); // } // ac.Store(); // WorkoutGenerator gen = new WorkoutGenerator(ac); // Console.WriteLine(gen.ToString()); //} //User bob = manager.createUser("bob", "bobtest"); //UserDataAccess bobaccess = new UserDataAccess(db, bob); //WorkoutGenerator bobs = new WorkoutGenerator(bobaccess); //WorkoutSession sesh = new WorkoutSession(); //sesh.date = DateTime.Now - TimeSpan.FromDays(1.0); ////sesh.primaryGroup = "Chest"; ////sesh.secondaryGroup = "Back"; //sesh.uuid = Guid.NewGuid().ToString(); //sesh.workoutItems = new List<WorkoutItem>(); //for(int i = 0; i < 3; ++i) { // WorkoutItem item = new WorkoutItem(); // item.difficulty = 2; // item.ex = Exercise.globalExercises[3]; //} //bobaccess.AddDay(new WorkoutSession()) mpBase root = new mpBase(); mpServer server = new mpServer(); server.start(root.restful, "http://*:8080/"); SetupRegistrationManager(root, db, manager); SetupLoginManager(root, db, manager); SetupExerciseInfoManager(root, db, manager); SetupExerciseCalibrationManager(root, db, manager); SetupExerciseFeedbackManager(root, db, manager); Console.ReadKey(); server.stop(); }