示例#1
0
文件: Data.cs 项目: Trainfire/DogBot
 void WriteToHistory(DogData dog)
 {
     history.Write(new HistoryRecord()
     {
         Dog = dog,
     });
 }
示例#2
0
        public DotdSetParser(SteamID setter, string message) : base(message)
        {
            var url     = "";
            var comment = "";

            if (Args.Count > 0 && IsURL(Args[0]))
            {
                url = Args[0];

                if (Args.Count > 1)
                {
                    comment = string.Join(" ", Args.Skip(1).ToList());
                }
            }
            else
            {
                Invalidate("*whines * That URL is invalid...");
            }

            if (IsValid)
            {
                Dog           = new DogData();
                Dog.Setter    = setter;
                Dog.URL       = url;
                Dog.Message   = !string.IsNullOrEmpty(comment) ? comment : "";
                Dog.TimeStamp = DateTime.UtcNow.ToBinary().ToString();
            }
        }
示例#3
0
文件: Data.cs 项目: Trainfire/DogBot
 /// <summary>
 /// Gets the next Dog in the queue, if there is one, and removes it from the queue file.
 /// </summary>
 public async void MoveToNextDog()
 {
     if (Queue.Data.Queue.Count != 0)
     {
         dog = Queue.Dequeue();
         WriteToHistory(dog);
         await Sync();
     }
 }
示例#4
0
        public void Enqueue(DogData dog)
        {
            Data.Queue.Add(dog);

            Save();

            if (DataChanged != null)
            {
                DataChanged(this, this);
            }
        }
示例#5
0
 string GetDoTDInfo(DogData dog)
 {
     if (DogOfTheDay.AnnouncementMode == AnnouncementMode.Hourly)
     {
         return(string.Format("{0} // {1}", DogOfTheDay.Strings.DogOfTheHour, dog.URL));
     }
     else
     {
         return(string.Format("{0}'s {1} // {2}", DateTime.Now.DayOfWeek.ToString(), DogOfTheDay.Strings.DogOfTheDay, dog.URL));
     }
 }