Example #1
0
        public void DownloadFile(string urlAddress, string location)
        {
            if (InternetCheck.ConnectToInternet() == true)
            {
                using (webClient = new WebClient())
                {
                    webClient.DownloadFileCompleted   += new AsyncCompletedEventHandler(Completed);
                    webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);

                    Uri URL = urlAddress.StartsWith("https://", StringComparison.OrdinalIgnoreCase) ? new Uri(urlAddress) : new Uri("https://" + urlAddress);

                    sw.Start();

                    try
                    {
                        webClient.DownloadFileAsync(URL, location);
                    }
                    catch (Exception ex)
                    {
                        Logs.DebugErrorLogs(ex);
                        Dialogs.ErrorDialog("Download error", ex.Message);
                    }
                }
            }
            else
            {
                Dialogs.ErrorDialog("Download failed", "Please check your internet connection!");
            }
        }
Example #2
0
 private void howtouseit_Click(object sender, EventArgs e)
 {
     if (InternetCheck.ConnectToInternet() == true)
     {
         if (File.Exists(@"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe") & File.Exists(@"C:\Program Files\Google\Chrome\Application\chrome.exe") == true)
         {
             BrowserCheck.StartBrowser("MicrosoftEdge.exe", "https://github.com/Franco28/MotoTool#getting-started-read-all-please");
         }
         else
         {
             BrowserCheck.StartBrowser("Chrome.exe", "https://github.com/Franco28/MotoTool#getting-started-read-all-please");
         }
     }
     else
     {
         Dialogs.ErrorDialog("Error: " + LangEngine.internetchecktitle, LangEngine.internetcheck);
     }
 }
