Skip to content

Commit 43bca00

Browse files
author
Claus
committed
various cleanup.
1 parent 8ff50cd commit 43bca00

File tree

4 files changed

+12
-23
lines changed

4 files changed

+12
-23
lines changed

src/Umbraco.Deploy.Contrib.Connectors/Caching/Comparers/StringArrayComparer.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
namespace Umbraco.Deploy.Contrib.Connectors.Caching.Comparers
55
{
6-
76
/// <summary>
87
/// Compares an array of strings.
98
/// </summary>
@@ -12,7 +11,6 @@ namespace Umbraco.Deploy.Contrib.Connectors.Caching.Comparers
1211
/// </remarks>
1312
public class StringArrayComparer : IEqualityComparer<string[]>
1413
{
15-
1614
/// <summary>
1715
/// Check if the arrays are equal.
1816
/// </summary>
@@ -32,17 +30,20 @@ public bool Equals(string[] x, string[] y)
3230
{
3331
return x == null && y == null;
3432
}
33+
3534
if (x.Length != y.Length)
3635
{
3736
return false;
3837
}
38+
3939
for (var i = 0; i < x.Length; i++)
4040
{
4141
if (x[i] != y[i])
4242
{
4343
return false;
4444
}
4545
}
46+
4647
return true;
4748
}
4849

@@ -68,10 +69,9 @@ public int GetHashCode(string[] items)
6869
{
6970
hashCode ^= (item ?? string.Empty).GetHashCode();
7071
}
72+
7173
return hashCode;
7274
}
7375
}
74-
7576
}
76-
7777
}

src/Umbraco.Deploy.Contrib.Connectors/Caching/InstanceByKeyCache.cs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Umbraco.Deploy.Contrib.Connectors.Caching
66
{
7-
87
/// <summary>
98
/// Caches instance variables by key in a dictionary-like structure.
109
/// </summary>
@@ -19,7 +18,6 @@ namespace Umbraco.Deploy.Contrib.Connectors.Caching
1918
/// </remarks>
2019
public class InstanceByKeyCache<T, TKey>
2120
{
22-
2321
/// <summary>
2422
/// An empty array (convenience variable).
2523
/// </summary>
@@ -77,8 +75,7 @@ public T Get(TKey key, Func<TKey, T> replenisher, TimeSpan duration, params stri
7775

7876
// Value already cached?
7977
var tempTuple = default(Tuple<Dictionary<string[], T>, DateTime>);
80-
if (Instances.TryGetValue(key, out tempTuple)
81-
&& tempTuple.Item1.ContainsKey(keys))
78+
if (Instances.TryGetValue(key, out tempTuple) && tempTuple.Item1.ContainsKey(keys))
8279
{
8380
if (now.Subtract(Instances[key].Item2) >= duration)
8481
{
@@ -166,6 +163,7 @@ private T TryGetByKeys(string[] keys, TKey accessKey)
166163
}
167164
}
168165
}
166+
169167
return default(T);
170168
}
171169

@@ -187,8 +185,7 @@ private T TryGetByKeys(string[] keys, TKey accessKey)
187185
/// <param name="doLock">
188186
/// Lock the instance cache during the update?
189187
/// </param>
190-
private void UpdateValueByKeys(string[] keys, TKey accessKey, T value,
191-
DateTime lastCache, bool doLock = true)
188+
private void UpdateValueByKeys(string[] keys, TKey accessKey, T value, DateTime lastCache, bool doLock = true)
192189
{
193190
if (doLock)
194191
{
@@ -215,10 +212,8 @@ private void UpdateValueByKeys(string[] keys, TKey accessKey, T value,
215212
/// <param name="value">
216213
/// The value to update the cache with.
217214
/// </param>
218-
private void UpdateValueByKeysWithoutLock(string[] keys, TKey accessKey,
219-
T value, DateTime lastCache)
215+
private void UpdateValueByKeysWithoutLock(string[] keys, TKey accessKey, T value, DateTime lastCache)
220216
{
221-
222217
// Variables.
223218
var instanceTuple = default(Tuple<Dictionary<string[], T>, DateTime>);
224219
var instanceDictionary = default(Dictionary<string[], T>);
@@ -237,11 +232,7 @@ private void UpdateValueByKeysWithoutLock(string[] keys, TKey accessKey,
237232
instanceDictionary[keys] = value;
238233

239234
// Update the last cache date.
240-
Instances[accessKey] = new Tuple<Dictionary<string[], T>, DateTime>(
241-
instanceDictionary, lastCache);
242-
235+
Instances[accessKey] = new Tuple<Dictionary<string[], T>, DateTime>(instanceDictionary, lastCache);
243236
}
244-
245237
}
246-
247238
}

src/Umbraco.Deploy.Contrib.Connectors/ValueConnectors/ArchetypeValueConnector.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ internal class ArchetypeModel
445445
/// <returns></returns>
446446
public string SerializeForPersistence()
447447
{
448-
var json = JObject.Parse(JsonConvert.SerializeObject(this, new JsonSerializerSettings() { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }));
448+
var json = JObject.Parse(JsonConvert.SerializeObject(this, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }));
449449

450450
var propertiesToRemove = new[] { "propertyEditorAlias", "dataTypeId", "dataTypeGuid", "hostContentType", "editorState" };
451451

@@ -514,7 +514,6 @@ internal class UmbracoEditorState
514514
public IEnumerable<string> FileNames { get; set; }
515515
}
516516

517-
518517
/// <summary>
519518
/// A local version of IDataTypeDefinition (to avoid any potential lazy loading/deferred
520519
/// execution issues).
@@ -526,6 +525,5 @@ internal class DataTypeDefinition
526525
public int Id { get; set; }
527526
public Guid Key { get; set; }
528527
}
529-
530528
}
531529
}

src/Umbraco.Deploy.Contrib.Connectors/ValueConnectors/NestedContentValueConnector.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public string GetValue(Property property, ICollection<ArtifactDependency> depend
9898

9999
if (propertyType == null)
100100
{
101-
LogHelper.Debug<NestedContentValueConnector>($"No Property Type found with alias {key} on Content Type {contentType.Alias}");
101+
LogHelper.Debug<NestedContentValueConnector>($"No property type found with alias {key} on content type {contentType.Alias}");
102102
continue;
103103
}
104104

@@ -203,7 +203,7 @@ public void SetValue(IContentBase content, string alias, string value)
203203

204204
if (propertyType == null)
205205
{
206-
LogHelper.Debug<NestedContentValueConnector>($"No Property Type found with alias {key} on Content Type {contentType.Alias}");
206+
LogHelper.Debug<NestedContentValueConnector>($"No property type found with alias {key} on content type {contentType.Alias}");
207207
continue;
208208
}
209209

0 commit comments

Comments
 (0)