ToString() public method

Returns information about the account in a string format.
public ToString ( ) : string
return string
コード例 #1
0
        /// <summary>
        /// 接続を開始します。<para />
        /// すでに接続が存在する場合は、すでに存在している接続を破棄します。
        /// </summary>
        public static bool RefreshConnection(AccountInfo info)
        {
            if (info == null)
            {
                throw new ArgumentNullException("info", "AccountInfo is not set.");
            }

            System.Diagnostics.Debug.WriteLine("Refresh connection: " + info.ToString());

            UserStreamsConnection ncon;

            lock (info)
            {
                UserStreamsConnection prevCon;
                // 旧接続の破棄
                if (connections.TryGetValue(info, out prevCon))
                {
                    connections.Remove(info);
                    if (prevCon != null)
                    {
                        prevCon.Dispose();
                    }
                }

                // User Streams接続しない設定になっている
                if (!info.AccountProperty.UseUserStreams)
                {
                    return(false);
                }

                ncon = new UserStreamsConnection(info);
                if (!connections.TryAdd(info, ncon))
                {
                    throw new InvalidOperationException("Connection refresh violation.");
                }
            }

            var queries = lookupDictionary.Where(v => v.Value == info).Select(v => v.Key).ToArray();

            try
            {
                ncon.Connect(queries);
                return(true);
            }
            catch (Exception e)
            {
                connections[info] = null;
                ncon.Dispose();
                ExceptionStorage.Register(e, ExceptionCategory.TwitterError,
                                          "User Streams接続に失敗しました。", () =>
                {
                    if (connections.ContainsKey(info) && connections[info] == null)
                    {
                        RefreshConnection(info);
                    }
                });
                return(false);
            }
        }
コード例 #2
0
 private void Dispose(bool disposing)
 {
     System.Diagnostics.Debug.WriteLine("Disposing:" + AccountInfo.ToString());
     if (this.disposed)
     {
         return;
     }
     this.disposed = true;
     if (this.connection != null)
     {
         this.connection.Dispose();
     }
     this.connection = null;
 }
コード例 #3
0
ファイル: Sam.cs プロジェクト: 40a/PowerShell
        /// <summary>
        /// Create a <see cref="LocalPrincipal"/> object from information in
        /// an AccountInfo object.
        /// </summary>
        /// <param name="info">
        /// An AccountInfo object containing information about the account
        /// for which the LocalPrincipal object is being created. This parameter
        /// may be null, in which case this method returns null.
        /// </param>
        /// <returns>
        /// A new LocalPrincipal object representing the account, or null if the
        /// <paramref name="info"/> parameter is null.
        /// </returns>
        private LocalPrincipal MakeLocalPrincipalObject(AccountInfo info)
        {
            if (info == null)
                return null;    // this is a legitimate case

            var rv = new LocalPrincipal(info.ToString());
            rv.SID = info.Sid;
            rv.PrincipalSource = GetPrincipalSource(info);

            switch (info.Use)
            {
                case SID_NAME_USE.SidTypeAlias:     //TODO: is this the right thing to do???
                case SID_NAME_USE.SidTypeGroup:
                case SID_NAME_USE.SidTypeWellKnownGroup:
                    rv.ObjectClass = Strings.ObjectClassGroup;
                    break;

                case SID_NAME_USE.SidTypeUser:
                    rv.ObjectClass = Strings.ObjectClassUser;
                    break;

                default:
                    rv.ObjectClass = Strings.ObjectClassOther;
                    break;
            }

            return rv;
        }
コード例 #4
0
        private async void button1_Click(object sender, RoutedEventArgs e)
        {
            AccountInfo loadedAccountInfo = await JsonSave.LoadPersonalDataFromJson();

            outputBox.Text = loadedAccountInfo.ToString();
        }