-
Notifications
You must be signed in to change notification settings - Fork 61
Sync rework #1105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Gerseras
wants to merge
25
commits into
928-sync-town-collections
Choose a base branch
from
sync-rework
base: 928-sync-town-collections
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Sync rework #1105
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
afa2677
Heavy WIP
Gerseras cfc4ddb
Fixes for Assembly to build
Gerseras 26937e4
Fixes to allow client/server start
Gerseras 11173c8
Merge branch 'development' into sync-rework
garrettluskey 09da8e8
Added scriban
garrettluskey 0b6257f
sciban property prefix class example
garrettluskey 6f10b86
added back tests and updated tempates
garrettluskey 16fe4eb
added back template
garrettluskey c004058
Update DynamicSyncRegistry.cs
garrettluskey 0e50ac1
Use different assemblies based on executing framework version
Gerseras 1ffc702
Working PropertySync
Gerseras b878ec7
Added TryGetIntercept for testing field set sync
Gerseras 9a2a4d9
Merge branch '928-sync-town-collections' into sync-rework
Gerseras 56eb299
Temporary fix to have development running
EgardA d6fa024
Rework in the making still heavy wip
Gerseras 32ca76a
Working Property sync with reworked codebase
Gerseras 4b1e68b
Further work on field sync one issue remaining
Gerseras 0290e79
Fixed InternalsVisibleToError
Gerseras 2b0a58b
Fix rebinding of handlers for mutliple test runs
Gerseras 18a2c5b
minor updates
garrettluskey ea1d763
updated syntax tre to linq
garrettluskey 6f6cf15
Update DynamicSyncBuilder.cs
garrettluskey e358252
Update DynamicSyncBuilder.cs
garrettluskey b0c2433
Cleanup and Revert on loadedAssemblyMap as it was no longer running
Gerseras 82dda6b
Merge branch 'development' into sync-rework
garrettluskey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
56 changes: 0 additions & 56 deletions
56
source/Coop.Core/Client/Services/Template/Handlers/TemplateClientHandler.cs
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
source/Coop.Core/Client/Services/Template/Messages/NetworkClientMessageTemplate.cs
This file was deleted.
Oops, something went wrong.
67 changes: 0 additions & 67 deletions
67
source/Coop.Core/Server/Services/Template/Handlers/TemplateServerHandler.cs
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
source/Coop.Core/Server/Services/Template/Messages/NetworkServerMessageTemplate.cs
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,66 @@ | ||
| using Autofac; | ||
| using E2E.Tests.Environment; | ||
| using GameInterface.AutoSync; | ||
| using GameInterface.AutoSync.Builders; | ||
| using GameInterface.Registry; | ||
| using HarmonyLib; | ||
| using Xunit.Abstractions; | ||
|
|
||
| namespace E2E.Tests.AutoSync; | ||
|
|
||
| public class AutoSyncTests : IDisposable | ||
| { | ||
| E2ETestEnvironment TestEnvironment { get; } | ||
|
|
||
| public AutoSyncTests(ITestOutputHelper output) | ||
| { | ||
| TestEnvironment = new E2ETestEnvironment(output); | ||
| } | ||
|
|
||
| public void Dispose() | ||
| { | ||
| TestEnvironment.Dispose(); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void FieldTest() | ||
| { | ||
| var server = TestEnvironment.Server; | ||
| const string instanceId = "MyObj"; | ||
| const int newMyIntValue = 2002; | ||
|
|
||
| var containers = TestEnvironment.Clients.Select(client => client.Container).AddItem(TestEnvironment.Server.Container); | ||
|
|
||
| foreach (var container in containers) | ||
| { | ||
| var testClass = new AutoSyncTestClass(); | ||
|
|
||
| var registry = new AutoSyncTestClassRegistry(container.Resolve<IRegistryCollection>()); | ||
|
|
||
| registry.RegisterExistingObject(instanceId, testClass); | ||
|
|
||
| var autosyncBuilder = container.Resolve<IAutoSyncBuilder>(); | ||
|
|
||
| autosyncBuilder.AddField(AccessTools.Field(typeof(AutoSyncTestClass), nameof(AutoSyncTestClass.MyInt))); | ||
| autosyncBuilder.Build(); | ||
| } | ||
|
|
||
| server.Resolve<IAutoSyncPatchCollector>().PatchAll(); | ||
|
|
||
| server.Call(() => | ||
| { | ||
| var testClass = server.GetRegisteredObject<AutoSyncTestClass>(instanceId); | ||
|
|
||
| testClass.SetMyInt(newMyIntValue); | ||
| }); | ||
|
|
||
|
|
||
| foreach (var client in TestEnvironment.Clients) | ||
| { | ||
| var testClass = client.GetRegisteredObject<AutoSyncTestClass>(instanceId); | ||
|
|
||
| Assert.Equal(newMyIntValue, testClass.MyInt); | ||
| } | ||
| } | ||
| } | ||
|
|
This file contains hidden or 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,66 @@ | ||
| using Autofac; | ||
| using E2E.Tests.Environment; | ||
| using GameInterface.AutoSync; | ||
| using GameInterface.AutoSync.Builders; | ||
| using GameInterface.Registry; | ||
| using HarmonyLib; | ||
| using Xunit.Abstractions; | ||
|
|
||
| namespace E2E.Tests.AutoSync; | ||
|
|
||
| public class DynamicSyncTests : IDisposable | ||
| { | ||
| E2ETestEnvironment TestEnvironment { get; } | ||
|
|
||
| public DynamicSyncTests(ITestOutputHelper output) | ||
| { | ||
| TestEnvironment = new E2ETestEnvironment(output); | ||
| } | ||
|
|
||
| public void Dispose() | ||
| { | ||
| TestEnvironment.Dispose(); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void FieldTest() | ||
| { | ||
| var server = TestEnvironment.Server; | ||
| const string instanceId = "MyObj"; | ||
| const int newMyIntValue = 2002; | ||
|
|
||
| var containers = TestEnvironment.Clients.Select(client => client.Container).AddItem(TestEnvironment.Server.Container); | ||
|
|
||
| foreach (var container in containers) | ||
| { | ||
| var testClass = new AutoSyncTestClass(); | ||
|
|
||
| var registry = new AutoSyncTestClassRegistry(container.Resolve<IRegistryCollection>()); | ||
|
|
||
| registry.RegisterExistingObject(instanceId, testClass); | ||
|
|
||
| var autosyncBuilder = container.Resolve<IAutoSyncBuilder>(); | ||
|
|
||
| autosyncBuilder.AddField(AccessTools.Field(typeof(AutoSyncTestClass), nameof(AutoSyncTestClass.MyInt))); | ||
| autosyncBuilder.Build(); | ||
| } | ||
|
|
||
| server.Resolve<IAutoSyncPatchCollector>().PatchAll(); | ||
|
|
||
| server.Call(() => | ||
| { | ||
| var testClass = server.GetRegisteredObject<AutoSyncTestClass>(instanceId); | ||
|
|
||
| testClass.SetMyInt(newMyIntValue); | ||
| }); | ||
|
|
||
|
|
||
| foreach (var client in TestEnvironment.Clients) | ||
| { | ||
| var testClass = client.GetRegisteredObject<AutoSyncTestClass>(instanceId); | ||
|
|
||
| Assert.Equal(newMyIntValue, testClass.MyInt); | ||
| } | ||
| } | ||
| } | ||
|
|
12 changes: 12 additions & 0 deletions
12
source/E2E.Tests/AutoSync/TestClasses/AutoSyncTestClass.cs
This file contains hidden or 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,12 @@ | ||
| namespace GameInterface.AutoSync.Builders; | ||
| internal class AutoSyncTestClass | ||
| { | ||
| public string Name = "hi"; | ||
| public int MyInt = 1; | ||
| public AutoSyncRefClass? RefClass = null; | ||
| public int MyProp { get; set; } | ||
|
|
||
| public void SetMyInt(int val) { MyInt = val; } | ||
| } | ||
|
|
||
| internal class AutoSyncRefClass { } |
22 changes: 22 additions & 0 deletions
22
source/E2E.Tests/AutoSync/TestClasses/AutoSyncTestClassRegistry.cs
This file contains hidden or 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,22 @@ | ||
| using GameInterface.Registry; | ||
| using GameInterface.Services.Registry; | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
|
|
||
| namespace GameInterface.AutoSync.Builders; | ||
| internal class AutoSyncTestClassRegistry : RegistryBase<AutoSyncTestClass> | ||
| { | ||
| public AutoSyncTestClassRegistry(IRegistryCollection collection) : base(collection) | ||
| { | ||
| } | ||
|
|
||
| public override void RegisterAll() | ||
| { | ||
| } | ||
|
|
||
| protected override string GetNewId(AutoSyncTestClass obj) | ||
| { | ||
| return Guid.NewGuid().ToString(); | ||
| } | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.