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