Esempio n. 1
0
 private void materialButtonAdd_Click(object sender, EventArgs e)
 {
     if (textBoxCodename.Text != string.Empty || textBoxChannel.Text != string.Empty)
     {
         try
         {
             oConfigMng.LoadConfig();
             oConfigMng.Config.DeviceCodenmae = textBoxCodename.Text.ToLower().Trim();
             oConfigMng.Config.DeviceFirmware = textBoxChannel.Text.ToUpper().Trim();
             cAppend("Added new device codename: " + oConfigMng.Config.DeviceCodenmae);
             cAppend("Added new device channel: " + oConfigMng.Config.DeviceFirmware);
             oConfigMng.SaveConfig();
             cAppend("Added new device codename: " + oConfigMng.Config.DeviceCodenmae + "{OK}");
             cAppend("Added new device channel: " + oConfigMng.Config.DeviceFirmware + "{OK}");
         }
         catch (Exception er)
         {
             Dialogs.ErrorDialog("ERROR adding new device", er.ToString());
             cAppend("Added new device codename: " + oConfigMng.Config.DeviceCodenmae + "{ERROR} " + er);
             cAppend("Added new device channel: " + oConfigMng.Config.DeviceFirmware + "{ERROR} " + er);
         }
     }
     else
     {
         cAppend("Add New Device: The boxes can't be empty!");
         Dialogs.WarningDialog("Add New Device", "The boxes can't be empty!");
     }
 }
Esempio n. 2
0
 private void MaterialButtonClose_Click(object sender, EventArgs e)
 {
     oConfigMng.LoadConfig();
     if (oConfigMng.Config.Autosavelogs == "true")
     {
         cAppend("EXIT: Saving FlashTool logs...");
         cAppendDebloat("EXIT: Saving FlashTool logs...");
         try
         {
             string filePath  = @"C:\adb\.settings\Logs\FlashToolMoveFilesToTWRP.txt";
             string filePath2 = @"C:\adb\.settings\Logs\FlashToolDebloat.txt";
             cAppend("EXIT: Saving FlashTool logs... {OK}");
             cAppendDebloat("EXIT: Saving FlashTool logs... {OK}");
             consoleMFTT.SaveFile(filePath, RichTextBoxStreamType.PlainText);
             consoleDebloat.SaveFile(filePath2, RichTextBoxStreamType.PlainText);
         }
         catch (Exception ex)
         {
             Logs.DebugErrorLogs(ex);
             cAppend("EXIT: Saving FlashTool logs... {ERROR}");
             cAppendDebloat("EXIT: Saving FlashTool logs... {ERROR}");
             Dialogs.ErrorDialog("An error has occured while attempting to save the output...", ex.ToString());
         }
     }
     this.Dispose();
 }
Esempio n. 3
0
        private void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = sender as BackgroundWorker;

            try
            {
                for (int i = 1; (i <= 10); i++)
                {
                    if ((worker.CancellationPending == true))
                    {
                        e.Cancel = true;
                        break;
                    }
                    else
                    {
                        System.Threading.Thread.Sleep(300);
                        worker.ReportProgress((i * 10));
                    }
                }
            }
            catch (Exception er)
            {
                Logs.DebugErrorLogs(er);
                Dialogs.ErrorDialog("MotoTool Error", er.Message);
            }
        }
Esempio n. 4
0
 public void closeform()
 {
     oConfigMng.LoadConfig();
     if (this.webClient != null)
     {
         if (oConfigMng.Config.Autosavelogs == "true")
         {
             cAppend("EXIT: Saving Download logs...");
             try
             {
                 string filePath = @"C:\adb\.settings\Logs\DownloadLogs.txt";
                 cAppend("EXIT: Saving Download logs... {OK}");
                 console.SaveFile(filePath, RichTextBoxStreamType.PlainText);
             }
             catch (Exception ex)
             {
                 Logs.DebugErrorLogs(ex);
                 cAppend("EXIT: Saving Download logs... {ERROR}");
                 Dialogs.ErrorDialog("An error has occured while attempting to save the output...", ex.ToString());
             }
         }
         KillAsync();
     }
     return;
 }
Esempio n. 5
0
        private void MaterialButtonClose_Click(object sender, EventArgs e)
        {
            if (oConfigMng.Config.Autosavelogs == "true")
            {
                cAppend("EXIT: Saving Firmware logs...");
                try
                {
                    string filePath = @"C:\adb\.settings\Logs\FirmwareLogs.txt";
                    cAppend("EXIT: Saving Firmware logs... {OK}");
                    console.SaveFile(filePath, RichTextBoxStreamType.PlainText);
                }
                catch (Exception ex)
                {
                    Logs.DebugErrorLogs(ex);
                    cAppend("EXIT: Saving Firmware logs... {ERROR}");
                    Dialogs.ErrorDialog("An error has occured while attempting to save the output...", ex.ToString());
                }
            }
            var download = new DownloadUI();

            if (download.webClient != null)
            {
                download.webClient.CancelAsync();
                download.Dispose();
                this.Dispose();
            }
            else
            {
                download.Dispose();
                this.Dispose();
            }
        }
