97 lines
5.1 KiB
C#
97 lines
5.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.IO;
|
|
|
|
|
|
namespace StacjaProb
|
|
{
|
|
class ReadWriteFile
|
|
{
|
|
|
|
public static void SaveDbAccessConfig()
|
|
{
|
|
string[] lines = {vGlobal.vMySql_hostname,vGlobal.vMySql_user,vGlobal.vMySql_pass,vGlobal.vMySql_dbname};
|
|
System.IO.File.WriteAllLines("dbacc.cfg", lines);
|
|
}
|
|
|
|
public static void ReadDbAccessConfig()
|
|
{
|
|
if (File.Exists("dbacc.cfg"))
|
|
{
|
|
string[] lines = System.IO.File.ReadAllLines("dbacc.cfg");
|
|
vGlobal.vMySql_hostname = lines[0];
|
|
vGlobal.vMySql_user = lines[1];
|
|
vGlobal.vMySql_pass = lines[2];
|
|
vGlobal.vMySql_dbname = lines[3];
|
|
}
|
|
else
|
|
{
|
|
vGlobal.vMySql_hostname = "localhost";
|
|
vGlobal.vMySql_user = "softspm";
|
|
vGlobal.vMySql_pass = "softspm";
|
|
vGlobal.vMySql_dbname = "softspm";
|
|
string[] lines = {vGlobal.vMySql_hostname, vGlobal.vMySql_user, vGlobal.vMySql_pass, vGlobal.vMySql_dbname};
|
|
System.IO.File.WriteAllLines("dbacc.cfg", lines);
|
|
}
|
|
}
|
|
|
|
public static void getLanguage(string lgnType)
|
|
{
|
|
string[] textToSplit;
|
|
if (File.Exists(lgnType))
|
|
{
|
|
string[] lines = System.IO.File.ReadAllLines(lgnType);
|
|
|
|
foreach (string element in lines)
|
|
{
|
|
if (element.Length > 3 && element.Substring(0,1)!="#")
|
|
{
|
|
textToSplit = element.Split('=');
|
|
if (textToSplit[0]=="systemName") vGlobal.vLng_systemName = textToSplit[1];
|
|
else if (textToSplit[0] == "main_MenuPlik") vGlobal.vLng_MenuPlik = textToSplit[1];
|
|
else if (textToSplit[0] == "main_MenuKatalog") vGlobal.vLng_MenuKatalog = textToSplit[1];
|
|
else if (textToSplit[0] == "main_MenuKonfiguracja") vGlobal.vLng_MenuKonfiguracja = textToSplit[1];
|
|
else if (textToSplit[0] == "main_MenuPomoc") vGlobal.vLng_MenuPomoc = textToSplit[1];
|
|
else if (textToSplit[0] == "main_MenuZamknij") vGlobal.vLng_MenuZamknij = textToSplit[1];
|
|
else if (textToSplit[0] == "main_SubMenuKatalogPomp") vGlobal.vLng_SubMenuKatalogPomp = textToSplit[1];
|
|
else if (textToSplit[0] == "main_SubMenuKatalogSilnikow") vGlobal.vLng_SubMenuKatalogSilnikow = textToSplit[1];
|
|
else if (textToSplit[0] == "main_SubMenuProducenci") vGlobal.vLng_SubMenuProducenci = textToSplit[1];
|
|
else if (textToSplit[0] == "main_SubMenuPolSzereg") vGlobal.vLng_SubMenuPolSzereg = textToSplit[1];
|
|
else if (textToSplit[0] == "main_SubMenuDbKonfig") vGlobal.vLng_SubMenuDbKonfig = textToSplit[1];
|
|
|
|
else if (textToSplit[0] == "dataGridPumpCatalogue_001") vGlobal.vLng_dataGridPumpCatalogue_001 = textToSplit[1];
|
|
else if (textToSplit[0] == "dataGridPumpCatalogue_002") vGlobal.vLng_dataGridPumpCatalogue_002 = textToSplit[1];
|
|
else if (textToSplit[0] == "dataGridPumpCatalogue_003") vGlobal.vLng_dataGridPumpCatalogue_003 = textToSplit[1];
|
|
else if (textToSplit[0] == "dataGridPumpCatalogue_004") vGlobal.vLng_dataGridPumpCatalogue_004 = textToSplit[1];
|
|
else if (textToSplit[0] == "dataGridPumpCatalogue_005") vGlobal.vLng_dataGridPumpCatalogue_005 = textToSplit[1];
|
|
|
|
else if (textToSplit[0] == "dataGridMotorCatalogue_001") vGlobal.vLng_dataGridMotorCatalogue_001 = textToSplit[1];
|
|
else if (textToSplit[0] == "dataGridMotorCatalogue_002") vGlobal.vLng_dataGridMotorCatalogue_002 = textToSplit[1];
|
|
else if (textToSplit[0] == "dataGridMotorCatalogue_003") vGlobal.vLng_dataGridMotorCatalogue_003 = textToSplit[1];
|
|
else if (textToSplit[0] == "dataGridMotorCatalogue_004") vGlobal.vLng_dataGridMotorCatalogue_004 = textToSplit[1];
|
|
|
|
else if (textToSplit[0] == "dataGridmanuMacturers_001") vGlobal.vLng_dataGridmanuMacturers_001 = textToSplit[1];
|
|
else if (textToSplit[0] == "dataGridmanuMacturers_002") vGlobal.vLng_dataGridmanuMacturers_002 = textToSplit[1];
|
|
else if (textToSplit[0] == "dataGridmanuMacturers_003") vGlobal.vLng_dataGridmanuMacturers_003 = textToSplit[1];
|
|
else if (textToSplit[0] == "dataGridmanuMacturers_004") vGlobal.vLng_dataGridmanuMacturers_004 = textToSplit[1];
|
|
else if (textToSplit[0] == "dataGridmanuMacturers_005") vGlobal.vLng_dataGridmanuMacturers_005 = textToSplit[1];
|
|
else if (textToSplit[0] == "dataGridmanuMacturers_006") vGlobal.vLng_dataGridmanuMacturers_006 = textToSplit[1];
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|