Esempio n. 1
0
        private void hsSaveSourceCodes_Click(object sender, EventArgs e)
        {
            var items = selDBObjects.CheckedItemDatas;

            pbExport.Minimum = 0;
            pbExport.Value   = 0;
            pbExport.Maximum = items.Count;
            if (ckDeleteOldSourceFiles.Checked)
            {
                string[] files = Directory.GetFiles(txtSourceCodePath.Text);
                foreach (string file in files)
                {
                    try
                    {
                        File.Delete($@"{file}");
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
            var gsource = MakeGlobalCode();

            try
            {
                var fi = new FileInfo(txtSourceCodePath.Text + "\\DBGlobalFunctionsClass.cs");
                if (fi.Directory != null && fi.Directory.Exists)
                {
                    File.WriteAllText(txtSourceCodePath.Text + "\\DBGlobalFunctionsClass.cs", gsource);
                }
            }
            catch (Exception ex)
            {
                _localNotify?.AddToERROR(AppStaticFunctionsClass.GetFormattedError($@"hsSaveSourceCodes_Click", ex));
            }


            foreach (var itm in items)
            {
                var source = itm.Text.StartsWith("Cb") ? MakeCbSourceCode(itm.Object) : MakeSourceCode(itm.Object);

                try
                {
                    var fi = new FileInfo(txtSourceCodePath.Text + "\\" + itm.Text + "Class.cs");
                    if (fi.Directory != null && fi.Directory.Exists)
                    {
                        File.WriteAllText(txtSourceCodePath.Text + "\\" + itm.Text + "Class.cs", source);
                    }
                }
                catch (Exception ex)
                {
                    _localNotify?.AddToERROR(AppStaticFunctionsClass.GetFormattedError($@"hsSaveSourceCodes_Click", ex));
                }

                pbExport.Value++;
                gbExportProgress.Text = LanguageClass.Instance().GetString("PROGRESS") + $@" ({pbExport.Value}/{pbExport.Maximum})";
                Application.DoEvents();
            }
        }
Esempio n. 2
0
        public int RefreshDependenciesTo()
        {
            string cmd_index0      = "SELECT RDB$DEPENDENCIES.RDB$FIELD_NAME as Field ,RDB$DEPENDENCIES.RDB$DEPENDENT_NAME as DepentTo,CASE RDB$DEPENDENCIES.RDB$DEPENDENT_TYPE";
            string case0           = EnumClass.Instance.GetDependenciesTypeSQLCase() + " AS  DependentType FROM RDB$DEPENDENCIES";
            string cmd_index_where = "WHERE UPPER(RDB$DEPENDENCIES.RDB$DEPENDED_ON_NAME) = '" + TriggerObject.Name + "' AND RDB$DEPENDENCIES.RDB$FIELD_NAME IS NOT NULL";
            string cmd_index_order = "ORDER BY RDB$DEPENDENCIES.RDB$DEPENDENT_NAME,RDB$DEPENDENCIES.RDB$FIELD_NAME";
            string cmd_index       = $@"{cmd_index0} {case0} {cmd_index_where} {cmd_index_order};";

            dsDependenciesTo.Clear();
            dgvDependenciesTo.AutoGenerateColumns = true;

            try
            {
                var           con = new FbConnection(ConnectionStrings.Instance.MakeConnectionString(_dbReg));
                FbDataAdapter ds  = new FbDataAdapter(cmd_index, con);
                ds.Fill(dsDependenciesTo);
                con.Close();
                dgvDependenciesTo.DataMember = "Table";
                return(dsDependenciesTo.Tables[0].Rows.Count);
            }
            catch (Exception ex)
            {
                _localNotify?.AddToERROR($@"{StaticFunctionsClass.DateTimeNowStr()}->{this.Name}->RefreshDependenciesTo->{ex.Message}");
            }
            return(0);
        }
Esempio n. 3
0
 void Error(int cnt, bool worker, string info)
 {
     if (worker)
     {
         measWorker.ReportProgress(cnt, new ReportDataClass(ErrorLine, info));
     }
     else
     {
         nf.AddToERROR(info, ErrorLine);
     }
 }
Esempio n. 4
0
        public string RefreshIndicesAndGetTablename()
        {
            string cmd_index = SQLStatements.Instance().GetIndiciesByName(_dbReg.Version, IndexName.Trim());

            DataFilled        = false;
            txtIndexName.Text = IndexName.Trim();
            string TableName = string.Empty;

            try
            {
                lvFields.Items.Clear();

                var con = new FbConnection(ConnectionStrings.Instance().MakeConnectionString(_dbReg));
                con.Open();
                string PkColumn        = string.Empty;
                string IndexName       = string.Empty;
                string IndexColumnName = string.Empty;
                int    Unique          = 0;

                FbCommand fcmd  = new FbCommand(cmd_index, con);
                var       dread = fcmd.ExecuteReader();

                if (dread.HasRows)
                {
                    while (dread.Read())
                    {
                        TableName        = dread.GetValue(0).ToString().Trim();
                        IndexColumnName  = dread.GetValue(2).ToString().Trim();
                        Unique           = StaticFunctionsClass.ToIntDef(dread.GetValue(3).ToString().Trim(), 0);
                        cbUnique.Checked = Unique > 0;
                        string[] lv = new string[1];
                        lv[0] = IndexColumnName;

                        ListViewItem lvi = new ListViewItem(lv);
                        lvFields.Items.Add(lvi);
                    }
                    DataFilled = true;
                }
                con.Close();
            }
            catch (Exception ex)
            {
                _localNotify?.AddToERROR(StaticFunctionsClass.DateTimeNowStr() + "->ConstraintForm->RefreshIndices()->" + ex.Message);
            }

            return(TableName);
        }
Esempio n. 5
0
        private void LoadUserDesign()
        {
            _ss.SharedFolder        = ApplicationPathClass.Instance.GetFullPath(Application.UserAppDataPath);
            _ss.StorageName         = Name;
            _ss.DestroyWhenDisposed = false;
            try
            {
                var mw2 = (MerkeWerte)_ss[Name];
                if (mw2 == null)
                {
                    return;
                }
                _mw = mw2;

                AddCbXMLFileText(_mw.XmlDataFileName);
                if (!string.IsNullOrEmpty(_mw.XmlDataFileName))
                {
                    fctXML.OpenFile(_mw.XmlDataFileName);
                }
                AddCbXSDFileText(_mw.XsdSchemaFileName);
                if (!string.IsNullOrEmpty(_mw.XsdSchemaFileName))
                {
                    fctXSD.OpenFile(_mw.XsdSchemaFileName);
                }
                AddCbReportFileText(_mw.ReportFileName);
                if (!string.IsNullOrEmpty(_mw.ReportFileName))
                {
                    fctFRX.OpenFile(_mw.ReportFileName);
                }

                foreach (ReportSqlCommands scmd in _mw.SqlCommands)
                {
                    AddItem(scmd.cmd, scmd.caption);
                }

                if (lvCreateStatements.Items.Count > 0)
                {
                    lvCreateStatements.Items[0].Selected = true;
                }
            }
            catch (Exception ex)
            {
                _notifies?.AddToERROR(AppStaticFunctionsClass.GetFormattedError($@"{Name}-> LoadUserDesign()", ex));
            }
        }
Esempio n. 6
0
        public SQLCommandsReturnInfoClass ExecSql(string cmd, DBRegistrationClass DBReg, NotifiesClass localNotify)
        {
            var SQLcommand = new SQLCommandsClass(DBReg);

            SQLcommand.SetEncoding("NONE");
            var ri = SQLcommand.ExecuteCommand(cmd, true);

            if (!ri.commandDone)
            {
                string errorStr = AppStaticFunctionsClass.GetErrorCodeString(ri.lastError, DBReg);
                localNotify?.AddToERROR(AppStaticFunctionsClass.GetFormattedError($@"FieldForm->ExecuteCommand", $@"{cmd}->{errorStr}"));
            }
            else
            {
                localNotify?.AddToINFO(AppStaticFunctionsClass.GetFormattedInfo($@"Command done", cmd));
            }
            return(ri);
        }
Esempio n. 7
0
        public void RefreshIndices()
        {
            string cmd_index = IndexSQLStatementsClass.Instance().GetIndiciesByName(_dbReg.Version, IndexName.Trim());

            DataFilled             = false;
            txtConstraintName.Text = IndexName.Trim();

            try
            {
                var con = new FbConnection(ConnectionStrings.Instance().MakeConnectionString(_dbReg));
                con.Open();
                string PkColumn        = string.Empty;
                string IndexName       = string.Empty;
                string IndexColumnName = string.Empty;
                int    Unique          = 0;

                FbCommand fcmd  = new FbCommand(cmd_index, con);
                var       dread = fcmd.ExecuteReader();

                if (dread.HasRows)
                {
                    while (dread.Read())
                    {
                        TableName       = dread.GetValue(0).ToString().Trim();
                        IndexColumnName = dread.GetValue(2).ToString().Trim();
                        Unique          = StaticFunctionsClass.ToIntDef(dread.GetValue(3).ToString().Trim(), 0);

                        string[] lv = new string[1];
                        lv[0] = IndexColumnName;
                    }
                    DataFilled = true;
                }
                con.Close();
            }
            catch (Exception ex)
            {
                _localNotify?.AddToERROR(StaticFunctionsClass.DateTimeNowStr() + "->NotNullForm->RefreshIndices()->" + ex.Message);
            }
        }
Esempio n. 8
0
        public void GetFieldConstraintList(string TableName)
        {
            string cmd = ConstraintsSQLStatementsClass.Instance.GetAllTableConstraintsByTableName(_dbReg.Version, eConstraintType.NOTNULL, TableName);

            DataFilled = false;

            try
            {
                lvFields.Items.Clear();
                var con = new FbConnection(ConnectionStrings.Instance.MakeConnectionString(_dbReg));
                con.Open();
                string        PkColumn  = string.Empty;
                string        IndexName = string.Empty;
                FbCommand     fcmd      = new FbCommand(cmd, con);
                var           dread     = fcmd.ExecuteReader();
                List <string> fields    = new List <string>();
                if (dread.HasRows)
                {
                    while (dread.Read())
                    {
                        TableName = dread.GetValue(0).ToString().Trim();
                        string   FieldName = dread.GetValue(6).ToString().Trim();
                        string[] st        = new string[2];
                        st[0] = FieldName;
                        st[1] = TableName;
                        ListViewItem lvi = new ListViewItem(st);
                        lvFields.Items.Add(lvi);
                    }
                    DataFilled = true;
                }
                con.Close();
            }
            catch (Exception ex)
            {
                _localNotify?.AddToERROR(StaticFunctionsClass.DateTimeNowStr() + "->NotNullForm->RefreshConstraints()->" + ex.Message);
            }
        }
Esempio n. 9
0
        public string RefreshIndicesAndGetTablename(string _indexObjectName)
        {
            string cmd_index = IndexSQLStatementsClass.Instance.GetIndiciesByName(_dbReg.Version, _indexObjectName.Trim());

            _dataFilled       = false;
            txtIndexName.Text = _indexObjectName.Trim();
            string TableName = string.Empty;

            try
            {
                lvFields.Items.Clear();
                var con = new FbConnection(ConnectionStrings.Instance.MakeConnectionString(_dbReg));
                con.Open();
                string    pkColumn           = string.Empty;
                string    indexName          = string.Empty;
                string    indexColumnName    = string.Empty;
                string    oldIndexColumnName = string.Empty;
                int       Unique             = 0;
                int       IndexType          = -1;
                bool      Active             = false;
                FbCommand fcmd  = new FbCommand(cmd_index, con);
                var       dread = fcmd.ExecuteReader();

                if (dread.HasRows)
                {
                    while (dread.Read())
                    {
                        TableName        = dread.GetValue(0).ToString().Trim();
                        indexColumnName  = dread.GetValue(2).ToString().Trim();
                        Unique           = StaticFunctionsClass.ToIntDef(dread.GetValue(3).ToString().Trim(), 0);
                        Active           = StaticFunctionsClass.ToIntDef(dread.GetValue(4).ToString().Trim(), 0) != 1;
                        IndexType        = StaticFunctionsClass.ToIntDef(dread.GetValue(5).ToString().Trim(), 0);
                        cbUnique.Checked = Unique > 0;
                        ckActive.Checked = Active;

                        if (IndexType < 0)
                        {
                            cbSorting.SelectedItem = eSort.NONE;
                        }
                        else if (IndexType == 0)
                        {
                            cbSorting.SelectedItem = eSort.ASC;
                        }
                        else if (IndexType == 1)
                        {
                            cbSorting.SelectedItem = eSort.DESC;
                        }

                        string[] lv = new string[1];
                        lv[0] = indexColumnName;
                        if (this.oldIndexColumnName != indexColumnName)
                        {
                            ListViewItem lvi = new ListViewItem(indexColumnName);
                            lvFields.Items.Add(lvi);
                            this.oldIndexColumnName = indexColumnName;
                        }
                    }
                    _dataFilled = true;
                }
                con.Close();
            }
            catch (Exception ex)
            {
                _localNotify?.AddToERROR($@"{StaticFunctionsClass.DateTimeNowStr()}->IndexForm->RefreshIndicesAndGetTablename()->{ex.Message}");
            }
            return(TableName);
        }
Esempio n. 10
0
        public List <SQLCommandsReturnInfoClass> RunPreparedCommands()
        {
            //var sb = new StringBuilder();
            var riList = new List <SQLCommandsReturnInfoClass>();

            _parentNotifies?.AddToINFO($@"{StaticFunctionsClass.DateTimeNowStr()} Executing script");
            Application.DoEvents();



            // int i = 0;
            int nr = 0;


            FbConnection fbConn = null;
            FbCommand    fbCmd  = null;


            if (_drc.DatabasePath.Length > 0)
            {
                var connstr = ConnectionStrings.Instance().MakeConnectionString(_drc);
                try
                {
                    fbConn = new FbConnection(connstr);
                    fbConn.Open();
                }
                catch (Exception ex)
                {
                    object[] param = { ex.Message };
                    SEMessageBox.ShowMDIDialog(FbXpertMainForm.Instance(), "DatabaseExceptionCaption", "ErrorWhileOpeningDatabase", SEMessageBoxButtons.OK, SEMessageBoxIcon.Exclamation, null, param);
                }
            }

            if (fbConn.State == System.Data.ConnectionState.Open)
            {
                var  startDt   = DateTime.Now;
                bool DBRepoend = false;
                bool ReopenConnectionEachCommand = true;
                foreach (SCRIPTCommandClass command in this.Commands.Values)
                {
                    var ri = new SQLCommandsReturnInfoClass();
                    if (ReopenConnectionEachCommand)
                    {
                        if (fbCmd != null && fbCmd.Transaction != null)
                        {
                            ri.lastSQL = "ReopenDatabase";
                            try
                            {
                                fbCmd.Transaction.Commit();
                                fbCmd.Transaction = null;
                                ri.commandDone    = true;
                            }
                            catch (Exception ex)
                            {
                                ri.commandDone = false;
                                _parentNotifies?.AddToERROR(AppStaticFunctionsClass.GetFormattedError($@"Command error {fbCmd.CommandText}", ex));
                                if (fbCmd.Transaction != null)
                                {
                                    fbCmd.Transaction.Rollback();
                                    fbCmd.Transaction = null;
                                }
                            }
                        }
                        fbConn.Close();
                        fbConn.Open();
                        DBRepoend = fbConn.State == System.Data.ConnectionState.Open;
                    }

                    var actDt = DateTime.Now;
                    if ((actDt.Ticks - startDt.Ticks) > 30000000000)
                    {
                        _parentNotifies?.AddToINFO($@"{StaticFunctionsClass.DateTimeNowStr()} ...Executing script{nr.ToString()} commands done of {Commands.Count}.");
                    }


                    FbConnection usedCon = IsCreateDatabaseOrConnect(command.CommandText, fbConn);
                    if (usedCon != null)
                    {
                        //Create Databes oder connect
                        if (fbConn != null)
                        {
                            if (fbConn.State != System.Data.ConnectionState.Closed)
                            {
                                fbConn.Close();
                            }
                        }
                        fbConn = usedCon;
                        if (fbConn.State != System.Data.ConnectionState.Open)
                        {
                            fbConn.Open();
                        }
                        continue;
                    }

                    if (fbCmd == null || fbCmd.Transaction == null || DBRepoend)
                    {
                        fbCmd             = new FbCommand(command.CommandText, fbConn);
                        fbCmd.Transaction = fbConn.BeginTransaction();
                        DBRepoend         = false;
                    }
                    else
                    {
                        fbCmd.CommandText = command.CommandText;
                    }

                    var sw = new Stopwatch();
                    sw.Start();
                    ri.lastCommandType = command.CommandType;
                    ri.lastSQL         = command.CommandText;
                    try
                    {
                        if (command.CommandType == SQLCommandType.commit)
                        {
                            fbCmd.Transaction.Commit();

                            fbCmd.Transaction = null;
                        }
                        else
                        {
                            fbCmd.ExecuteNonQuery();
                        }
                        ri.commandDone = true;
                    }
                    catch (Exception ex)
                    {
                        ri.nErrors++;
                        ri.lastError   = ex.Message;
                        ri.commandDone = false;
                        _parentNotifies?.AddToERROR(AppStaticFunctionsClass.GetFormattedError($@"Command error {fbCmd.CommandText}", ex));
                        if (fbCmd.Transaction != null)
                        {
                            fbCmd.Transaction.Rollback();
                            fbCmd.Transaction = null;
                        }
                    }
                    sw.Stop();
                    command.Costs = sw.ElapsedMilliseconds;
                    _eventNotifies?.Notify.RaiseInfo($@"SQLScriptingClass.RunPreparedCommands()", Constants.CommandDone, command);
                    ri.costs = sw.ElapsedMilliseconds;
                    riList.Add(ri);
                    nr++;
                }

                if (fbCmd != null && fbCmd.Transaction != null)
                {
                    fbCmd.Transaction.Commit();

                    fbCmd.Transaction = null;
                }

                if (fbConn.State == System.Data.ConnectionState.Open)
                {
                    fbConn.Close();
                }
            }

            _parentNotifies?.AddToINFO($@"{StaticFunctionsClass.DateTimeNowStr()} Executing done {nr.ToString()} Commands");
            Application.DoEvents();
            return(riList);
        }
Esempio n. 11
0
        private void RunSingleCommand(SCRIPTCommandClass command)
        {
            _notifies?.AddToINFO($@"{StaticFunctionsClass.DateTimeNowStr()} Executing script command");
            Application.DoEvents();
            var _sql = new SQLScriptingClass(_actScriptingDbReg, "SCRIPT", _notifies);

            _sql.ClearCommands();
            FbConnection fbConn   = null;
            FbCommand    fbCmd    = null;
            bool         connOpen = false;

            if (_actScriptingDbReg.DatabasePath.Length > 0)
            {
                var connstr = ConnectionStrings.Instance().MakeConnectionString(_actScriptingDbReg);
                try
                {
                    fbConn = new FbConnection(connstr);
                    fbConn.Open();
                    connOpen = fbConn.State == System.Data.ConnectionState.Open;
                }
                catch (Exception ex)
                {
                    Enabled = false;
                    object[] param = { ex.Message };
                    SEMessageBox.ShowMDIDialog(FbXpertMainForm.Instance(), "DatabaseExceptionCaption", "ErrorWhileOpeningDatabase", SEMessageBoxButtons.OK, SEMessageBoxIcon.Exclamation, null, param);
                    Enabled = true;
                    BringToFront();
                }
            }

            if (connOpen)
            {
                var sw = new Stopwatch();
                sw.Start();
                FbConnection usedCon = IsCreateDatabaseOrConnect(command.CommandText, fbConn);
                if (usedCon != null)
                {
                    //Create database oder connect database
                    fbConn = usedCon;
                }
                else // kein create oder connect, voreingestellte connetion wird verwended
                {
                    fbCmd             = new FbCommand(command.CommandText, fbConn);
                    fbCmd.Transaction = fbConn.BeginTransaction();
                    try
                    {
                        if (command.CommandType == SQLCommandType.commit)
                        {
                            fbCmd.Transaction.Commit();
                        }
                        else
                        {
                            fbCmd.ExecuteNonQuery();
                            if (fbCmd.Transaction != null)
                            {
                                fbCmd.Transaction.Commit();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        if (fbCmd.Transaction != null)
                        {
                            fbCmd.Transaction.Rollback();
                        }
                        fbCmd.Transaction = null;
                        _notifies?.AddToERROR(AppStaticFunctionsClass.GetFormattedError($@"Command error {fbCmd.CommandText}", ex));
                    }
                }
                if (connOpen)
                {
                    fbConn.Close();
                }
                sw.Stop();
                Cursor = Cursors.Default;
                _notifies?.AddToINFO($@"{StaticFunctionsClass.DateTimeNowStr()} Executing done in {sw} ms");
                Application.DoEvents();
            }
            else
            {
                _notifies?.AddToINFO($@"{StaticFunctionsClass.DateTimeNowStr()} Database {_actScriptingDbReg.Alias} not open ");
                Application.DoEvents();
            }
        }
Esempio n. 12
0
        public int RefreshDatas(string cmd)
        {
            int errorsCnt     = 0;
            int errorsAllowed = BasicClassLibrary.StaticFunctionsClass.ToIntDef(txtMaxAllowedErrors.Text, 0);

            if (string.IsNullOrEmpty(ViewObject.Name))
            {
                return(dsViewContent.Tables[0].Rows.Count);
            }
            try
            {
                long.TryParse(txtMaxRows.Text, out var maxRows);

                dgvResults.AutoGenerateColumns = true;
                GetDataWorker.ReportProgress(1, "Reading data...");
                long skip = 0;

                if (_dataConnection != null)
                {
                    if (_dataConnection.State != System.Data.ConnectionState.Closed)
                    {
                        _dataConnection.Close();
                    }
                }
                _dataConnection = new FbConnection(ConnectionStrings.Instance().MakeConnectionString(DBReg));
                _dataConnection.Open();
                var cnt = DBReg.SkipForSelect;
                var sk  = DBReg.SkipForSelect;
                if ((maxRows > 0) && (cnt > maxRows))
                {
                    cnt = maxRows;
                    sk  = cnt;
                }
                string cmds = string.Empty;
                while ((cnt >= sk) && (skip < maxRows || maxRows <= 0))
                {
                    try
                    {
                        if (this.GetDataWorker.CancellationPending)
                        {
                            return(0);
                        }
                        cmds = $@"SELECT FIRST {sk} SKIP {skip} {cmd};";
                        var ds = new FbDataAdapter(cmds, _dataConnection);

                        cnt = ds.Fill(dsViewContent);
                        GetDataWorker.ReportProgress(1, "..." + skip.ToString());
                        skip += cnt;
                    }
                    catch (Exception ex)
                    {
                        _localNofity.AddToERROR($@"{BasicClassLibrary.StaticFunctionsClass.DateTimeNowStr()}->{this.Name}->RefreshDatas({cmds}), msg:{ex.Message}");
                        errorsCnt++;

                        if (errorsCnt > errorsAllowed)
                        {
                            GetDataWorker.CancelAsync();
                        }
                    }
                }
                _dataConnection.Close();
            }
            catch (Exception ex)
            {
                NotifiesClass.Instance().AddToERROR($@"{BasicClassLibrary.StaticFunctionsClass.DateTimeNowStr()}->{this.Name}->RefreshDatas({cmd}), msg:{ex.Message}");
            }
            return(dsViewContent.Tables[0].Rows.Count);
        }
Esempio n. 13
0
        private void hsSaveSourceCodes_Click(object sender, EventArgs e)
        {
            if (!Directory.Exists(txtSourceCodePath.Text))
            {
                object[] p = { txtSourceCodePath.Text, Environment.NewLine };
                SEMessageBox.ShowMDIDialog(FbXpertMainForm.Instance(), "DirectoryNotExists", "DirectoryNotExistsParam", FormStartPosition.CenterScreen, SEMessageBoxButtons.OK, SEMessageBoxIcon.Exclamation, null, p);
                return;
            }
            var items = selDBObjects.CheckedItemDatas;

            pbExport.Minimum = 0;
            pbExport.Value   = 0;
            pbExport.Maximum = items.Count;
            if (ckDeleteOldSourceFiles.Checked)
            {
                string[] files = Directory.GetFiles(txtSourceCodePath.Text);
                foreach (string file in files)
                {
                    try
                    {
                        File.Delete($@"{file}");
                    }
                    catch //(Exception ex)
                    {
                    }
                }
            }
            var gsource = MakeGlobalCode();

            try
            {
                var fi = new FileInfo(txtSourceCodePath.Text + "\\DBGlobalFunctionsClass.cs");
                if (fi.Directory != null && fi.Directory.Exists)
                {
                    File.WriteAllText(txtSourceCodePath.Text + "\\DBGlobalFunctionsClass.cs", gsource);
                }
            }
            catch (Exception ex)
            {
                _localNotify?.AddToERROR(AppStaticFunctionsClass.GetFormattedError($@"hsSaveSourceCodes_Click", ex));
            }


            foreach (var itm in items)
            {
                var source = itm.Text.StartsWith("Cb") ? MakeCbSourceCode(itm.Object) : MakeSourceCode(itm.Object);

                try
                {
                    var fi = new FileInfo(txtSourceCodePath.Text + "\\" + itm.Text + "Class.cs");
                    if (fi.Directory != null && fi.Directory.Exists)
                    {
                        File.WriteAllText(txtSourceCodePath.Text + "\\" + itm.Text + "Class.cs", source);
                    }
                }
                catch (Exception ex)
                {
                    _localNotify?.AddToERROR(AppStaticFunctionsClass.GetFormattedError($@"hsSaveSourceCodes_Click", ex));
                }

                pbExport.Value++;
                gbExportProgress.Text = LanguageClass.Instance.GetString("PROGRESS") + $@" ({pbExport.Value}/{pbExport.Maximum})";
                Application.DoEvents();
            }
        }