Exemplo n.º 1
0
        /*
         * public void AddTTHL(QueueEntry me)
         * {
         *  QueueEntry existing = FindExistingEntryForFileList(hub, username);
         *  if (existing == null)
         *  {
         *      QueueEntry entry = new QueueEntry();
         *      entry.Type = QueueEntry.EntryType.FileList;
         *      string temp_hub_address = hub.Address.Replace(":", "_");
         *      entry.OutputFilename = filelists_directory + "\\" + temp_hub_address + "-" + Base32.ToBase32String(Encoding.Default.GetBytes(username)) + ".xml.bz2";//TODO .. maybe changes needed here to incorporate other filelist formats
         *      entry.AddSource(new Queue.QueueEntry.Source(username, "", hub));
         *      lock (queue_lock)
         *      {
         *          items.Add(entry);
         *      }
         *      GrabEntry(entry);
         *      try
         *      {
         *          if (EntryAdded != null)
         *              EntryAdded(entry);
         *          if (EntriesChanged != null)
         *              EntriesChanged();
         *      }
         *      catch (Exception ex)
         *      {
         *          Console.WriteLine("Exception occured in added event callback: " + ex.Message);
         *      }
         *
         *  }
         * }*/

        public void AddFileList(Hub hub, string username)
        {
            QueueEntry existing = FindExistingEntryForFileList(hub, username);

            if (existing == null)
            {
                QueueEntry entry = new QueueEntry();
                entry.Type = QueueEntry.EntryType.FileList;
                string temp_hub_address = hub.Address.Replace(":", "_");
                entry.OutputFilename = filelists_directory + "\\" + temp_hub_address + "-" + Base32.ToBase32String(Encoding.Default.GetBytes(username)) + ".xml.bz2";//TODO .. maybe changes needed here to incorporate other filelist formats
                entry.AddSource(new Queue.QueueEntry.Source(username, "", hub));
                lock (queue_lock)
                {
                    items.Add(entry);
                }
                GrabEntry(entry);
                try
                {
                    if (EntryAdded != null)
                    {
                        EntryAdded(entry);
                    }
                    if (EntriesChanged != null)
                    {
                        EntriesChanged();
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Exception occured in added event callback: " + ex.Message);
                }
            }
        }