-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sharing custom variables system, and working on various functions
- Loading branch information
1 parent
8257e88
commit 667a953
Showing
8 changed files
with
122 additions
and
91 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using ValkyrieFSMCore; | ||
|
||
using System.Text.Json; | ||
using System.Collections; | ||
using System.Diagnostics; | ||
|
||
namespace Valkyrie_Server | ||
{ | ||
public class GetSyncDataHandler | ||
{ | ||
|
||
/// <summary> | ||
/// Get the functions from the libary as a JSON string | ||
/// </summary> | ||
/// <returns>returns the json string of the functions</returns> | ||
public static IEnumerable<FunctionListItem> GetFunctionDefinitions() => | ||
new FunctionLibrary().ImportedFunctions.Values.Select(x => new FunctionListItem() | ||
{ | ||
Name = x.Name, | ||
Description = x.Description, | ||
Parameters = x.ExpectedParametersList | ||
}); | ||
|
||
public static IEnumerable<VariableTypeDef> GetVariableTypes() => new VariableFactory().GetAllPossibleVarableTypes.Select(x => new VariableTypeDef() | ||
{ | ||
Description = x.description, | ||
Name = x.key | ||
}); | ||
|
||
public static string GetSyncData() | ||
{ | ||
var functions = GetFunctionDefinitions(); | ||
var variableTypes = GetVariableTypes(); | ||
|
||
foreach (var x in functions) | ||
{ | ||
foreach (var y in x.Parameters) | ||
{ | ||
Debug.WriteLine(y.Name + " " + y.Type + " " + y.IO + " " + y.Description); | ||
} | ||
} | ||
|
||
var syncData = new SyncRequestBody(functions.ToArray(), variableTypes.ToArray()); | ||
|
||
return JsonSerializer.Serialize(syncData); | ||
} | ||
} | ||
|
||
public class VariableTypeDef | ||
{ | ||
public string Name { get; set; } = ""; | ||
public string Description { get; set; } = ""; | ||
} | ||
|
||
public class FunctionListItem | ||
{ | ||
public string Name { get; set; } = ""; | ||
public string Description { get; set; } = ""; | ||
|
||
public ExpectedParameter[] Parameters { get; set; } = new ExpectedParameter[0]; | ||
} | ||
|
||
internal record SyncRequestBody(FunctionListItem[] Functions, VariableTypeDef[] CustomTypes); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters