Ejemplo n.º 1
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!");
            }
        }
Ejemplo n.º 2
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);
            }
        }