diff --git a/Benchmarks/SystemSqliteDatabaseManager.cs b/Benchmarks/SystemSqliteDatabaseManager.cs index 04cfd20f..473331ca 100644 --- a/Benchmarks/SystemSqliteDatabaseManager.cs +++ b/Benchmarks/SystemSqliteDatabaseManager.cs @@ -225,7 +225,7 @@ namespace Microsoft.CST.AttackSurfaceAnalyzer.Utils var resultTypeString = reader["result_type"].ToString(); if (runId != null && resultTypeString != null) { - var wo = WriteObject.FromString((byte[])reader["serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), resultTypeString), runId); + var wo = WriteObject.FromSerialized((byte[])reader["serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), resultTypeString), runId); if (wo is WriteObject WO) { output.Add(WO); @@ -256,8 +256,8 @@ namespace Microsoft.CST.AttackSurfaceAnalyzer.Utils if (aRunId != null && bRunId != null && aResultType != null && bResultType != null) { - var val1 = WriteObject.FromString((byte[])reader["a_serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), aResultType), aRunId); - var val2 = WriteObject.FromString((byte[])reader["b_serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), bResultType), bRunId); + var val1 = WriteObject.FromSerialized((byte[])reader["a_serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), aResultType), aRunId); + var val2 = WriteObject.FromSerialized((byte[])reader["b_serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), bResultType), bRunId); if (val1 is WriteObject V1 && val2 is WriteObject V2) { @@ -389,7 +389,7 @@ namespace Microsoft.CST.AttackSurfaceAnalyzer.Utils var resultTypeString = reader["result_type"].ToString(); if (runId != null && resultTypeString != null) { - var val = WriteObject.FromString((byte[])reader["serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), resultTypeString), runId); + var val = WriteObject.FromSerialized((byte[])reader["serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), resultTypeString), runId); if (val is WriteObject valid) yield return valid; } diff --git a/Lib/Objects/WriteObject.cs b/Lib/Objects/WriteObject.cs index 64f020da..03f50219 100644 --- a/Lib/Objects/WriteObject.cs +++ b/Lib/Objects/WriteObject.cs @@ -30,7 +30,7 @@ namespace Microsoft.CST.AttackSurfaceAnalyzer.Objects public string RunId { get; } public byte[] Serialized { get; } - public static WriteObject? FromString(byte[] SerializedIn, RESULT_TYPE ResultTypeIn, string RunIdIn) + public static WriteObject? FromSerialized(byte[] SerializedIn, RESULT_TYPE ResultTypeIn, string RunIdIn) { var deserialized = ProtoBufUtils.Hydrate(SerializedIn, ResultTypeIn); diff --git a/Lib/Utils/SqliteDatabaseManager.cs b/Lib/Utils/SqliteDatabaseManager.cs index 98181728..ebf69751 100644 --- a/Lib/Utils/SqliteDatabaseManager.cs +++ b/Lib/Utils/SqliteDatabaseManager.cs @@ -179,7 +179,7 @@ namespace Microsoft.CST.AttackSurfaceAnalyzer.Utils var resultTypeString = reader["result_type"].ToString(); if (runId != null && resultTypeString != null) { - var wo = WriteObject.FromString((byte[])reader["serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), resultTypeString), runId); + var wo = WriteObject.FromSerialized((byte[])reader["serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), resultTypeString), runId); if (wo is WriteObject WO) output.Enqueue(WO); } @@ -207,7 +207,7 @@ namespace Microsoft.CST.AttackSurfaceAnalyzer.Utils var resultTypeString = reader["result_type"].ToString(); if (runId != null && resultTypeString != null) { - var wo = WriteObject.FromString((byte[])reader["serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), resultTypeString), runId); + var wo = WriteObject.FromSerialized((byte[])reader["serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), resultTypeString), runId); if (wo is WriteObject WO) output.Enqueue(WO); } @@ -233,7 +233,7 @@ namespace Microsoft.CST.AttackSurfaceAnalyzer.Utils var resultTypeString = reader["result_type"].ToString(); if (runId != null && resultTypeString != null) { - var wo = WriteObject.FromString((byte[])reader["serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), resultTypeString), runId); + var wo = WriteObject.FromSerialized((byte[])reader["serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), resultTypeString), runId); if (wo is WriteObject WO) output.Enqueue(WO); } @@ -415,7 +415,7 @@ namespace Microsoft.CST.AttackSurfaceAnalyzer.Utils var resultTypeString = reader["result_type"].ToString(); if (runId != null && resultTypeString != null) { - var wo = WriteObject.FromString((byte[])reader["serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), resultTypeString), runId); + var wo = WriteObject.FromSerialized((byte[])reader["serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), resultTypeString), runId); if (wo is WriteObject WO) output.Enqueue(WO); } @@ -446,8 +446,8 @@ namespace Microsoft.CST.AttackSurfaceAnalyzer.Utils { if (reader["a_serialized"] is byte[] a_serialized && reader["b_serialized"] is byte[] b_serialized) { - var val1 = WriteObject.FromString(a_serialized, (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), aResultType), aRunId); - var val2 = WriteObject.FromString(b_serialized, (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), bResultType), bRunId); + var val1 = WriteObject.FromSerialized(a_serialized, (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), aResultType), aRunId); + var val2 = WriteObject.FromSerialized(b_serialized, (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), bResultType), bRunId); if (val1 is WriteObject V1 && val2 is WriteObject V2) { @@ -585,7 +585,7 @@ namespace Microsoft.CST.AttackSurfaceAnalyzer.Utils var resultTypeString = reader["result_type"].ToString(); if (runId != null && resultTypeString != null) { - var wo = WriteObject.FromString((byte[])reader["serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), resultTypeString), runId); + var wo = WriteObject.FromSerialized((byte[])reader["serialized"], (RESULT_TYPE)Enum.Parse(typeof(RESULT_TYPE), resultTypeString), runId); if (wo is WriteObject WO) { yield return WO;