float predrating(int movieid, user userid)
        {
            int           k                     = 1;
            float         predracting           = 0.0f;
            float         sumpredracting        = 0.0f;
            rateduserlist userwhowatchthismovie = ratedmovielist.Where(r => r.Movieid == movieid).First();

            int co   = 0;
            int simi = 0;

            foreach (userpm id in userwhowatchthismovie.Userid)
            {
                user userothermovies;
                if (listusers.Where(r => r.Userid == id.Userid).Count() != 0)
                {
                    userothermovies = listusers.Where(r => r.Userid == id.Userid).FirstOrDefault();


                    foreach (Rated r in userothermovies.Moviewatched)
                    {
                        if (userid.Moviewatched.Where(ka => ka.Movieid == r.Movieid).Count() != 0)
                        {
                            Rated rk = userid.Moviewatched.Where(ka => ka.Movieid == r.Movieid).First();
                            simi++;
                            sumpredracting = sumpredracting + (r.Rate + rk.Rate) / 2;
                            co++;
                            if (k == simi)
                            {
                                break;
                            }
                        }
                    }
                }
            }

            predracting = sumpredracting / co;
            return(predracting);
        }
        private void Load()
        {
            using (var reader = new StreamReader(configs.nonsorted))
            {
                rateduserlist m         = new rateduserlist();
                int           Movieidte = 0;
                while (!reader.EndOfStream)
                {
                    var line   = reader.ReadLine();
                    var values = line.Split(',');


                    int Movieid = Int32.Parse(values[0]);
                    if (Movieidte != Movieid)
                    {
                        ratedmovielist.Add(m);
                        m         = new rateduserlist();
                        m.Movieid = Int32.Parse(values[0]);
                        m.Userid  = new List <userpm>();
                        Movieidte = Movieid;
                    }
                    else
                    {
                        userpm r = new userpm();
                        r.Userid = Int32.Parse(values[1]);
                        r.Rate   = float.Parse(values[2]);
                        m.Userid.Add(r);
                    }
                }
                ratedmovielist.RemoveAt(0);
            }

            int pi = 0;

            using (var reader = new StreamReader(configs.movielist))
            {
                pi++;


                while (!reader.EndOfStream)
                {
                    var      line   = reader.ReadLine();
                    var      values = line.Split(',');
                    movilist m      = new movilist();
                    m.Id = Int32.Parse(values[0]);
                    if (ratedmovielist.Where(r => r.Movieid == m.Id).Count() != 0)
                    {
                        try
                        {
                            m.Year = Int32.Parse(values[1]);
                        }
                        catch (Exception ex)
                        { m.Year = 0; }
                        m.Title = (values[2]);
                        listMovies.Add(m);
                    }
                }
            }

            listBox1.Items.Clear();

            foreach (movilist m in listMovies)
            {
                listBox1.Items.Add(m.Title + " , " + m.Year);
            }

            listBox1.Invalidate();

            using (var reader = new StreamReader(configs.userdb))
            {
                int           userid = 0;
                List <string> sl     = new List <string>();

                user m = new user();
                pi = 0;

                while (!reader.EndOfStream)
                {
                    pi++;
                    var line   = reader.ReadLine();
                    var values = line.Split(',');

                    int useridte = Int32.Parse(values[1]);
                    if (useridte != userid)
                    {
                        listusers.Add(m);
                        m      = new user(); m.Userid = Int32.Parse(values[1]); m.Moviewatched = new List <Rated>();
                        userid = useridte;
                    }
                    else
                    {
                        Rated r = new Rated();
                        r.Movieid = Int32.Parse(values[0]);
                        r.Rate    = float.Parse(values[2]);
                        m.Moviewatched.Add(r);
                    }
                }
                listusers.RemoveAt(0);
            }


            listBox2.Items.Clear();

            foreach (user m in listusers)
            {
                listBox2.Items.Add(m.Userid);
            }
        }