Example #3
0
 private void contact_Click(object sender, EventArgs e)
 {
     if (InternetCheck.ConnectToInternet() == true)
     {
         if (File.Exists(@"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe") & File.Exists(@"C:\Program Files\Google\Chrome\Application\chrome.exe") == true)
         {
             BrowserCheck.StartBrowser("MicrosoftEdge.exe", "https://t.me/francom28");
         }
         else
         {
             BrowserCheck.StartBrowser("Chrome.exe", "https://t.me/francom28");
         }
     }
     else
     {
         Dialogs.ErrorDialog("Error: " + LangEngine.internetchecktitle, LangEngine.internetcheck);
     }
 }
 private void contact_Click(object sender, EventArgs e)
 {
     if (InternetCheck.ConnectToInternet() == true)
     {
         if (File.Exists(@"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe") & File.Exists(@"C:\Program Files\Google\Chrome\Application\chrome.exe") == true)
         {
             BrowserCheck.StartBrowser("MicrosoftEdge.exe", "https://beckhamtool.000webhostapp.com/");
         }
         else
         {
             BrowserCheck.StartBrowser("Chrome.exe", "https://beckhamtool.000webhostapp.com/");
         }
     }
     else
     {
         Dialogs.ErrorDialog("Error: Network Lost", "Please check your internet connection!");
     }
 }
 public void startDownload(string url, string filepath)
 {
     System.Threading.Thread.Sleep(3000);
     TextBox1.Text = "Checking internet connection ERROR: Please click the option again!";
     try
     {
         if (InternetCheck.Ping("www.google.com") == true)
         {
             TextBox1.Text = "Checking internet connection: OK";
             System.Threading.Thread.Sleep(1000);
             if (!this.IsDisposed)
             {
                 Thread thread = new Thread(() =>
                 {
                     client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
                     client.DownloadFileCompleted   += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
                     client.DownloadFileAsync(new Uri(url), filepath);
                 });
                 thread.Start();
             }
             else
             {
                 KillAsync();
                 closeform();
             }
         }
         else
         {
             TextBox1.Text = "Checking internet connection: ERROR";
             MessageBox.Show("ERROR: CanĀ“t connect to the server to download files!", "Network Lost", MessageBoxButtons.OK, MessageBoxIcon.Error);
             client.Dispose();
             client.CancelAsync();
             KillAsync();
             closeform();
             base.Dispose(Disposing);
         }
     }
     catch (Exception er)
     {
         MessageBox.Show("ERROR: " + er, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #6
0
        private void NotiPanel_Load(object sender, EventArgs e)
        {
            oConfigMng.LoadConfig();

            if (oConfigMng.Config.ToolTheme == "light")
            {
                materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT;
            }
            if (oConfigMng.Config.ToolTheme == "dark")
            {
                materialSkinManager.Theme = MaterialSkinManager.Themes.DARK;
            }

            if (InternetCheck.ConnectToInternet() == false)
            {
                offline.Show();
                offline.Visible = true;
            }
            else
            {
                offline.Hide();
                offline.Visible = false;
            }
        }
        public static void CheckDevice(string device, string readdevice)
        {
            if (InternetCheck.ConnectToInternet() == true)
            {
                if (InternetCheck.CheckServerRed(FirmwareServerPath + device) == false)
                {
                    try
                    {
                        reader = new XmlTextReader(FirmwareServerPath + device);
                        reader.MoveToContent();
                        string elementName = "";
                        if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == readdevice))
                        {
                            while (reader.Read())
                            {
                                if (reader.NodeType == XmlNodeType.Element)
                                {
                                    elementName = reader.Name;
                                }
                                else
                                {
                                    if ((reader.NodeType == XmlNodeType.Text) && (reader.HasValue))
                                    {
                                        switch (elementName)
                                        {
                                        case "amserver":
                                            amserver = reader.Value;
                                            break;

                                        case "retserver":
                                            retserver = reader.Value;
                                            break;

                                        case "othersserver":
                                            othersserver = reader.Value;
                                            break;

                                        case "tefserver":
                                            tefserver = reader.Value;
                                            break;

                                        case "fserverMaintenance":
                                            fserverMaintenance = reader.Value;
                                            break;

                                        case "devicecodename":
                                            devicecodename = reader.Value;
                                            break;

                                        case "twrpname":
                                            twrpname = reader.Value;
                                            break;

                                        case "twrpinstallername":
                                            twrpinstallername = reader.Value;
                                            break;

                                        case "blankflashname":
                                            unbrickname = reader.Value;
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Logs.DebugErrorLogs(ex);
                        Dialogs.ErrorDialog(Strings.DeviceServerErrorTitle, ex.Message);
                    }
                    finally
                    {
                        if (reader != null)
                        {
                            reader.Close();
                        }
                    }
                }
                else
                {
                    Dialogs.ErrorDialog("SERVER IS DOWN", "Please MotoTool will be back when server returns back!");
                }
            }
            else
            {
                Strings.MSGBOXServerNetworkLost();
            }
        }
Example #8
0
        public static void TOOLDOWNLOAD(string serverpath, string serverpath2, string fchannelname)
        {
            if (InternetCheck.ConnectToInternet() == true)
            {
                try
                {
                    reader = new XmlTextReader(xmlUrl + serverpath + serverpath2);
                    reader.MoveToContent();
                    string elementName = "";
                    if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == fchannelname))
                    {
                        while (reader.Read())
                        {
                            if (reader.NodeType == XmlNodeType.Element)
                            {
                                elementName = reader.Name;
                            }
                            else
                            {
                                if ((reader.NodeType == XmlNodeType.Text) && (reader.HasValue))
                                {
                                    switch (elementName)
                                    {
                                    case "url":
                                        downloadUrl  = reader.Value;
                                        DOWNLOADPath = downloadUrl;
                                        break;

                                    case "name":
                                        filename = reader.Value;
                                        break;

                                    case "filepath":
                                        filepath = reader.Value;
                                        SAVEPath = filepath;
                                        break;

                                    case "filepathname":
                                        filepathname = reader.Value;
                                        SAVEPathname = filepathname;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logs.DebugErrorLogs(ex);
                    Dialogs.ErrorDialog("Download Error", ex.Message);
                }
                finally
                {
                    if (reader != null)
                    {
                        reader.Close();
                    }
                }
            }
            else
            {
                Dialogs.ErrorDialog("Network Lost", "Network lost... Please check your internet connection!");
            }
        }
Example #9
0
        private void Firmwares_Load(object sender, EventArgs e)
        {
            oConfigMng.LoadConfig();

            if (oConfigMng.Config.ToolTheme == "light")
            {
                materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT;
            }
            if (oConfigMng.Config.ToolTheme == "dark")
            {
                materialSkinManager.Theme = MaterialSkinManager.Themes.DARK;
            }
            cAppend("FIRMWARE STARTING: Checking internet connection...");
            if (InternetCheck.ConnectToInternet() == true)
            {
                cAppend("FIRMWARE STARTING: Checking internet connection... {OK}");
                label2.Text = " Internet Connection: Online";
            }
            else
            {
                cAppend("FIRMWARE STARTING: Checking internet connection... {ERROR}");
                label2.Text = " Internet Connection: Offline";
            }

            if (oConfigMng.Config.DeviceCodenmae == "")
            {
                cAppend("FIRMWARE STARTING: Please connect your device, so MotoTool can read firmwares!");
                Dialogs.WarningDialog("Device Check", "Please connect your device, so MotoTool can read firmwares!");
                return;
            }

            if (oConfigMng.Config.DeviceCodenmae == oConfigMng.Config.DeviceCodenmae)
            {
                LoadDeviceServer.CheckDevice(oConfigMng.Config.DeviceCodenmae + ".xml", oConfigMng.Config.DeviceCodenmae);
                string tr = "true";
                cAppend("FIRMWARE STARTING: Checking server...");
                if (LoadDeviceServer.fserverMaintenance == tr)
                {
                    cAppend("FIRMWARE STARTING: Firmware server is on maintenance! Please this will be back soon...");
                    Dialogs.WarningDialog("Firmware server is on maintenance", "Please this will be back soon...");
                    return;
                }
                else
                {
                    materialButtonFirmwareServer.Enabled = true;
                    cAppend("FIRMWARE STARTING: Checking server... {OK}");
                }
            }

            cAppend("FIRMWARE STARTING: Checking device info... ");
            if (oConfigMng.Config.DeviceCodenmae == "lima")
            {
                materialButtonRETAIL.Enabled  = true;
                materialButtonRETAPAC.Enabled = true;
                materialButtonRETAR.Enabled   = true;
                materialButtonRETIN.Enabled   = true;
                materialButtonRETBR.Enabled   = true;
                materialButtonRETCA.Enabled   = true;
                materialButtonRETEU.Enabled   = true;
                materialButtonRETLA.Enabled   = true;
                materialButtonRETGB.Enabled   = true;
                materialButtonRETCL.Enabled   = true;
                materialButtonTEFBR.Enabled   = true;
                materialButtonOPENCL.Enabled  = true;
                materialButtonOPENMX.Enabled  = true;
                materialButtonOPENLA.Enabled  = true;
                materialButtonOPENPE.Enabled  = true;
                materialButtonEEGB.Enabled    = true;
                cAppend("FIRMWARE STARTING: Checking device info... {" + oConfigMng.Config.DeviceCodenmae + "}");
            }
            if (oConfigMng.Config.DeviceCodenmae == "sofiar")
            {
                materialButtonAMXLA.Enabled  = true;
                materialButtonAMXCL.Enabled  = true;
                materialButtonAMXCO.Enabled  = true;
                materialButtonATTMX.Enabled  = true;
                materialButtonOPENMX.Enabled = true;
                materialButtonRETLA.Enabled  = true;
                materialButtonRETAR.Enabled  = true;
                materialButtonRETEU.Enabled  = true;
                cAppend("FIRMWARE STARTING: Checking device info... {" + oConfigMng.Config.DeviceCodenmae + "}");
            }
            if (oConfigMng.Config.DeviceCodenmae == "beckham")
            {
                materialButtonAMXBR.Enabled   = true;
                materialButtonAMXLA.Enabled   = true;
                materialButtonAMXM.Enabled    = true;
                materialButtonAMZ.Enabled     = true;
                materialButtonRETAIL.Enabled  = true;
                materialButtonRETAPAC.Enabled = true;
                materialButtonRETAR.Enabled   = true;
                materialButtonRETBR.Enabled   = true;
                materialButtonRETCA.Enabled   = true;
                materialButtonRETEU.Enabled   = true;
                materialButtonRETUS.Enabled   = true;
                materialButtonRETLA.Enabled   = true;
                materialButtonTEFBR.Enabled   = true;
                materialButtonTEFCL.Enabled   = true;
                materialButtonTEFCO.Enabled   = true;
                materialButtonTEFPE.Enabled   = true;
                materialButtonATTMX.Enabled   = true;
                materialButtonBWACA.Enabled   = true;
                materialButtonDTEU.Enabled    = true;
                materialButtonNIIPE.Enabled   = true;
                materialButtonOPENCL.Enabled  = true;
                materialButtonOPENMX.Enabled  = true;
                materialButtonSprint.Enabled  = true;
                materialButtonTIGCO.Enabled   = true;
                materialButtonTIMBR.Enabled   = true;
                materialButtonUSC.Enabled     = true;
                cAppend("FIRMWARE STARTING: Checking device info... {" + oConfigMng.Config.DeviceCodenmae + "}");
            }
            if (oConfigMng.Config.DeviceCodenmae == "doha")
            {
                materialButtonAMXBR.Enabled   = true;
                materialButtonAMXLA.Enabled   = true;
                materialButtonAMXM.Enabled    = true;
                materialButtonAMXCL.Enabled   = true;
                materialButtonAMXPE.Enabled   = true;
                materialButtonRETIN.Enabled   = true;
                materialButtonRETRU.Enabled   = true;
                materialButtonRETAIL.Enabled  = true;
                materialButtonRETAPAC.Enabled = true;
                materialButtonRETAR.Enabled   = true;
                materialButtonRETBR.Enabled   = true;
                materialButtonRETEU.Enabled   = true;
                materialButtonTEFMX.Enabled   = true;
                materialButtonORAEU.Enabled   = true;
                materialButtonPLUSPL.Enabled  = true;
                materialButtonTIGCA.Enabled   = true;
                materialButtonATTMX.Enabled   = true;
                materialButtonOPENCL.Enabled  = true;
                materialButtonOPENMX.Enabled  = true;
                cAppend("FIRMWARE STARTING: Checking device info... {" + oConfigMng.Config.DeviceCodenmae + "}");
            }
            if (oConfigMng.Config.DeviceCodenmae == "evert" &&
                oConfigMng.Config.DeviceCodenmae == "potter" &&
                oConfigMng.Config.DeviceCodenmae == "lake")
            {
                materialButtonAMXBR.Enabled = true;
                materialButtonAMXLA.Enabled = true;
                materialButtonAMXM.Enabled  = true;
                materialButtonAMXCL.Enabled = true;
                materialButtonAMXPE.Enabled = true;
                materialButtonAMXCO.Enabled = true;
                materialButtonTEFBR.Enabled = true;
                materialButtonTEFCO.Enabled = true;
                materialButtonTEFMX.Enabled = true;
                materialButtonTEFES.Enabled = true;

                if (oConfigMng.Config.DeviceCodenmae == "evert")
                {
                    materialButtonRETUS.Enabled    = true;
                    materialButtonRETGB.Enabled    = true;
                    materialButtonRETIN.Enabled    = true;
                    materialButtonRETAIL.Enabled   = true;
                    materialButtonRETAPAC.Enabled  = true;
                    materialButtonRETAR.Enabled    = true;
                    materialButtonRETBR.Enabled    = true;
                    materialButtonRETEU.Enabled    = true;
                    materialButtonRETLA.Enabled    = true;
                    materialButtonRETLA1ST.Enabled = true;
                    materialButtonWOMCL.Enabled    = true;
                    materialButtonTIMBR.Enabled    = true;
                    materialButtonTIGCO.Enabled    = true;
                    materialButtonENTCL.Enabled    = true;
                    cAppend("FIRMWARE STARTING: Checking device info... {" + oConfigMng.Config.DeviceCodenmae + "}");
                }
                if (oConfigMng.Config.DeviceCodenmae == "potter")
                {
                    materialButtonRETUS.Enabled    = true;
                    materialButtonRETGB.Enabled    = true;
                    materialButtonRETIN.Enabled    = true;
                    materialButtonRETAIL.Enabled   = true;
                    materialButtonRETAPAC.Enabled  = true;
                    materialButtonRETAR.Enabled    = true;
                    materialButtonRETBR.Enabled    = true;
                    materialButtonRETEU.Enabled    = true;
                    materialButtonRETLA.Enabled    = true;
                    materialButtonRETLA1ST.Enabled = true;
                    materialButtonRETMX.Enabled    = true;
                    materialButtonTIMBR.Enabled    = true;
                    materialButtonTIGCO.Enabled    = true;
                    cAppend("FIRMWARE STARTING: Checking device info... {" + oConfigMng.Config.DeviceCodenmae + "}");
                }
                if (oConfigMng.Config.DeviceCodenmae == "lake")
                {
                    materialButtonRETGB.Enabled   = true;
                    materialButtonRETAIL.Enabled  = true;
                    materialButtonRETAPAC.Enabled = true;
                    materialButtonRETAR.Enabled   = true;
                    materialButtonRETBR.Enabled   = true;
                    materialButtonRETEU.Enabled   = true;
                    materialButtonRETLA.Enabled   = true;
                    materialButtonRETRU.Enabled   = true;
                    materialButtonTEFBR.Enabled   = true;
                    materialButtonTEFCO.Enabled   = true;
                    materialButtonTEFMX.Enabled   = true;
                    materialButtonEEGB.Enabled    = true;
                    materialButtonORAEU.Enabled   = true;
                    materialButtonTMO.Enabled     = true;
                    materialButtonENTCL.Enabled   = true;
                    materialButtonTIMBR.Enabled   = true;
                    materialButtonWOMCL.Enabled   = true;
                    materialButtonTIGCO.Enabled   = true;
                    cAppend("FIRMWARE STARTING: Checking device info... {" + oConfigMng.Config.DeviceCodenmae + "}");
                }
            }
            if (oConfigMng.Config.DeviceCodenmae == "river")
            {
                materialButtonAMXBR.Enabled   = true;
                materialButtonAMZ.Enabled     = true;
                materialButtonRETGB.Enabled   = true;
                materialButtonRETAIL.Enabled  = true;
                materialButtonRETAPAC.Enabled = true;
                materialButtonRETAR.Enabled   = true;
                materialButtonRETBR.Enabled   = true;
                materialButtonRETEU.Enabled   = true;
                materialButtonRETLA.Enabled   = true;
                materialButtonRETRU.Enabled   = true;
                materialButtonRETUS.Enabled   = true;
                materialButtonRETIN.Enabled   = true;
                materialButtonTEFBR.Enabled   = true;
                materialButtonTEFCO.Enabled   = true;
                materialButtonTEFPE.Enabled   = true;
                materialButtonOPENCL.Enabled  = true;
                materialButtonOPENMX.Enabled  = true;
                materialButtonTIMBR.Enabled   = true;
                materialButtonNIIPE.Enabled   = true;
                materialButtonTIGCO.Enabled   = true;
                cAppend("FIRMWARE STARTING: Checking device info... {" + oConfigMng.Config.DeviceCodenmae + "}");
            }
            if (oConfigMng.Config.DeviceCodenmae == "sanders")
            {
                materialButtonAMXBR.Enabled   = true;
                materialButtonRETGB.Enabled   = true;
                materialButtonRETAIL.Enabled  = true;
                materialButtonRETAPAC.Enabled = true;
                materialButtonRETAR.Enabled   = true;
                materialButtonRETBR.Enabled   = true;
                materialButtonRETLA.Enabled   = true;
                materialButtonRETRU.Enabled   = true;
                materialButtonRETUS.Enabled   = true;
                materialButtonRETIN.Enabled   = true;
                materialButtonTEFBR.Enabled   = true;
                materialButtonOPENMX.Enabled  = true;
                materialButtonTIMBR.Enabled   = true;
                cAppend("FIRMWARE STARTING: Checking device info... {" + oConfigMng.Config.DeviceCodenmae + "}");
            }
        }