当前位置: 首页>>代码示例>>C#>>正文


C# Message.SetDesktopLocation方法代码示例

本文整理汇总了C#中Message.SetDesktopLocation方法的典型用法代码示例。如果您正苦于以下问题:C# Message.SetDesktopLocation方法的具体用法?C# Message.SetDesktopLocation怎么用?C# Message.SetDesktopLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Message的用法示例。


在下文中一共展示了Message.SetDesktopLocation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FromPhone

        public void FromPhone(String L)
        {
            if (Directory.Exists("WorkDIR/" + comboBox1.SelectedItem + "/" + L) == true)
                Directory.Delete("WorkDIR/" + comboBox1.SelectedItem + "/" + L, true);

            string Patch = Directory.GetCurrentDirectory() + @"\trace.bat";
            StreamWriter BatFile = new StreamWriter(Patch, false, Encoding.GetEncoding(866));
            BatFile.WriteLine("@echo off");
            BatFile.WriteLine("echo Starting ADB...");
            BatFile.WriteLine("adb start-server");
            BatFile.WriteLine("echo connect phone...");
            BatFile.WriteLine("rem adb wait-for-device");
            BatFile.WriteLine("echo Gett files from phone...");

            if (L == "YourFiles")
            {
                for (int i = 0; i < checkedListBox1.Items.Count; i++)
                {
                    string D = null;
                    D = Convert.ToString(checkedListBox1.Items[i]);
                    switch (D)
                    {
                        default:
                            {
                                BatFile.WriteLine("adb pull /" + D + " \"WorkDIR/" + comboBox1.SelectedItem + "/" + L + "/" + D + "\"");
                                break;
                            }
                        case "boot.img":
                            {
                                BatFile.WriteLine("adb remount");
                                BatFile.WriteLine("adb shell su -c \"mkdir /data/tmp/\"");
                                BatFile.WriteLine("adb shell su -c \"dd if=/dev/bootimg of=/data/tmp/boot.img bs=6291456c count=1\"");
                                BatFile.WriteLine("adb pull /data/tmp/boot.img " + " \"WorkDIR/" + comboBox1.SelectedItem + "/" + L + "/" + D + "\"");
                                BatFile.WriteLine("adb shell su -c \"rm /data/tmp/boot.img\"");
                                break;
                            }
                        case "uboot.bin":
                            {
                                BatFile.WriteLine("adb remount");
                                BatFile.WriteLine("adb shell su -c \"mkdir /data/tmp/\"");
                                BatFile.WriteLine("adb shell su -c \"dd if=/dev/uboot of=/data/tmp/uboot.bin bs=393216c count=1\"");
                                BatFile.WriteLine("adb pull /data/tmp/uboot.bin " + " \"WorkDIR/" + comboBox1.SelectedItem + "/" + L + "/" + D + "\"");
                                BatFile.WriteLine("adb shell su -c \"rm /data/tmp/uboot.bin\"");
                                break;
                            }
                        case "logo.bin":
                            {
                                BatFile.WriteLine("adb remount");
                                BatFile.WriteLine("adb shell su -c \"mkdir /data/tmp/\"");
                                BatFile.WriteLine("adb shell su -c \"dd if=/dev/uboot of=/data/tmp/lk.bin bs=3145728c count=1\"");
                                BatFile.WriteLine("adb pull /data/tmp/lk.bin " + " \"WorkDIR/" + comboBox1.SelectedItem + "/" + L + "/" + D + "\"");
                                BatFile.WriteLine("adb shell su -c \"rm /data/tmp/lk.bin\"");
                                break;
                            }
                        case "lk.bin":
                            {
                                BatFile.WriteLine("adb remount");
                                BatFile.WriteLine("adb shell su -c \"mkdir /data/tmp/\"");
                                BatFile.WriteLine("adb shell su -c \"dd if=/dev/uboot of=/data/tmp/lk.bin bs=393216c count=1\"");
                                BatFile.WriteLine("adb pull /data/tmp/lk.bin " + " \"WorkDIR/" + comboBox1.SelectedItem + "/" + L + "/" + D + "\"");
                                BatFile.WriteLine("adb shell su -c \"rm /data/tmp/lk.bin\"");
                                break;
                            }

                    }
                }
            }
            else
            {
                BatFile.WriteLine("adb pull /system \"WorkDIR/" + comboBox1.SelectedItem + "/" + L + "/system\"");
                BatFile.WriteLine("adb remount");
                BatFile.WriteLine("adb shell su -c \"mkdir /data/tmp/\"");
                BatFile.WriteLine("adb shell su -c \"dd if=/dev/bootimg of=/data/tmp/boot.img bs=6291456c count=1\"");
                BatFile.WriteLine("adb pull /data/tmp/boot.img " + " \"WorkDIR/" + comboBox1.SelectedItem + "/" + L + "/boot.img\"");
                BatFile.WriteLine("adb shell su -c \"rm /data/tmp/boot.img\"");
            }

            BatFile.WriteLine("taskkill /F /IM adb.exe");
            BatFile.Close();

            Process win = new Process();
            win.StartInfo.ErrorDialog = true;
            win.StartInfo.FileName = "trace.bat";
            win.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            this.Cursor = Cursors.WaitCursor;
            win.Start();
            win.WaitForExit();
            this.Cursor = Cursors.Default;
            File.Delete("trace.bat");
            SoundPlay();
            Message MS = new Message(null, succ, null, ok, null, null, null, 1, time);
            MS.SetDesktopLocation(this.Location.X + (this.Width / 2) - (MS.Width / 2), this.Location.Y + (this.Height / 2) - (MS.Height / 2));
            MS.ShowDialog();
        }
开发者ID:liuxingghost,项目名称:MTK-FirmwareAdapter-Tool,代码行数:94,代码来源:Main.cs

