示例#1
0
        public void Load(AppSettingsClass appSettings)
        {
            this.Stamp = appSettings.Stamp;
            //this.CodeSettings = appSettings.CodeSettings;
            this.SQLVariables     = appSettings.SQLVariables;
            this.DatabaseSettings = appSettings.DatabaseSettings;
            this.PathSettings     = appSettings.PathSettings;
            this.BehavierSettings = appSettings.BehavierSettings;

            this.Path = appSettings.Path;
            this.PathSettings.ScriptingPath       = ApplicationPathClass.Instance.GetFullPath(appSettings.PathSettings.ScriptingPath);
            this.PathSettings.TempPath            = ApplicationPathClass.Instance.GetFullPath(appSettings.PathSettings.TempPath);
            this.PathSettings.DatabasesConfigPath = ApplicationPathClass.Instance.GetFullPath(appSettings.PathSettings.DatabasesConfigPath);
            this.PathSettings.SQLExportPath       = ApplicationPathClass.Instance.GetFullPath(appSettings.PathSettings.SQLExportPath);
            this.PathSettings.InfoPath            = ApplicationPathClass.Instance.GetFullPath(appSettings.PathSettings.InfoPath);
            this.PathSettings.SQLHistoryPath      = ApplicationPathClass.Instance.GetFullPath(appSettings.PathSettings.SQLHistoryPath);
            this.PathSettings.ExportPath          = ApplicationPathClass.Instance.GetFullPath(appSettings.PathSettings.ExportPath);



            /*
             * instance = appSettings.MemberwiseClone() as AppSettingsClass;
             * instance.Path = appSettings.Path;
             * instance.PathSettings.ScriptingPath = ApplicationPathClass.GetFullPath(appSettings.PathSettings.ScriptingPath);
             * instance.PathSettings.TempPath = ApplicationPathClass.GetFullPath(appSettings.PathSettings.TempPath);
             * instance.PathSettings.DatabasesConfigPath = ApplicationPathClass.GetFullPath(appSettings.PathSettings.DatabasesConfigPath);
             */
        }
示例#2
0
        public void Load(AppSettingsClass appSettings)
        {
            instance = appSettings.MemberwiseClone() as AppSettingsClass;

            instance.PathSettings.ScriptingPath       = ApplicationPathClass.GetFullPath(appSettings.PathSettings.ScriptingPath);
            instance.PathSettings.TempPath            = ApplicationPathClass.GetFullPath(appSettings.PathSettings.TempPath);
            instance.PathSettings.DatabasesConfigPath = ApplicationPathClass.GetFullPath(appSettings.PathSettings.DatabasesConfigPath);
        }
示例#3
0
 public static AppSettingsClass Instance()
 {
     if (instance == null)
     {
         lock (_lock_this)
         {
             instance = new AppSettingsClass();
         }
     }
     return(instance);
 }
示例#4
0
        public void SaveSettings()
        {
            fastJSON.JSON.Parameters.UseExtensions = true;

            AppSettingsClass appsetting = instance.MemberwiseClone() as AppSettingsClass;

            appsetting.PathSettings.DatabasesConfigPath = ApplicationPathClass.GetPathCode(instance.PathSettings.DatabasesConfigPath);
            appsetting.PathSettings.TempPath            = ApplicationPathClass.GetPathCode(instance.PathSettings.TempPath);
            appsetting.PathSettings.ScriptingPath       = ApplicationPathClass.GetPathCode(instance.PathSettings.ScriptingPath);

            string jsonText = fastJSON.JSON.ToNiceJSON(appsetting);

            File.WriteAllText(Application.StartupPath + "\\config\\AppSettings.json", jsonText);
        }
