Example #1
0
        // get the favourite conferences from the server, return aray of conf_infos
        public static conf_info[] svrFavourites(Int32 you)
        {
            String XMLloc = ServerFunctionHelper.Post("http://" + hostname + "/stb_scripts/get_favourites.php", "user_id=" + you);
            Int32 i = 0;
            Int32 NoOfFavs = 0;
            //Counts the total number of favourites in the xml file
            //***************************************************
            XmlTextReader Counter = new XmlTextReader(new StringReader(XMLloc));

            while (Counter.Read())
            {
                switch (Counter.NodeType)
                {
                    case XmlNodeType.Element: // The node is an Element

                        if (Counter.Name == "Fav")
                        {
                            NoOfFavs++;
                        }
                        break;
                }
            }
            Counter.Close();
            //***************************************************

            XmlTextReader reader = new XmlTextReader(new StringReader(XMLloc));
            conf_info[] Favs = new conf_info[NoOfFavs];
            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element: // The node is an Element

                        if (reader.Depth == 2)
                        {
                            switch (reader.Name)
                            {
                                case "ConfID":
                                    i++;
                                    Favs[i-1].ConferenceID = reader.ReadElementContentAsInt();
                                    break;
                                case "ConfPIN":
                                    Favs[i-1].ConferencePIN = reader.ReadElementContentAsInt();
                                    break;
                                case "Name":
                                    Favs[i-1].Name = reader.ReadElementContentAsString();
                                    break;
                                case "Description":
                                    Favs[i-1].Description = reader.ReadElementContentAsString();
                                    break;
                                case "Type":
                                    Favs[i-1].Type = (conf_type)reader.ReadElementContentAsInt();
                                    break;
                                case "MadeBY":
                                    Favs[i-1].Made_By = reader.ReadElementContentAsInt();
                                    break;
                                case "Participants":
                                    Favs[i - 1].No_Of_Participants = reader.ReadElementContentAsInt();
                                    break;
                            }

                        }
                        break;
                }
            }

            return Favs;
        }
Example #2
0
        public static conf_info[] TestFavList()
        {
            conf_info[] favlist = new conf_info[9];

            favlist[0].ConferenceID = 999670;
            favlist[0].ConferencePIN = 642250;
            favlist[0].Name = "1 Fav Server";
            favlist[0].Description = "1 Place to Chat";
            favlist[0].Type = conf_type.PermPublic;
            favlist[0].Made_By = 501;

            favlist[1].ConferenceID = 999671;
            favlist[1].ConferencePIN = 642251;
            favlist[1].Name = "2 Fav Server";
            favlist[1].Description = "2 Place to Chat";
            favlist[1].Type = conf_type.PermPrivate;
            favlist[1].Made_By = 502;
            
            favlist[2].ConferenceID = 999672;
            favlist[2].ConferencePIN = 642252;
            favlist[2].Name = "3 Fav Server";
            favlist[2].Description = "3 Place to Chat";
            favlist[2].Type = conf_type.PermPublic;
            favlist[2].Made_By = 503;

            favlist[3].ConferenceID = 999673;
            favlist[3].ConferencePIN = 642253;
            favlist[3].Name = "4 Fav Server";
            favlist[3].Description = "4 Place to Chat";
            favlist[3].Type = conf_type.PermPrivate;
            favlist[3].Made_By = 504;

            favlist[4].ConferenceID = 999674;
            favlist[4].ConferencePIN = 642254;
            favlist[4].Name = "5 Fav Server";
            favlist[4].Description = "5 Place to Chat";
            favlist[4].Type = conf_type.PermPublic;
            favlist[4].Made_By = 505;

            favlist[5].ConferenceID = 999675;
            favlist[5].ConferencePIN = 642255;
            favlist[5].Name = "6 Fav Server";
            favlist[5].Description = "6 Place to Chat";
            favlist[5].Type = conf_type.PermPublic;
            favlist[5].Made_By = 506;

            favlist[6].ConferenceID = 999676;
            favlist[6].ConferencePIN = 642256;
            favlist[6].Name = "7 Fav Server";
            favlist[6].Description = "7 Place to Chat";
            favlist[6].Type = conf_type.PermPublic;
            favlist[6].Made_By = 507;

            favlist[7].ConferenceID = 999677;
            favlist[7].ConferencePIN = 642257;
            favlist[7].Name = "8 Fav Server";
            favlist[7].Description = "8 Place to Chat";
            favlist[7].Type = conf_type.PermPublic;
            favlist[7].Made_By = 508;

            favlist[8].ConferenceID = 999678;
            favlist[8].ConferencePIN = 642258;
            favlist[8].Name = "9 Fav Server";
            favlist[8].Description = "9 Place to Chat";
            favlist[8].Type = conf_type.PermPublic;
            favlist[8].Made_By = 509;
            
            return favlist;
        }