示例2: BootUnpack

        public void BootUnpack()
        {
            if (Directory.Exists("WorkDIR\\Images") == true)
                Directory.Delete("WorkDIR\\Images", true);

            Directory.CreateDirectory("WorkDIR\\Images");

            Process win = new Process();
            if (File.Exists(@"WorkDIR\" + comboBox1.SelectedItem + @"\ROMtoPort\boot.img") == true)
            {
                File.Copy(@"WorkDIR\" + comboBox1.SelectedItem + @"\ROMtoPort\boot.img", Directory.GetCurrentDirectory() + "\\Bin\\bootP.img", true);
            }
            else
            {
                Message M = new Message(err, err1, err2, ok, null, null, null, 1, time);
                M.SetDesktopLocation(this.Location.X + (this.Width / 2) - (M.Width / 2), this.Location.Y + (this.Height / 2) - (M.Height / 2));
                M.ShowDialog();
                return;
            }

            if (File.Exists(@"WorkDIR\" + comboBox1.SelectedItem + @"\YourFiles\boot.img") == false)
            {
                Message M = new Message(err, err3, err2, ok, null, null, null, 1, time);
                M.SetDesktopLocation(this.Location.X + (this.Width / 2) - (M.Width / 2), this.Location.Y + (this.Height / 2) - (M.Height / 2));
                M.ShowDialog();
                return;
            }
            else
            {
                File.Copy(@"WorkDIR\" + comboBox1.SelectedItem + @"\YourFiles\boot.img", Directory.GetCurrentDirectory() + "\\Bin\\bootO.img", true);
            }

            win.StartInfo.FileName = "Bin\\imgunpack.cmd";
            win.StartInfo.Arguments = "bootO.img";
            win.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            this.Cursor = Cursors.WaitCursor;
            win.Start();
            win.WaitForExit();
            this.Cursor = Cursors.Default;

            string Patch2 = Directory.GetCurrentDirectory() + @"\Bin\trace2.bat";
            StreamWriter perm = new StreamWriter(Patch2, false, Encoding.GetEncoding(866));
            perm.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\bootO" + "\"" + "  /r /d y && icacls  \"" + Directory.GetCurrentDirectory() + "\\Bin\\bootO" + "\"" + " /grant %username%:F /t");
            //perm.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\bootO" + "\"" + " && icacls /\"" + Directory.GetCurrentDirectory() + "\\Bin\\bootO" + "\"" + " /grant все:F");
            perm.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\bootO" + "\"" + "  /r /d y && icacls  \"" + Directory.GetCurrentDirectory() + "\\Bin\\bootO" + "\"" + " /grant все:F /t");
            //perm.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\bootO" + "\"" + " && icacls /\"" + Directory.GetCurrentDirectory() + "\\Bin\\bootO" + "\"" + " /grant all:F");
            perm.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\bootO" + "\"" + "  /r /d y && icacls  \"" + Directory.GetCurrentDirectory() + "\\Bin\\bootO" + "\"" + " /grant all:F /t");
            //perm.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\bootO" + "\"" + " && icacls /\"" + Directory.GetCurrentDirectory() + "\\Bin\\bootO" + "\"" + " /grant %username%:F");
            perm.Close();

            win.StartInfo.ErrorDialog = true;
            win.StartInfo.FileName = Patch2;
            this.Cursor = Cursors.WaitCursor;
            win.Start();
            win.WaitForExit();
            this.Cursor = Cursors.Default;

            if (Directory.Exists("Bin\\bootO"))
            {
                if (Directory.Exists("WorkDIR\\Images\\bootO"))
                    Directory.Delete("WorkDIR\\Images\\bootO");
                Directory.Move("Bin\\bootO","WorkDIR\\Images\\bootO");
            }

            Process winc = new Process();
            winc.StartInfo.FileName = "Bin\\imgunpack.cmd";
            winc.StartInfo.Arguments = "bootP.img";
            winc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            this.Cursor = Cursors.WaitCursor;
            winc.Start();
            winc.WaitForExit();
            this.Cursor = Cursors.Default;

            StreamWriter per = new StreamWriter(Patch2, false, Encoding.GetEncoding(866));
            per.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\bootP" + "\"" + " && icacls /\"" + Directory.GetCurrentDirectory() + "\\Bin\\bootP" + "\"" + " /grant все:F");
            per.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\bootP" + "\"" + "  /r /d y && icacls  \"" + Directory.GetCurrentDirectory() + "\\Bin\\bootP" + "\"" + " /grant все:F /t");
            per.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\bootP" + "\"" + " && icacls /\"" + Directory.GetCurrentDirectory() + "\\Bin\\bootP" + "\"" + " /grant all:F");
            per.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\bootP" + "\"" + "  /r /d y && icacls  \"" + Directory.GetCurrentDirectory() + "\\Bin\\bootP" + "\"" + " /grant all:F /t");
            per.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\bootP" + "\"" + " && icacls /\"" + Directory.GetCurrentDirectory() + "\\Bin\\bootP" + "\"" + " /grant %username%:F");
            per.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\bootP" + "\"" + "  /r /d y && icacls  \"" + Directory.GetCurrentDirectory() + "\\Bin\\bootP" + "\"" + " /grant %username%:F /t");
            per.Close();

            winc.StartInfo.ErrorDialog = true;
            winc.StartInfo.FileName = Patch2;
            this.Cursor = Cursors.WaitCursor;
            winc.Start();
            winc.WaitForExit();
            this.Cursor = Cursors.Default;

            if (Directory.Exists("Bin\\bootP"))
            {
                if (Directory.Exists("WorkDIR\\Images\\bootP"))
                    Directory.Delete("WorkDIR\\Images\\bootP");
                Directory.Move("Bin\\bootP", "WorkDIR\\Images\\bootP");
            }

            File.Delete("Bin\\bootP.img");
            File.Delete("Bin\\bootO.img");

            button15.Enabled = true;
//.........这里部分代码省略.........
开发者ID:liuxingghost,项目名称:MTK-FirmwareAdapter-Tool,代码行数:101,代码来源:Main.cs

