Esempio n. 1
0
 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();
 }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
 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;
 }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 public static void Prompt(string program, AuthInfo ai) { Prompt(program, ai, true, null); }
Esempio n. 6
0
 public static void Prompt(string program, bool pause)
 {
     Prompt(program, AuthInfo.GetProgramAuth(program), pause, null);
 }
Esempio n. 7
0
 public static void Prompt(string program, AuthInfo ai)
 {
     Prompt(program, ai, true, null);
 }
Esempio n. 8
0
 public static void Prompt(string program, AuthInfo ai, bool pause, DebugDelegate deb)
 {
     Prompt(program, Common.Util.ProgramData(program), ai, pause, DEFAULTPROMPT, null);
 }
Esempio n. 9
0
 public static AuthInfo GetAuthInfo(string filepath)
 {
     return(AuthInfo.GetAuthInfo(filepath));
 }
Esempio n. 10
0
 public static bool SetAuthInfo(string file, AuthInfo ai)
 {
     return(SetAuthInfo(file, ai, null));
 }
Esempio n. 11
0
 public static bool SetProgramAuth(string basepath, string program, AuthInfo ai, DebugDelegate deb)
 {
     return(SetAuthInfo(basepath + Auth.AuthFile, ai, deb));
 }
Esempio n. 12
0
 public static bool SetProgramAuth(string program, AuthInfo ai, DebugDelegate deb)
 {
     return(SetProgramAuth(Common.Util.ProgramData(program), program, ai, deb));
 }
Esempio n. 13
0
 public static bool SetProgramAuth(string program, AuthInfo ai)
 {
     return(SetProgramAuth(program, ai, null));
 }
Esempio n. 14
0
 /// <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);
 }
Esempio n. 15
0
 public static void Prompt(string program, AuthInfo ai, bool pause) { Prompt(program, ai, pause, null); }
Esempio n. 16
0
 public static void Prompt(string program, AuthInfo ai, bool pause, DebugDelegate deb) { Prompt(program, Common.Util.ProgramData(program),ai, pause, DEFAULTPROMPT,null); }
Esempio n. 17
0
 public static bool SetProgramAuth(string program, AuthInfo ai) { return SetProgramAuth(program, ai, null); }
Esempio n. 18
0
 static void aip_NewAuthInfo(AuthInfo ai)
 {
     AuthInfo.SetProgramAuth(BASEPATH,PROGRAM, aip.Accepted, d);
 }
Esempio n. 19
0
 public static bool SetProgramAuth(string program, AuthInfo ai, DebugDelegate deb) { return SetProgramAuth(Common.Util.ProgramData(program),program, ai, deb); }
Esempio n. 20
0
 public static AuthInfo GetProgramAuth(string PROGRAM)
 {
     return(AuthInfo.GetProgramAuth(PROGRAM));
 }
Esempio n. 21
0
 public static bool SetProgramAuth(string basepath, string program, AuthInfo ai, DebugDelegate deb)
 {
     return SetAuthInfo(basepath+Auth.AuthFile, ai, deb);
 }
Esempio n. 22
0
 static void aip_NewAuthInfo(AuthInfo ai)
 {
     AuthInfo.SetProgramAuth(BASEPATH, PROGRAM, aip.Accepted, d);
 }
Esempio n. 23
0
 public static bool SetAuthInfo(string file, AuthInfo ai) { return SetAuthInfo(file, ai, null); }
Esempio n. 24
0
 public static void Prompt(string program, AuthInfo ai, bool pause)
 {
     Prompt(program, ai, pause, null);
 }
Esempio n. 25
0
 public static void Prompt(string program)
 {
     Prompt(program, AuthInfo.GetProgramAuth(program), true, null);
 }