示例#5
0
        public void SaveSettings()
        {
            fastJSON.JSON.Parameters.UseExtensions = true;
            AppSettingsClass appsetting = new AppSettingsClass();

            appsetting.PathSettings = this.PathSettings;
            //appsetting.CodeSettings = this.CodeSettings;
            appsetting.DatabaseSettings = this.DatabaseSettings;
            appsetting.BehavierSettings = this.BehavierSettings;

            appsetting.PathSettings.DatabasesConfigPath = ApplicationPathClass.Instance.GetAppBegriff(this.PathSettings.DatabasesConfigPath);
            appsetting.PathSettings.TempPath            = ApplicationPathClass.Instance.GetAppBegriff(this.PathSettings.TempPath);
            appsetting.PathSettings.ScriptingPath       = ApplicationPathClass.Instance.GetAppBegriff(this.PathSettings.ScriptingPath);
            appsetting.PathSettings.SQLHistoryPath      = ApplicationPathClass.Instance.GetAppBegriff(this.PathSettings.SQLHistoryPath);
            appsetting.PathSettings.InfoPath            = ApplicationPathClass.Instance.GetAppBegriff(this.PathSettings.InfoPath);
            appsetting.PathSettings.SQLExportPath       = ApplicationPathClass.Instance.GetAppBegriff(this.PathSettings.SQLExportPath);
            appsetting.PathSettings.ExportPath          = ApplicationPathClass.Instance.GetAppBegriff(this.PathSettings.ExportPath);
            appsetting.Path  = this.Path;
            appsetting.Stamp = DateTime.Now;

            string jsonText = fastJSON.JSON.ToNiceJSON(appsetting);

            File.WriteAllText(appsetting.Path, jsonText);
        }
示例#6
0
        private bool CreateDatabase(string sqlCmd)
        {
            /*
             *  CREATE DATABASE 'localhost:D:\Data\kj\KJFERT59.FDB'
             *  USER 'SYSDBA' PASSWORD 'masterkey'
             *  PAGE_SIZE 8192
             *  DEFAULT CHARACTER SET NONE;
             */
            string sql        = sqlCmd.ToUpper();
            string location   = "D:\\Data\\test111.FDB";
            string server     = "localhost";
            string user       = "******";
            string password   = "******";
            string packetsize = "8192";

            int inx = sql.IndexOf("CREATE DATABASE ", StringComparison.Ordinal);

            if (inx >= 0)
            {
                string cmd3 = sqlCmd.Substring(inx + 16);
                int    inx2 = cmd3.IndexOf(" ", StringComparison.Ordinal);
                string arg  = cmd3.Substring(0, inx2);

                int inx3 = arg.IndexOf(":\\", StringComparison.Ordinal);
                int inx4 = arg.IndexOf(":", StringComparison.Ordinal);
                if (inx4 < inx3)
                {
                    //server
                    server   = arg.Substring(0, inx4).Replace("'", "");
                    location = arg.Substring(inx4 + 1);
                    location = location.Replace("'", "");
                }
                else
                {
                    //nur dateipfad
                    server   = "localhost";
                    location = arg.Replace("'", "");
                }
            }

            inx = sql.IndexOf("USER ", StringComparison.Ordinal);
            if (inx >= 0)
            {
                string cmd3 = sqlCmd.Substring(inx + 5);
                int    inx2 = cmd3.IndexOf(" ", StringComparison.Ordinal);
                string arg  = cmd3.Substring(0, inx2);
                user = arg.Replace("'", "");
            }

            inx = sql.IndexOf("PASSWORD ", StringComparison.Ordinal);
            if (inx >= 0)
            {
                string cmd3 = sqlCmd.Substring(inx + 9);
                int    inx2 = cmd3.IndexOf(" ", StringComparison.Ordinal);
                string arg  = cmd3.Substring(0, inx2);
                password = arg.Replace("'", "");
            }

            inx = sql.IndexOf("PAGE_SIZE ", StringComparison.Ordinal);
            if (inx >= 0)
            {
                string cmd3 = sqlCmd.Substring(inx + 10);
                int    inx2 = cmd3.IndexOf(" ", StringComparison.Ordinal);
                string arg  = cmd3.Substring(0, inx2);
                packetsize = arg;
            }

            try
            {
                _parentNotifies?.AddToINFO(StaticFunctionsClass.DateTimeNowStr() + " ...Creating new database via script " + server + ":" + location);
                DBProviderSet.CreateDatabase(location, server, user, password, StaticFunctionsClass.ToIntDef(packetsize, AppSettingsClass.Instance().DatabaseSettings.DefaultPacketSize));
            }
            catch (Exception ex)
            {
                NotifiesClass.Instance().AddToERROR(AppStaticFunctionsClass.GetFormattedError($@"{sqlCmd}-> CreateDatabase()", ex));
            }

            return(true);
        }