protected override RdFSharpTypeProvidersModel InitModel(Lifetime lifetime, Rd.Impl.Protocol protocol) { var model = new RdFSharpTypeProvidersModel(lifetime, protocol); var typeProvidersContext = new TypeProvidersContext(Logger); new TypeProvidersHost(typeProvidersContext).Initialize(model.RdTypeProviderProcessModel); new ProvidedTypesHost(typeProvidersContext).Initialize(model.RdProvidedTypeProcessModel); new ProvidedMethodInfosHost(typeProvidersContext).Initialize(model.RdProvidedMethodInfoProcessModel); new ProvidedAssemblyHost(typeProvidersContext).Initialize(model.RdProvidedAssemblyProcessModel); new ProvidedConstructorInfosHost(typeProvidersContext).Initialize(model.RdProvidedConstructorInfoProcessModel); new TypeProvidersTestHost(typeProvidersContext).Initialize(model.RdTestHost); return(model); }
private void CreateProtocol(FileSystemPath protocolInstancePath) { var protocolInstance = GetProtocolInstanceData(protocolInstancePath); if (protocolInstance == null) { return; } myLogger.Info($"EditorPlugin protocol port {protocolInstance.Port} for Solution: {protocolInstance.SolutionName}."); if (protocolInstance.ProtocolGuid != ProtocolCompatibility.ProtocolGuid) { OnOutOfSync(myLifetime); myLogger.Info("Avoid attempt to create protocol, incompatible."); return; } try { var thisSessionLifetime = mySessionLifetimes.Next(); myLogger.Info("Create protocol..."); myLogger.Info("Creating SocketWire with port = {0}", protocolInstance.Port); var wire = new SocketWire.Client(thisSessionLifetime, myDispatcher, protocolInstance.Port, "UnityClient") { BackwardsCompatibleWireFormat = true }; var protocol = new Rd.Impl.Protocol("UnityEditorPlugin", new Serializers(thisSessionLifetime, null, null), new Identities(IdKind.Client), myDispatcher, wire, thisSessionLifetime) { ThrowErrorOnOutOfSyncModels = false }; protocol.OutOfSyncModels.AdviseOnce(thisSessionLifetime, _ => OnOutOfSync(thisSessionLifetime)); wire.Connected.WhenTrue(thisSessionLifetime, connectionLifetime => { myLogger.Info("WireConnected."); var backendUnityModel = new BackendUnityModel(connectionLifetime, protocol); SafeExecuteOrQueueEx("setModel", () => myBackendUnityHost.BackendUnityModel.SetValue(backendUnityModel)); connectionLifetime.OnTermination(() => { SafeExecuteOrQueueEx("clearModel", () => { myLogger.Info("Wire disconnected."); // Clear model myBackendUnityHost.BackendUnityModel.SetValue(null); }); }); }); } catch (Exception ex) { myLogger.Error(ex); } }