示例3: FTUnpack

        public void FTUnpack(string L)
        {
            openFileDialog1.Filter = "System Image File |*system*.img";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    Process win = new Process();
                    win.StartInfo.FileName = Directory.GetCurrentDirectory() + "//Bin//Ext4Extractor.exe";

                    if (Directory.Exists("WorkDIR/" + comboBox1.SelectedItem + "/" + L) == true)
                    {
                        Directory.Delete("WorkDIR/" + comboBox1.SelectedItem + "/" + L, true);
                    }
                    if (Directory.Exists("WorkDIR/" + comboBox1.SelectedItem + "/Temp"))
                        Directory.Delete("WorkDIR/" + comboBox1.SelectedItem + "/Temp", true);

                    Directory.CreateDirectory("WorkDIR/" + comboBox1.SelectedItem + "/Temp");

                    win.StartInfo.Arguments = "\"" + openFileDialog1.FileName + "\"" + " \"WorkDIR\\" + comboBox1.SelectedItem + "\\Temp\\system\"";
                    win.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                    win.StartInfo.ErrorDialog = false;
                    this.Cursor = Cursors.WaitCursor;
                    win.Start();
                    win.WaitForExit();
                    this.Cursor = Cursors.Default;

                }
                finally
                {

                    if (L == "YourFiles")
                    {
                        for (int i = 0; i < checkedListBox1.Items.Count; i++)
                        {

                            {
                                string D2 = null;
                                string D = null;
                                D = Convert.ToString(checkedListBox1.Items[i]);
                                D = D.Replace("/", "\\");
                                try
                                {
                                    if (Directory.Exists("WorkDIR\\" + comboBox1.SelectedItem + "\\" + "Temp\\" + D) == true)
                                    {
                                        CopyDirectory("WorkDIR\\" + comboBox1.SelectedItem + "\\" + "Temp\\" + D, "WorkDIR\\" + comboBox1.SelectedItem + "\\" + L + "\\" + D);
                                    }
                                    else
                                        if (File.Exists("WorkDIR\\" + comboBox1.SelectedItem + "\\" + "Temp\\" + D) == true)
                                        {
                                            if (D.LastIndexOf("\\") >= 0)
                                            {
                                                D2 = D.Remove(D.LastIndexOf("\\"));
                                            }
                                            Directory.CreateDirectory("WorkDIR\\" + comboBox1.SelectedItem + "\\" + L + "\\" + D2);
                                            File.Copy("WorkDIR\\" + comboBox1.SelectedItem + "\\" + "Temp\\" + D, "WorkDIR\\" + comboBox1.SelectedItem + "\\" + L + "\\" + D, true);
                                        }
                                }
                                catch (Exception ex)
                                {
                                    Message M = new Message(err, ex.Message, null, ok, null, null, null, 1, time);
                                    M.SetDesktopLocation(this.Location.X + (this.Width / 2) - (M.Width / 2), this.Location.Y + (this.Height / 2) - (M.Height / 2));
                                    M.ShowDialog();
                                }
                            }
                        }
                    }
                    else
                    {
                        Directory.Move("WorkDIR\\" + comboBox1.SelectedItem + "\\" + "Temp", "WorkDIR/" + comboBox1.SelectedItem + "/" + L);
                    }


                    openFileDialog1.Filter = "Boot Image File |*boot*.img";
                    if (openFileDialog1.ShowDialog() == DialogResult.OK)
                    {
                        if (Directory.Exists("WorkDIR/" + comboBox1.SelectedItem + "/" + L) == false)
                            Directory.CreateDirectory("WorkDIR/" + comboBox1.SelectedItem + "/" + L);
                        File.Copy(openFileDialog1.FileName, "WorkDIR/" + comboBox1.SelectedItem + "/" + L + "/boot.img", true);
                    }

                    if (Directory.Exists(@"WorkDIR\" + comboBox1.SelectedItem + @"\YourFiles\system") == true)
                    {
                        SoundPlay();
                        Message MS = new Message(null, succ, null, ok, null, null, null, 1, time);
                        MS.SetDesktopLocation(this.Location.X + (this.Width / 2) - (MS.Width / 2), this.Location.Y + (this.Height / 2) - (MS.Height / 2));
                        MS.ShowDialog();
                    }
                }

                try
                {
                    if (Directory.Exists("WorkDIR\\" + comboBox1.SelectedItem + "\\" + "Temp") == true)
                        Directory.Delete("WorkDIR\\" + comboBox1.SelectedItem + "\\" + "Temp", true);
                }
                catch (Exception)
                {
                    
                }
            }
//.........这里部分代码省略.........
开发者ID:liuxingghost,项目名称:MTK-FirmwareAdapter-Tool,代码行数:101,代码来源:Main.cs

示例4: Unpacked

        public void Unpacked(string L, bool C)
        {
            folderBrowserDialog1.Description = chooses;
            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                if (Directory.Exists("WorkDIR/" + comboBox1.SelectedItem + "/" + L + "/system") == true)
                    Directory.Delete("WorkDIR/" + comboBox1.SelectedItem + "/" + L + "/system", true);

                if (Directory.Exists("WorkDIR/" + comboBox1.SelectedItem + "/Temp"))
                    Directory.Delete("WorkDIR/" + comboBox1.SelectedItem + "/Temp", true);

                CopyDirectory(folderBrowserDialog1.SelectedPath, "WorkDIR/" + comboBox1.SelectedItem + "/Temp/system");
            }
            else
                return;

            if (L == "YourFiles")
            {
                for (int i = 0; i < checkedListBox1.Items.Count; i++)
                {

                    {
                        string D2 = null;
                        string D = null;
                        D = Convert.ToString(checkedListBox1.Items[i]);
                        D = D.Replace("/", "\\");
                        try
                        {
                            if (Directory.Exists("WorkDIR\\" + comboBox1.SelectedItem + "\\" + "Temp\\" + D) == true)
                            {
                                CopyDirectory("WorkDIR\\" + comboBox1.SelectedItem + "\\" + "Temp\\" + D, "WorkDIR\\" + comboBox1.SelectedItem + "\\" + L + "\\" + D);
                            }
                            else
                                if (File.Exists("WorkDIR\\" + comboBox1.SelectedItem + "\\" + "Temp\\" + D) == true)
                                {
                                    if (D.LastIndexOf("\\") >= 0)
                                    {
                                        D2 = D.Remove(D.LastIndexOf("\\"));
                                    }
                                    Directory.CreateDirectory("WorkDIR\\" + comboBox1.SelectedItem + "\\" + L + "\\" + D2);
                                    File.Copy("WorkDIR\\" + comboBox1.SelectedItem + "\\" + "Temp\\" + D, "WorkDIR\\" + comboBox1.SelectedItem + "\\" + L + "\\" + D, true);
                                }

                            if (Directory.Exists("WorkDIR/" + comboBox1.SelectedItem + "/Temp"))
                                Directory.Delete("WorkDIR/" + comboBox1.SelectedItem + "/Temp", true);
                        }
                        catch (Exception ex)
                        {
                            Message M = new Message(err, ex.Message, null, ok, null, null, null, 1, time);
                            M.SetDesktopLocation(this.Location.X + (this.Width / 2) - (M.Width / 2), this.Location.Y + (this.Height / 2) - (M.Height / 2));
                            M.ShowDialog();
                        }
                    }
                }
            }
            else
            {
                Directory.Move("WorkDIR\\" + comboBox1.SelectedItem + "\\" + "Temp", "WorkDIR/" + comboBox1.SelectedItem + "/" + L);
            }

            openFileDialog1.Filter = "Boot Image File |*boot*.img";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                if (Directory.Exists("WorkDIR/" + comboBox1.SelectedItem + "/" + L) == false)
                    Directory.CreateDirectory("WorkDIR/" + comboBox1.SelectedItem + "/" + L);
                File.Copy(openFileDialog1.FileName, "WorkDIR/" + comboBox1.SelectedItem + "/" + L + "/boot.img", true);
            }

            if (C == true)
            {
                folderBrowserDialog1.Description = choosem;
                if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
                {
                    CopyDirectory(folderBrowserDialog1.SelectedPath, @"WorkDIR\" + comboBox1.SelectedItem + @"\YourFiles\META-INF");
                }
            }
            SoundPlay();
            Message MS = new Message(null, succ, null, ok, null, null, null, 1, time);
            MS.SetDesktopLocation(this.Location.X + (this.Width / 2) - (MS.Width / 2), this.Location.Y + (this.Height / 2) - (MS.Height / 2));
            MS.ShowDialog();
        }
开发者ID:liuxingghost,项目名称:MTK-FirmwareAdapter-Tool,代码行数:81,代码来源:Main.cs

