コード例 #1
0
 public static Timestamps FromTimeSpan(double seconds)
 {
     return(Timestamps.FromTimeSpan(TimeSpan.FromSeconds(seconds)));
 }
コード例 #2
0
 /// <summary>
 /// Sets the timestamp of the Rich Presence. See also <seealso cref="Timestamps"/>.
 /// </summary>
 /// <param name="timestamps">The time elapsed / remaining time data.</param>
 /// <returns>The modified Rich Presence.</returns>
 public RichPresence WithTimestamps(Timestamps timestamps)
 {
     Timestamps = timestamps;
     return(this);
 }
コード例 #3
0
        public RichPresence Clone()
        {
            RichPresence richPresence = new RichPresence();

            richPresence.State = this._state != null?this._state.Clone() as string : (string)null;

            richPresence.Details = this._details != null?this._details.Clone() as string : (string)null;

            Secrets secrets;

            if (this.HasSecrets())
            {
                secrets = new Secrets()
                {
                    JoinSecret     = this.Secrets.JoinSecret != null?this.Secrets.JoinSecret.Clone() as string         : (string)null,
                    SpectateSecret = this.Secrets.SpectateSecret != null?this.Secrets.SpectateSecret.Clone() as string : (string)null
                }
            }
            ;
            else
            {
                secrets = (Secrets)null;
            }
            richPresence.Secrets = secrets;
            Timestamps timestamps;

            if (this.HasTimestamps())
            {
                timestamps = new Timestamps()
                {
                    Start = this.Timestamps.Start,
                    End   = this.Timestamps.End
                }
            }
            ;
            else
            {
                timestamps = (Timestamps)null;
            }
            richPresence.Timestamps = timestamps;
            Assets assets;

            if (this.HasAssets())
            {
                assets = new Assets()
                {
                    LargeImageKey  = this.Assets.LargeImageKey != null?this.Assets.LargeImageKey.Clone() as string   : (string)null,
                    LargeImageText = this.Assets.LargeImageText != null?this.Assets.LargeImageText.Clone() as string : (string)null,
                    SmallImageKey  = this.Assets.SmallImageKey != null?this.Assets.SmallImageKey.Clone() as string   : (string)null,
                    SmallImageText = this.Assets.SmallImageText != null?this.Assets.SmallImageText.Clone() as string : (string)null
                }
            }
            ;
            else
            {
                assets = (Assets)null;
            }
            richPresence.Assets = assets;
            Party party;

            if (this.HasParty())
            {
                party = new Party()
                {
                    ID   = this.Party.ID,
                    Size = this.Party.Size,
                    Max  = this.Party.Max
                }
            }
            ;
            else
            {
                party = (Party)null;
            }
            richPresence.Party = party;
            return(richPresence);
        }