Skip to content

Commit

Permalink
fixed documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
SirJosh3917 committed Jun 20, 2018
1 parent 3e8d0e1 commit a195876
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
15 changes: 10 additions & 5 deletions StringDB/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,17 @@ internal Database(Stream s, bool disposeStream = false) {
internal void NotifyInsert(IEnumerable<KeyValuePair<string, string>> inserts) => (this._reader as Reader.Reader).NotifyInsert(inserts ?? throw new ArgumentNullException(nameof(inserts))); /// <inheritdoc/>
internal void NotifyInsert(IEnumerable<IReaderPair> inserts) => (this._reader as Reader.Reader).NotifyInsert(inserts ?? throw new ArgumentNullException(nameof(inserts))); /// <inheritdoc/>
IEnumerator IEnumerable.GetEnumerator() => this._reader.GetEnumerator();
/// <summary>Cleans out the DB. You should only use this if you've overwritten a value, or if you've done a lot of single inserts, or if you need to clean up a database</summary>
/// <param name="dbCleanTo"></param>

/// <summary>Cleans out the database specified, and copies all of the contents of the other database into this one. You may be able to experience a smaller DB file if you've used StringDB to not to perfectionist values.</summary>
/// <param name="dbCleanTo">The database to clean up</param>
public void CleanFrom(Database dbCleanTo) {
this.InsertRange(FromDatabase(dbCleanTo));
}

/// <summary>Cleans out the current database, and copies all of the contents of this database into the other one. You may be able to experience a smaller DB file if you've used StringDB to not to perfectionist values.</summary>
/// <param name="dbCleanTo">The database that will be used to insert the other database's values into</param>
public void CleanTo(Database dbCleanTo) {
dbCleanTo.InsertRange(FromDatabase(this));
} /// <inheritdoc/>

public void Insert(string index, string value) {
Expand Down Expand Up @@ -79,9 +85,8 @@ public void Dispose() {
}

private IEnumerable<IReaderPair> FromDatabase(Database other) {
foreach (var i in other) {
foreach (var i in other)
yield return i;
}
}
}
}
8 changes: 2 additions & 6 deletions StringDB/Writer/Writer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,7 @@ public void InsertRange(IEnumerable<KeyValuePair<string, string>> items) {
lock (this._lock) {
#endif
var l = this._stream.Length;

/*if (l >= 8)
this._stream.Seek(0, SeekOrigin.End);
else*/

if(l < 8) {
_Seek(0);
this._bw.Write((long)0);
Expand All @@ -88,8 +85,7 @@ public void InsertRange(IEnumerable<KeyValuePair<string, string>> items) {
_Seek(p);

var judge = p + sizeof(byte) + sizeof(long);

//judge the amount of space it'd require to write each item

foreach (var i in items)
judge += Judge_WriteIndex(i.Key);

Expand Down

0 comments on commit a195876

Please sign in to comment.