コード例 #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
ファイル: 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();
        }