コード例 #1
0
ファイル: ImportSQL.cs プロジェクト: schifflee/LightBox
        private void bStartImport_Click(object sender, EventArgs e)
        {
            if (!performChecks())
            {
                return;
            }

            this.UseWaitCursor   = true;
            bStartImport.Enabled = false;

            DataRow serverdata             = firedumpdbDataSet.sql_servers.Rows[cmbServers.SelectedIndex];
            ImportCredentialsConfig config = new ImportCredentialsConfig();

            config.database = (string)serverdata["database"];
            if (cmbDatabases.SelectedIndex != 0)
            {
                config.database = (string)cmbDatabases.SelectedValue;
            }
            config.host            = (string)serverdata["host"];
            config.password        = (string)serverdata["password"];
            config.port            = Convert.ToInt32((Int64)serverdata["port"]);
            config.username        = (string)serverdata["username"];
            config.scriptDelimeter = tbDelimeter.Text;

            adapter = new ImportAdapterManager(tb.Text, isLocal, isCompressed, isEncrypted, tbConfirmPass.Text, location, config);
            adapter.ImportComplete    += onImportCompleteHandler;
            adapter.ImportInit        += onImportInitHandler;
            adapter.ImportError       += onImportErrorHandler;
            adapter.ImportProgress    += onImportProgressHandler;
            adapter.InnerProccessInit += onInnerProccessInitHandler;

            adapter.startImport();
        }
コード例 #2
0
 public SQLImport(ImportCredentialsConfig config)
 {
     this.config = config;
     if (config.port == 0)
     {
         this.config.port = 3306;
     }
     conStringBuilder();
 }
コード例 #3
0
 public ImportAdapterManager(string path, bool isLocal, bool isCompressed, bool isEncrypted, string password, DataRow locationdata, ImportCredentialsConfig importconfig)
 {
     string[] splitpath = StringUtils.splitPath(path);
     this.path         = splitpath[0];
     this.filename     = splitpath[1];
     this.isLocal      = isLocal;
     this.isCompressed = isCompressed;
     this.isEncrypted  = isEncrypted;
     this.password     = password;
     this.locationdata = locationdata;
     this.importconfig = importconfig;
 }
コード例 #4
0
        private void button3_Click(object sender, EventArgs e)
        {
            ImportCredentialsConfig config = new ImportCredentialsConfig();

            config.host       = "127.0.0.1";
            config.port       = 3306;
            config.username   = "******";
            config.password   = "******";
            config.scriptPath = "D:\\MyStuff\\desktop\\anime.sql";
            ImportAdapter adapter = new ImportAdapter(config);

            adapter.ImportComplete += onImportCompleteHandler;
            adapter.ImportError    += onImportErrorHandler;
            adapter.ImportInit     += onImportInitHandler;
            adapter.ImportProgress += onImportProgressHandler;
            adapter.executeScript();
        }
コード例 #5
0
ファイル: ImportAdapter.cs プロジェクト: CsPeitch/Firedump
 public ImportAdapter(ImportCredentialsConfig config)
 {
     sqlimportInstance           = new SQLImport(config);
     sqlimportInstance.Progress += onProgressHandler;
 }
コード例 #6
0
ファイル: ImportSQL.cs プロジェクト: CsPeitch/Firedump
        private void bStartImport_Click(object sender, EventArgs e)
        {
            if (!performChecks())
            {
                return;
            }
            string path = tb.Text;

            //incremental chain
            if (cImportChain.Checked && pathsToImport == null)
            {
                IncrementalUtils iutils = new IncrementalUtils();
                int isLocalInt          = -1;
                if (!isLocal)
                {
                    try
                    {
                        isLocalInt = (int)(long)location["id"];
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Chain Import", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Console.WriteLine(ex.StackTrace);
                        return;
                    }
                }
                pathsToImport = iutils.calculateChain(tb.Text, isLocalInt);
                if (pathsToImport[0].StartsWith("Error"))
                {
                    MessageBox.Show(pathsToImport[1], "Chain Import", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                path = pathsToImport[0];
                foreach (string ptoimp in pathsToImport)
                {
                    Console.WriteLine("path to import: " + ptoimp);
                }
            }
            else if (cImportChain.Checked && pathsToImport != null)
            {
                if (pathsToImport.Count() == 0)
                {
                    return;
                }
                path = pathsToImport[0];
            }

            Console.WriteLine("Importing path: " + path);

            this.UseWaitCursor   = true;
            bStartImport.Enabled = false;

            DataRow serverdata             = firedumpdbDataSet.mysql_servers.Rows[cmbServers.SelectedIndex];
            ImportCredentialsConfig config = new ImportCredentialsConfig();

            config.database = (string)serverdata["database"];
            if (cmbDatabases.SelectedIndex != 0)
            {
                config.database = (string)cmbDatabases.SelectedValue;
            }
            config.host            = (string)serverdata["host"];
            config.password        = (string)serverdata["password"];
            config.port            = Convert.ToInt32((Int64)serverdata["port"]);
            config.username        = (string)serverdata["username"];
            config.scriptDelimeter = tbDelimeter.Text;

            adapter = new ImportAdapterManager(path, isLocal, isCompressed, isEncrypted, tbConfirmPass.Text, location, config);
            adapter.ImportComplete    += onImportCompleteHandler;
            adapter.ImportInit        += onImportInitHandler;
            adapter.ImportError       += onImportErrorHandler;
            adapter.ImportProgress    += onImportProgressHandler;
            adapter.InnerProccessInit += onInnerProccessInitHandler;

            adapter.startImport();
        }