public bool GetAccountInformations() { bool Result; UInt32 Count = 0; LiveIdInformation Info = new LiveIdInformation(); LangMgr = new LanguageSupport(); IntPtr BufPtr = IntPtr.Zero; NativeWin32API.CREDENTIAL CurrentCredential; if (IsSuccess) { return(true); } Result = NativeWin32API.CredEnumerate("WindowsLive:name=*", 0, out Count, out CredentialPtr); if (Result) { LiveAccounts = new List <LiveIdInformation>((int)Count); BufPtr = CredentialPtr; for (int i = 0; i < Count; i++) { BufPtr = new IntPtr(BufPtr.ToInt32() + ((i == 0) ? 0 : Marshal.SizeOf(CredentialPtr))); CurrentCredential = (NativeWin32API.CREDENTIAL)Marshal.PtrToStructure(Marshal.ReadIntPtr(BufPtr), typeof(NativeWin32API.CREDENTIAL)); Info.LiveId = CurrentCredential.UserName; Info.Password = Marshal.PtrToStringUni(CurrentCredential.CredentialBlob); int LngIndex = System.Globalization.CultureInfo.CurrentCulture.Parent.NativeName == "English"? 1 : 0; if (Info.Password == null) { Info.Password = LangMgr["PwdNotSet"]; } LiveAccounts.Add(Info); } IsSuccess = true; } return(Result); }
public bool GetAccountInformations() { bool Result; UInt32 Count=0; LiveIdInformation Info = new LiveIdInformation(); LangMgr = new LanguageSupport(); IntPtr BufPtr = IntPtr.Zero; NativeWin32API.CREDENTIAL CurrentCredential; if (IsSuccess) return true; Result = NativeWin32API.CredEnumerate("WindowsLive:name=*",0,out Count,out CredentialPtr); if (Result) { LiveAccounts = new List<LiveIdInformation>((int)Count); BufPtr = CredentialPtr; for (int i = 0; i < Count; i++) { BufPtr = new IntPtr(BufPtr.ToInt32() + ((i == 0) ? 0 : Marshal.SizeOf(CredentialPtr))); CurrentCredential = (NativeWin32API.CREDENTIAL)Marshal.PtrToStructure(Marshal.ReadIntPtr(BufPtr),typeof(NativeWin32API.CREDENTIAL)); Info.LiveId = CurrentCredential.UserName; Info.Password = Marshal.PtrToStringUni(CurrentCredential.CredentialBlob); int LngIndex = System.Globalization.CultureInfo.CurrentCulture.Parent.NativeName == "English"? 1 : 0; if (Info.Password == null) Info.Password = LangMgr["PwdNotSet"]; LiveAccounts.Add(Info); } IsSuccess = true; } return Result; }
public bool Read(out LiveIdInformation Account) { Account = new LiveIdInformation(); if (!this.IsSuccess) { return(false); } if (this.ReaderIndex == this.LiveAccounts.Count) { return(false); } else { Account = this.LiveAccounts[this.ReaderIndex++]; } return(true); }
public bool Read(out LiveIdInformation Account) { Account = new LiveIdInformation(); if (!IsSuccess) { return(false); } if (ReaderIndex != LiveAccounts.Count) { Account = LiveAccounts[ReaderIndex++]; } else { return(false); } return(true); }
public bool Read(out LiveIdInformation Account) { Account = new LiveIdInformation(); if (!IsSuccess) return false; if (ReaderIndex != LiveAccounts.Count) Account = LiveAccounts[ReaderIndex++]; else return false; return true; }