예제 #1
0
        public static Int32 IsUserBanned()
        {
            try
            {
                Int32 BanStatus = TelemetryStatus.USER_OK;

                WebClient client = new WebClient();

                Byte[] userbanRAW = client.DownloadData(String.Format("https://kaleidonkep99.altervista.org/kstelemetry/{0}", "users.banlist"));
                String userban    = System.Text.Encoding.UTF8.GetString(userbanRAW);

                Byte[] pcbanRAW = client.DownloadData(String.Format("https://kaleidonkep99.altervista.org/kstelemetry/{0}", "pcs.banlist"));
                String pcban    = System.Text.Encoding.UTF8.GetString(pcbanRAW);

                Byte[] macbanRAW = client.DownloadData(String.Format("https://kaleidonkep99.altervista.org/kstelemetry/{0}", "macaddresses.banlist"));
                String macban    = System.Text.Encoding.UTF8.GetString(macbanRAW);

                Byte[] hwidRAW = client.DownloadData(String.Format("https://kaleidonkep99.altervista.org/kstelemetry/{0}", "hwid.banlist"));
                String hwid    = System.Text.Encoding.UTF8.GetString(hwidRAW);

                if (BanStatus == TelemetryStatus.USER_OK)
                {
                    BanStatus = CheckPresence(userban, Environment.UserName, true); // Check userban
                    if (BanStatus == TelemetryStatus.USER_BANNED)
                    {
                        TelemetryStatus.TypeOfBan = TelemetryStatus.USER_BAN;
                    }
                }
                if (BanStatus == TelemetryStatus.USER_OK)
                {
                    BanStatus = CheckPresence(pcban, Environment.MachineName, true); // Check PC ban
                    if (BanStatus == TelemetryStatus.USER_BANNED)
                    {
                        TelemetryStatus.TypeOfBan = TelemetryStatus.PC_BAN;
                    }
                }
                if (BanStatus == TelemetryStatus.USER_OK)
                {
                    BanStatus = CheckPresence(macban, MACAddress, true); // Check MAC address ban
                    if (BanStatus == TelemetryStatus.USER_BANNED)
                    {
                        TelemetryStatus.TypeOfBan = TelemetryStatus.MAC_BAN;
                    }
                }
                if (BanStatus == TelemetryStatus.USER_OK)
                {
                    BanStatus = CheckPresence(hwid, TelemetryExt.ParseHWID(), true); // Check HWID ban
                    if (BanStatus == TelemetryStatus.USER_BANNED)
                    {
                        TelemetryStatus.TypeOfBan = TelemetryStatus.HWID_BAN;
                    }
                }

                return(BanStatus);
            }
            catch { return(TelemetryStatus.DATA_ERROR); }
        }
예제 #2
0
        private void OkBtn_Click(object sender, EventArgs e)
        {
            Enabled = false;

            Int32 UserStatus = TelemetryExt.IsUserBanned();

            if (UserStatus != TelemetryStatus.USER_OK)
            {
                if (UserStatus == TelemetryStatus.USER_BANNED)
                {
                    MessageBox.Show(
                        String.Format("You're not allowed to send telemetry data.{0}", TelemetryStatus.Debug ? String.Format("\n\nReason: {0}", TelemetryStatus.Reasons[TelemetryStatus.TypeOfBan]) : ""),
                        "OmniMIDI - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Enabled = true;
                    Close();
                }
                else
                {
                    MessageBox.Show("Unable to run the telemetry.\n\nPlease try again later.", "OmniMIDI - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Enabled = true;
                }

                return;
            }

            // Do a check first
            if (String.IsNullOrWhiteSpace(NicknameVal.Text))
            {
                MessageBox.Show("Please use a valid (nick)name!", "OmniMIDI - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Enabled = true;
                return;
            }

            if (string.IsNullOrWhiteSpace(EmailVal.Text))
            {
                DialogResult dialogResult = MessageBox.Show("Without specifying your e-mail, I will not be able to communicate with you if an issue arises.\n\nAre you sure you would like to continue sending telemetry data without specifying your e-mail address?", "OmniMIDI - Telemetry warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dialogResult == DialogResult.No)
                {
                    return;
                }
                else
                {
                    EmailVal.Text += "No e-mail address specified";
                }
            }
            else
            {
                if (!TelemetryExt.IsValidEmail(EmailVal.Text))
                {
                    DialogResult dialogResult = MessageBox.Show("Without specifying a valid e-mail, I will not be able to communicate with you if an issue arises.\n\nAre you sure you would like to continue sending telemetry data without specifying a valid e-mail address?", "OmniMIDI - Telemetry warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (dialogResult == DialogResult.No)
                    {
                        return;
                    }
                    else
                    {
                        EmailVal.Text += " (Invalid e-mail address)";
                    }
                }
            }

            if (String.IsNullOrWhiteSpace(InstCPUVal.Text) ||
                String.IsNullOrWhiteSpace(InstRAMVal.Text) ||
                String.IsNullOrWhiteSpace(OSVal.Text) ||
                String.IsNullOrWhiteSpace(InstGPUVal.Text))
            {
                MessageBox.Show("Your PC specifications are mandatory!\nYou can't remove them.", "OmniMIDI - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                LetUserEditSpecs.Checked = false;
                LetUserEditSpecs_CheckedChanged(sender, e);
                Enabled = true;
                return;
            }

            if (SoundCards.SelectedIndex == 0)
            {
                DialogResult dialogResult = MessageBox.Show("Without specifying your default sound card, I will be hard for me to troubleshoot the issue.\n\nAre you sure you would like to continue sending telemetry data without specifying your default sound card?", "OmniMIDI - Telemetry warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dialogResult == DialogResult.No)
                {
                    return;
                }
            }

            if (TelemetryExt.SendInfoForTelemetry(
                    // User info
                    NicknameVal.Text,
                    Environment.UserName,
                    Environment.MachineName,
                    EmailVal.Text,
                    String.Format("{0}", String.IsNullOrWhiteSpace(AgeVal.Text) ? "Not specified" : AgeVal.Text),
                    String.Format("{0}", String.IsNullOrWhiteSpace(CountryVal.Text) ? "Not specified" : CountryVal.Text),

                    // Computer specifications
                    String.Format("{0} (Real value: {1})", InstCPUVal.Text, RealCPU),
                    String.Format("{0} (Real value: {1})", InstGPUVal.Text, RealGPU),
                    String.Format("{0} (Real value: {1})", InstRAMVal.Text, RealRAM),
                    String.Format("{0} (Real value: {1})", OSVal.Text, String.Format("{0}, {1}", RealOS, RealPatch)),
                    SoundCards.Text.ToString(),
                    TelemetryExt.ParseHWID(),
                    MACAddress,

                    // Other info
                    DateTime.Now.ToString("dd MMMM yyyy", TelemetryExt.cultureTelemetry),
                    TelemetryExt.RandomID.Next(0, 2147483647).ToString("0000000000"),
                    String.Format("{0}.{1}.{2}.{3}", Driver.FileMajorPart, Driver.FileMinorPart, Driver.FileBuildPart, Driver.FilePrivatePart),

                    // Feedback
                    String.IsNullOrWhiteSpace(AdditionalFeed.Text) ? "No additional feedback." : AdditionalFeed.Text.ToString().Replace(System.Environment.NewLine, " "),

                    // ?
                    BugReport.Checked))
            {
                MessageBox.Show("The data have been sent!\nThank you for collaborating!\n\nPress OK to close this dialog.", "OmniMIDI - Telemetry complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            CurrentVerKey.Close();
            Close();
        }