1 // Copyright 2001-2019 Crytek GmbH / Crytek Group. All rights reserved.
4 using System
.ServiceModel
;
11 interface IStatoscopeRPC
14 void LoadLog(string logURI
);
17 [ServiceBehavior(InstanceContextMode
= InstanceContextMode
.Single
)]
18 class CStatoscopeRPC
: IStatoscopeRPC
20 StatoscopeForm m_ssForm
;
22 public CStatoscopeRPC(StatoscopeForm ssForm
)
27 public void LoadLog(string logURI
)
29 System
.Console
.WriteLine("Received RPC to load: " + logURI
);
30 m_ssForm
.OpenLog(logURI
);
34 static ServiceHost s_serviceHost
;
35 const string PipeAddress
= "net.pipe://localhost/Statoscope";
36 const string PipeServiceName
= "StatoscopeRPC";
37 const string PipeEndpointAddress
= PipeAddress
+ "/" + PipeServiceName
;
39 public static void CreateServiceHost(StatoscopeForm ssForm
)
43 s_serviceHost
= new ServiceHost(new CStatoscopeRPC(ssForm
), new Uri
[] { new Uri(PipeAddress) }
);
44 s_serviceHost
.AddServiceEndpoint(typeof(IStatoscopeRPC
), new NetNamedPipeBinding(), PipeServiceName
);
47 catch (AddressAlreadyInUseException
)
52 public static bool CheckForExistingToolProcess(string logURI
)
56 ChannelFactory
<IStatoscopeRPC
> ssRPCFactory
= new ChannelFactory
<IStatoscopeRPC
>(new NetNamedPipeBinding(), new EndpointAddress(PipeEndpointAddress
));
57 IStatoscopeRPC ssRPCProxy
= ssRPCFactory
.CreateChannel();
58 ssRPCProxy
.LoadLog(logURI
);
60 catch (EndpointNotFoundException
)