diff options
author | natrixaeria <janng@gmx.de> | 2019-05-19 17:40:59 +0200 |
---|---|---|
committer | natrixaeria <janng@gmx.de> | 2019-05-19 17:40:59 +0200 |
commit | 1509b5ef3d7e9e71d9294e234ec0e39f2d831998 (patch) | |
tree | 78300ffff230958101b422a4e6026925b287822f /FireBase/Offline/OfflineEntry.cs | |
parent | c3bb858bb54dc8c64bbd48054c2c58dc0073f09c (diff) | |
parent | c4d046858e0822b7c2c540ac2368b2c0e88e7a26 (diff) |
Merge branch 'scribble' of https://github.com/TrueDoctor/DiscoBot into scribble
Diffstat (limited to 'FireBase/Offline/OfflineEntry.cs')
-rw-r--r-- | FireBase/Offline/OfflineEntry.cs | 103 |
1 files changed, 43 insertions, 60 deletions
diff --git a/FireBase/Offline/OfflineEntry.cs b/FireBase/Offline/OfflineEntry.cs index 3b862cb..9feffa3 100644 --- a/FireBase/Offline/OfflineEntry.cs +++ b/FireBase/Offline/OfflineEntry.cs @@ -1,41 +1,47 @@ -namespace Firebase.Database.Offline -{ - using System; - - using Newtonsoft.Json; +using System; +using Newtonsoft.Json; +namespace Firebase.Database.Offline +{ /// <summary> - /// Represents an object stored in offline storage. + /// Represents an object stored in offline storage. /// </summary> public class OfflineEntry { private object dataInstance; /// <summary> - /// Initializes a new instance of the <see cref="OfflineEntry"/> class with an already serialized object. + /// Initializes a new instance of the <see cref="OfflineEntry" /> class with an already serialized object. /// </summary> /// <param name="key"> The key. </param> /// <param name="obj"> The object. </param> - /// <param name="priority"> The priority. Objects with higher priority will be synced first. Higher number indicates higher priority. </param> + /// <param name="priority"> + /// The priority. Objects with higher priority will be synced first. Higher number indicates higher + /// priority. + /// </param> /// <param name="syncOptions"> The sync options. </param> - public OfflineEntry(string key, object obj, string data, int priority, SyncOptions syncOptions, bool isPartial = false) + public OfflineEntry(string key, object obj, string data, int priority, SyncOptions syncOptions, + bool isPartial = false) { - this.Key = key; - this.Priority = priority; - this.Data = data; - this.Timestamp = DateTime.UtcNow; - this.SyncOptions = syncOptions; - this.IsPartial = isPartial; + Key = key; + Priority = priority; + Data = data; + Timestamp = DateTime.UtcNow; + SyncOptions = syncOptions; + IsPartial = isPartial; - this.dataInstance = obj; + dataInstance = obj; } /// <summary> - /// Initializes a new instance of the <see cref="OfflineEntry"/> class. + /// Initializes a new instance of the <see cref="OfflineEntry" /> class. /// </summary> /// <param name="key"> The key. </param> /// <param name="obj"> The object. </param> - /// <param name="priority"> The priority. Objects with higher priority will be synced first. Higher number indicates higher priority. </param> + /// <param name="priority"> + /// The priority. Objects with higher priority will be synced first. Higher number indicates higher + /// priority. + /// </param> /// <param name="syncOptions"> The sync options. </param> public OfflineEntry(string key, object obj, int priority, SyncOptions syncOptions, bool isPartial = false) : this(key, obj, JsonConvert.SerializeObject(obj), priority, syncOptions, isPartial) @@ -43,74 +49,51 @@ } /// <summary> - /// Initializes a new instance of the <see cref="OfflineEntry"/> class. + /// Initializes a new instance of the <see cref="OfflineEntry" /> class. /// </summary> - public OfflineEntry() + public OfflineEntry() { } /// <summary> - /// Gets or sets the key of this entry. + /// Gets or sets the key of this entry. /// </summary> - public string Key - { - get; - set; - } + public string Key { get; set; } /// <summary> - /// Gets or sets the priority. Objects with higher priority will be synced first. Higher number indicates higher priority. + /// Gets or sets the priority. Objects with higher priority will be synced first. Higher number indicates higher + /// priority. /// </summary> - public int Priority - { - get; - set; - } + public int Priority { get; set; } /// <summary> - /// Gets or sets the timestamp when this entry was last touched. + /// Gets or sets the timestamp when this entry was last touched. /// </summary> - public DateTime Timestamp - { - get; - set; - } + public DateTime Timestamp { get; set; } /// <summary> - /// Gets or sets the <see cref="SyncOptions"/> which define what sync state this entry is in. + /// Gets or sets the <see cref="SyncOptions" /> which define what sync state this entry is in. /// </summary> - public SyncOptions SyncOptions - { - get; - set; - } + public SyncOptions SyncOptions { get; set; } /// <summary> - /// Gets or sets serialized JSON data. + /// Gets or sets serialized JSON data. /// </summary> - public string Data - { - get; - set; - } + public string Data { get; set; } /// <summary> - /// Specifies whether this is only a partial object. + /// Specifies whether this is only a partial object. /// </summary> - public bool IsPartial - { - get; - set; - } + public bool IsPartial { get; set; } /// <summary> - /// Deserializes <see cref="Data"/> into <typeparamref name="T"/>. The result is cached. + /// Deserializes <see cref="Data" /> into <typeparamref name="T" />. The result is cached. /// </summary> /// <typeparam name="T"> Type of object to deserialize into. </typeparam> - /// <returns> Instance of <typeparamref name="T"/>. </returns> + /// <returns> Instance of <typeparamref name="T" />. </returns> public T Deserialize<T>() { - return (T)(this.dataInstance ?? (this.dataInstance = JsonConvert.DeserializeObject<T>(this.Data))); + return (T) (dataInstance ?? (dataInstance = JsonConvert.DeserializeObject<T>(Data))); } } -} +}
\ No newline at end of file |