Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Server started");
            Console.WriteLine("Loading movies...");
            //films = MakeFilmList();
            films = StreamReadWrite.Read();
            Console.WriteLine("Movies loaded");

            listener = new TcpListener(IPAddress.Any, 14653);
            listener.Start();
            listener.BeginAcceptTcpClient(new AsyncCallback(OnConnect), null); //Open the connection, server can now receive clients

            Console.ReadLine();                                                //Can be used to implement server-side commands if needed
        }
Esempio n. 2
0
        //Creates some test movies, only gets called when file has to be remade
        public static List <Film> MakeFilmList()
        {
            List <Film> films = new List <Film>();    //Use FileIO to make this list

            films.Add(new Film("Tester", 120, "F****n top tier movie right there", 100));
            films.Add(new Film("Tester2", 80, "Shit movie but at least it short lmao", 300));
            films[0].Date = (new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day));
            films[1].Date = (new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day));

            StreamReadWrite.Write(films);
            //films = StreamReadWrite.Read();

            Console.WriteLine("movies saved");

            return(films);
        }
Esempio n. 3
0
 /// <summary>
 /// Updates the movies and saves the changes in the files
 /// </summary>
 /// <param name="newfilms">Updated list of movies</param>
 public static void updateFilms(List <Film> newfilms)
 {
     films = newfilms;
     StreamReadWrite.Write(films);
 }