Exemple #1
0
    private void CreateMySQLConfig()
    {
        mySQLConfig = new MySQLConfig();

        string dataAsJson = JsonUtility.ToJson(mySQLConfig);

        File.WriteAllText(pathMySQLConfig, dataAsJson);
    }
Exemple #2
0
    public void Awake()
    {
        string jsonTextFile = File.ReadAllText(Application.dataPath + "/Resources/MySQL.json");

        config = MySQLConfig.CreateFromJSON(jsonTextFile);

        connectString = "SERVER=" + config.host + ";DATABASE=" + config.database + ";UID=" + config.user + ";PASSWORD=" + config.password;

        ConnectDB();
    }
Exemple #3
0
    public void EnterLoginInput()
    {
        mySQLConfig = new MySQLConfig();

        mySQLConfig.host     = serverInput.text;
        mySQLConfig.database = databaseInput.text;
        mySQLConfig.user     = userInput.text;
        mySQLConfig.password = passwordInput.text;

        WriteMySQLConfig(mySQLConfig);

        if (!CheckLoginDaten())
        {
            if (!fehlschlagText.activeSelf)
            {
                fehlschlagText.SetActive(true);
            }
        }
    }
Exemple #4
0
 public override void Connect_To_Database(StorageConfig config)
 {
     myConfig = config as MySQLConfig;
     if (myConfig == null)
     {
         throw new Exception("Database Config is NULL");
     }
     try
     {
         myDBConn = new MySqlConnection(ConnectionString);
         myDBConn.Open();
         if (myDBConn.State != System.Data.ConnectionState.Open)
         {
             throw new Exception("Unable to Open Database. Storage:" + config.Name);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        private void cmdAddMySQLStorage_Click(object sender, RoutedEventArgs e)
        {
            string val = "Storage_" + (grdStorages.Items.Count + 1);

            if (DotNetSiemensPLCToolBoxLibrary.General.InputBox.Show("Storage-Name", "Name of the Storage", ref val) == DialogResult.OK)
            {
                foreach (var tmp in ProtokollerConfiguration.ActualConfigInstance.Storages)
                {
                    if (tmp.Name.ToLower().Trim() == val.ToLower().Trim())
                    {
                        MessageBox.Show("A Storage with this Name already Exists!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        return;
                    }
                }
                MySQLConfig storage = new MySQLConfig()
                {
                    Name = val
                };
                ProtokollerConfiguration.ActualConfigInstance.Storages.Add(storage);
            }
        }
Exemple #6
0
    private void WriteMySQLConfig(MySQLConfig mySQLC)
    {
        string dataAsJson = JsonUtility.ToJson(mySQLC);

        File.WriteAllText(pathMySQLConfig, dataAsJson);
    }