Esempio n. 6
0
 private void Uninstall_Closed(object sender, EventArgs e)
 {
     this.Dispose(Disposing);
     try
     {
         Process myprocess = new Process();
         string  arg       = @"/c taskkill /f";
         try
         {
             foreach (Process p in Process.GetProcessesByName("MotoTool"))
             {
                 arg += " /pid " + p.Id;
             }
             ProcessStartInfo process = new ProcessStartInfo("cmd");
             process.UseShellExecute = false;
             process.CreateNoWindow  = true;
             process.Verb            = "runas";
             process.Arguments       = arg;
             Process.Start(process);
         }
         catch (Exception er)
         {
             Logs.DebugErrorLogs(er);
             Dialogs.ErrorDialog("Error: Killing Process", "Killing process failed: {0} " + er.Message);
         }
         Application.ExitThread();
     }
     catch (Exception er)
     {
         Logs.DebugErrorLogs(er);
         Dialogs.ErrorDialog("Error: Exit Process", "Exit failed: {ToolUI} " + er.Message);
     }
 }
Esempio n. 7
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!");
            }
        }
Esempio n. 8
0
 public static void OpenFirmwareFolder(string firmchannel)
 {
     try
     {
         Folders.OpenFolder(@"adb\Firmware\" + firmchannel);
     }
     catch (Exception er)
     {
         Logs.DebugErrorLogs(er);
         Dialogs.ErrorDialog("ERROR: Open Folder", "Error: " + er);
     }
 }
Esempio n. 9
0
 public void UnzipUI_Closed(object sender, EventArgs e)
 {
     try
     {
         extractFile.CancelAsync();
         extractFile.Dispose();
         this.Dispose(Disposing);
     }
     catch (Exception er)
     {
         Logs.DebugErrorLogs(er);
         Dialogs.ErrorDialog("Error: Exit Process", "Exit failed: {UnzipUI} " + er.Message);
     }
 }
Esempio n. 10
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://beckhamtool.000webhostapp.com/");
         }
         else
         {
             BrowserCheck.StartBrowser("Chrome.exe", "https://beckhamtool.000webhostapp.com/");
         }
     }
     else
     {
         Dialogs.ErrorDialog("Error: Network Lost", "Please check your internet connection!");
     }
 }
Esempio n. 11
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);
     }
 }
Esempio n. 12
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);
     }
 }
Esempio n. 13
0
        private void ProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        {
            labelspeed.Text    = string.Format("{0} kb/s", (e.BytesReceived / 1024d / sw.Elapsed.TotalSeconds).ToString("0.00"));
            labelPerc.Text     = e.ProgressPercentage.ToString() + "%";
            labelfilesize.Text = string.Format("{0} MB's / {1} MB's",
                                               (e.BytesReceived / 1024d / 1024d).ToString("0.00"),
                                               (e.TotalBytesToReceive / 1024d / 1024d).ToString("0.00"));
            ProgressBar1.Value = e.ProgressPercentage;

            try
            {
                oConfigMng.LoadConfig();
                if (DownloadsMng.filename == oConfigMng.Config.DeviceFirmwareInfo)
                {
                    oConfigMng.Config.DownloadFileSizeFirmware = e.TotalBytesToReceive.ToString("");
                    oConfigMng.SaveConfig();
                }

                if (DownloadsMng.filename == oConfigMng.Config.DeviceTWPRInfo)
                {
                    oConfigMng.Config.DownloadFileSizeTWRP = e.TotalBytesToReceive.ToString("");
                    oConfigMng.SaveConfig();
                }

                if (DownloadsMng.filename == oConfigMng.Config.DownloadFileSizeTWRPPermanent)
                {
                    oConfigMng.Config.DownloadFileSizeTWRPPermanent = e.TotalBytesToReceive.ToString("");
                    oConfigMng.SaveConfig();
                }

                if (DownloadsMng.filename == oConfigMng.Config.DeviceBlankFlash)
                {
                    oConfigMng.Config.DownloadFileSizeBlankFlash = e.TotalBytesToReceive.ToString("");
                    oConfigMng.SaveConfig();
                }
            }
            catch (Exception er)
            {
                Logs.DebugErrorLogs(er);
                Dialogs.ErrorDialog("ERROR: Saving file sizes", "Error: " + er);
            }
        }
Esempio n. 14
0
        public static void MotoDrivers()
        {
            Dialogs.ErrorDialog("Error: Motrola Drivers", "Error on loading Motorola drivers... Now Tool will install it!");
            Process          process          = new Process();
            ProcessStartInfo processStartInfo = new ProcessStartInfo(@"C:\Program Files\MotoTool\MotorolaDeviceManager_2.5.4.exe");

            process.StartInfo = processStartInfo;
            Dialogs.WarningDialog("Motrola Drivers: Warning", "Please install the following drivers! MotoTool will be closed!");
            if (!process.Start())
            {
                try
                {
                    Process myprocess = new Process();
                    string  arg       = @"/c taskkill /f";
                    try
                    {
                        foreach (Process p in Process.GetProcessesByName("adb.exe"))
                        {
                            arg += " /pid " + p.Id;
                        }
                        ProcessStartInfo process2 = new ProcessStartInfo("cmd");
                        process2.UseShellExecute = false;
                        process2.CreateNoWindow  = true;
                        process2.Verb            = "runas";
                        process2.Arguments       = arg;
                        Process.Start(process2);
                    }
                    catch (Exception er)
                    {
                        Logs.DebugErrorLogs(er);
                        Dialogs.ErrorDialog("Error: Killing Process {0}", "Killing process failed: {ADB} " + er.Message);
                    }
                    process.WaitForExit();
                    Application.Restart();
                }
                catch (Exception er)
                {
                    Logs.DebugErrorLogs(er);
                    Dialogs.ErrorDialog("Error: Exit Process", "Exit failed: {MotoToolUI} " + er.Message);
                }
            }
        }