Example #3
0
        //Gets doctor info (ID CONF and PIN)
        public static conf_info svrGetDocConf(Int32 user)
        {
            String XMLloc = ServerFunctionHelper.Post("http://" + hostname + "/stb_scripts/get_doctor_info.php", "user_id=" + user);
            XmlTextReader reader = new XmlTextReader(new StringReader(XMLloc));
            conf_info DocConf = new conf_info();
            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element: // The node is an Element

                        if (reader.Depth == 1)
                        {
                            switch (reader.Name)
                            {
                                case "DoctorConf":
                                    DocConf.ConferenceID = reader.ReadElementContentAsInt();
                                    break;
                                case "DoctorPIN":
                                    DocConf.ConferencePIN = reader.ReadElementContentAsInt();
                                    break;
                            }

                        }
                        break;
                }
            }
            if (DocConf.ConferenceID != 0)
            {
                conf_info TempConfInfo = svrConfInfo(DocConf.ConferenceID);
                TempConfInfo.ConferencePIN = DocConf.ConferencePIN;
                return TempConfInfo;
            }
            else return DocConf;
        }
Example #4
0
        //makes a conference and returns ID and Pin
        public static conf_info svrMakeConf(conf_type type, Int32 user)
        {
            String XMLloc = ServerFunctionHelper.Post("http://" + hostname + "/stb_scripts/make_conference.php", "type=" + (Int32)type + "&user_id=" + user);
            XmlTextReader reader = new XmlTextReader(new StringReader(XMLloc));
            conf_info ConfIDPIN = new conf_info();
            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element: // The node is an Element

                        if (reader.Depth == 1)
                        {
                            switch (reader.Name)
                            {
                                case "ConfID":
                                    ConfIDPIN.ConferenceID = reader.ReadElementContentAsInt();
                                    break;
                                case "ConfPIN":
                                    ConfIDPIN.ConferencePIN = reader.ReadElementContentAsInt();
                                    break;
                            }

                        }
                        break;
                }
            }

            conf_info TempConfInfo = svrConfInfo(ConfIDPIN.ConferenceID);
            TempConfInfo.ConferencePIN = ConfIDPIN.ConferencePIN;
            return TempConfInfo;

        }
Example #5
0
        //get conference info for given id
        public static conf_info svrConfInfo(Int32 conf)
        {
            String XMLloc = ServerFunctionHelper.Post("http://" + hostname + "/stb_scripts/get_conf_info.php", "conf_id=" + conf);
            XmlTextReader reader = new XmlTextReader(new StringReader(XMLloc));
            conf_info ConfInfo = new conf_info();
            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element: // The node is an Element

                        if (reader.Depth == 1)
                        {
                            switch (reader.Name)
                            {
                                case "ConfID":
                                    ConfInfo.ConferenceID = reader.ReadElementContentAsInt();
                                    break;
                                case "Name":
                                    ConfInfo.Name = reader.ReadElementContentAsString();
                                    break;
                                case "Description":
                                    ConfInfo.Description = reader.ReadElementContentAsString();
                                    break;
                                case "Type":
                                    ConfInfo.Type = (conf_type)reader.ReadElementContentAsInt();
                                    break;
                                case "MadeBY":
                                    ConfInfo.Made_By = reader.ReadElementContentAsInt();
                                    break;
                                case "Participants":
                                    ConfInfo.No_Of_Participants = reader.ReadElementContentAsInt();
                                    break;
                            }

                        }
                        break;
                }
            }
            return ConfInfo;
        }
Example #6
0
 private Boolean compareFavLists(conf_info[] previous, conf_info[] current)
 {
     if (previous.Length != current.Length)
     {
         return false;
     }
     else
     {
         for (Int32 i = 0; i < previous.Length; i++)
         {
             if (previous[i].ConferenceID != current[i].ConferenceID)
             {
                 return false;
             }
         }
     }
     return true;
 }
Example #7
0
        void listRefreshTimer_Tick(object sender, EventArgs e)
        {
            user_info[] tempbuddylist = new user_info[100];
            conf_info[] tempfavlist = new conf_info[100];
            tempbuddylist = Data.constants.buddylist;
            tempfavlist = Data.constants.favlist;
            Int32 LastBuddyIndex = -1, LastFavIndex = -1;
            if (LstJoinBuddy.Focused)
            {
                LastBuddyIndex = LstJoinBuddy.FocusedItem.Index;
            }
            if (LstJoinFav.Focused)
            {
                LastFavIndex = LstJoinFav.FocusedItem.Index;
            }
            updateServerLists();
            if (!compareBuddyLists(tempbuddylist, Data.constants.buddylist))
            {
                LstJoinBuddy.Items.Clear();
                AvatarList.Images.Clear();
                AvatarList.Images.Add(System.Drawing.Image.FromFile("Images//locked.jpg"));
                PopulateBuddyListView();
            }
            if (!compareFavLists(tempfavlist, Data.constants.favlist))
            {
                LstJoinFav.Items.Clear();
                FirstJoinFav = true;
                PopulateFavListView();
            }

            if (LastBuddyIndex != -1)
            {
                LstJoinBuddy.Focus();
                LstJoinBuddy.Items[LastBuddyIndex].Selected = true;
                LstJoinBuddy.Items[LastBuddyIndex].Focused = true;
            }
            else if (LastFavIndex != -1)
            {
                LstJoinFav.Focus();
                LstJoinFav.Items[LastFavIndex].Selected = true;
                LstJoinFav.Items[LastFavIndex].Focused = true;
            }
        }