Skip to content

Commit

Permalink
upgraded to .net 5.0
Browse files Browse the repository at this point in the history
noah80 committed Dec 8, 2020
1 parent f85fbd8 commit cfb6794
Showing 753 changed files with 6,961 additions and 7,444 deletions.
6 changes: 3 additions & 3 deletions Automation/Automation.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -13,10 +13,10 @@
<LangVersion>9</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" />
<PackageReference Include="JetBrains.Annotations" Version="2020.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="NullCheckAnalyzer" Version="1.0.0.3" />
<PackageReference Include="Roslynator.Analyzers" Version="2.3.0">
<PackageReference Include="Roslynator.Analyzers" Version="3.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
23 changes: 11 additions & 12 deletions Automation/AutomationUtili.cs
Original file line number Diff line number Diff line change
@@ -6,12 +6,11 @@
using System.IO;
using System.Linq;
using Automation.ResultFiles;
using JetBrains.Annotations;

namespace Automation {
public static class AutomationUtili {
[NotNull]
public static List<CalcOption> GetOptionList([NotNull] params CalcOption[] list)
[JetBrains.Annotations.NotNull]
public static List<CalcOption> GetOptionList([JetBrains.Annotations.NotNull] params CalcOption[] list)
{
List<CalcOption> cos = new List<CalcOption>();
foreach (var option in list) {
@@ -20,20 +19,20 @@ public static List<CalcOption> GetOptionList([NotNull] params CalcOption[] list)
return cos;
}

[NotNull]
public static string CombineName([NotNull] this DirectoryInfo di, [NotNull] string name)
[JetBrains.Annotations.NotNull]
public static string CombineName([JetBrains.Annotations.NotNull] this DirectoryInfo di, [JetBrains.Annotations.NotNull] string name)
{
return Path.Combine(di.FullName, name);
}
[NotNull]
public static string CleanFileName([NotNull] string oldname)
[JetBrains.Annotations.NotNull]
public static string CleanFileName([JetBrains.Annotations.NotNull] string oldname)
{
var newname = oldname;
var forbiddenchars = Path.GetInvalidFileNameChars();
return forbiddenchars.Aggregate(newname, (current, forbiddenchar) => current.Replace(forbiddenchar, ' '));
}

[NotNull]
[JetBrains.Annotations.NotNull]
public static string MakePrettySize(long size)
{
var extension = " B";
@@ -65,7 +64,7 @@ public static string MakePrettySize(long size)
//}

[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
[NotNull]
[JetBrains.Annotations.NotNull]
public static string GetCurrentMethodAndClass() {
var stackTrace = new StackTrace(true);
var frames = stackTrace.GetFrames();
@@ -79,7 +78,7 @@ public static string GetCurrentMethodAndClass() {
}
return method.DeclaringType.Name + "." + method.Name;
}
[NotNull]
[JetBrains.Annotations.NotNull]
public static string GetCallingMethodAndClass()
{
var stackTrace = new StackTrace(true);
@@ -97,7 +96,7 @@ public static string GetCallingMethodAndClass()
return method.DeclaringType.Name + "." + method.Name;
}

public static T ParseStringToEnum<T>([NotNull] string s, T defaultValue) where T : struct, IConvertible {
public static T ParseStringToEnum<T>([JetBrains.Annotations.NotNull] string s, T defaultValue) where T : struct, IConvertible {
var defs = Enum.GetValues(typeof(T)).Cast<T>().ToList();
var result = defaultValue;
foreach (var def in defs) {
@@ -108,7 +107,7 @@ public static T ParseStringToEnum<T>([NotNull] string s, T defaultValue) where T
return result;
}

public static void WriteLine([NotNull] string message) {
public static void WriteLine([JetBrains.Annotations.NotNull] string message) {
#pragma warning disable S2228 // Console logging should not be used
Console.WriteLine(message);
#pragma warning restore S2228 // Console logging should not be used
12 changes: 6 additions & 6 deletions Automation/CommentAttribute.cs
Original file line number Diff line number Diff line change
@@ -6,22 +6,22 @@
namespace Automation {
[AttributeUsage(AttributeTargets.All)]
public class CommentAttribute : Attribute {
[NotNull] private string _text;
[JetBrains.Annotations.NotNull] private string _text;

public CommentAttribute([NotNull] string text, ListPossibleOptions list= ListPossibleOptions.NoSelection)
public CommentAttribute([JetBrains.Annotations.NotNull] string text, ListPossibleOptions list= ListPossibleOptions.NoSelection)
{
_text = text;
List = list;
}

[NotNull]
[JetBrains.Annotations.NotNull]
public string Text {
get => _text;

set => _text = value.Replace("\n","").Replace("\r","");
}

[NotNull]
[JetBrains.Annotations.NotNull]
[ItemNotNull]
public List<string> TurnIntoComment(int indentDepth)
{
@@ -76,9 +76,9 @@ public List<string> TurnIntoComment(int indentDepth)
}
public ListPossibleOptions List { get; }

[NotNull]
[JetBrains.Annotations.NotNull]
[ItemNotNull]
public static List<string> WrapText([NotNull] string text, int targetLineLength)
public static List<string> WrapText([JetBrains.Annotations.NotNull] string text, int targetLineLength)
{
string[] originalLines = text.Split(new[] { " " },
StringSplitOptions.None);
4 changes: 2 additions & 2 deletions Automation/HouseData.cs
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ namespace Automation {
public class HouseData {

public HouseData(StrGuid houseGuid, string? houseTypeCode, double? targetHeatDemand,
double? targetCoolingDemand, [NotNull] string name)
double? targetCoolingDemand, [JetBrains.Annotations.NotNull] string name)
{
HouseGuid = houseGuid;
HouseTypeCode = houseTypeCode;
@@ -27,7 +27,7 @@ public HouseData()
public string? Name { get; set; }
public StrGuid? HouseGuid { get; set; }

[NotNull]
[JetBrains.Annotations.NotNull]
[ItemNotNull]
public List<HouseholdData> Households { get; set; } = new List<HouseholdData>();

24 changes: 12 additions & 12 deletions Automation/HouseholdData.cs
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
namespace Automation {
public class TransportationDistanceModifier
{
public TransportationDistanceModifier([NotNull] string routeKey, [NotNull] string stepKey, double newDistanceInMeters)
public TransportationDistanceModifier([JetBrains.Annotations.NotNull] string routeKey, [JetBrains.Annotations.NotNull] string stepKey, double newDistanceInMeters)
{
RouteKey = routeKey;
StepKey = stepKey;
@@ -21,9 +21,9 @@ public TransportationDistanceModifier()
{
}

[NotNull]
[JetBrains.Annotations.NotNull]
public string? RouteKey { get; set; }
[NotNull]
[JetBrains.Annotations.NotNull]
public string? StepKey { get; set; }
public double NewDistanceInMeters { get; set; }
}
@@ -35,7 +35,7 @@ public enum HouseholdDataSpecificationType {
}

public class HouseholdDataPersonSpecification {
public HouseholdDataPersonSpecification([NotNull] List<PersonData> persons)
public HouseholdDataPersonSpecification([JetBrains.Annotations.NotNull] List<PersonData> persons)
{
Persons = persons;
}
@@ -45,7 +45,7 @@ public HouseholdDataPersonSpecification()
{
}

[NotNull]
[JetBrains.Annotations.NotNull]
[ItemNotNull]
public List<PersonData> Persons { get; set; } = new List<PersonData>();

@@ -60,22 +60,22 @@ public class PersonLivingTag {

public class HouseholdTemplateSpecification
{
public HouseholdTemplateSpecification([NotNull] string householdTemplateName) => HouseholdTemplateName = householdTemplateName;
public HouseholdTemplateSpecification([JetBrains.Annotations.NotNull] string householdTemplateName) => HouseholdTemplateName = householdTemplateName;

[Obsolete("Only for Json")]
[SuppressMessage("ReSharper", "NotNullMemberIsNotInitialized")]
public HouseholdTemplateSpecification()
{
}
public List<PersonLivingTag>? Persons { get; set; } = new List<PersonLivingTag>();
[NotNull]
[JetBrains.Annotations.NotNull]
public string? HouseholdTemplateName { get; set; }

public List<string>? ForbiddenTraitTags { get; set; } = new List<string>();
}

public class HouseholdNameSpecification {
public HouseholdNameSpecification([NotNull] JsonReference householdName) => HouseholdReference = householdName;
public HouseholdNameSpecification([JetBrains.Annotations.NotNull] JsonReference householdName) => HouseholdReference = householdName;

[Obsolete("only for json")]
[SuppressMessage("ReSharper", "NotNullMemberIsNotInitialized")]
@@ -86,8 +86,8 @@ public HouseholdNameSpecification()
public JsonReference? HouseholdReference { get; set; }
}
public class HouseholdData {
public HouseholdData([NotNull] string uniqueHouseholdId,
[NotNull] string name, [CanBeNull] JsonReference? chargingStationSet,
public HouseholdData([JetBrains.Annotations.NotNull] string uniqueHouseholdId,
[JetBrains.Annotations.NotNull] string name, [CanBeNull] JsonReference? chargingStationSet,
[CanBeNull] JsonReference? transportationDeviceSet, [CanBeNull] JsonReference? travelRouteSet,
[ItemNotNull][CanBeNull] List<TransportationDistanceModifier>? transportationDistanceModifiers,
HouseholdDataSpecificationType householdDataSpecifictionType)
@@ -116,10 +116,10 @@ public HouseholdData()
[CanBeNull]
public HouseholdNameSpecification? HouseholdNameSpec { get; set; }

[NotNull]
[JetBrains.Annotations.NotNull]
public string UniqueHouseholdId { get; set; }

[NotNull]
[JetBrains.Annotations.NotNull]
public string? Name { get; set; }


6 changes: 3 additions & 3 deletions Automation/JsonCalcSpecification.cs
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ public JsonCalcSpecification( bool deleteAllButPDF, [CanBeNull] JsonReference? d
EnableTransportation = enableTransportation;
}

public JsonCalcSpecification([NotNull] JsonCalcSpecification o)
public JsonCalcSpecification([JetBrains.Annotations.NotNull] JsonCalcSpecification o)
{
//CalcObject = o.CalcObject;
DefaultForOutputFiles = o.DefaultForOutputFiles;
@@ -175,14 +175,14 @@ public JsonCalcSpecification([NotNull] JsonCalcSpecification o)
public bool EnableIdlemode { get; set; }


[NotNull]
[JetBrains.Annotations.NotNull]
public static JsonCalcSpecification MakeDefaultsForTesting()
{
return new JsonCalcSpecification(false,null,new DateTime(2019,1,1),
"00:15:00","00:01:00",null,LoadTypePriority.All,null,false,new DateTime(2019,1,1),null,false);
}

[NotNull]
[JetBrains.Annotations.NotNull]
public static JsonCalcSpecification MakeDefaultsForProduction()
{
return new JsonCalcSpecification( false, null, new DateTime(2019, 12, 31),
7 changes: 3 additions & 4 deletions Automation/JsonReference.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Diagnostics.CodeAnalysis;
using JetBrains.Annotations;

namespace Automation {
public class JsonReference : IGuidObject, IEquatable<JsonReference>
@@ -54,7 +53,7 @@ public override int GetHashCode()
}
}

public JsonReference([NotNull] string name, StrGuid guid)
public JsonReference([JetBrains.Annotations.NotNull] string name, StrGuid guid)
{
Name = name;
Guid = guid;
@@ -71,11 +70,11 @@ public JsonReference()
Guid = StrGuid.Empty;
}

[NotNull]
[JetBrains.Annotations.NotNull]
public string? Name { get; set; }
public StrGuid Guid { get; set; }

[NotNull]
[JetBrains.Annotations.NotNull]
public override string ToString() => Name + "(" + Guid + ")";
}
}
3 changes: 1 addition & 2 deletions Automation/JsonSumProfile.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using Automation.ResultFiles;
using JetBrains.Annotations;

namespace Automation
{
@@ -56,7 +55,7 @@ public JsonDeviceProfiles()
}
public class JsonSumProfile
{
public JsonSumProfile(string name, TimeSpan timeResolution, DateTime startTime, string loadTypeName, string unit, LoadTypeInformation? loadTypeDefinition, [NotNull] HouseholdKeyEntry houseKey)
public JsonSumProfile(string name, TimeSpan timeResolution, DateTime startTime, string loadTypeName, string unit, LoadTypeInformation? loadTypeDefinition, [JetBrains.Annotations.NotNull] HouseholdKeyEntry houseKey)
{
Name = name;
TimeResolution = timeResolution;
9 changes: 4 additions & 5 deletions Automation/ResultFiles/HouseholdKey.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using System;
using JetBrains.Annotations;

namespace Automation.ResultFiles {
[Serializable]
public class HouseholdKey :IComparable<HouseholdKey>, IEquatable<HouseholdKey> {
[NotNull]
[JetBrains.Annotations.NotNull]
public string Key { get; }

public HouseholdKey([NotNull] string key)
public HouseholdKey([JetBrains.Annotations.NotNull] string key)
{
Key = key;
}
@@ -29,10 +28,10 @@ public HouseholdKey([NotNull] string key)
return k1.Equals(k2);
}

[NotNull]
[JetBrains.Annotations.NotNull]
public override string ToString() => Key;

public static bool operator !=([NotNull] HouseholdKey k1, [NotNull] HouseholdKey k2)
public static bool operator !=([JetBrains.Annotations.NotNull] HouseholdKey k1, [JetBrains.Annotations.NotNull] HouseholdKey k2)
{
return !(k1 == k2);
}
12 changes: 6 additions & 6 deletions Automation/ResultFiles/HouseholdKeyEntry.cs
Original file line number Diff line number Diff line change
@@ -4,8 +4,8 @@

namespace Automation.ResultFiles {
public class HouseholdKeyEntry {
public HouseholdKeyEntry([NotNull] HouseholdKey hhKey, [NotNull] string householdName, HouseholdKeyType type,
[NotNull] string householdDescription, [CanBeNull] string? houseName,
public HouseholdKeyEntry([JetBrains.Annotations.NotNull] HouseholdKey hhKey, [JetBrains.Annotations.NotNull] string householdName, HouseholdKeyType type,
[JetBrains.Annotations.NotNull] string householdDescription, [CanBeNull] string? houseName,
[CanBeNull] string? houseDescription)
{
HHKey = hhKey;
@@ -18,15 +18,15 @@ public HouseholdKeyEntry([NotNull] HouseholdKey hhKey, [NotNull] string househol
[JsonProperty]
public string? HouseDescription { get; set; }

[NotNull]
[JetBrains.Annotations.NotNull]
[JsonProperty]
public string HouseholdDescription { get; private set; }

[NotNull]
[JetBrains.Annotations.NotNull]
[JsonProperty]
public HouseholdKey HHKey { get; private set; }

[NotNull]
[JetBrains.Annotations.NotNull]
[JsonProperty]
public string HouseholdName { get; private set; }
[JsonProperty]
@@ -36,7 +36,7 @@ public HouseholdKeyEntry([NotNull] HouseholdKey hhKey, [NotNull] string househol
[JsonConverter(typeof(StringEnumConverter))]
public HouseholdKeyType KeyType { get; private set; }

[NotNull]
[JetBrains.Annotations.NotNull]
public override string ToString() => HHKey.Key + " " + HouseholdName + " (" + KeyType + ")";
}
}
Loading

0 comments on commit cfb6794

Please sign in to comment.