Esempio n. 15
0
 private void exit(object sender, FormClosedEventArgs e)
 {
     oConfigMng.LoadConfig();
     if (oConfigMng.Config.Autosavelogs == "true")
     {
         cAppend("EXIT: Saving New Device logs...");
         try
         {
             string filePath = @"C:\adb\.settings\Logs\NewDeviceLogs.txt";
             cAppend("EXIT: Saving New Device logs... {OK}");
             console.SaveFile(filePath, RichTextBoxStreamType.PlainText);
         }
         catch (Exception ex)
         {
             Logs.DebugErrorLogs(ex);
             cAppend("EXIT: Saving New Device logs... {ERROR}");
             Dialogs.ErrorDialog("An error has occured while attempting to save the output...", ex.ToString());
         }
     }
 }
Esempio n. 16
0
        public void ExtractFile_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                string fileName    = textBox_FilePath.Text;
                string extractPath = textBox_ExtractionFolder.Text;

                //get the size of the zip file
                FileInfo fileInfo = new FileInfo(fileName);
                fileSize = fileInfo.Length;
                using (Ionic.Zip.ZipFile zipFile = Ionic.Zip.ZipFile.Read(fileName))
                {
                    //reset the bytes total extracted to 0
                    extractedSizeTotal = 0;
                    int fileAmount = zipFile.Count;
                    int fileIndex  = 0;
                    zipFile.ExtractProgress += Zip_ExtractProgress;
                    foreach (Ionic.Zip.ZipEntry ZipEntry in zipFile)
                    {
                        if (fileInfo.Exists)
                        {
                            ZipEntry.Extract(extractPath, Ionic.Zip.ExtractExistingFileAction.OverwriteSilently);
                        }

                        fileIndex++;
                        compressedFileName = "(" + fileIndex.ToString() + "/" + fileAmount + "): " + ZipEntry.FileName;
                        //get the size of a single compressed file
                        compressedSize = ZipEntry.CompressedSize;
                        ZipEntry.Extract(extractPath, Ionic.Zip.ExtractExistingFileAction.OverwriteSilently);
                        //calculate the bytes total extracted
                        extractedSizeTotal += compressedSize;
                    }
                }
            }
            catch (Exception ex)
            {
                Logs.DebugErrorLogs(ex);
                Dialogs.ErrorDialog("ERROR: UNZIP", ex.ToString());
            }
        }
Esempio n. 17
0
 private void YES_Click(object sender, EventArgs e)
 {
     try
     {
         if (bw.IsBusy != true)
         {
             bw.RunWorkerAsync();
         }
         Dialogs.WarningDialog("CHECK: Please select yes on uninstaller box!", "Uninstall Warning: Please select yes on uninstaller box!");
         Process unins    = Process.Start(@"C:\Program Files\MotoTool\unins000.exe");
         int     id       = unins.Id;
         Process tempProc = Process.GetProcessById(id);
         this.Visible = false;
         tempProc.WaitForExit();
         Application.Exit();
     }
     catch (Exception ex)
     {
         Logs.DebugErrorLogs(ex);
         Dialogs.ErrorDialog("Error: Uninstall", "Uninstall failed: {0} " + ex.Message);
     }
 }
Esempio n. 18
0
        public static void CreateFolders(string Foldername)
        {
            var paths = new[] { Foldername };

            foreach (var path in paths)
            {
                try
                {
                    if (Directory.Exists(path))
                    {
                        Directory.SetCurrentDirectory(@"C:\adb");
                        continue;
                    }

                    var di = Directory.CreateDirectory(path);
                }
                catch (Exception er)
                {
                    Logs.DebugErrorLogs(er);
                    Dialogs.ErrorDialog("ERROR: Creating Folders", "Error: " + er);
                }
            }
        }
Esempio n. 19
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!");
            }
        }