示例5: button32_Click

        private void button32_Click(object sender, EventArgs e)
        {
            
                 Message MS = new Message(syd, null, null, next, null, null, null, 1, 0);
                 MS.SetDesktopLocation(this.Location.X + (this.Width / 2) - (MS.Width / 2), this.Location.Y + (this.Height / 2) - (MS.Height / 2));
                 MS.groupBox7.Visible = true;
                 MS.radioButton1.Text = syu;
                 MS.radioButton2.Text = syn;
                 MS.ShowDialog();

                 string tmp = DateTime.Now.ToString("dd.MM.yy_HH-mm-ss");

                 if (MS.radioButton1.Checked == true)
                 {

                     openFileDialog1.Filter = "System Image File |*system*.img";
                     if (openFileDialog1.ShowDialog() == DialogResult.OK)
                     {
                         try
                         {
                             Process win = new Process();
                             win.StartInfo.FileName = Directory.GetCurrentDirectory() + "//Bin//Ext4Extractor.exe";

                             if (Directory.Exists("Utilits\\Temp") == true)
                             {
                                 Directory.Delete("Utilits\\Temp", true);
                             }

                             Directory.CreateDirectory("Utilits\\Temp");

                             win.StartInfo.Arguments = "\"" + openFileDialog1.FileName + "\"" + " \"Utilits\\Temp\\system\"";
                             win.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                             win.StartInfo.ErrorDialog = false;
                             this.Cursor = Cursors.WaitCursor;
                             win.Start();
                             win.WaitForExit();
                             this.Cursor = Cursors.Default;

                         }
                         finally
                         {
                             openFileDialog1.Filter = "Boot Image File |*boot*.img";
                             if (openFileDialog1.ShowDialog() == DialogResult.OK)
                             {
                                 File.Copy(openFileDialog1.FileName, "Utilits\\Temp\\boot.img", true);
                             }
                         }

                         {
                             Message M = new Message("META-INF", null, null, next, null, null, null, 1, 0);
                             M.SetDesktopLocation(this.Location.X + (this.Width / 2) - (M.Width / 2), this.Location.Y + (this.Height / 2) - (M.Height / 2));
                             M.groupBox7.Visible = true;
                             M.radioButton1.Text = mz;
                             M.radioButton2.Text = mf;
                             M.ShowDialog();

                             if (M.radioButton1.Checked == true)
                             {
                                 if (openFileDialog2.ShowDialog() == DialogResult.OK)
                                 {
                                     string Patch0 = Directory.GetCurrentDirectory() + @"\Bin\trace.bat";
                                     StreamWriter BatFile0 = new StreamWriter(Patch0, false, Encoding.GetEncoding(866));
                                     BatFile0.WriteLine("@echo off");
                                     BatFile0.WriteLine("cd /d " + Directory.GetCurrentDirectory() + @"\Bin");
                                     BatFile0.WriteLine("7z.exe x " + "\"" + openFileDialog2.FileName.ToString() + "\" -o\"" + Directory.GetCurrentDirectory() + "\\Utilits\\Temp\" META-INF -r -y");
                                     BatFile0.Close();

                                     Process wing = new Process();
                                     wing.StartInfo.CreateNoWindow = true;
                                     wing.StartInfo.ErrorDialog = false;
                                     wing.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                                     wing.StartInfo.FileName = @"Bin\trace.bat";
                                     this.Cursor = Cursors.WaitCursor;
                                     wing.Start();
                                     wing.WaitForExit();
                                     this.Cursor = Cursors.Default;
                                     if (File.Exists(@"Bin\trace.bat"))
                                         File.Delete(@"Bin\trace.bat");
                                 }
                                 else
                                     return;

                                 if (Directory.Exists("Utilits\\Temp") == true)
                                 {
                                     Directory.Delete("Utilits\\Temp", true);
                                 }
                             }
                             else
                             {
                                 folderBrowserDialog1.Description = choosem;
                                 if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
                                 {
                                     CopyDirectory(folderBrowserDialog1.SelectedPath, "Utilits/Temp/META-INF");

                                     this.Cursor = Cursors.WaitCursor;
                                 }
                                 else
                                     return;
                             }
                             if (Directory.Exists("Utilits/Temp"))
//.........这里部分代码省略.........
开发者ID:liuxingghost,项目名称:MTK-FirmwareAdapter-Tool,代码行数:101,代码来源:Main.cs

示例6: ZIPunpack


//.........这里部分代码省略.........
                        if (File.Exists(Directory.GetCurrentDirectory() + "\\WorkDIR\\" + comboBox1.SelectedItem + "\\Temp\\atrs.bat"))
                        {
                            Process winh = new Process();
                            winh.StartInfo.CreateNoWindow = true;
                            winh.StartInfo.ErrorDialog = false;
                            winh.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                            winh.StartInfo.FileName = Patch;
                            this.Cursor = Cursors.WaitCursor;
                            winh.Start();
                            winh.WaitForExit();
                            this.Cursor = Cursors.Default;
                        }

                        if (File.Exists(Directory.GetCurrentDirectory() + "\\WorkDIR\\" + comboBox1.SelectedItem + "\\Temp\\atrs.bat"))
                            File.Delete(Directory.GetCurrentDirectory() + "\\WorkDIR\\" + comboBox1.SelectedItem + "\\Temp\\atrs.bat");


                        if (L == "YourFiles")
                        {
                            for (int i = 0; i < checkedListBox1.Items.Count; i++)
                            {

                                {
                                    string D2 = null;
                                    string D = null;
                                    D = Convert.ToString(checkedListBox1.Items[i]);
                                    D = D.Replace("/", "\\");
                                    try
                                    {
                                        if (Directory.Exists("WorkDIR\\" + comboBox1.SelectedItem + "\\" + "Temp\\" + D) == true)
                                        {
                                            CopyDirectory("WorkDIR\\" + comboBox1.SelectedItem + "\\" + "Temp\\" + D, "WorkDIR\\" + comboBox1.SelectedItem + "\\" + L + "\\" + D);
                                        }
                                        else
                                            if (File.Exists("WorkDIR\\" + comboBox1.SelectedItem + "\\" + "Temp\\" + D) == true)
                                            {
                                                if (D.LastIndexOf("\\") >= 0)
                                                {
                                                    D2 = D.Remove(D.LastIndexOf("\\"));
                                                }
                                                Directory.CreateDirectory("WorkDIR\\" + comboBox1.SelectedItem + "\\" + L + "\\" + D2);
                                                File.Copy("WorkDIR\\" + comboBox1.SelectedItem + "\\" + "Temp\\" + D, "WorkDIR\\" + comboBox1.SelectedItem + "\\" + L + "\\" + D, true);
                                            }
                                        if (C == true)
                                        {
                                            if (Directory.Exists("WorkDIR\\" + comboBox1.SelectedItem + "\\" + "Temp\\META-INF") == true)
                                            {
                                                CopyDirectory("WorkDIR\\" + comboBox1.SelectedItem + "\\" + "Temp\\META-INF", "WorkDIR\\" + comboBox1.SelectedItem + "\\" + L + "\\META-INF");
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        Message M = new Message(err, ex.Message, null, ok, null, null, null, 1, time);
                                        M.SetDesktopLocation(this.Location.X + (this.Width / 2) - (M.Width / 2), this.Location.Y + (this.Height / 2) - (M.Height / 2));
                                        M.ShowDialog();
                                    }
                                }
                            }
                        }
                        else
                        {
                            Directory.Move("WorkDIR\\" + comboBox1.SelectedItem + "\\" + "Temp", "WorkDIR/" + comboBox1.SelectedItem + "/" + L);
                            if (C == false)
                            {
                                if (Directory.Exists("WorkDIR\\" + comboBox1.SelectedItem + "\\" + L + "\\META-INF") == true)
                                {
                                    Directory.Delete("WorkDIR\\" + comboBox1.SelectedItem + "\\" + L + "\\META-INF", true);
                                }
                            }
                        }
                        SoundPlay();
                        Message MS = new Message(null, succ, null, ok, null, null, null, 1, time);
                        MS.SetDesktopLocation(this.Location.X + (this.Width / 2) - (MS.Width / 2), this.Location.Y + (this.Height / 2) - (MS.Height / 2));
                        MS.ShowDialog();
                        try
                        {
                            if (Directory.Exists("WorkDIR\\" + comboBox1.SelectedItem + "\\" + "Temp") == true)
                                Directory.Delete("WorkDIR\\" + comboBox1.SelectedItem + "\\" + "Temp", true);
                        }
                        catch (Exception)
                        {

                        }
                    }
                    else
                    {
                        Message M = new Message(err, null, null, ok, null, null, null, 1, time);
                        M.SetDesktopLocation(this.Location.X + (this.Width / 2) - (M.Width / 2), this.Location.Y + (this.Height / 2) - (M.Height / 2));
                        M.ShowDialog();
                    }
                }
                else
                    return;
            }
            finally
            {

            }
        }
开发者ID:liuxingghost,项目名称:MTK-FirmwareAdapter-Tool,代码行数:101,代码来源:Main.cs

示例7: button26_Click

        private void button26_Click(object sender, EventArgs e)
        {
            if (File.Exists("Utilits\\prop") == true || File.Exists("Utilits\\logcat.txt") == true)
            {
                if (File.Exists("Utilits\\prop") == true)
                    File.Delete("Utilits\\prop");
                if (File.Exists("Utilits\\logcat.txt") == true)
                    File.Delete("Utilits\\logcat.txt");
            }
            else return;

            Message MS = new Message(null, temp_succ, temp_succ1, ok, null, null, null, 1, time);
            MS.SetDesktopLocation(this.Location.X + (this.Width / 2) - (MS.Width / 2), this.Location.Y + (this.Height / 2) - (MS.Height / 2));
            MS.ShowDialog();
        }
开发者ID:liuxingghost,项目名称:MTK-FirmwareAdapter-Tool,代码行数:15,代码来源:Main.cs

示例8: button4_Click

        private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                if (Directory.Exists("Utilits\\IMGRepack\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString())))
                    Directory.Move("Utilits\\IMGRepack\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()), "Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()));
                else return;
            }
            catch (Exception)
            {
                return;
            }

            Process win = new Process();
            if (comboBox1.SelectedIndex == 0)
            {
                string Patch1 = Directory.GetCurrentDirectory() + "\\Bin\\trace2.bat";
                StreamWriter BatFile1 = new StreamWriter(Patch1, false, Encoding.GetEncoding(866));
                BatFile1.WriteLine("cd /d \"" + Directory.GetCurrentDirectory() + "\\Bin\\\"");
                BatFile1.WriteLine("imgpack.cmd " + "boot");
                BatFile1.Close();
                win.StartInfo.FileName = Patch1;
                win.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                this.Cursor = Cursors.WaitCursor;
                win.Start();
                win.WaitForExit();
                this.Cursor = Cursors.Default;
                File.Delete("Bin\\trace2.bat");
            }
            else
            {
                string Patch1 = Directory.GetCurrentDirectory() + "\\Bin\\trace2.bat";
                StreamWriter BatFile1 = new StreamWriter(Patch1, false, Encoding.GetEncoding(866));
                BatFile1.WriteLine("cd /d \"" + Directory.GetCurrentDirectory() + "\\Bin\\\"");
                BatFile1.WriteLine("imgpack.cmd " + "recovery");
                BatFile1.Close();
                win.StartInfo.FileName = Patch1;
                win.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                this.Cursor = Cursors.WaitCursor;
                win.Start();
                win.WaitForExit();
                this.Cursor = Cursors.Default;
                File.Delete("Bin\\trace2.bat");
            }

            if (File.Exists("Bin\\new_image.img"))
            {
                if (File.Exists("Utilits\\IMGRepack\\" + comboBox1.SelectedItem.ToString()))
                    File.Move("Bin\\new_image.img", "Utilits\\IMGRepack\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + DateTime.Now.ToString("_dd.MM.yy_HH-mm-ss") + ".img");
                else
                    File.Move("Bin\\new_image.img", "Utilits\\IMGRepack\\" + comboBox1.SelectedItem.ToString());
            }
            try
            {
                if (Directory.Exists("Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString())))
                    Directory.Delete("Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()),true);
            }
            catch (Exception)
            {
            }

            finally
            {

            }

            Message MS = new Message(null, build, comboBox1.SelectedItem.ToString(), ok, null, null, null, 1, 5);
            MS.SetDesktopLocation(this.Location.X + (this.Width / 2) - (MS.Width / 2), this.Location.Y + (this.Height / 2) - (MS.Height / 2));
            MS.ShowDialog();
        }
开发者ID:liuxingghost,项目名称:MTK-FirmwareAdapter-Tool,代码行数:70,代码来源:BR_repack.cs

示例9: BuildROM

        public void BuildROM()
        {
            if (Directory.Exists(@"WorkDIR\" + comboBox1.SelectedItem + @"\ROMtoPORT\system") == false)
            {
                Message M = new Message(err, err4, err5, ok, null, null, null, 1, time);
                M.SetDesktopLocation(this.Location.X + (this.Width / 2) - (M.Width / 2), this.Location.Y + (this.Height / 2) - (M.Height / 2));
                M.ShowDialog();
                return;
            }

            if (Directory.Exists(@"WorkDIR\" + comboBox1.SelectedItem + @"\YourFiles\system") == false)
            {
                Message M = new Message(err, err6, err7, ok, null, null, null, 1, time);
                M.SetDesktopLocation(this.Location.X + (this.Width / 2) - (M.Width / 2), this.Location.Y + (this.Height / 2) - (M.Height / 2));
                M.ShowDialog();
                return;
            }
            if (checkBox6.Checked == true)
            {
                Process win = new Process();
                if (File.Exists(@"WorkDIR\" + comboBox1.SelectedItem + @"\ROMtoPort\boot.img") == true)
                {
                    File.Copy(@"WorkDIR\" + comboBox1.SelectedItem + @"\ROMtoPort\boot.img", Directory.GetCurrentDirectory() + "\\Bin\\bootP.img", true);
                }
                else
                {
                    Message M = new Message(err, err1, err2, ok, null, null, null, 1, time);
                    M.SetDesktopLocation(this.Location.X + (this.Width / 2) - (M.Width / 2), this.Location.Y + (this.Height / 2) - (M.Height / 2));
                    M.ShowDialog();
                    return;
                }

                if (File.Exists(@"WorkDIR\" + comboBox1.SelectedItem + @"\YourFiles\boot.img") == false)
                {
                    Message M = new Message(err, err3, err2, ok, null, null, null, 1, time);
                    M.SetDesktopLocation(this.Location.X + (this.Width / 2) - (M.Width / 2), this.Location.Y + (this.Height / 2) - (M.Height / 2));
                    M.ShowDialog();
                    return;
                }
                else
                {
                    File.Copy(@"WorkDIR\" + comboBox1.SelectedItem + @"\YourFiles\boot.img", Directory.GetCurrentDirectory() + "\\Bin\\bootO.img", true);
                }

                win.StartInfo.FileName = "Bin\\imgunpack.cmd";
                win.StartInfo.Arguments = "bootO.img";
                win.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                this.Cursor = Cursors.WaitCursor;
                win.Start();
                win.WaitForExit();
                this.Cursor = Cursors.Default;

                Process winc = new Process();
                winc.StartInfo.FileName = "Bin\\imgunpack.cmd";
                winc.StartInfo.Arguments = "bootP.img";
                winc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                this.Cursor = Cursors.WaitCursor;
                winc.Start();
                winc.WaitForExit();
                this.Cursor = Cursors.Default;

                if (Directory.Exists("Bin\\bootP"))
                    CopyDirectory("Bin\\bootP", "Bin\\boot");

                if (File.Exists("Bin\\bootO\\kernel"))
                    File.Copy("Bin\\bootO\\kernel", "Bin\\boot\\kernel", true);
                if (File.Exists("Bin\\bootO\\kernel_header"))
                    File.Copy("Bin\\bootO\\kernel_header", "Bin\\boot\\kernel_header", true);

                File.Delete("Bin\\bootP.img");
                File.Delete("Bin\\bootO.img");
                Directory.Delete("Bin\\bootO",true);
                Directory.Delete("Bin\\bootP",true);

                Process wind = new Process();
                wind.StartInfo.FileName = "Bin\\imgpack.cmd";
                wind.StartInfo.Arguments = "boot";
                wind.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                this.Cursor = Cursors.WaitCursor;
                wind.StartInfo.WorkingDirectory = "\"" + Directory.GetCurrentDirectory() + "\\Bin\"";
                wind.Start();
                wind.WaitForExit();
                this.Cursor = Cursors.Default;

                if (File.Exists("Bin\\new_image.img"))
                {
                    if (File.Exists(@"WorkDIR\" + comboBox1.SelectedItem + @"\boot.img"))
                        File.Delete(@"WorkDIR\" + comboBox1.SelectedItem + @"\boot.img");

                    File.Move("Bin\\new_image.img", @"WorkDIR\" + comboBox1.SelectedItem + @"\boot.img");
                    Directory.Delete("Bin\\boot", true);
                }
            }

            /*if (radioButton1.Checked == true)
            {*/

                using (ZipFile zip = new ZipFile())
                {
                    if (Directory.Exists(@"WorkDIR\" + comboBox1.SelectedItem + @"\YourFiles\META-INF") == false && Directory.Exists(@"WorkDIR\" + comboBox1.SelectedItem + @"\ROMtoPort\META-INF") == false)
//.........这里部分代码省略.........
开发者ID:liuxingghost,项目名称:MTK-FirmwareAdapter-Tool,代码行数:101,代码来源:Main.cs

示例10: button20_Click

        private void button20_Click(object sender, EventArgs e)
        {
            try
            {
                if (Directory.Exists("WorkDIR\\" + comboBox1.SelectedItem) == true)
                {
                    if (Directory.Exists("boot\\" + comboBox1.SelectedItem) == true)
                        Directory.Delete("boot\\" + comboBox1.SelectedItem, true);

                    Directory.Delete("WorkDIR\\" + comboBox1.SelectedItem, true);
                    Message M = new Message(null, del_succ, null, ok, null, null, null, 1, time);
                    M.SetDesktopLocation(this.Location.X + (this.Width / 2) - (M.Width / 2), this.Location.Y + (this.Height / 2) - (M.Height / 2));
                    M.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                Message M = new Message(del_err, ex.Message, null, ok, null, null, null, 1, time);
                M.SetDesktopLocation(this.Location.X + (this.Width / 2) - (M.Width / 2), this.Location.Y + (this.Height / 2) - (M.Height / 2));
                M.ShowDialog();
            }
            finally
            {

            }
        }
开发者ID:liuxingghost,项目名称:MTK-FirmwareAdapter-Tool,代码行数:26,代码来源:Main.cs

示例11: SignROM

        public void SignROM()
        {
            if (openFileDialog2.ShowDialog() == DialogResult.OK)
            {
                Directory.CreateDirectory("WorkDIR/AdaptedROMS");
                string Patch = Directory.GetCurrentDirectory() + @"\Bin\trace.bat";
                StreamWriter BatFile = new StreamWriter(Patch, false, Encoding.GetEncoding(866));
                BatFile.WriteLine("@echo off");
                BatFile.WriteLine("cd /d " + Directory.GetCurrentDirectory() + @"\Bin");
                BatFile.WriteLine("signapk.cmd " + "\"" + openFileDialog2.FileName + "\"");
                BatFile.Close();
                try
                {
                    Process win = new Process();
                    win.StartInfo.ErrorDialog = true;
                    win.StartInfo.FileName = Patch;
                    win.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                    this.Cursor = Cursors.WaitCursor;
                    win.Start();
                    win.WaitForExit();
                    this.Cursor = Cursors.Default;

                    if (File.Exists("WorkDIR/AdaptedROMS\\" + Path.GetFileName(openFileDialog2.FileName)))
                        File.Delete("WorkDIR/AdaptedROMS\\" + Path.GetFileName(openFileDialog2.FileName));
                    File.Move(Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(openFileDialog2.FileName) + "_signed.zip", "WorkDIR/AdaptedROMS\\" + Path.GetFileName(openFileDialog2.FileName));
                }

                finally
                {
                    SoundPlay();

                    Message MS = new Message(null, sign_succ, null, ok, null, null, null, 1, time);
                    MS.SetDesktopLocation(this.Location.X + (this.Width / 2) - (MS.Width / 2), this.Location.Y + (this.Height / 2) - (MS.Height / 2));
                    MS.ShowDialog();

                    ProcessStartInfo startInfo = null;
                    if (File.Exists("WorkDIR/AdaptedROMS\\" + Path.GetFileName(openFileDialog2.FileName)) == true)
                    {
                        startInfo = new ProcessStartInfo("Explorer");
                        startInfo.UseShellExecute = false;
                        startInfo.Arguments = @"/select," + "\"" + Directory.GetCurrentDirectory() + "\\WorkDIR\\AdaptedROMS\\" + Path.GetFileName(openFileDialog2.FileName) + "\"";
                        Process.Start(startInfo);
                    }

                    if (File.Exists("Bin\\trace.bat"))
                        File.Delete("Bin\\trace.bat");
                }
            }
        }
开发者ID:liuxingghost,项目名称:MTK-FirmwareAdapter-Tool,代码行数:49,代码来源:Main.cs

示例12: button2_Click


//.........这里部分代码省略.........
            string Patch = Directory.GetCurrentDirectory() + @"\Bin\trace.bat";
            StreamWriter BatFile = new StreamWriter(Patch, false, Encoding.GetEncoding(866));
            BatFile.WriteLine("@echo off");
            BatFile.WriteLine("echo Starting ADB...");
            BatFile.WriteLine("adb start-server");
            BatFile.WriteLine("echo connect phone...");
            BatFile.WriteLine("rem adb wait-for-device");
            BatFile.WriteLine("echo Gett files from phone...");
            BatFile.WriteLine("adb remount");
            BatFile.WriteLine("adb shell su -c \"mkdir /data/tmp/\"");
            if (comboBox1.SelectedIndex == 0)
            {
                BatFile.WriteLine("adb shell su -c \"dd if=/dev/bootimg of=/data/tmp/boot.img bs=6291456c count=1\"");
                BatFile.WriteLine("adb pull /data/tmp/boot.img " + "boot.img");
                BatFile.WriteLine("adb shell su -c \"rm /data/tmp/boot.img\"");
            }
            else
            {
                BatFile.WriteLine("adb shell su -c \"dd if=/dev/recovery of=/data/tmp/recovery.img bs=6291456c count=1\"");
                BatFile.WriteLine("adb pull /data/tmp/recovery.img " + "recovery.img");
                BatFile.WriteLine("adb shell su -c \"rm /data/tmp/recovery.img\"");
            }
            BatFile.WriteLine("taskkill /F /IM adb.exe");
            BatFile.Close();

            Process win = new Process();
            win.StartInfo.ErrorDialog = true;
            win.StartInfo.FileName = Patch;
            win.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            this.Cursor = Cursors.WaitCursor;
            win.Start();
            win.WaitForExit();
            this.Cursor = Cursors.Default;
            File.Delete("Bin\\trace.bat");
// Начало распаковки
            if (Directory.Exists("Utilits\\IMGRepack") == true)
                Directory.Delete("Utilits\\IMGRepack", true);
            Directory.CreateDirectory("Utilits\\IMGRepack");

            string Patch1 = Directory.GetCurrentDirectory() + @"\Bin\trace1.bat";
            StreamWriter BatFile1 = new StreamWriter(Patch1, false, Encoding.GetEncoding(866));
            BatFile1.WriteLine("cd /d \"" + Directory.GetCurrentDirectory() + "\\Bin\"");
            if (comboBox1.SelectedIndex == 0)
            {
                BatFile1.WriteLine("imgunpack.cmd boot.img");
            }
            else
            {
                BatFile1.WriteLine("imgunpack.cmd recovery.img");
            }
            BatFile1.Close();

            Process winc = new Process();
            winc.StartInfo.ErrorDialog = true;
            winc.StartInfo.FileName = Patch;
            winc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            this.Cursor = Cursors.WaitCursor;
            winc.Start();
            winc.WaitForExit();
            this.Cursor = Cursors.Default;

            File.Delete("Bin\\trace1.bat");
            File.Delete("Bin\\"+ comboBox1.SelectedItem);

            Process win1 = new Process();
            string Patch2 = Directory.GetCurrentDirectory() + @"\Bin\trace2.bat";
            StreamWriter perm = new StreamWriter(Patch2, false, Encoding.GetEncoding(866));
            perm.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + "  /r /d y && icacls  \"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + " /grant %username%:F /t");
            //perm.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + " && icacls /\"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + " /grant все:F");
            perm.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + "  /r /d y && icacls  \"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + " /grant все:F /t");
            //perm.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + " && icacls /\"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + " /grant all:F");
            perm.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + "  /r /d y && icacls  \"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + " /grant all:F /t");
            //perm.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + " && icacls /\"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + " /grant %username%:F");
            perm.Close();
            win1.StartInfo.ErrorDialog = true;
            win1.StartInfo.FileName = Patch2;
            this.Cursor = Cursors.WaitCursor;
            win1.Start();
            win1.WaitForExit();
            this.Cursor = Cursors.Default;

            if (Directory.Exists("Bin\\boot"))
            {
                if (Directory.Exists("Utilits\\IMGRepack\\boot"))
                    Directory.Delete("Utilits\\IMGRepack\\boot", true);
                Directory.Move("Bin\\boot", "Utilits\\IMGRepack\\boot");
            }

            if (Directory.Exists("Bin\\recovery"))
            {
                if (Directory.Exists("Utilits\\IMGRepack\\recovery"))
                    Directory.Delete("Utilits\\IMGRepack\\recovery", true);
                Directory.Move("Bin\\recovery", "Utilits\\IMGRepack\\recovery");
            }

            Message MS = new Message(null, comboBox1.SelectedItem + " " + succ, null, ok, null, null, null, 1, 5);
            MS.SetDesktopLocation(this.Location.X + (this.Width / 2) - (MS.Width / 2), this.Location.Y + (this.Height / 2) - (MS.Height / 2));
            MS.ShowDialog();

        }
开发者ID:liuxingghost,项目名称:MTK-FirmwareAdapter-Tool,代码行数:101,代码来源:BR_repack.cs

示例13: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                File.Copy(openFileDialog1.FileName, "Bin\\" + comboBox1.SelectedItem,true);
                Process win1 = new Process();
                string Patch1 = Directory.GetCurrentDirectory() + @"\Bin\trace.bat";
                StreamWriter BatFile1 = new StreamWriter(Patch1, false, Encoding.GetEncoding(866));
                BatFile1.WriteLine("cd /d \"" + Directory.GetCurrentDirectory() + "\\Bin\\\"");
                BatFile1.WriteLine("imgunpack.cmd " + comboBox1.SelectedItem);
                BatFile1.Close();
                win1.StartInfo.ErrorDialog = true;
                win1.StartInfo.FileName = Patch1;
                win1.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                this.Cursor = Cursors.WaitCursor;
                win1.Start();
                win1.WaitForExit();
                this.Cursor = Cursors.Default;

                File.Delete("Bin\\trace.bat");

                string Patch2 = Directory.GetCurrentDirectory() + @"\Bin\trace2.bat";
                StreamWriter perm = new StreamWriter(Patch2, false, Encoding.GetEncoding(866));
                perm.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + "  /r /d y && icacls  \"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + " /grant %username%:F /t");
                //perm.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + " && icacls /\"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + " /grant все:F");
                perm.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + "  /r /d y && icacls  \"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + " /grant все:F /t");
                //perm.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + " && icacls /\"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + " /grant all:F");
                perm.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + "  /r /d y && icacls  \"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + " /grant all:F /t");
                //perm.WriteLine("cmd.exe /c takeown /f \"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + " && icacls /\"" + Directory.GetCurrentDirectory() + "\\Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()) + "\"" + " /grant %username%:F");
                perm.Close();
                win1.StartInfo.ErrorDialog = true;
                win1.StartInfo.FileName = Patch2;
                this.Cursor = Cursors.WaitCursor;
                win1.Start();
                win1.WaitForExit();
                this.Cursor = Cursors.Default;

                if (Directory.Exists("Utilits\\IMGRepack\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString())))
                    Directory.Delete("Utilits\\IMGRepack\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()),true);
                Directory.Move("Bin\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()), "Utilits\\IMGRepack\\" + Path.GetFileNameWithoutExtension(comboBox1.SelectedItem.ToString()));
                if (File.Exists("Bin\\" + comboBox1.SelectedItem))
                    File.Delete("Bin\\" + comboBox1.SelectedItem);

                Message MS = new Message(null, succ, null, ok, null, null, null, 1, 5);
                MS.SetDesktopLocation(this.Location.X + (this.Width / 2) - (MS.Width / 2), this.Location.Y + (this.Height / 2) - (MS.Height / 2));
                MS.ShowDialog();
            }
            else
                return;
        }
开发者ID:liuxingghost,项目名称:MTK-FirmwareAdapter-Tool,代码行数:50,代码来源:BR_repack.cs

示例14: BootPack

        public void BootPack()
        {
            if (Directory.Exists("WorkDIR\\Images\\bootP"))
                CopyDirectory("WorkDIR\\Images\\bootP", "Bin\\boot");
            if (File.Exists("WorkDIR\\Images\\bootO\\kernel"))
                File.Copy("WorkDIR\\Images\\bootO\\kernel","Bin\\boot\\kernel", true);
            if (File.Exists("WorkDIR\\Images\\bootO\\kernel_header"))
                File.Copy("WorkDIR\\Images\\bootO\\kernel_header","Bin\\boot\\kernel_header", true);

            Process wind = new Process();
            wind.StartInfo.FileName = "Bin\\imgpack.cmd";
            wind.StartInfo.Arguments = "boot";
            wind.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
            this.Cursor = Cursors.WaitCursor;
            wind.StartInfo.WorkingDirectory = "\"" + Directory.GetCurrentDirectory() + "\\Bin\"";
            wind.Start();
            wind.WaitForExit();
            this.Cursor = Cursors.Default;

            if (File.Exists("Bin\\new_image.img"))
            {
                if (File.Exists(@"WorkDIR\" + comboBox1.SelectedItem + @"\Pack\boot.img"))
                    File.Delete(@"WorkDIR\" + comboBox1.SelectedItem + @"\Pack\boot.img");
                File.Move("Bin\\new_image.img", @"WorkDIR\" + comboBox1.SelectedItem + @"\boot.img");
                Directory.Delete("WorkDIR\\Images", true);
                Directory.Delete("Bin\\boot", true);

                Message MF = new Message(null, re_succ, null, ok, null, null, null, 1, time);
                MF.SetDesktopLocation(this.Location.X + (this.Width / 2) - (MF.Width / 2), this.Location.Y + (this.Height / 2) - (MF.Height / 2));
                MF.ShowDialog();
            }
            else
            {
                Message MD = new Message(err, repeat, null, ok, null, null, null, 1, time);
                MD.SetDesktopLocation(this.Location.X + (this.Width / 2) - (MD.Width / 2), this.Location.Y + (this.Height / 2) - (MD.Height / 2));
                MD.ShowDialog();
            }
        }
开发者ID:liuxingghost,项目名称:MTK-FirmwareAdapter-Tool,代码行数:38,代码来源:Main.cs

示例15: button22_Click

        private void button22_Click(object sender, EventArgs e)
        {
            Message M = new Message(get, null, null, exit, next, null, null, 2, 0);
            M.SetDesktopLocation(this.Location.X + (this.Width / 2) - (M.Width / 2), this.Location.Y + (this.Height / 2) - (M.Height / 2));
            M.groupBox7.Visible = true;
            M.radioButton1.Text = yf;
            M.radioButton2.Text = sm;
            M.ShowDialog();
            if (M.fk == 1)
            {
                return;
            }
            else
            {
                if (M.radioButton1.Checked == true)
                {
                    if (Directory.Exists(@"WorkDIR\" + comboBox1.SelectedItem + @"\YourFiles\system") == false)
                    {
                        if (checkBox8.Checked)
                        {
                            int lastIndex = checkedListBox1.Items.Count - 1;
                            for (int i = lastIndex; i >= 0; i--)
                                checkedListBox1.Items.RemoveAt(i);
                            checkBox1.Text = sa;
                        }

                        var dir = new DirectoryInfo(@"WorkDIR\" + comboBox1.SelectedItem + @"\YourFiles");
                        foreach (FileInfo file in dir.GetFiles("*", SearchOption.AllDirectories))
                        {
                            if (file.FullName.IndexOf("META-INF") < 1)
                                checkedListBox1.Items.Add(file.FullName.Replace(@"WorkDIR\" + comboBox1.SelectedItem + @"\YourFiles" + "\\", "").Replace(@"\", "/"));
                        }
                    }
                    else
                        return;
                }
                else
                {
                    ImportList.Description = des;
                    if (ImportList.ShowDialog() == DialogResult.OK)
                    {
                        int lastIndex = checkedListBox1.Items.Count - 1;
                        for (int i = lastIndex; i >= 0; i--)
                            checkedListBox1.Items.RemoveAt(i);
                        checkBox1.Text = sa;

                        var dir = new DirectoryInfo(ImportList.SelectedPath);
                        foreach (FileInfo file in dir.GetFiles("*", SearchOption.AllDirectories))
                        {
                            if (file.FullName.IndexOf("META-INF") < 1)
                                if (file.FullName.IndexOf("system") < 1)
                                    if (ImportList.SelectedPath.EndsWith("app") || ImportList.SelectedPath.EndsWith("bin") || ImportList.SelectedPath.EndsWith("mobile_toolkit") || ImportList.SelectedPath.EndsWith("etc") || ImportList.SelectedPath.EndsWith("fonts") || ImportList.SelectedPath.EndsWith("framework") || ImportList.SelectedPath.EndsWith("lib") || ImportList.SelectedPath.EndsWith("data") || ImportList.SelectedPath.EndsWith("media") || ImportList.SelectedPath.EndsWith("usr") || ImportList.SelectedPath.EndsWith("vendor") || ImportList.SelectedPath.EndsWith("xbin"))
                                    {
                                        if (ImportList.SelectedPath.EndsWith("app"))
                                            checkedListBox1.Items.Add("system/app" + file.FullName.Replace(ImportList.SelectedPath, "").Replace(@"\", "/"));
                                        if (ImportList.SelectedPath.EndsWith("bin"))
                                            checkedListBox1.Items.Add("system/bin" + file.FullName.Replace(ImportList.SelectedPath, "").Replace(@"\", "/"));
                                        if (ImportList.SelectedPath.EndsWith("etc"))
                                            checkedListBox1.Items.Add("system/etc" + file.FullName.Replace(ImportList.SelectedPath, "").Replace(@"\", "/"));
                                        if (ImportList.SelectedPath.EndsWith("fonts"))
                                            checkedListBox1.Items.Add("system/fonts" + file.FullName.Replace(ImportList.SelectedPath, "").Replace(@"\", "/"));
                                        if (ImportList.SelectedPath.EndsWith("framework"))
                                            checkedListBox1.Items.Add("system/framework" + file.FullName.Replace(ImportList.SelectedPath, "").Replace(@"\", "/"));
                                        if (ImportList.SelectedPath.EndsWith("lib"))
                                            checkedListBox1.Items.Add("system/lib" + file.FullName.Replace(ImportList.SelectedPath, "").Replace(@"\", "/"));
                                        if (ImportList.SelectedPath.EndsWith("data"))
                                            checkedListBox1.Items.Add("system/data" + file.FullName.Replace(ImportList.SelectedPath, "").Replace(@"\", "/"));
                                        if (ImportList.SelectedPath.EndsWith("media"))
                                            checkedListBox1.Items.Add("system/media" + file.FullName.Replace(ImportList.SelectedPath, "").Replace(@"\", "/"));
                                        if (ImportList.SelectedPath.EndsWith("mobile_toolkit"))
                                            checkedListBox1.Items.Add("system/mobile_toolkit" + file.FullName.Replace(ImportList.SelectedPath, "").Replace(@"\", "/"));
                                        if (ImportList.SelectedPath.EndsWith("usr"))
                                            checkedListBox1.Items.Add("system/usr" + file.FullName.Replace(ImportList.SelectedPath, "").Replace(@"\", "/"));
                                        if (ImportList.SelectedPath.EndsWith("vendor"))
                                            checkedListBox1.Items.Add("system/vendor" + file.FullName.Replace(ImportList.SelectedPath, "").Replace(@"\", "/"));
                                        if (ImportList.SelectedPath.EndsWith("xbin"))
                                            checkedListBox1.Items.Add("system/xbin" + file.FullName.Replace(ImportList.SelectedPath, "").Replace(@"\", "/"));
                                    }
                                    else
                                        checkedListBox1.Items.Add("system" + file.FullName.Replace(ImportList.SelectedPath, "").Replace(@"\", "/"));
                                else
                                    if (ImportList.SelectedPath.EndsWith("system"))
                                    {
                                        checkedListBox1.Items.Add("system" + file.FullName.Replace(ImportList.SelectedPath, "").Replace(@"\", "/"));
                                    }
                                    else
                                    {
                                        if (ImportList.SelectedPath.EndsWith("app") || ImportList.SelectedPath.EndsWith("bin") || ImportList.SelectedPath.EndsWith("mobile_toolkit") || ImportList.SelectedPath.EndsWith("etc") || ImportList.SelectedPath.EndsWith("fonts") || ImportList.SelectedPath.EndsWith("framework") || ImportList.SelectedPath.EndsWith("lib") || ImportList.SelectedPath.EndsWith("data") || ImportList.SelectedPath.EndsWith("media") || ImportList.SelectedPath.EndsWith("usr") || ImportList.SelectedPath.EndsWith("vendor") || ImportList.SelectedPath.EndsWith("xbin"))
                                        {
                                            if (ImportList.SelectedPath.EndsWith("app"))
                                                checkedListBox1.Items.Add("system/app" + file.FullName.Replace(ImportList.SelectedPath, "").Replace(@"\", "/"));
                                            if (ImportList.SelectedPath.EndsWith("bin"))
                                                checkedListBox1.Items.Add("system/bin" + file.FullName.Replace(ImportList.SelectedPath, "").Replace(@"\", "/"));
                                            if (ImportList.SelectedPath.EndsWith("etc"))
                                                checkedListBox1.Items.Add("system/etc" + file.FullName.Replace(ImportList.SelectedPath, "").Replace(@"\", "/"));
                                            if (ImportList.SelectedPath.EndsWith("fonts"))
                                                checkedListBox1.Items.Add("system/fonts" + file.FullName.Replace(ImportList.SelectedPath, "").Replace(@"\", "/"));
                                            if (ImportList.SelectedPath.EndsWith("framework"))
                                                checkedListBox1.Items.Add("system/framework" + file.FullName.Replace(ImportList.SelectedPath, "").Replace(@"\", "/"));
                                            if (ImportList.SelectedPath.EndsWith("lib"))
//.........这里部分代码省略.........
开发者ID:liuxingghost,项目名称:MTK-FirmwareAdapter-Tool,代码行数:101,代码来源:Main.cs


注:本文中的Message.SetDesktopLocation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。