Added a C# port of my new Variegator collection, a MultiDictionary that resolves ambiguities by picking a random value or providing the least recently used one, very useful for returning varying responses

git-svn-id: file:///srv/devel/repo-conversion/nusu@286 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2013-06-27 16:05:54 +00:00
parent 4b94bdd1a5
commit 2462dd6dc4
6 changed files with 410 additions and 9 deletions

View file

@ -43,18 +43,18 @@ namespace Nuclex.Support.IO {
throw new ArgumentException("Start index must not be less than 0", "start");
}
if(!stream.CanSeek) {
if(start != 0) {
throw new ArgumentException(
"The only valid start for unseekable streams is 0", "start"
);
}
} else {
if(stream.CanSeek) {
if(start + length > stream.Length) {
throw new ArgumentException(
"Partial stream exceeds end of full stream", "length"
);
}
} else {
if(start != 0) {
throw new ArgumentException(
"The only valid start for unseekable streams is 0", "start"
);
}
}
this.stream = stream;
@ -258,7 +258,6 @@ namespace Nuclex.Support.IO {
/// <summary>Length of the partial stream</summary>
private long length;
}
} // namespace Nuclex.Support.IO