Пример #1
0
        protected void Access(object sender, EventArgs e)
        {
            MD5 encryptor = MD5.Create();

            byte[] password = System.Text.Encoding.UTF8.GetBytes(entry5.Text);
            password = encryptor.ComputeHash(password);
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            for (int i = 0; i < password.Length; i++)
            {
                sb.Append(password[i].ToString("X2"));
            }
            XDocument    xml          = XMLGenerator.Generate(entry4.Text, sb.ToString(), " ", " ", " ", " ", 20);
            SocketClient socketClient = SocketClient.GetSocketClient();

            socketClient.send(xml);
            XDocument reply = socketClient.Listen();

            Console.Write(reply);
            if (reply.Root.Element("Reply").Value == "Granted")
            {
                Destroy();
                ViewManager viewmanager = new ViewManager();
            }
            else
            {
                AlertWindow alertWindow = new AlertWindow("Error: Usuario o Contraseña incorrectos, Por favor reintentar");
                alertWindow.Show();
            }
            //Console.Write(reply);
        }
Пример #2
0
        protected void Register(object sender, System.EventArgs e)
        {
            MD5 encryptor = MD5.Create();

            byte[] password = System.Text.Encoding.UTF8.GetBytes(entry4.Text);
            password = encryptor.ComputeHash(password);
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            for (int i = 0; i < password.Length; i++)
            {
                sb.Append(password[i].ToString("X2"));
            }
            label2.Text = label2.Text.Replace("Amigos: ", "");
            SocketClient.GetSocketClient().send(XMLGenerator.Generate(entry1.Text, sb.ToString(), comboboxentry1.ActiveText, entry2.Text, entry3.Text, label2.Text.Substring(0, label2.Text.Length - 1), 21));
            XDocument xml = SocketClient.GetSocketClient().Listen();

            if (xml.Root.Element("Reply").Value == "Granted")
            {
                Destroy();
                ViewManager viewmanager = new ViewManager();
            }
            else
            {
                AlertWindow alertWindow = new AlertWindow("Error: Nombre de Usuario ya se encunetra en uso, Por favor reintentar");
                alertWindow.Show();
            }
        }
Пример #3
0
        protected void ChangeData(object sender, EventArgs e)
        {
            int yearInt = 0;

            if (nameSong.Text == "")
            {
                nameSong.Text = "Unknown";
            }
            if (album.Text == "")
            {
                album.Text = "Unknown";
            }
            if (style.Text == "")
            {
                style.Text = "Unknown";
            }
            if (artist.Text == "")
            {
                artist.Text = "Unknown";
            }
            if (lyrics.Text == "")
            {
                lyrics.Text = "Unknown";
            }
            try
            {
                yearInt = Int32.Parse(year.Text);
            }
            catch (Exception)
            {
                yearInt = -1;
            }
            nameSong.Text = nameSong.Text.Replace(" ", "");
            album.Text    = album.Text.Replace(" ", "");
            style.Text    = style.Text.Replace(" ", "");
            artist.Text   = artist.Text.Replace(" ", "");
            XDocument document = new XDocument(new XElement("Data",
                                                            new XElement("opCode", 26),
                                                            new XElement("OriginalName", this.originalName),
                                                            new XElement("OriginalArtist", this.originalArtist),
                                                            new XElement("Name", nameSong.Text),
                                                            new XElement("Artist", artist.Text),
                                                            new XElement("Album", album.Text),
                                                            new XElement("Style", style.Text),
                                                            new XElement("Year", year.Text),
                                                            new XElement("Lyrics", lyrics.Text)));

            SocketClient.GetSocketClient().send(document);


            Destroy();
            MainWindow.GetMainWindow().UpdateSongs(XMLGenerator.RequestSongs(page));

            return;
        }
Пример #4
0
        protected void AddSong(object sender, EventArgs e)
        {
            FileChooserDialog fileChooser = new FileChooserDialog("Hola", window, FileChooserAction.Open, "Cancel", ResponseType.Cancel,
                                                                  "Open", ResponseType.Accept);

            FileFilter file = new FileFilter();

            file.AddPattern("*.mp3");

            fileChooser.AddFilter(file);
            //fileChooser.Show();
            if (fileChooser.Run() == (int)ResponseType.Accept)
            {
                int    yearInt      = 0;
                byte[] cancionBytes = System.IO.File.ReadAllBytes(fileChooser.Filename);
                if (nameSong.Text == "")
                {
                    nameSong.Text = "Unknown";
                }
                if (album.Text == "")
                {
                    album.Text = "Unknown";
                }
                if (style.Text == "")
                {
                    style.Text = "Unknown";
                }
                if (artist.Text == "")
                {
                    artist.Text = "Unknown";
                }
                if (lyrics.Text == "")
                {
                    lyrics.Text = "Unknown";
                }
                try
                {
                    yearInt = Int32.Parse(year.Text);
                }catch (Exception)
                {
                    yearInt = -1;
                }
                nameSong.Text = nameSong.Text.Replace(" ", "");
                album.Text    = album.Text.Replace(" ", "");
                style.Text    = style.Text.Replace(" ", "");
                artist.Text   = artist.Text.Replace(" ", "");



                SocketClient.GetSocketClient().send(XMLGenerator.Generate(style.Text, nameSong.Text, artist.Text, album.Text, yearInt, lyrics.Text, 0, cancionBytes));
            }
            Destroy();
            fileChooser.Destroy();
        }
Пример #5
0
        public RegisterWindow() :
            base(Gtk.WindowType.Toplevel)
        {
            this.Build();
            SocketClient.GetSocketClient().send(XMLGenerator.RequestUsers());
            XDocument xmlUsers = SocketClient.GetSocketClient().Listen();
            IEnumerable <XElement> inumerable = xmlUsers.Root.Elements();

            //XElement xElement = new XElement("");

            foreach (XElement x in inumerable)
            {
                comboboxentry2.AppendText(x.Value);
            }
            ShowAll();
        }