Public Types | |
enum | EntryType { File, Directory, FileList } |
enum | Priority { higher, normal, lesser } |
Public Member Functions | |
bool | AddSource (Source me) |
void | ClearSources () |
void | DeleteOutputFile () |
delegate void | EntryClaimedEventHandler (QueueEntry entry, Peer claiming_peer) |
delegate void | EntrySourceAddedEventHandler (QueueEntry entry, QueueEntry.Source source) |
delegate void | EntrySourceRemovedEventHandler (QueueEntry entry, QueueEntry.Source source) |
delegate void | EntrySourceStatusChangedEventHandler (QueueEntry entry, QueueEntry.Source source) |
delegate void | EntryUnclaimedEventHandler (QueueEntry entry) |
Source | FindFirstSourceByUser (string username) |
Source | FindFirstSourceByUserAndHub (string username, Hub hub) |
void | GrabSources () |
QueueEntry () | |
void | RemoveSource (Source me) |
void | StartDownload () |
bool | TryToClaimEntry (Peer claiming_peer) |
void | UnclaimEntry () |
void | Ungrab () |
void | UpdateSourcesByUsername (string username, Hub source_hub, bool is_online) |
Public Attributes | |
event EntryClaimedEventHandler | EntryClaimed |
event EntrySourceAddedEventHandler | EntrySourceAdded |
event EntrySourceRemovedEventHandler | EntrySourceRemoved |
event EntrySourceStatusChangedEventHandler | EntrySourceStatusChanged |
event EntryUnclaimedEventHandler | EntryUnclaimed |
Protected Attributes | |
Priority | download_priority = Priority.normal |
long | filesize = 0 |
bool | is_in_use = false |
Object | is_in_use_lock = new Object() |
string | output_filename = "" |
List< Source > | sources = new List<Source>() |
Object | sources_lock = new Object() |
string | tth = "" |
byte[] | tthl = new byte[0] |
EntryType | type = EntryType.File |
bool | want_tthl = false |
Properties | |
Priority | DownloadPriority [get, set] |
long | Filesize [get, set] |
long | FilesizeOnDisk [get] |
get the filesize of the output file ( not very cpu efficient ;-( ) | |
bool | HasTTH [get] |
[XmlIgnoreAttribute] bool | IsInUse [get] |
string | OutputFilename [get, set] |
List< Source > | Sources [get] |
int | SourcesOnline [get] |
string | TTH [get, set] |
byte[] | TTHL [get, set] |
EntryType | Type [get, set] |
bool | WantTTHL [get, set] |
Classes | |
class | Source |
Definition at line 14 of file Queue.cs.
DCPlusPlus.Queue.QueueEntry.QueueEntry | ( | ) |
bool DCPlusPlus.Queue.QueueEntry.AddSource | ( | Source | me | ) |
Definition at line 439 of file Queue.cs.
References DCPlusPlus.Queue.QueueEntry.EntrySourceAdded, DCPlusPlus.Queue.QueueEntry.EntrySourceStatusChanged, DCPlusPlus.Queue.QueueEntry.FindFirstSourceByUser(), DCPlusPlus.Queue.QueueEntry.sources, DCPlusPlus.Queue.QueueEntry.sources_lock, DCPlusPlus.Queue.QueueEntry.Source.SourceStatusChanged, and DCPlusPlus.Queue.QueueEntry.Source.UserName.
Referenced by DCPlusPlus.Queue.AddFileList(), and DCPlusPlus.Queue.AddSearchResult().
00440 { 00441 if (FindFirstSourceByUser(me.UserName) == null) 00442 { 00443 lock (sources_lock) 00444 { 00445 sources.Add(me); 00446 } 00447 me.SourceStatusChanged += delegate(Source status_changed) 00448 { 00449 if (EntrySourceStatusChanged != null) 00450 EntrySourceStatusChanged(this, status_changed); 00451 }; 00452 if (EntrySourceAdded != null) 00453 EntrySourceAdded(this, me); 00454 return (true); 00455 } 00456 else 00457 { 00458 return (false); 00459 } 00460 }
Here is the call graph for this function:
Here is the caller graph for this function:
void DCPlusPlus.Queue.QueueEntry.ClearSources | ( | ) |
Definition at line 489 of file Queue.cs.
References DCPlusPlus.Queue.QueueEntry.EntrySourceRemoved, DCPlusPlus.Queue.QueueEntry.sources, and DCPlusPlus.Queue.QueueEntry.sources_lock.
00490 { 00491 lock (sources_lock) 00492 { 00493 foreach (Source source in sources) 00494 { 00495 sources.Remove(source); 00496 source.Ungrab(); 00497 if (EntrySourceRemoved != null) 00498 EntrySourceRemoved(this, source); 00499 } 00500 } 00501 }
void DCPlusPlus.Queue.QueueEntry.DeleteOutputFile | ( | ) |
Definition at line 462 of file Queue.cs.
References DCPlusPlus.Queue.QueueEntry.File, and DCPlusPlus.Queue.QueueEntry.output_filename.
Referenced by DCPlusPlus.Queue.RestartDownload().
00463 { 00464 if (File.Exists(output_filename)) 00465 { 00466 try 00467 { 00468 File.Delete(output_filename); 00469 } 00470 catch (Exception ex) 00471 { 00472 Console.WriteLine("Error deleting file: "+ output_filename); 00473 } 00474 } 00475 }
Here is the caller graph for this function:
delegate void DCPlusPlus.Queue.QueueEntry.EntryClaimedEventHandler | ( | QueueEntry | entry, | |
Peer | claiming_peer | |||
) |
delegate void DCPlusPlus.Queue.QueueEntry.EntrySourceAddedEventHandler | ( | QueueEntry | entry, | |
QueueEntry.Source | source | |||
) |
delegate void DCPlusPlus.Queue.QueueEntry.EntrySourceRemovedEventHandler | ( | QueueEntry | entry, | |
QueueEntry.Source | source | |||
) |
delegate void DCPlusPlus.Queue.QueueEntry.EntrySourceStatusChangedEventHandler | ( | QueueEntry | entry, | |
QueueEntry.Source | source | |||
) |
delegate void DCPlusPlus.Queue.QueueEntry.EntryUnclaimedEventHandler | ( | QueueEntry | entry | ) |
Source DCPlusPlus.Queue.QueueEntry.FindFirstSourceByUser | ( | string | username | ) |
Definition at line 400 of file Queue.cs.
References DCPlusPlus.Queue.QueueEntry.sources, and DCPlusPlus.Queue.QueueEntry.sources_lock.
Referenced by DCPlusPlus.Queue.QueueEntry.AddSource().
00401 { 00402 Source ret = null; 00403 lock (sources_lock) 00404 { 00405 foreach (Source source in sources) 00406 { 00407 if (source.UserName == username) ret = source; 00408 } 00409 } 00410 return (ret); 00411 }
Here is the caller graph for this function:
Definition at line 412 of file Queue.cs.
References DCPlusPlus.Queue.QueueEntry.sources, and DCPlusPlus.Queue.QueueEntry.sources_lock.
00413 { 00414 Source ret = null; 00415 lock (sources_lock) 00416 { 00417 foreach (Source source in sources) 00418 { 00419 if (source.UserName == username && source.HasHub && source.Hub == hub) ret = source; 00420 } 00421 } 00422 return (ret); 00423 }
void DCPlusPlus.Queue.QueueEntry.GrabSources | ( | ) |
Definition at line 504 of file Queue.cs.
References DCPlusPlus.Queue.QueueEntry.EntrySourceStatusChanged, DCPlusPlus.Queue.QueueEntry.sources, and DCPlusPlus.Queue.QueueEntry.sources_lock.
00505 { 00506 lock (sources_lock) 00507 { 00508 foreach (Source source in sources) 00509 { 00510 source.SourceStatusChanged += delegate(Source status_changed) 00511 { 00512 if (EntrySourceStatusChanged != null) 00513 EntrySourceStatusChanged(this, status_changed); 00514 }; 00515 00516 } 00517 } 00518 }
void DCPlusPlus.Queue.QueueEntry.RemoveSource | ( | Source | me | ) |
Definition at line 478 of file Queue.cs.
References DCPlusPlus.Queue.QueueEntry.EntrySourceRemoved, DCPlusPlus.Queue.QueueEntry.sources, DCPlusPlus.Queue.QueueEntry.sources_lock, and DCPlusPlus.Queue.QueueEntry.Source.Ungrab().
00479 { 00480 lock (sources_lock) 00481 { 00482 sources.Remove(me); 00483 } 00484 me.Ungrab(); 00485 if (EntrySourceRemoved != null) 00486 EntrySourceRemoved(this, me); 00487 }
Here is the call graph for this function:
void DCPlusPlus.Queue.QueueEntry.StartDownload | ( | ) |
Definition at line 380 of file Queue.cs.
References DCPlusPlus.Queue.QueueEntry.sources, and DCPlusPlus.Queue.QueueEntry.sources_lock.
00381 { 00382 lock (sources_lock) 00383 {//TODO put this in queue class 00384 foreach (Source source in sources) 00385 { 00386 if (source.HasHub && source.IsOnline) 00387 { 00388 source.Hub.SendConnectToMe(source.UserName); //signal download to hub to start it 00389 } 00390 } 00391 } 00392 //sources strategy 00393 //for selection and skipping if source offline 00394 //source offline detection 00395 00396 //result.Hub.SendCommand("ConnectToMe", result.UserName); //signal download to hub to start it 00397 //Console.WriteLine("Hub was not resolved from result hub address: " + result.HubAddress); 00398 00399 }
bool DCPlusPlus.Queue.QueueEntry.TryToClaimEntry | ( | Peer | claiming_peer | ) |
Definition at line 351 of file Queue.cs.
References DCPlusPlus.Queue.QueueEntry.EntryClaimed, DCPlusPlus.Queue.QueueEntry.is_in_use, and DCPlusPlus.Queue.QueueEntry.is_in_use_lock.
00352 { 00353 lock (is_in_use_lock) 00354 { 00355 if (!is_in_use) 00356 { 00357 is_in_use = true; 00358 if (EntryClaimed != null) 00359 EntryClaimed(this, claiming_peer); 00360 return (true); 00361 } 00362 else return (false); 00363 } 00364 }
void DCPlusPlus.Queue.QueueEntry.UnclaimEntry | ( | ) |
Definition at line 365 of file Queue.cs.
References DCPlusPlus.Queue.QueueEntry.EntryUnclaimed, DCPlusPlus.Queue.QueueEntry.is_in_use, and DCPlusPlus.Queue.QueueEntry.is_in_use_lock.
00366 { 00367 lock (is_in_use_lock) 00368 { 00369 is_in_use = false; 00370 } 00371 if (EntryUnclaimed != null) 00372 EntryUnclaimed(this); 00373 }
void DCPlusPlus.Queue.QueueEntry.Ungrab | ( | ) |
Definition at line 520 of file Queue.cs.
References DCPlusPlus.Queue.QueueEntry.EntryClaimed, DCPlusPlus.Queue.QueueEntry.EntrySourceAdded, DCPlusPlus.Queue.QueueEntry.EntrySourceRemoved, DCPlusPlus.Queue.QueueEntry.EntrySourceStatusChanged, and DCPlusPlus.Queue.QueueEntry.EntryUnclaimed.
00521 { 00522 EntrySourceAdded = null; 00523 EntrySourceRemoved = null; 00524 EntryUnclaimed = null; 00525 EntryClaimed = null; 00526 EntrySourceStatusChanged = null; 00527 }
void DCPlusPlus.Queue.QueueEntry.UpdateSourcesByUsername | ( | string | username, | |
Hub | source_hub, | |||
bool | is_online | |||
) |
Definition at line 424 of file Queue.cs.
References DCPlusPlus.Queue.QueueEntry.sources, and DCPlusPlus.Queue.QueueEntry.sources_lock.
00425 { 00426 lock (sources_lock) 00427 { 00428 foreach (Source source in sources) 00429 { 00430 if (source.UserName == username) 00431 { 00432 source.Hub = source_hub; 00433 source.IsOnline = is_online; 00434 00435 } 00436 } 00437 } 00438 }
Priority DCPlusPlus.Queue.QueueEntry.download_priority = Priority.normal [protected] |
event EntryClaimedEventHandler DCPlusPlus.Queue.QueueEntry.EntryClaimed |
Definition at line 153 of file Queue.cs.
Referenced by DCPlusPlus.Queue.GrabEntry(), DCPlusPlus.Queue.QueueEntry.TryToClaimEntry(), and DCPlusPlus.Queue.QueueEntry.Ungrab().
event EntrySourceAddedEventHandler DCPlusPlus.Queue.QueueEntry.EntrySourceAdded |
Definition at line 147 of file Queue.cs.
Referenced by DCPlusPlus.Queue.QueueEntry.AddSource(), DCPlusPlus.Queue.GrabEntry(), and DCPlusPlus.Queue.QueueEntry.Ungrab().
event EntrySourceRemovedEventHandler DCPlusPlus.Queue.QueueEntry.EntrySourceRemoved |
Definition at line 149 of file Queue.cs.
Referenced by DCPlusPlus.Queue.QueueEntry.ClearSources(), DCPlusPlus.Queue.GrabEntry(), DCPlusPlus.Queue.QueueEntry.RemoveSource(), and DCPlusPlus.Queue.QueueEntry.Ungrab().
event EntrySourceStatusChangedEventHandler DCPlusPlus.Queue.QueueEntry.EntrySourceStatusChanged |
Definition at line 151 of file Queue.cs.
Referenced by DCPlusPlus.Queue.QueueEntry.AddSource(), DCPlusPlus.Queue.GrabEntry(), DCPlusPlus.Queue.QueueEntry.GrabSources(), and DCPlusPlus.Queue.QueueEntry.Ungrab().
event EntryUnclaimedEventHandler DCPlusPlus.Queue.QueueEntry.EntryUnclaimed |
Definition at line 155 of file Queue.cs.
Referenced by DCPlusPlus.Queue.GrabEntry(), DCPlusPlus.Queue.QueueEntry.UnclaimEntry(), and DCPlusPlus.Queue.QueueEntry.Ungrab().
long DCPlusPlus.Queue.QueueEntry.filesize = 0 [protected] |
bool DCPlusPlus.Queue.QueueEntry.is_in_use = false [protected] |
Definition at line 328 of file Queue.cs.
Referenced by DCPlusPlus.Queue.QueueEntry.TryToClaimEntry(), and DCPlusPlus.Queue.QueueEntry.UnclaimEntry().
Object DCPlusPlus.Queue.QueueEntry.is_in_use_lock = new Object() [protected] |
Definition at line 170 of file Queue.cs.
Referenced by DCPlusPlus.Queue.QueueEntry.TryToClaimEntry(), and DCPlusPlus.Queue.QueueEntry.UnclaimEntry().
string DCPlusPlus.Queue.QueueEntry.output_filename = "" [protected] |
Definition at line 254 of file Queue.cs.
Referenced by DCPlusPlus.Queue.QueueEntry.DeleteOutputFile().
List<Source> DCPlusPlus.Queue.QueueEntry.sources = new List<Source>() [protected] |
Definition at line 184 of file Queue.cs.
Referenced by DCPlusPlus.Queue.QueueEntry.AddSource(), DCPlusPlus.Queue.QueueEntry.ClearSources(), DCPlusPlus.Queue.QueueEntry.FindFirstSourceByUser(), DCPlusPlus.Queue.QueueEntry.FindFirstSourceByUserAndHub(), DCPlusPlus.Queue.QueueEntry.GrabSources(), DCPlusPlus.Queue.QueueEntry.RemoveSource(), DCPlusPlus.Queue.QueueEntry.StartDownload(), and DCPlusPlus.Queue.QueueEntry.UpdateSourcesByUsername().
Object DCPlusPlus.Queue.QueueEntry.sources_lock = new Object() [protected] |
Definition at line 157 of file Queue.cs.
Referenced by DCPlusPlus.Queue.QueueEntry.AddSource(), DCPlusPlus.Queue.QueueEntry.ClearSources(), DCPlusPlus.Queue.QueueEntry.FindFirstSourceByUser(), DCPlusPlus.Queue.QueueEntry.FindFirstSourceByUserAndHub(), DCPlusPlus.Queue.QueueEntry.GrabSources(), DCPlusPlus.Queue.QueueEntry.RemoveSource(), DCPlusPlus.Queue.QueueEntry.StartDownload(), and DCPlusPlus.Queue.QueueEntry.UpdateSourcesByUsername().
string DCPlusPlus.Queue.QueueEntry.tth = "" [protected] |
byte [] DCPlusPlus.Queue.QueueEntry.tthl = new byte[0] [protected] |
EntryType DCPlusPlus.Queue.QueueEntry.type = EntryType.File [protected] |
bool DCPlusPlus.Queue.QueueEntry.want_tthl = false [protected] |
Priority DCPlusPlus.Queue.QueueEntry.DownloadPriority [get, set] |
long DCPlusPlus.Queue.QueueEntry.Filesize [get, set] |
long DCPlusPlus.Queue.QueueEntry.FilesizeOnDisk [get] |
get the filesize of the output file ( not very cpu efficient ;-( )
Definition at line 320 of file Queue.cs.
Referenced by DCPlusPlus.Queue.RestartDownload().
[XmlIgnoreAttribute] bool DCPlusPlus.Queue.QueueEntry.IsInUse [get] |
string DCPlusPlus.Queue.QueueEntry.OutputFilename [get, set] |
Definition at line 256 of file Queue.cs.
Referenced by DCPlusPlus.Queue.AddFileList(), DCPlusPlus.Queue.AddSearchResult(), and DCPlusPlus.Queue.RestartDownload().
string DCPlusPlus.Queue.QueueEntry.TTH [get, set] |
EntryType DCPlusPlus.Queue.QueueEntry.Type [get, set] |
Definition at line 289 of file Queue.cs.
Referenced by DCPlusPlus.Queue.AddFileList(), and DCPlusPlus.Queue.AddSearchResult().