Esempio n. 1
0
        private static void OnDiscordUpdate(object state)
        {
            if (RecentlyGotUpdate && DateTimeOffset.UtcNow.Subtract(LastUpdated) >= TimeToWaitBeforeRemovingRichPresence)
            {
                Console.WriteLine("Expired! LastUpdated: " + LastUpdated.ToString("T"));
                OnActivityStatusTimerElapsed();
            }

            if (_discord != null)
            {
                try
                {
                    if (IsCurrentlyDisposing)
                    {
                        return;
                    }

                    lock (Lock)
                    {
                        _discord.RunCallbacks();
                    }

#if DEBUG
                    _runCnt++;

                    if (_runCnt % 1000 == 0)
                    {
                        Console.WriteLine("Callback: " + WhoAmI);
                    }
#endif
                }
                catch (SEHException) { }
                catch { }
            }
        }
Esempio n. 2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (Id != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (Email.Length != 0)
            {
                hash ^= Email.GetHashCode();
            }
            hash ^= phones_.GetHashCode();
            if (lastUpdated_ != null)
            {
                hash ^= LastUpdated.GetHashCode();
            }
            if (address_ != null)
            {
                hash ^= Address.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 3
0
        public override UITableViewCell GetCell(UITableView tv)
        {
            var cell = tv.DequeueReusableCell(CellKey) as IssueCellView ?? IssueCellView.Create();

            cell.Bind(Title, Status, Priority, Assigned, LastUpdated.ToDaysAgo(), Id, Kind);
            return(cell);
        }
Esempio n. 4
0
        /// <summary>
        /// Formats string for display by replacing placeholder strings with actual values.
        /// </summary>
        /// <param name="Format">The <see cref="string"/></param>
        /// <returns>The <see cref="string"/></returns>
        public string FormatLine(string Format)
        {
            Dictionary <string, string> replacementTable = new
                                                           Dictionary <string, string>
            {
                { "i", (Index + 1).ToString() },
                { "n", Configuration.Instance.GetReadState(this.IsNew) },
                { "D", Configuration.Instance.GetDownloadState(this.IsDownloaded) },
                { "x", Configuration.Instance.GetDeletedState(this.Deleted) }, //only shown when article is marked as deleted, afterwards filtered out
                { "d", PublishDate.ToString(dateFormat) },
                { "u", LastUpdated.ToString(dateFormat) },
                { "t", Title },
                { "s", Summary },
                { "l", FeedUrl.ToString() },
                { "V", Configuration.MAJOR_VERSION },
                { "v", Configuration.VERSION }
            };
            var line = Formatter.FormatLine(Format, replacementTable);

            if (this.IsProcessing)
            {
                return(Configuration.Instance.LoadingPrefix + line +
                       Configuration.Instance.LoadingSuffix);
            }
            else
            {
                return(line);
            }
        }
Esempio n. 5
0
            public override void Save()
            {
                base.Save();

                var settings = new TaskSettings(Task);

                settings.SaveValue(Config.LastUpdatedName, LastUpdated.ToString());
            }
Esempio n. 6
0
 /// <summary>
 /// Returns LastUpdate as a formatted string (ex. July 29, 2015 at 12:00 PM)
 /// </summary>
 /// <returns></returns>
 public string GetLastUpdatedAsString()
 {
     if (LastUpdated.Equals(DateTime.MinValue))
     {
         return("Never");
     }
     return(GetDateTimeAsFormattedString(LastUpdated));
 }
Esempio n. 7
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (Id != null ? Id.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ VersionCounter.GetHashCode();
         hashCode = (hashCode * 397) ^ Created.GetHashCode();
         hashCode = (hashCode * 397) ^ LastUpdated.GetHashCode();
         hashCode = (hashCode * 397) ^ (CreatedBy != null ? CreatedBy.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (WorkspaceId != null ? WorkspaceId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (BranchName != null ? BranchName.GetHashCode() : 0);
         return(hashCode);
     }
 }
Esempio n. 8
0
        /// <summary>
        /// Check function to limit output frequency, when outputting to console.
        /// </summary>
        /// <returns></returns>
        public bool ShouldUpdate()
        {
            var update = false;

            lock (UpdateLock)
            {
                if (DateTime.UtcNow >= LastUpdated.AddSeconds(UpdateFrequencySeconds))
                {
                    LastUpdated = DateTime.UtcNow;
                    update      = true;
                }
            }
            return(update);
        }
Esempio n. 9
0
 public override int GetHashCode()
 {
     unchecked {
         int hashCode = (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CreatedBy != null ? CreatedBy.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Created.GetHashCode();
         hashCode = (hashCode * 397) ^ LastUpdated.GetHashCode();
         hashCode = (hashCode * 397) ^ (Id != null ? Id.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ VersionCounter.GetHashCode();
         hashCode = (hashCode * 397) ^ (Workspaces != null ? Workspaces.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         return(hashCode);
     }
 }
Esempio n. 10
0
 public bool Equals(WorkspaceBranch other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(string.Equals(Id, other.Id) && VersionCounter == other.VersionCounter &&
            Created.Equals(other.Created) && LastUpdated.Equals(other.LastUpdated) &&
            string.Equals(CreatedBy, other.CreatedBy) && string.Equals(WorkspaceId, other.WorkspaceId) &&
            string.Equals(BranchName, other.BranchName));
 }
Esempio n. 11
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Adds;
         hashCode = (hashCode * 397) ^ Updates;
         hashCode = (hashCode * 397) ^ Removes;
         hashCode = (hashCode * 397) ^ Refreshes;
         hashCode = (hashCode * 397) ^ Moves;
         hashCode = (hashCode * 397) ^ Count;
         hashCode = (hashCode * 397) ^ Index;
         hashCode = (hashCode * 397) ^ LastUpdated.GetHashCode();
         return(hashCode);
     }
 }
Esempio n. 12
0
        private void GetLastUpdated()
        {
            string SQL = "SELECT TOP 1 CONVERT(varchar, ExecutionTime, 1) AS LastUpdated FROM SavingsEventLog ORDER BY ExecutionTime DESC";

            cmd = new SqlCommand(SQL, con);
            con.Open();
            SqlDataReader dr = cmd.ExecuteReader();

            if (dr.Read())
            {
                string lastUpdated = (dr["LastUpdated"].ToString());
                LastUpdated.AppendText(lastUpdated);
            }
            con.Close();
        }