Ejemplo n.º 1
0
    public void resetpeida()
    {
        green.enabled       = false;
        orange.enabled      = false;
        red.enabled         = false;
        redverify.enabled   = false;
        Passtextverify.text = "";
        Passtext.text       = "";
        Password.text       = "";
        CURRENTPASS.text    = "";
        CURRENTPASS1.text   = "";
        EmailText.text      = "";
        TWRINOSPASS1.text   = "";
        TWRINOSPASS.text    = "";
        Email.text          = "";
        errorPassconfir     = false;
        errorPasscur        = false;
        errorPass           = false;
        Emailalreadyused    = false;
        errorMail           = false;

        if (ColorUtility.TryParseHtmlString("#635E5E", out color))
        {
            Passwordverify.GetComponent <Image>().color = color;
            Password.GetComponent <Image>().color       = color;
            TWRINOSPASS.GetComponent <Image>().color    = color;
            TWRINOSPASS1.GetComponent <Image>().color   = color;
            Email.GetComponent <Image>().color          = color;
        }
    }
Ejemplo n.º 2
0
    public void changeemailinfile()
    {
        if (File.Exists(path))
        {
            System.IO.StreamReader file = new System.IO.StreamReader(path);
            count = 0;
            file.ReadLine();
            while ((line = file.ReadLine()) != null)
            {
                count   = count + 1;
                linecol = line.Split(',');
                if (linecol[0] == usernamelog)
                {
                    break;
                }
            }

            file.Close();
        }
        if (TWRINOSPASS1.text != linecol[1])
        {
            CURRENTPASS1.text = "Ο Τρέχων κωδικός δεν είναι σωστός";
            errorPasscur      = false;
            TWRINOSPASS1.GetComponent <Image>().color = Color.red;
        }
        else
        {
            CURRENTPASS1.text = " ";
            errorPasscur      = true;
            TWRINOSPASS1.GetComponent <Image>().color = Color.green;
        }
        if (Email.text == "")
        {
            EmailText.text = "Το email Απαιτείται ";
            Email.GetComponent <Image>().color = Color.red;
        }
        else
        {
            try
            {
                var addr = new System.Net.Mail.MailAddress(Email.text);
                errorMail = true;
            }
            catch
            {
                EmailText.text = "Εισαγάγετε τη διεύθυνση email σας στη μορφή: Yourname @example.com ";
                Email.GetComponent <Image>().color = Color.red;
                errorMail = false;
            }
            char[]   spearator = { '@', '.' };
            string[] email1    = Email.text.Split(spearator);
            Emailalreadyused = true;
            if (File.Exists(path))
            {
                flagfirsttime = true;
                System.IO.StreamReader file1 = new System.IO.StreamReader(path);
                while ((line = file1.ReadLine()) != null)
                {
                    if (flagfirsttime)
                    {
                        flagfirsttime = false;
                    }
                    else
                    {
                        linecolemail = line.Split(',');
                        if (linecolemail[2] == Email.text)
                        {
                            Emailalreadyused = false;
                            break;
                        }
                    }
                }
                file1.Close();
            }
            if (email1.Length == 1 || email1.Length == 2)
            {
                EmailText.text = "Εισαγάγετε τη διεύθυνση email σας στη μορφή: Yourname @example.com ";
                Email.GetComponent <Image>().color = Color.red;
                errorMail = false;
            }
            else if (email1[2] != "com" && email1[2] != "gr" && email1[2] != "en" && email1[2] != "be" && email1[2] != "cy" && email1[2] != "fi" && email1[2] != "fr" && email1[2] != "de")
            {
                EmailText.text = "Εισαγάγετε τη διεύθυνση email σας στη μορφή: Yourname @example.com ";
                Email.GetComponent <Image>().color = Color.red;
                errorMail = false;
            }
            else if (!Emailalreadyused)
            {
                EmailText.text = "Αυτο το email υπάρχει ήδη ή χρησιμοποιείται από άλλον χρήστη";
                Email.GetComponent <Image>().color = Color.red;
                errorMail = false;
            }
            else
            {
                EmailText.text = "";
                if (ColorUtility.TryParseHtmlString("#11FF00", out color))
                {
                    Email.GetComponent <Image>().color = color;
                }
            }
        }
        if (errorMail && errorPasscur)
        {
            string[] lines = File.ReadAllLines(path);
            using (StreamWriter save = File.CreateText(path))
            {
                save.WriteLine("UserName" + "," + "Password" + "," + "Email");
                for (int currentLine = 1; currentLine < lines.Length; ++currentLine)
                {
                    if (currentLine == count)
                    {
                        linecol = lines[count].Split(',');
                        save.WriteLine(linecol[0] + "," + linecol[1] + "," + Email.text);
                    }
                    else
                    {
                        save.WriteLine(lines[currentLine]);
                    }
                }
            }
            changemailwindow.SetActive(false);
            edit1.text = "Tο email σας ενημερώθηκε ";
            edit2.text = "Tο email σας άλλαξε με επιτυχία σε" + "\n" + Email.text;
            succesfull.SetActive(true);
            rithm.GetComponent <rithmiseis>().enabled = false;
        }
    }