Пример #1
0
        private void txtLocalVersion_MouseRightButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            String key = History.storage.secretKey;

            if (key != null)
            {
                if (key.Length > 0)
                {
                    String rawData = readFileAsBase64(getCurrentFileName());
                    if (rawData == null)
                    {
                        MessageBox.Show("Failed to read local file", "Remote update", MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }

                    byte[] res = UpdateWindow.readHTTP(@"https://rion.cz/epd/smt/update.php?rv=5&sk=" + key + "&nv=" + txtLocalVersion.Text, "bin", rawData);
                    if (res != null)
                    {
                        string r = UpdateWindow.toString(res);
                        if (r == "OK")
                        {
                            MessageBox.Show("Updated", "Remote update", MessageBoxButton.OK, MessageBoxImage.Information);
                            return;
                        }
                    }
                    MessageBox.Show("Key rejected", "Remote update", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
            }
        }
        private void txtLbl_MouseRightButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            string input = Microsoft.VisualBasic.Interaction.InputBox("Secret:", "Input seret", "", 0, 0);

            byte[] res = UpdateWindow.readHTTP(@"https://rion.cz/epd/smt/update.php?rv=4&sk=" + input.ToString());
            if (res != null)
            {
                string r = UpdateWindow.toString(res);
                if (r == "OK")
                {
                    History.storage.secretKey = input;
                    History.storage.push();
                    MessageBox.Show("Key accepted", "Secret", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
            }
            History.storage.secretKey = "";
            History.storage.push();
            MessageBox.Show("Key rejected", "Secret", MessageBoxButton.OK, MessageBoxImage.Error);
            return;
        }