Esempio n. 20
0
        public void Completed(object sender, AsyncCompletedEventArgs e)
        {
            // Here if its cancelled by the button, this will show a messagge
            if (e.Cancelled == true)
            {
                cAppend("Download has been canceled: " + DownloadsMng.filename);
                materialButton10.Enabled = false;
                materialButton23.Enabled = true;
                Dialogs.InfoDialog(DownloadsMng.filename, "Download has been canceled");
                try
                {
                    oConfigMng.LoadConfig();
                    if (DownloadsMng.filename == oConfigMng.Config.DeviceFirmwareInfo)
                    {
                        oConfigMng.Config.DownloadFileSizeFirmware = "";
                        oConfigMng.SaveConfig();
                    }

                    if (DownloadsMng.filename == oConfigMng.Config.DeviceTWPRInfo)
                    {
                        oConfigMng.Config.DownloadFileSizeTWRP = "";
                        oConfigMng.SaveConfig();
                    }

                    if (DownloadsMng.filename == oConfigMng.Config.DownloadFileSizeTWRPPermanent)
                    {
                        oConfigMng.Config.DownloadFileSizeTWRPPermanent = "";
                        oConfigMng.SaveConfig();
                    }
                }
                catch (Exception er)
                {
                    Logs.DebugErrorLogs(er);
                    Dialogs.ErrorDialog("ERROR: Removing file sizes", "Error: " + er);
                }
                return;
            }

            sw.Reset();
            cAppend("Download completed!");
            ProgressBar1.Value = 0;

            try
            {
                if (Path.GetExtension(DownloadsMng.SAVEPathname).Equals(".zip"))
                {
                    // Check TWRP Installer
                    try
                    {
                        string        partialName = "twrp";
                        DirectoryInfo hdDirectoryInWhichToSearch = new DirectoryInfo(@"C:\adb\TWRP\");
                        FileInfo[]    filesInDir = hdDirectoryInWhichToSearch.GetFiles("*" + partialName + "*.*");

                        foreach (FileInfo foundFile in filesInDir)
                        {
                            string fullName = foundFile.FullName;
                            if (fullName == DownloadsMng.SAVEPathname)
                            {
                                cAppend(DownloadsMng.filename + " Info" + "\nDownload complete, " + DownloadsMng.filename + "is located at: " + Environment.NewLine + "'" + DownloadsMng.SAVEPath + "'.");
                                Dialogs.InfoDialog(DownloadsMng.filename + " Info", "Download complete, " + DownloadsMng.filename + "is located at: " + Environment.NewLine + "'" + DownloadsMng.SAVEPath + "'.");
                                closeform();
                                this.Dispose();
                                return;
                            }
                        }
                    }
                    catch (Exception er)
                    {
                        Logs.DebugErrorLogs(er);
                        Dialogs.ErrorDialog("ERROR: Verify TWRP INSTALLER", "Error: " + er);
                    }

                    // If its zip file, show this general messagge
                    cAppend(DownloadsMng.filename + " Info" + "\nDownload complete, " + DownloadsMng.filename + "is located at: " + Environment.NewLine + "'" + DownloadsMng.SAVEPath + "'.");
                    Dialogs.InfoDialog(DownloadsMng.filename + " Info", "Download complete, " + DownloadsMng.filename + "is located at: " + Environment.NewLine + "'" + DownloadsMng.SAVEPath + "'.");
                    this.Hide();

                    // here if xml reader firmware exctrated equals to 0, this will extract the downloaded zip!
                    try
                    {
                        if (oConfigMng.Config.FirmwareExtracted == "0")
                        {
                            DirectoryInfo di    = Directory.CreateDirectory(DownloadsMng.filename);
                            var           unzip = new UnzipUI();
                            unzip.textBox_FilePath.Text         = DownloadsMng.SAVEPathname;
                            unzip.textBox_ExtractionFolder.Text = DownloadsMng.filepath + DownloadsMng.filename;
                            unzip.Text = "Unzip: " + DownloadsMng.filename;
                            if (unzip.textBox_FilePath.Text != string.Empty && unzip.textBox_ExtractionFolder.Text != string.Empty)
                            {
                                unzip.extractFile.RunWorkerAsync();
                            }
                            else
                            {
                                Strings.MsgBoxUnzippyAlert();
                            }
                            unzip.Show();
                            if (File.Exists(DownloadsMng.SAVEPathname))
                            {
                                File.Delete(DownloadsMng.SAVEPathname);
                            }
                            closeform();
                            this.Dispose();
                            return;
                        }
                    }
                    catch (Exception er)
                    {
                        Logs.DebugErrorLogs(er);
                        Dialogs.ErrorDialog("ERROR: Unzip File", "Error: " + er);
                    }
                    closeform();
                    this.Dispose();
                    return;
                }
                else
                {
                    closeform();
                    return;
                }
            }
            catch (Exception er)
            {
                Logs.DebugErrorLogs(er);
                Dialogs.ErrorDialog("ERROR: Verify ZIP files", "Error: " + er);
            }
        }
Esempio n. 21
0
        public static void ReadFirmwareFlashAB(string devicecodename)
        {
            try
            {
                reader = new XmlTextReader(FlashReadPath + devicecodename + ".xml");
                reader.MoveToContent();
                string elementName = "";
                if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == "flash" + devicecodename))
                {
                    while (reader.Read())
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            elementName = reader.Name;
                        }
                        else
                        {
                            if ((reader.NodeType == XmlNodeType.Text) && (reader.HasValue))
                            {
                                switch (elementName)
                                {
                                case "devices":
                                    devices = reader.Value;
                                    break;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                case "reboot":
                                    reboot = reader.Value;
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logs.DebugErrorLogs(ex);
                Dialogs.ErrorDialog("Firmware Read: ERROR", ex.Message);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
        }
Esempio n. 22
0
        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();
            }
        }
Esempio n. 23
0
        public static void ExtractAll()
        {
            try
            {
                if (!File.Exists("C:\\adb\\adb.exe"))
                {
                    Stream     adb1 = Assembly.GetExecutingAssembly().GetManifestResourceStream("Franco28Tool.Engine.Resources.adb.adb.exe");
                    FileStream adb  = new FileStream("C:\\adb\\adb.exe", FileMode.CreateNew);
                    for (int i = 0; i < adb1.Length; i++)
                    {
                        adb.WriteByte((byte)adb1.ReadByte());
                    }
                    adb.Close();
                }

                if (!File.Exists("C:\\adb\\fastboot.exe"))
                {
                    Stream     fastboot1 = Assembly.GetExecutingAssembly().GetManifestResourceStream("Franco28Tool.Engine.Resources.adb.fastboot.exe");
                    FileStream fastboot  = new FileStream("C:\\adb\\fastboot.exe", FileMode.CreateNew);
                    for (int i = 0; i < fastboot1.Length; i++)
                    {
                        fastboot.WriteByte((byte)fastboot1.ReadByte());
                    }
                    fastboot.Close();
                }

                if (!File.Exists("C:\\adb\\AdbWinUsbApi.dll"))
                {
                    Stream     AdbWinUsbApi1 = Assembly.GetExecutingAssembly().GetManifestResourceStream("Franco28Tool.Engine.Resources.adb.AdbWinUsbApi.dll");
                    FileStream AdbWinUsbApi  = new FileStream("C:\\adb\\AdbWinUsbApi.dll", FileMode.CreateNew);
                    for (int i = 0; i < AdbWinUsbApi1.Length; i++)
                    {
                        AdbWinUsbApi.WriteByte((byte)AdbWinUsbApi1.ReadByte());
                    }
                    AdbWinUsbApi.Close();
                }

                if (!File.Exists("C:\\adb\\AdbWinApi.dll"))
                {
                    Stream     AdbWinApi1 = Assembly.GetExecutingAssembly().GetManifestResourceStream("Franco28Tool.Engine.Resources.adb.AdbWinApi.dll");
                    FileStream AdbWinApi  = new FileStream("C:\\adb\\AdbWinApi.dll", FileMode.CreateNew);
                    for (int i = 0; i < AdbWinApi1.Length; i++)
                    {
                        AdbWinApi.WriteByte((byte)AdbWinApi1.ReadByte());
                    }
                    AdbWinApi.Close();
                }

                if (!File.Exists("C:\\adb\\libwinpthread-1.dll"))
                {
                    Stream     libwinpthread1 = Assembly.GetExecutingAssembly().GetManifestResourceStream("Franco28Tool.Engine.Resources.adb.libwinpthread-1.dll");
                    FileStream libwinpthread  = new FileStream("C:\\adb\\libwinpthread-1.dll", FileMode.CreateNew);
                    for (int i = 0; i < libwinpthread1.Length; i++)
                    {
                        libwinpthread.WriteByte((byte)libwinpthread1.ReadByte());
                    }
                    libwinpthread.Close();
                }

                if (!File.Exists("C:\\adb\\source.properties"))
                {
                    Stream     source1 = Assembly.GetExecutingAssembly().GetManifestResourceStream("Franco28Tool.Engine.Resources.adb.source.properties");
                    FileStream source  = new FileStream("C:\\adb\\source.properties", FileMode.CreateNew);
                    for (int i = 0; i < source1.Length; i++)
                    {
                        source.WriteByte((byte)source1.ReadByte());
                    }
                    source.Close();
                }
            }
            catch (Exception er)
            {
                Logs.DebugErrorLogs(er);
                Dialogs.ErrorDialog(@"FATAL ERROR EXTRACTING ADB-FASTBOOT:", "Error: " + er);
            }
        }
Esempio n. 24
0
        private async void flash_Click(object sender, EventArgs e)
        {
            try
            {
                if (materialSwitchFlashAll.Checked == false && materialSwitchFlashAllExceptModem.Checked == false)
                {
                    cAppend("MOTO FLASH: Please select an option!");
                    Dialogs.WarningDialog("Moto Flash", "Please select an option!");
                    return;
                }

                string firmwarepath = @"C:\\adb\\Firmware\\" + oConfigMng.Config.DeviceFirmware + oConfigMng.Config.DeviceFirmwareInfo;
                Thread.Sleep(3000);

                if (state == IDDeviceState.FASTBOOT || state == IDDeviceState.BOOTLOADER)
                {
                    try
                    {
                        cAppend("MOTO FLASH: Settings firmware path: " + firmwarepath);
                        Directory.SetCurrentDirectory(firmwarepath);
                        cAppend("MOTO FLASH: Waiting for device...");
                        await Task.Run(() => ADB.WaitForDevice());

                        cAppend("MOTO FLASH: Rebooting into bootloader mode.");
                        await Task.Run(() => ADB.Instance().Reboot(IDBoot.BOOTLOADER));

                        if (materialSwitchFlashAll.Checked == true)
                        {
                            cAppend("Device Info: Waiting for device...");
                            await Task.Run(() => ADB.WaitForDevice());

                            if (oConfigMng.Config.DeviceCodenmae == "sofiar" && oConfigMng.Config.DeviceCodenmae == "doha" && oConfigMng.Config.DeviceCodenmae == "ocean" && oConfigMng.Config.DeviceCodenmae == "evert")
                            {
                                FFlash(FirmwareFlashRead.set_a);
                            }

                            FFlash(FirmwareFlashRead.getvar);
                            FFlash(FirmwareFlashRead.oem);
                            FFlash(FirmwareFlashRead.gpt);
                            FFlash(FirmwareFlashRead.bootloader);

                            if (oConfigMng.Config.DeviceCodenmae == "sanders")
                            {
                                FFlash(FirmwareFlashRead.fsg_a);
                                FFlash(FirmwareFlashRead.modemst1);
                                FFlash(FirmwareFlashRead.modemst2);
                                FFlash(FirmwareFlashRead.bluetooth_a);
                                FFlash(FirmwareFlashRead.dsp_a);
                                FFlash(FirmwareFlashRead.logo_a);
                                FFlash(FirmwareFlashRead.boot_a);
                                FFlash(FirmwareFlashRead.system_a_0);
                                FFlash(FirmwareFlashRead.system_a_1);
                                FFlash(FirmwareFlashRead.system_a_2);
                                FFlash(FirmwareFlashRead.system_a_3);
                                FFlash(FirmwareFlashRead.system_a_4);
                                FFlash(FirmwareFlashRead.system_a_5);
                                FFlash(FirmwareFlashRead.system_a_6);
                                FFlash(FirmwareFlashRead.system_a_7);
                                FFlash(FirmwareFlashRead.system_a_8);
                                FFlash(FirmwareFlashRead.system_a_9);
                                FFlash(FirmwareFlashRead.system_a_10);
                                FFlash(FirmwareFlashRead.oem_a);
                            }
                            if (oConfigMng.Config.DeviceCodenmae == "potter")
                            {
                                FFlash(FirmwareFlashRead.fsg_a);
                                FFlash(FirmwareFlashRead.modemst1);
                                FFlash(FirmwareFlashRead.modemst2);
                                FFlash(FirmwareFlashRead.bluetooth_a);
                                FFlash(FirmwareFlashRead.dsp_a);
                                FFlash(FirmwareFlashRead.logo_a);
                                FFlash(FirmwareFlashRead.boot_a);
                                FFlash(FirmwareFlashRead.system_a_0);
                                FFlash(FirmwareFlashRead.system_a_1);
                                FFlash(FirmwareFlashRead.system_a_2);
                                FFlash(FirmwareFlashRead.system_a_3);
                                FFlash(FirmwareFlashRead.system_a_4);
                                FFlash(FirmwareFlashRead.system_a_5);
                                FFlash(FirmwareFlashRead.system_a_6);
                                FFlash(FirmwareFlashRead.system_a_7);
                                FFlash(FirmwareFlashRead.system_a_8);
                                FFlash(FirmwareFlashRead.oem_a);
                            }
                            if (oConfigMng.Config.DeviceCodenmae == "ocean")
                            {
                                FFlash(FirmwareFlashRead.modem_a);
                                FFlash(FirmwareFlashRead.modem_b);
                                FFlash(FirmwareFlashRead.fsg_a);
                                FFlash(FirmwareFlashRead.fsg_b);
                                FFlash(FirmwareFlashRead.modemst1);
                                FFlash(FirmwareFlashRead.modemst2);
                                FFlash(FirmwareFlashRead.dsp_a);
                                FFlash(FirmwareFlashRead.dsp_b);
                                FFlash(FirmwareFlashRead.logo_a);
                                FFlash(FirmwareFlashRead.logo_b);
                                FFlash(FirmwareFlashRead.boot_a);
                                FFlash(FirmwareFlashRead.boot_b);
                                FFlash(FirmwareFlashRead.dtbo_a);
                                FFlash(FirmwareFlashRead.dtbo_b);
                                FFlash(FirmwareFlashRead.system_a_0);
                                FFlash(FirmwareFlashRead.system_a_1);
                                FFlash(FirmwareFlashRead.system_a_2);
                                FFlash(FirmwareFlashRead.system_a_3);
                                FFlash(FirmwareFlashRead.system_a_4);
                                FFlash(FirmwareFlashRead.system_a_5);
                                FFlash(FirmwareFlashRead.system_a_6);
                                FFlash(FirmwareFlashRead.system_a_7);
                                FFlash(FirmwareFlashRead.system_a_8);
                                FFlash(FirmwareFlashRead.system_a_9);
                                FFlash(FirmwareFlashRead.system_b_0);
                                FFlash(FirmwareFlashRead.system_b_1);
                                FFlash(FirmwareFlashRead.system_b_2);
                                FFlash(FirmwareFlashRead.vendor_a_0);
                                FFlash(FirmwareFlashRead.vendor_a_1);
                                FFlash(FirmwareFlashRead.vendor_b_0);
                                FFlash(FirmwareFlashRead.vendor_b_1);
                                FFlash(FirmwareFlashRead.oem_a);
                                FFlash(FirmwareFlashRead.oem_b);
                            }
                            if (oConfigMng.Config.DeviceCodenmae == "sofiar")
                            {
                                FFlash(FirmwareFlashRead.vbmeta_a);
                                FFlash(FirmwareFlashRead.vbmeta_b);
                                FFlash(FirmwareFlashRead.radio_a);
                                FFlash(FirmwareFlashRead.radio_b);
                                FFlash(FirmwareFlashRead.bluetooth_a);
                                FFlash(FirmwareFlashRead.bluetooth_b);
                                FFlash(FirmwareFlashRead.dsp_a);
                                FFlash(FirmwareFlashRead.dsp_b);
                                FFlash(FirmwareFlashRead.logo_a);
                                FFlash(FirmwareFlashRead.logo_b);
                                FFlash(FirmwareFlashRead.boot_a);
                                FFlash(FirmwareFlashRead.boot_b);
                                FFlash(FirmwareFlashRead.dtbo_a);
                                FFlash(FirmwareFlashRead.dtbo_b);
                                FFlash(FirmwareFlashRead.recovery_a);
                                FFlash(FirmwareFlashRead.recovery_b);
                                FFlash(FirmwareFlashRead.system_a_0);
                                FFlash(FirmwareFlashRead.system_a_1);
                                FFlash(FirmwareFlashRead.system_a_2);
                                FFlash(FirmwareFlashRead.system_a_3);
                                FFlash(FirmwareFlashRead.system_a_4);
                                FFlash(FirmwareFlashRead.system_a_5);
                                FFlash(FirmwareFlashRead.system_a_6);
                                FFlash(FirmwareFlashRead.system_a_7);
                                FFlash(FirmwareFlashRead.system_a_8);
                                FFlash(FirmwareFlashRead.system_a_9);
                                FFlash(FirmwareFlashRead.system_a_10);
                                FFlash(FirmwareFlashRead.system_a_11);
                                FFlash(FirmwareFlashRead.system_a_12);
                                FFlash(FirmwareFlashRead.system_a_13);
                                FFlash(FirmwareFlashRead.system_a_14);
                            }
                            if (oConfigMng.Config.DeviceCodenmae == "doha")
                            {
                                FirmwareFlashRead.ReadFirmwareFlashAB(oConfigMng.Config.DeviceCodenmae);
                                FFlash(FirmwareFlashRead.vbmeta_a);
                                FFlash(FirmwareFlashRead.vbmeta_b);
                                FFlash(FirmwareFlashRead.modem_a);
                                FFlash(FirmwareFlashRead.modem_b);
                                FFlash(FirmwareFlashRead.fsg_a);
                                FFlash(FirmwareFlashRead.fsg_b);
                                FFlash(FirmwareFlashRead.modemst1);
                                FFlash(FirmwareFlashRead.modemst2);
                                FFlash(FirmwareFlashRead.bluetooth_a);
                                FFlash(FirmwareFlashRead.bluetooth_b);
                                FFlash(FirmwareFlashRead.dsp_a);
                                FFlash(FirmwareFlashRead.dsp_b);
                                FFlash(FirmwareFlashRead.logo_a);
                                FFlash(FirmwareFlashRead.logo_b);
                                FFlash(FirmwareFlashRead.boot_a);
                                FFlash(FirmwareFlashRead.boot_b);
                                FFlash(FirmwareFlashRead.dtbo_a);
                                FFlash(FirmwareFlashRead.dtbo_b);
                                FFlash(FirmwareFlashRead.system_a_0);
                                FFlash(FirmwareFlashRead.system_a_1);
                                FFlash(FirmwareFlashRead.system_a_2);
                                FFlash(FirmwareFlashRead.system_a_3);
                                FFlash(FirmwareFlashRead.system_a_4);
                                FFlash(FirmwareFlashRead.system_a_5);
                                FFlash(FirmwareFlashRead.system_b_0);
                                FFlash(FirmwareFlashRead.system_b_1);
                                FFlash(FirmwareFlashRead.oem_a);
                                FFlash(FirmwareFlashRead.oem_b);
                                FFlash(FirmwareFlashRead.vendor_a);
                                FFlash(FirmwareFlashRead.vendor_b);
                            }
                            if (oConfigMng.Config.DeviceCodenmae == "beckham")
                            {
                                FirmwareFlashRead.ReadFirmwareFlashAB(oConfigMng.Config.DeviceCodenmae);
                                FFlash(FirmwareFlashRead.modem_a);
                                FFlash(FirmwareFlashRead.fsg_a);
                                FFlash(FirmwareFlashRead.modemst1);
                                FFlash(FirmwareFlashRead.modemst2);
                                FFlash(FirmwareFlashRead.bluetooth_a);
                                FFlash(FirmwareFlashRead.dsp_a);
                                FFlash(FirmwareFlashRead.logo_a);
                                FFlash(FirmwareFlashRead.boot_a);
                                FFlash(FirmwareFlashRead.system_a_0);
                                FFlash(FirmwareFlashRead.system_a_1);
                                FFlash(FirmwareFlashRead.system_a_2);
                                FFlash(FirmwareFlashRead.system_a_3);
                                FFlash(FirmwareFlashRead.system_a_4);
                                FFlash(FirmwareFlashRead.system_a_5);
                                FFlash(FirmwareFlashRead.system_b_0);
                                FFlash(FirmwareFlashRead.oem_a);
                                FFlash(FirmwareFlashRead.oem_b);
                                FFlash(FirmwareFlashRead.vendor_a);
                                FFlash(FirmwareFlashRead.vendor_b);
                            }
                            FFlash(FirmwareFlashRead.erasecarrier);
                            FFlash(FirmwareFlashRead.eraseuserdata);
                            FFlash(FirmwareFlashRead.eraseddr);
                            FFlash(FirmwareFlashRead.oemclear);
                            FFlash(FirmwareFlashRead.reboot);
                            Dialogs.InfoDialog("FIRMWARE Installed!", "FIRMWARE: " + oConfigMng.Config.DeviceFirmwareInfo + " installed!");
                        }

                        // no modem
                        if (materialSwitchFlashAllExceptModem.Checked == true)
                        {
                            cAppend("Moto Flash: Flash No Modem: This option is not ready yet...");
                            Dialogs.WarningDialog("Moto Flash: Flash No Modem", "This option is not ready yet...");
                            materialSwitchFlashAllExceptModem.Checked = false;
                            return;
                        }
                    }
                    catch (Exception er)
                    {
                        Logs.DebugErrorLogs(er);
                        Dialogs.WarningDialog("Moto Flash: ERROR", er.Message);
                    }
                }
                else
                {
                    Dialogs.WarningDialog("Moto Flash", "Please plug your device! Remember to plug your phone on Fastboot Mode!");
                }
            }
            catch (Exception er)
            {
                Logs.DebugErrorLogs(er);
                Dialogs.ErrorDialog("ERROR: Moto Flash", "Error: " + er);
                return;
            }
        }
Esempio n. 25
0
        public void downloadstart()
        {
            oConfigMng.LoadConfig();
            string firmwarepath = @"C:\\adb\\Firmware\\" + oConfigMng.Config.DeviceFirmware + @"\\" + DownloadsMng.filename;
            string firmwarezip  = DownloadsMng.filepathname;
            var    dld          = new DownloadUI();

            try
            {
                cAppend("FIRMWARE DOWNLOAD: Checking firmware files...");
                if (File.Exists(firmwarezip) && oConfigMng.Config.FirmwareExtracted == "0")
                {
                    long   length = new FileInfo(firmwarezip).Length;
                    string vIn    = oConfigMng.Config.DownloadFileSizeFirmware;
                    long   vOut   = Convert.ToInt64(vIn);
                    if (length == vOut)
                    {
                        cAppend("FIRMWARE DOWNLOAD: Firmware already exist, now it will be exctracted");
                        DirectoryInfo di    = Directory.CreateDirectory(DownloadsMng.filename);
                        var           unzip = new UnzipUI();
                        unzip.textBox_FilePath.Text         = DownloadsMng.SAVEPathname;
                        unzip.textBox_ExtractionFolder.Text = firmwarepath;
                        unzip.Text = "Unzip: " + DownloadsMng.filename;
                        cAppend("FIRMWARE DOWNLOAD EXTRACTING: Firmware " + DownloadsMng.filename);
                        if (unzip.textBox_FilePath.Text != string.Empty && unzip.textBox_ExtractionFolder.Text != string.Empty)
                        {
                            unzip.extractFile.RunWorkerAsync();
                        }
                        else
                        {
                            Strings.MsgBoxUnzippyAlert();
                        }
                        unzip.Show();
                        return;
                    }
                    else
                    {
                        Strings.MSGBOXFileCorrupted();
                        oConfigMng.Config.DownloadFileSizeFirmware = "";
                        cAppend(@"FIRMWARE DOWNLOAD: File is corrupted \:  " + DownloadsMng.SAVEPathname);
                        File.Delete(DownloadsMng.SAVEPathname);
                        oConfigMng.Config.DeviceFirmwareInfo = DownloadsMng.filename;
                        oConfigMng.Config.FirmwareExtracted  = "0";
                        oConfigMng.SaveConfig();
                        openChildForm(dld);
                        return;
                    }
                }
                else if (oConfigMng.Config.FirmwareExtracted == "1")
                {
                    cAppend("FIRMWARE DOWNLOAD: Firmware already " + DownloadsMng.SAVEPathname);
                    return;
                }
            }
            catch (Exception er)
            {
                Logs.DebugErrorLogs(er);
                Dialogs.ErrorDialog("ERROR: Unzip File", "Error: " + er);
                return;
            }

            if (Directory.Exists(firmwarepath))
            {
                DirectoryInfo files = new DirectoryInfo(firmwarepath + @"\");
                if (!File.Exists(files + "*.img") || !File.Exists("*.bin"))
                {
                    cAppend("Can't find firmware images on folder! firmware will be downloaded again! \nFirmware: " + DownloadsMng.filename);
                    Dialogs.ErrorDialog(DownloadsMng.filename, "Can't find firmware images on folder! firmware will be downloaded again! \nFirmware: " + DownloadsMng.filename);
                    openChildForm(dld);
                    return;
                }
                cAppend("Firmware already downloaded! \nFirmware: " + DownloadsMng.filename);
                Dialogs.InfoDialog(DownloadsMng.filename, "Firmware already downloaded! \nFirmware: " + DownloadsMng.filename);
                return;
            }
            else
            {
                CreateFirmwareFolder();
                oConfigMng.Config.DeviceFirmwareInfo = DownloadsMng.filename;
                oConfigMng.Config.FirmwareExtracted  = "0";
                oConfigMng.SaveConfig();
                openChildForm(dld);
            }
        }
Esempio n. 26
0
        public static void ReadLang(string langxml, string lang)
        {
            try
            {
                reader = new XmlTextReader(LangFilePath + langxml);
                reader.MoveToContent();
                string elementName = "";
                if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == lang))
                {
                    while (reader.Read())
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            elementName = reader.Name;
                        }
                        else
                        {
                            if ((reader.NodeType == XmlNodeType.Text) && (reader.HasValue))
                            {
                                switch (elementName)
                                {
                                case "btnfolder":
                                    btnfolder = reader.Value;
                                    break;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                case "unzipexctractok":
                                    unzipexctractok = reader.Value;
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Dialogs.ErrorDialog("MotoTool Lang Engine", ex.Message);
                Logs.DebugErrorLogs(ex);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
        }