public ContentSync() { //load config string path = ConfigMng.FindTmpl("fb.cfg"); string txt = File.ReadAllText(path); ConfigCS cfg = JsonConvert.DeserializeObject <ConfigCS>(txt); ApiKey = cfg.ApiKey; FirebaseEmail = cfg.FirebaseEmail; FirebasePassword = cfg.FirebasePassword; }
void getCnnStr() { #if DEBUG m_db = ConfigMng.CfgRead("zDb") as string; #else m_db = ConfigMng.FindTmpl("PTXX_NB.accdb"); #endif if (m_db != null) { var cnnStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=<zDb>;"; m_cnnStr = cnnStr.Replace("<zDb>", m_db); } else { OpenDbDlg(); #if DEBUG ConfigMng.CfgWrite("zDb", m_db); #endif } }
private void openFormToolStripMenuItem_Click(object sender, EventArgs e) { string vbs; #if DEBUG vbs = @"C:\Users\Onsiter\Google Drive\CBV\DTPTXX\tools\dkthoikhoa.vbs"; #else vbs = ConfigMng.FindTmpl("dkthoikhoa.vbs"); #endif Process scriptProc = new Process(); scriptProc.StartInfo.WorkingDirectory = vbs.Substring(0, vbs.LastIndexOf("\\")); scriptProc.StartInfo.FileName = @"C:\Windows\SysWOW64\cscript.exe"; scriptProc.StartInfo.UseShellExecute = false; scriptProc.StartInfo.Arguments = "dkthoikhoa.vbs"; scriptProc.StartInfo.CreateNoWindow = false; scriptProc.StartInfo.Verb = "runas"; scriptProc.StartInfo.WindowStyle = ProcessWindowStyle.Normal; //prevent console window from popping up scriptProc.Start(); //scriptProc.StartInfo.WorkingDirectory = vbs.Substring(vbs.LastIndexOf("\\")); //<---very important //scriptProc.WaitForExit(); // <-- Optional if you want program running until your script exit //scriptProc.Close(); }