public static void Prompt(string program, string basepath, AuthInfo ai, bool pause, string promptmsg, DebugDelegate deb) { PROGRAM = program; BASEPATH = basepath+"\\"; aip = new AuthInfoPrompt(ai); aip.status(promptmsg); aip.NewAuthInfo += new AuthInfoDelegate(aip_NewAuthInfo); d = deb; if (pause) aip.ShowDialog(); else aip.Show(); }
public static bool SetAuthInfo(string file, AuthInfo ai, DebugDelegate deb) { try { System.IO.StreamWriter sw = new System.IO.StreamWriter(file, false); sw.WriteLine(ai.Username); sw.WriteLine(ai.Password); sw.Close(); return true; } catch (Exception ex) { if (deb != null) { deb("error saving file: " + file + " with: " + ex.Message + ex.StackTrace); } } return false; }
public static AuthInfo GetAuthInfo(string filepath,DebugDelegate deb) { AuthInfo ai = new AuthInfo(); try { System.IO.StreamReader sr = new System.IO.StreamReader(filepath); // skip user ai.Username = sr.ReadLine(); // get password ai.Password = sr.ReadLine(); sr.Close(); return ai; } catch (Exception ex) { if (deb != null) { deb("exception opening: "+filepath+" "+ex.Message + ex.StackTrace); } } return ai; }
public static AuthInfo GetAuthInfo(string filepath, DebugDelegate deb) { AuthInfo ai = new AuthInfo(); try { System.IO.StreamReader sr = new System.IO.StreamReader(filepath); // skip user ai.Username = sr.ReadLine(); // get password ai.Password = sr.ReadLine(); sr.Close(); return(ai); } catch (Exception ex) { if (deb != null) { deb("exception opening: " + filepath + " " + ex.Message + ex.StackTrace); } } return(ai); }
public static void Prompt(string program, AuthInfo ai) { Prompt(program, ai, true, null); }
public static void Prompt(string program, bool pause) { Prompt(program, AuthInfo.GetProgramAuth(program), pause, null); }
public static void Prompt(string program, AuthInfo ai, bool pause, DebugDelegate deb) { Prompt(program, Common.Util.ProgramData(program), ai, pause, DEFAULTPROMPT, null); }
public static AuthInfo GetAuthInfo(string filepath) { return(AuthInfo.GetAuthInfo(filepath)); }
public static bool SetAuthInfo(string file, AuthInfo ai) { return(SetAuthInfo(file, ai, null)); }
public static bool SetProgramAuth(string basepath, string program, AuthInfo ai, DebugDelegate deb) { return(SetAuthInfo(basepath + Auth.AuthFile, ai, deb)); }
public static bool SetProgramAuth(string program, AuthInfo ai, DebugDelegate deb) { return(SetProgramAuth(Common.Util.ProgramData(program), program, ai, deb)); }
public static bool SetProgramAuth(string program, AuthInfo ai) { return(SetProgramAuth(program, ai, null)); }
/// <summary> /// get authentication information in the program path of PROGRAM /// </summary> /// <param name="PROGRAM"></param> /// <returns></returns> public static AuthInfo GetProgramAuth(string PROGRAM) { AuthInfo ai = GetProgramAuth(TradeLink.Common.Util.ProgramData(PROGRAM), PROGRAM); ai.Program = PROGRAM; return(ai); }
public static void Prompt(string program, AuthInfo ai, bool pause) { Prompt(program, ai, pause, null); }
public static void Prompt(string program, AuthInfo ai, bool pause, DebugDelegate deb) { Prompt(program, Common.Util.ProgramData(program),ai, pause, DEFAULTPROMPT,null); }
public static bool SetProgramAuth(string program, AuthInfo ai) { return SetProgramAuth(program, ai, null); }
static void aip_NewAuthInfo(AuthInfo ai) { AuthInfo.SetProgramAuth(BASEPATH,PROGRAM, aip.Accepted, d); }
public static bool SetProgramAuth(string program, AuthInfo ai, DebugDelegate deb) { return SetProgramAuth(Common.Util.ProgramData(program),program, ai, deb); }
public static AuthInfo GetProgramAuth(string PROGRAM) { return(AuthInfo.GetProgramAuth(PROGRAM)); }
public static bool SetProgramAuth(string basepath, string program, AuthInfo ai, DebugDelegate deb) { return SetAuthInfo(basepath+Auth.AuthFile, ai, deb); }
static void aip_NewAuthInfo(AuthInfo ai) { AuthInfo.SetProgramAuth(BASEPATH, PROGRAM, aip.Accepted, d); }
public static bool SetAuthInfo(string file, AuthInfo ai) { return SetAuthInfo(file, ai, null); }
public static void Prompt(string program) { Prompt(program, AuthInfo.GetProgramAuth(program), true, null); }