├── .gitignore ├── Install └── RedGate.AppHost.wxs ├── LICENSE.md ├── NuSpec ├── Build │ └── RedGate.AppHost.targets └── RedGate.AppHost.nuspec ├── README.md ├── RedGate.AppHost.Client ├── ConsoleNativeMethods.cs ├── HostProcessMonitor.cs ├── Options.cs ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── RedGate.AppHost.Client.csproj ├── RedGate.AppHost.Client.x64.csproj ├── SafeChildProcessHandle.cs ├── app.manifest ├── honeycomb.ico └── packages.config ├── RedGate.AppHost.Example.Client ├── OutOfProcessEntryPoint.cs ├── Properties │ └── AssemblyInfo.cs ├── RedGate.AppHost.Example.Client.csproj ├── UserControl1.xaml └── UserControl1.xaml.cs ├── RedGate.AppHost.Example.Remote.Services ├── IServerImplementedThingThatClientNeeds.cs ├── Properties │ └── AssemblyInfo.cs └── RedGate.AppHost.Example.Remote.Services.csproj ├── RedGate.AppHost.Example.Server ├── App.xaml ├── App.xaml.cs ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── RedGate.AppHost.Example.Server.csproj ├── ServerImplementedThingThatClientNeeds.cs └── ServiceLocator.cs ├── RedGate.AppHost.Interfaces ├── IAppHostServices.cs ├── IOutOfProcessEntryPoint.cs ├── IRemoteElement.cs ├── ISafeChildProcessHandle.cs ├── Properties │ └── AssemblyInfo.cs └── RedGate.AppHost.Interfaces.csproj ├── RedGate.AppHost.Remoting.WPF ├── FrameworkElementExtensions.cs ├── NativeHandleContractAdapter.cs ├── NativeHandleContractMarshalByRefObject.cs ├── Properties │ └── AssemblyInfo.cs ├── RedGate.AppHost.Remoting.WPF.csproj └── RemoteElementExtensions.cs ├── RedGate.AppHost.Remoting ├── ClientChannelSinkProviderForParticularServer.cs ├── Properties │ └── AssemblyInfo.cs ├── RedGate.AppHost.Remoting.csproj └── Remoting.cs ├── RedGate.AppHost.Server ├── ChildProcessFactory.cs ├── ChildProcessHandle.cs ├── IChildProcessHandle.cs ├── IProcessStartOperation.cs ├── Job.cs ├── Native.cs ├── ProcessExtensions.cs ├── ProcessStarter.cs ├── ProcessStarter32bit.cs ├── ProcessStarter64Bit.cs ├── Properties │ └── AssemblyInfo.cs ├── RedGate.AppHost.Server.csproj ├── RemotedProcessBootstrapper.cs ├── StartProcessWithJobSupport.cs └── StartProcessWithTimeout.cs └── RedGate.AppHost.sln /.gitignore: -------------------------------------------------------------------------------- 1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs) 2 | [Bb]in/ 3 | [Oo]bj/ 4 | 5 | # mstest test results 6 | TestResults 7 | 8 | ## Ignore Visual Studio temporary files, build results, and 9 | ## files generated by popular Visual Studio add-ons. 10 | 11 | # User-specific files 12 | *.suo 13 | *.user 14 | *.sln.docstates 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Rr]elease/ 19 | x64/ 20 | *_i.c 21 | *_p.c 22 | *.ilk 23 | *.meta 24 | *.obj 25 | *.pch 26 | *.pdb 27 | *.pgc 28 | *.pgd 29 | *.rsp 30 | *.sbr 31 | *.tlb 32 | *.tli 33 | *.tlh 34 | *.tmp 35 | *.log 36 | *.vspscc 37 | *.vssscc 38 | .builds 39 | 40 | # Visual C++ cache files 41 | ipch/ 42 | *.aps 43 | *.ncb 44 | *.opensdf 45 | *.sdf 46 | 47 | # Visual Studio profiler 48 | *.psess 49 | *.vsp 50 | *.vspx 51 | 52 | # Guidance Automation Toolkit 53 | *.gpState 54 | 55 | # ReSharper is a .NET coding add-in 56 | _ReSharper* 57 | 58 | # NCrunch 59 | *.ncrunch* 60 | .*crunch*.local.xml 61 | 62 | # Installshield output folder 63 | [Ee]xpress 64 | 65 | # DocProject is a documentation generator add-in 66 | DocProject/buildhelp/ 67 | DocProject/Help/*.HxT 68 | DocProject/Help/*.HxC 69 | DocProject/Help/*.hhc 70 | DocProject/Help/*.hhk 71 | DocProject/Help/*.hhp 72 | DocProject/Help/Html2 73 | DocProject/Help/html 74 | 75 | # Click-Once directory 76 | publish 77 | 78 | # Publish Web Output 79 | *.Publish.xml 80 | 81 | # NuGet Packages Directory 82 | packages 83 | 84 | # Windows Azure Build Output 85 | csx 86 | *.build.csdef 87 | 88 | # Windows Store app package directory 89 | AppPackages/ 90 | 91 | # Others 92 | [Bb]in 93 | [Oo]bj 94 | sql 95 | TestResults 96 | [Tt]est[Rr]esult* 97 | *.Cache 98 | ClientBin 99 | [Ss]tyle[Cc]op.* 100 | ~$* 101 | *.dbmdl 102 | Generated_Code #added for RIA/Silverlight projects 103 | 104 | # Backup & report files from converting an old project file to a newer 105 | # Visual Studio version. Backup files are not needed, because we have git ;-) 106 | _UpgradeReport_Files/ 107 | Backup*/ 108 | UpgradeLog*.XML 109 | -------------------------------------------------------------------------------- /Install/RedGate.AppHost.wxs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /NuSpec/Build/RedGate.AppHost.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %(RecursiveDir)%(Filename)%(Extension) 6 | PreserveNewest 7 | 8 | 9 | -------------------------------------------------------------------------------- /NuSpec/RedGate.AppHost.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | RedGate.AppHost 5 | 1.0.0 6 | Red Gate Out of Process App Host 7 | Red Gate 8 | Red Gate 9 | https://github.com/red-gate/RedGate.AppHost 10 | false 11 | Provides a way to host a UI out of process and remote it in 12 | Provides a way to host a UI out of process and remote it in 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | RedGate AppHost 2 | =============== 3 | 4 | This library provides a way to run much of your application out of process, including the UI. 5 | 6 | **RedGate.AppHost.Server**: Used in your host application to start the child process and return a handle to the entry point 7 | 8 | **RedGate.AppHost.Client**: A stub application that will be started with some arguments including the assembly that contains your application which it will load via reflection. 9 | 10 | **RedGate.AppHost.Interfaces**: Contains the interfaces that you need to implement, starting with IOutOfProcessEntryPoint. 11 | 12 | 13 | Key Types & Control Flow 14 | ----------------------------- 15 | This library came out of the need to load multiple versions of a native binary inside a single process. This does not work, so we must load stubs inside the host process and remote in the UI that the native libraries create. 16 | 17 | 18 | 1. IOutOfProcessEntryPoint: The code that you wish to run out of process implements this interface to create the remote UI. It is called by RedGate.AppHost.Client via reflection 19 | 1. ISafeChildProcessHandle: The RedGate.AppHost.Client will take your framework element and adapt it into an IRemoteElement that can be sent across the remoting boundary. 20 | 1. ChildProcessFactory: This will start the remoting channel, the child process and take the IRemoteElement created in the child process and unwrap it back into a FrameworkElement 21 | 22 | Examples 23 | -------- 24 | There is an example application. It uses WPF to create the Windows chrome, but then the actual content is loaded externally and remoted in. It also shows how to share some services across the remoting boundary. 25 | 26 | 27 | ### Use Cases 28 | 29 | - Write your application in .NET 4/4.5, and load inside an application that needs to remain .NET 2 30 | - Write your application to take advantage of 64-bit machines with lots of memory, and load inside a 32 bit process 31 | - Use native libraries in a safe way that don't conflict with other assemblies in the same app domain 32 | - Isolate badly behaved components 33 | -------------------------------------------------------------------------------- /RedGate.AppHost.Client/ConsoleNativeMethods.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace RedGate.AppHost.Client 4 | { 5 | internal static class ConsoleNativeMethods 6 | { 7 | [DllImport("kernel32.dll", SetLastError = true)] 8 | internal static extern int AllocConsole(); 9 | } 10 | } -------------------------------------------------------------------------------- /RedGate.AppHost.Client/HostProcessMonitor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | namespace RedGate.AppHost.Client 5 | { 6 | internal class HostProcessMonitor 7 | { 8 | private readonly int m_HostProcessId; 9 | private readonly Action m_OnHostMissing; 10 | 11 | public HostProcessMonitor(int hostProcessId, Action onHostMissing) 12 | { 13 | if (onHostMissing == null) 14 | { 15 | throw new ArgumentNullException("onHostMissing"); 16 | } 17 | 18 | m_HostProcessId = hostProcessId; 19 | m_OnHostMissing = onHostMissing; 20 | } 21 | 22 | public void Start() 23 | { 24 | var hostProcess = Process.GetProcessById(m_HostProcessId); 25 | hostProcess.EnableRaisingEvents = true; 26 | hostProcess.Exited += (sender, e) => { m_OnHostMissing(); }; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /RedGate.AppHost.Client/Options.cs: -------------------------------------------------------------------------------- 1 | using CommandLine; 2 | 3 | namespace RedGate.AppHost.Client 4 | { 5 | internal class Options 6 | { 7 | [Option('a', "assembly", Required = true, HelpText = "Assembly that contains an IOutOfProcessEntryPoint to load")] 8 | public string Assembly { get; set; } 9 | 10 | [Option('i', "id", Required = true, HelpText = "The communication channel to call back to the host")] 11 | public string ChannelId { get; set; } 12 | 13 | [Option('d', "debug", Required = false, HelpText = "Opens the client in debug mode")] 14 | public bool Debug { get; set; } 15 | 16 | [Option('p', "processid", Required = false, HelpText = "Exits the process if the host process with the given id exits")] 17 | public int? HostProcessId { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /RedGate.AppHost.Client/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Threading; 6 | using System.Windows; 7 | using System.Windows.Threading; 8 | using CommandLine; 9 | using RedGate.AppHost.Interfaces; 10 | 11 | namespace RedGate.AppHost.Client 12 | { 13 | internal static class Program 14 | { 15 | private static SafeChildProcessHandle s_SafeChildProcessHandle; 16 | 17 | [STAThread] 18 | private static void Main(string[] args) 19 | { 20 | var options = new Options(); 21 | if (Parser.Default.ParseArguments(args, options)) 22 | { 23 | #if DEBUG 24 | options.Debug = true; 25 | #endif 26 | if (options.Debug) 27 | { 28 | ConsoleNativeMethods.AllocConsole(); 29 | } 30 | 31 | if (options.HostProcessId.HasValue) 32 | { 33 | new HostProcessMonitor(options.HostProcessId.Value, () => { Process.GetCurrentProcess().Kill(); }).Start(); 34 | } 35 | 36 | MainInner(options.ChannelId, options.Assembly); 37 | } 38 | else 39 | { 40 | MessageBox.Show("This application is used by RedGate.AppHost and should not be started manually. See https://github.com/red-gate/RedGate.AppHost", "Red Gate", MessageBoxButton.OK, MessageBoxImage.Information); 41 | } 42 | } 43 | 44 | private static void MainInner(string id, string assembly) 45 | { 46 | var entryPoint = LoadChildAssembly(assembly); 47 | InitializeRemoting(id, entryPoint); 48 | SignalReady(id); 49 | RunWpf(); 50 | } 51 | 52 | private static IOutOfProcessEntryPoint LoadChildAssembly(string assembly) 53 | { 54 | var outOfProcAssembly = Assembly.LoadFile(assembly); 55 | 56 | var entryPoint = outOfProcAssembly.GetTypes().Single(x => x.GetInterfaces().Contains(typeof (IOutOfProcessEntryPoint))); 57 | 58 | return (IOutOfProcessEntryPoint) Activator.CreateInstance(entryPoint); 59 | } 60 | 61 | private static void InitializeRemoting(string id, IOutOfProcessEntryPoint entryPoint) 62 | { 63 | Remoting.Remoting.RegisterChannels(true, id); 64 | 65 | s_SafeChildProcessHandle = new SafeChildProcessHandle(Dispatcher.CurrentDispatcher, entryPoint); 66 | Remoting.Remoting.RegisterService(s_SafeChildProcessHandle); 67 | } 68 | 69 | private static void SignalReady(string id) 70 | { 71 | using (EventWaitHandle signal = EventWaitHandle.OpenExisting(id)) 72 | { 73 | signal.Set(); 74 | } 75 | } 76 | 77 | private static void RunWpf() 78 | { 79 | Dispatcher.Run(); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /RedGate.AppHost.Client/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("RedGate AppHost")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("RedGate.AppHost.Client")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("a98ad493-fde6-432e-a44c-6b26ad564528")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /RedGate.AppHost.Client/RedGate.AppHost.Client.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {99836D0F-4605-445C-8B4D-4BEF55963477} 8 | WinExe 9 | Properties 10 | RedGate.AppHost.Client 11 | RedGate.AppHost.Client 12 | v4.0 13 | 512 14 | true 15 | \\red-gate.com\Files\RG_Build_Key\RedGate.snk 16 | 17 | 18 | 19 | 20 | 21 | true 22 | bin\x64\Debug\ 23 | DEBUG;TRACE 24 | true 25 | full 26 | x64 27 | prompt 28 | MinimumRecommendedRules.ruleset 29 | 30 | 31 | bin\x64\Release\ 32 | TRACE 33 | true 34 | true 35 | pdbonly 36 | x64 37 | prompt 38 | MinimumRecommendedRules.ruleset 39 | 40 | 41 | true 42 | ..\Build\Debug\ 43 | DEBUG;TRACE 44 | true 45 | full 46 | x86 47 | prompt 48 | MinimumRecommendedRules.ruleset 49 | 50 | 51 | ..\Build\Release\ 52 | TRACE 53 | true 54 | true 55 | pdbonly 56 | x86 57 | prompt 58 | MinimumRecommendedRules.ruleset 59 | 60 | 61 | 62 | true 63 | 64 | true 65 | 66 | 67 | honeycomb.ico 68 | 69 | 70 | app.manifest 71 | 72 | 73 | 74 | ..\packages\CommandLineParser.1.9.71\lib\net40\CommandLine.dll 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | {3084D987-50DD-43A5-9CF3-CE550513F8D0} 101 | RedGate.AppHost.Interfaces 102 | 103 | 104 | {24E71C6D-17CB-4D61-A092-EF1A37F7CD70} 105 | RedGate.AppHost.Remoting.WPF 106 | 107 | 108 | {B26AA798-4734-434A-9875-7E9000ED24F5} 109 | RedGate.AppHost.Remoting 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 128 | -------------------------------------------------------------------------------- /RedGate.AppHost.Client/RedGate.AppHost.Client.x64.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {B9B7B458-D610-420E-89C5-96EBF49EFA01} 8 | WinExe 9 | Properties 10 | RedGate.AppHost.Client 11 | RedGate.AppHost.Client.x64 12 | v4.0 13 | 512 14 | true 15 | \\red-gate.com\Files\RG_Build_Key\RedGate.snk 16 | 17 | 18 | 19 | 20 | 21 | true 22 | ..\Build\Debug\ 23 | DEBUG;TRACE 24 | true 25 | full 26 | x64 27 | prompt 28 | MinimumRecommendedRules.ruleset 29 | 30 | 31 | ..\Build\Release\ 32 | TRACE 33 | true 34 | true 35 | pdbonly 36 | x64 37 | prompt 38 | MinimumRecommendedRules.ruleset 39 | 40 | 41 | true 42 | bin\x86\Debug\ 43 | DEBUG;TRACE 44 | true 45 | full 46 | x86 47 | prompt 48 | MinimumRecommendedRules.ruleset 49 | 50 | 51 | bin\x86\Release\ 52 | TRACE 53 | true 54 | true 55 | pdbonly 56 | x86 57 | prompt 58 | MinimumRecommendedRules.ruleset 59 | 60 | 61 | 62 | true 63 | 64 | true 65 | 66 | 67 | honeycomb.ico 68 | app.manifest 69 | 70 | 71 | 72 | ..\packages\CommandLineParser.1.9.71\lib\net40\CommandLine.dll 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | {3084D987-50DD-43A5-9CF3-CE550513F8D0} 99 | RedGate.AppHost.Interfaces 100 | 101 | 102 | {24E71C6D-17CB-4D61-A092-EF1A37F7CD70} 103 | RedGate.AppHost.Remoting.WPF 104 | 105 | 106 | {B26AA798-4734-434A-9875-7E9000ED24F5} 107 | RedGate.AppHost.Remoting 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 126 | -------------------------------------------------------------------------------- /RedGate.AppHost.Client/SafeChildProcessHandle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Threading; 3 | using RedGate.AppHost.Interfaces; 4 | using RedGate.AppHost.Remoting.WPF; 5 | 6 | namespace RedGate.AppHost.Client 7 | { 8 | internal class SafeChildProcessHandle : MarshalByRefObject, ISafeChildProcessHandle 9 | { 10 | private readonly Dispatcher m_UiThreadDispatcher; 11 | private readonly IOutOfProcessEntryPoint m_EntryPoint; 12 | 13 | public SafeChildProcessHandle(Dispatcher uiThreadDispatcher, IOutOfProcessEntryPoint entryPoint) 14 | { 15 | if (uiThreadDispatcher == null) 16 | throw new ArgumentNullException("uiThreadDispatcher"); 17 | 18 | if (entryPoint == null) 19 | throw new ArgumentNullException("entryPoint"); 20 | 21 | m_UiThreadDispatcher = uiThreadDispatcher; 22 | m_EntryPoint = entryPoint; 23 | } 24 | 25 | public IRemoteElement CreateElement(IAppHostServices services) 26 | { 27 | Func createRemoteElement = () => m_EntryPoint.CreateElement(services).ToRemotedElement(); 28 | 29 | return (IRemoteElement)m_UiThreadDispatcher.Invoke(createRemoteElement); 30 | } 31 | 32 | public override object InitializeLifetimeService() 33 | { 34 | return null; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /RedGate.AppHost.Client/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /RedGate.AppHost.Client/honeycomb.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/red-gate/RedGate.AppHost/bfcf27dffe188e3a1d05b0fcd0685323ebcf8b66/RedGate.AppHost.Client/honeycomb.ico -------------------------------------------------------------------------------- /RedGate.AppHost.Client/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /RedGate.AppHost.Example.Client/OutOfProcessEntryPoint.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using RedGate.AppHost.Example.Remote.Services; 3 | using RedGate.AppHost.Interfaces; 4 | 5 | namespace RedGate.AppHost.Example.Client 6 | { 7 | public class OutOfProcessEntryPoint : IOutOfProcessEntryPoint 8 | { 9 | public FrameworkElement CreateElement(IAppHostServices service) 10 | { 11 | var serverThing = service.GetService(); 12 | 13 | string textToDisplay = serverThing.GetTextToDisplay(); 14 | 15 | return new UserControl1(textToDisplay); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /RedGate.AppHost.Example.Client/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("RedGate.AppHost.Example.Client")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("RedGate.AppHost.Example.Client")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("1fa2153e-fbef-4dc2-9b96-42313e80fc82")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /RedGate.AppHost.Example.Client/RedGate.AppHost.Example.Client.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {01D94911-0A29-47FB-9691-10ABFD0B78AB} 8 | Library 9 | Properties 10 | RedGate.AppHost.Example.Client 11 | RedGate.AppHost.Example.Client 12 | v4.0 13 | 512 14 | true 15 | \\red-gate.com\Files\RG_Build_Key\RedGate.snk 16 | 17 | 18 | true 19 | full 20 | false 21 | $(SolutionDir)Build\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | true 26 | 27 | 28 | pdbonly 29 | true 30 | $(SolutionDir)Build\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | true 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | UserControl1.xaml 54 | 55 | 56 | 57 | 58 | Designer 59 | MSBuild:Compile 60 | 61 | 62 | 63 | 64 | {EAFB4321-3E74-40D1-8369-D1667C374D9C} 65 | RedGate.AppHost.Example.Remote.Services 66 | 67 | 68 | {3084d987-50dd-43a5-9cf3-ce550513f8d0} 69 | RedGate.AppHost.Interfaces 70 | 71 | 72 | 73 | 74 | 81 | -------------------------------------------------------------------------------- /RedGate.AppHost.Example.Client/UserControl1.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | This is Kevin's remoted user control 11 | 12 | 13 | -------------------------------------------------------------------------------- /RedGate.AppHost.Example.Client/UserControl1.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace RedGate.AppHost.Example.Client 4 | { 5 | /// 6 | /// Interaction logic for UserControl1.xaml 7 | /// 8 | public partial class UserControl1 : UserControl 9 | { 10 | public UserControl1(string textToDisplay) 11 | { 12 | InitializeComponent(); 13 | 14 | Content = new TextBlock 15 | { 16 | Text = textToDisplay 17 | }; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /RedGate.AppHost.Example.Remote.Services/IServerImplementedThingThatClientNeeds.cs: -------------------------------------------------------------------------------- 1 | namespace RedGate.AppHost.Example.Remote.Services 2 | { 3 | public interface IServerImplementedThingThatClientNeeds 4 | { 5 | string GetTextToDisplay(); 6 | } 7 | } -------------------------------------------------------------------------------- /RedGate.AppHost.Example.Remote.Services/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("RedGate.AppHost.Example.Remote.Services")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("RedGate.AppHost.Example.Remote.Services")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("17871459-d0e4-4da8-8349-1a33bc6958c1")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /RedGate.AppHost.Example.Remote.Services/RedGate.AppHost.Example.Remote.Services.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {EAFB4321-3E74-40D1-8369-D1667C374D9C} 8 | Library 9 | Properties 10 | RedGate.AppHost.Example.Remote.Services 11 | RedGate.AppHost.Example.Remote.Services 12 | v4.0 13 | 512 14 | 15 | true 16 | \\red-gate.com\Files\RG_Build_Key\RedGate.snk 17 | 18 | 19 | true 20 | full 21 | false 22 | $(SolutionDir)Build\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | pdbonly 29 | true 30 | $(SolutionDir)Build\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 57 | -------------------------------------------------------------------------------- /RedGate.AppHost.Example.Server/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /RedGate.AppHost.Example.Server/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Windows; 7 | 8 | namespace RedGate.AppHost.Example.Server 9 | { 10 | /// 11 | /// Interaction logic for App.xaml 12 | /// 13 | public partial class App : Application 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /RedGate.AppHost.Example.Server/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /RedGate.AppHost.Example.Server/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using RedGate.AppHost.Server; 5 | 6 | namespace RedGate.AppHost.Example.Server 7 | { 8 | public partial class MainWindow : Window 9 | { 10 | public MainWindow() 11 | { 12 | InitializeComponent(); 13 | 14 | try 15 | { 16 | var safeAppHostChildHandle = new ChildProcessFactory().Create("RedGate.AppHost.Example.Client.dll"); 17 | 18 | Content = safeAppHostChildHandle.CreateElement(new ServiceLocator()); 19 | } 20 | catch (Exception e) 21 | { 22 | Content = new TextBlock 23 | { 24 | Text = e.ToString() 25 | }; 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /RedGate.AppHost.Example.Server/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("RedGate.AppHost.Example.Server")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("RedGate.AppHost.Example.Server")] 15 | [assembly: AssemblyCopyright("Copyright © 2014")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.0.0")] 55 | [assembly: AssemblyFileVersion("1.0.0.0")] 56 | -------------------------------------------------------------------------------- /RedGate.AppHost.Example.Server/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18408 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace RedGate.AppHost.Example.Server.Properties 12 | { 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// Returns the cached ResourceManager instance used by this class. 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RedGate.AppHost.Example.Server.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// Overrides the current thread's CurrentUICulture property for all 56 | /// resource lookups using this strongly typed resource class. 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /RedGate.AppHost.Example.Server/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /RedGate.AppHost.Example.Server/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18408 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace RedGate.AppHost.Example.Server.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /RedGate.AppHost.Example.Server/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /RedGate.AppHost.Example.Server/RedGate.AppHost.Example.Server.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {516C4CE3-F671-4E6A-A55D-952D08D3850E} 8 | WinExe 9 | Properties 10 | RedGate.AppHost.Example.Server 11 | RedGate.AppHost.Example.Server 12 | v4.0 13 | 512 14 | true 15 | \\red-gate.com\Files\RG_Build_Key\RedGate.snk 16 | 17 | 18 | AnyCPU 19 | true 20 | full 21 | false 22 | $(SolutionDir)Build\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | true 27 | 28 | 29 | AnyCPU 30 | pdbonly 31 | true 32 | $(SolutionDir)Build\Release\ 33 | TRACE 34 | prompt 35 | 4 36 | true 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 4.0 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | MSBuild:Compile 58 | Designer 59 | 60 | 61 | 62 | 63 | MSBuild:Compile 64 | Designer 65 | 66 | 67 | App.xaml 68 | Code 69 | 70 | 71 | MainWindow.xaml 72 | Code 73 | 74 | 75 | 76 | 77 | Code 78 | 79 | 80 | True 81 | True 82 | Resources.resx 83 | 84 | 85 | True 86 | Settings.settings 87 | True 88 | 89 | 90 | ResXFileCodeGenerator 91 | Resources.Designer.cs 92 | 93 | 94 | SettingsSingleFileGenerator 95 | Settings.Designer.cs 96 | 97 | 98 | 99 | 100 | 101 | {99836d0f-4605-445c-8b4d-4bef55963477} 102 | RedGate.AppHost.Client 103 | 104 | 105 | {EAFB4321-3E74-40D1-8369-D1667C374D9C} 106 | RedGate.AppHost.Example.Remote.Services 107 | 108 | 109 | {3084D987-50DD-43A5-9CF3-CE550513F8D0} 110 | RedGate.AppHost.Interfaces 111 | 112 | 113 | {DA6AC02A-EAA5-4C61-81BD-1BA3BB615C44} 114 | RedGate.AppHost.Server 115 | 116 | 117 | 118 | 119 | 126 | -------------------------------------------------------------------------------- /RedGate.AppHost.Example.Server/ServerImplementedThingThatClientNeeds.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Remoting.Lifetime; 3 | using RedGate.AppHost.Example.Remote.Services; 4 | 5 | namespace RedGate.AppHost.Example.Server 6 | { 7 | public class ServerImplementedThingThatClientNeeds : MarshalByRefObject, IServerImplementedThingThatClientNeeds, ISponsor 8 | { 9 | public string GetTextToDisplay() 10 | { 11 | return "This is a string that the server needs displayed"; 12 | } 13 | 14 | public TimeSpan Renewal(ILease lease) 15 | { 16 | return TimeSpan.FromMinutes(1); 17 | } 18 | 19 | public override object InitializeLifetimeService() 20 | { 21 | ILease ret = (ILease)base.InitializeLifetimeService(); 22 | ret.SponsorshipTimeout = TimeSpan.FromMinutes(2); 23 | ret.Register(this); 24 | return ret; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /RedGate.AppHost.Example.Server/ServiceLocator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using RedGate.AppHost.Interfaces; 3 | 4 | namespace RedGate.AppHost.Example.Server 5 | { 6 | public class ServiceLocator : MarshalByRefObject, IAppHostServices 7 | { 8 | public T GetService() where T : class 9 | { 10 | return new ServerImplementedThingThatClientNeeds() as T; 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /RedGate.AppHost.Interfaces/IAppHostServices.cs: -------------------------------------------------------------------------------- 1 | namespace RedGate.AppHost.Interfaces 2 | { 3 | /// 4 | /// Provides a way for the server to proffer services to the client 5 | /// 6 | public interface IAppHostServices 7 | { 8 | T GetService() where T : class; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /RedGate.AppHost.Interfaces/IOutOfProcessEntryPoint.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace RedGate.AppHost.Interfaces 4 | { 5 | /// 6 | /// All assemblies that are intended to be run out of process need a single type that implements this interface. It will be 7 | /// loaded via reflection and will be called. 8 | /// 9 | public interface IOutOfProcessEntryPoint 10 | { 11 | FrameworkElement CreateElement(IAppHostServices service); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /RedGate.AppHost.Interfaces/IRemoteElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.AddIn.Contract; 3 | using System.Security.Permissions; 4 | 5 | namespace RedGate.AppHost.Interfaces 6 | { 7 | /// 8 | /// Provides a specialization IContract that allows to move across the .NET Remoting boundary. Casts to long 9 | /// 10 | /// 11 | /// To work around http://support.microsoft.com/kb/982638 12 | /// 13 | public interface IRemoteElement : IContract 14 | { 15 | /// 16 | /// Akin to 17 | /// 18 | [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)] 19 | long GetHandle(); 20 | } 21 | } -------------------------------------------------------------------------------- /RedGate.AppHost.Interfaces/ISafeChildProcessHandle.cs: -------------------------------------------------------------------------------- 1 | namespace RedGate.AppHost.Interfaces 2 | { 3 | /// 4 | /// Registered by the client to provide a remotable handle to the type returned by the 5 | /// 6 | public interface ISafeChildProcessHandle 7 | { 8 | IRemoteElement CreateElement(IAppHostServices services); 9 | } 10 | } -------------------------------------------------------------------------------- /RedGate.AppHost.Interfaces/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("RedGate.AppHost.Interfaces")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("RedGate.AppHost.Interfaces")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("0c1712ae-d4ce-46df-b90f-8c3e0dd6a477")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /RedGate.AppHost.Interfaces/RedGate.AppHost.Interfaces.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {3084D987-50DD-43A5-9CF3-CE550513F8D0} 8 | Library 9 | Properties 10 | RedGate.AppHost.Interfaces 11 | RedGate.AppHost.Interfaces 12 | v3.5 13 | 512 14 | true 15 | \\red-gate.com\Files\RG_Build_Key\RedGate.snk 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | $(SolutionDir)Build\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | true 27 | 28 | 29 | pdbonly 30 | true 31 | $(SolutionDir)Build\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | true 36 | 37 | 38 | 39 | true 40 | true 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 72 | -------------------------------------------------------------------------------- /RedGate.AppHost.Remoting.WPF/FrameworkElementExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using RedGate.AppHost.Interfaces; 3 | 4 | namespace RedGate.AppHost.Remoting.WPF 5 | { 6 | public static class FrameworkElementExtensions 7 | { 8 | public static IRemoteElement ToRemotedElement(this FrameworkElement element) 9 | { 10 | return NativeHandleContractMarshalByRefObject.Create(element); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /RedGate.AppHost.Remoting.WPF/NativeHandleContractAdapter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.AddIn.Contract; 3 | using RedGate.AppHost.Interfaces; 4 | 5 | namespace RedGate.AppHost.Remoting.WPF 6 | { 7 | internal class NativeHandleContractAdapter : INativeHandleContract 8 | { 9 | private readonly IRemoteElement m_Upstream; 10 | 11 | internal NativeHandleContractAdapter(IRemoteElement upstream) 12 | { 13 | if (upstream == null) 14 | { 15 | throw new ArgumentNullException("upstream"); 16 | } 17 | m_Upstream = upstream; 18 | } 19 | 20 | 21 | public IContract QueryContract(string contractIdentifier) 22 | { 23 | return m_Upstream.QueryContract(contractIdentifier); 24 | } 25 | 26 | public int GetRemoteHashCode() 27 | { 28 | return m_Upstream.GetRemoteHashCode(); 29 | } 30 | 31 | public bool RemoteEquals(IContract contract) 32 | { 33 | return m_Upstream.RemoteEquals(contract); 34 | } 35 | 36 | public string RemoteToString() 37 | { 38 | return m_Upstream.RemoteToString(); 39 | } 40 | 41 | public int AcquireLifetimeToken() 42 | { 43 | return m_Upstream.AcquireLifetimeToken(); 44 | } 45 | 46 | public void RevokeLifetimeToken(int token) 47 | { 48 | m_Upstream.RevokeLifetimeToken(token); 49 | } 50 | 51 | public IntPtr GetHandle() 52 | { 53 | return (IntPtr)m_Upstream.GetHandle(); 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /RedGate.AppHost.Remoting.WPF/NativeHandleContractMarshalByRefObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.AddIn.Contract; 3 | using System.AddIn.Pipeline; 4 | using System.Windows; 5 | using RedGate.AppHost.Interfaces; 6 | 7 | namespace RedGate.AppHost.Remoting.WPF 8 | { 9 | internal class NativeHandleContractMarshalByRefObject : MarshalByRefObject, IRemoteElement 10 | { 11 | internal static NativeHandleContractMarshalByRefObject Create(FrameworkElement element) 12 | { 13 | return new NativeHandleContractMarshalByRefObject(FrameworkElementAdapters.ViewToContractAdapter(element)); 14 | } 15 | 16 | private readonly INativeHandleContract m_Upstream; 17 | 18 | private NativeHandleContractMarshalByRefObject(INativeHandleContract upstream) 19 | { 20 | m_Upstream = upstream; 21 | } 22 | 23 | public override object InitializeLifetimeService() 24 | { 25 | return null; 26 | } 27 | 28 | public IContract QueryContract(string contractIdentifier) 29 | { 30 | return m_Upstream.QueryContract(contractIdentifier); 31 | } 32 | 33 | public int GetRemoteHashCode() 34 | { 35 | return m_Upstream.GetRemoteHashCode(); 36 | } 37 | 38 | public bool RemoteEquals(IContract contract) 39 | { 40 | return m_Upstream.RemoteEquals(contract); 41 | } 42 | 43 | public string RemoteToString() 44 | { 45 | return m_Upstream.RemoteToString(); 46 | } 47 | 48 | public int AcquireLifetimeToken() 49 | { 50 | return m_Upstream.AcquireLifetimeToken(); 51 | } 52 | 53 | public void RevokeLifetimeToken(int token) 54 | { 55 | m_Upstream.RevokeLifetimeToken(token); 56 | } 57 | 58 | public long GetHandle() 59 | { 60 | return (long)m_Upstream.GetHandle(); 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /RedGate.AppHost.Remoting.WPF/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("RedGate.AppHost.Remoting.WPF")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("RedGate.AppHost.Remoting.WPF")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("81b1ea2d-168a-4288-ace5-f100a5d3f5ee")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /RedGate.AppHost.Remoting.WPF/RedGate.AppHost.Remoting.WPF.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {24E71C6D-17CB-4D61-A092-EF1A37F7CD70} 8 | Library 9 | Properties 10 | RedGate.AppHost.Remoting.WPF 11 | RedGate.AppHost.Remoting.WPF 12 | v3.5 13 | 512 14 | true 15 | \\red-gate.com\Files\RG_Build_Key\RedGate.snk 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | $(SolutionDir)Build\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | true 27 | 28 | 29 | pdbonly 30 | true 31 | $(SolutionDir)Build\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | 38 | true 39 | true 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | {3084D987-50DD-43A5-9CF3-CE550513F8D0} 66 | RedGate.AppHost.Interfaces 67 | 68 | 69 | 70 | 71 | 78 | -------------------------------------------------------------------------------- /RedGate.AppHost.Remoting.WPF/RemoteElementExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.AddIn.Contract; 2 | using System.AddIn.Pipeline; 3 | using System.Windows; 4 | using RedGate.AppHost.Interfaces; 5 | 6 | namespace RedGate.AppHost.Remoting.WPF 7 | { 8 | public static class RemoteElementExtensions 9 | { 10 | public static FrameworkElement ToFrameworkElement(this IRemoteElement remotedElement) 11 | { 12 | INativeHandleContract nativeHandleContractAdapter = new NativeHandleContractAdapter(remotedElement); 13 | 14 | return FrameworkElementAdapters.ContractToViewAdapter(nativeHandleContractAdapter); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /RedGate.AppHost.Remoting/ClientChannelSinkProviderForParticularServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Remoting.Channels; 3 | 4 | namespace RedGate.AppHost.Remoting 5 | { 6 | internal class ClientChannelSinkProviderForParticularServer : IClientChannelSinkProvider 7 | { 8 | private readonly IClientChannelSinkProvider m_Upstream; 9 | private readonly string m_Url; 10 | 11 | internal ClientChannelSinkProviderForParticularServer(IClientChannelSinkProvider upstream, string id) 12 | { 13 | if (upstream == null) 14 | throw new ArgumentNullException("upstream"); 15 | 16 | if (String.IsNullOrEmpty(id)) 17 | throw new ArgumentNullException("id"); 18 | 19 | m_Upstream = upstream; 20 | m_Url = string.Format("ipc://{0}", id); 21 | } 22 | 23 | public IClientChannelSinkProvider Next 24 | { 25 | get { return m_Upstream.Next; } 26 | set { m_Upstream.Next = value; } 27 | } 28 | 29 | public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData) 30 | { 31 | //Returning null indicates that the sink cannot be created as per Microsoft documentation 32 | return url == m_Url ? m_Upstream.CreateSink(channel, url, remoteChannelData) : null; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /RedGate.AppHost.Remoting/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("RedGate.AppHost.Remoting")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("RedGate.AppHost.Remoting")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("5fd925ac-09bb-4359-a98a-0a57ab0b6124")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /RedGate.AppHost.Remoting/RedGate.AppHost.Remoting.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {B26AA798-4734-434A-9875-7E9000ED24F5} 8 | Library 9 | Properties 10 | RedGate.AppHost.Remoting 11 | RedGate.AppHost.Remoting 12 | v3.5 13 | 512 14 | true 15 | \\red-gate.com\Files\RG_Build_Key\RedGate.snk 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | $(SolutionDir)Build\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | true 27 | 28 | 29 | pdbonly 30 | true 31 | $(SolutionDir)Build\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | true 36 | 37 | 38 | 39 | true 40 | true 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 64 | -------------------------------------------------------------------------------- /RedGate.AppHost.Remoting/Remoting.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Remoting; 3 | using System.Runtime.Remoting.Channels; 4 | using System.Runtime.Remoting.Channels.Ipc; 5 | using System.Runtime.Remoting.Lifetime; 6 | using System.Runtime.Serialization.Formatters; 7 | 8 | namespace RedGate.AppHost.Remoting 9 | { 10 | public static class Remoting 11 | { 12 | #if DEBUG 13 | /// 14 | /// This constructor tries to highlight issues in your code. .NET doesn't have a inter-process GC, and not calling method on your 15 | /// services can cause them to be GC'ed. This constructor will force this issue by making the lifetime 16 | /// of those remoted objects very short. Implement on your types to ensure 17 | /// your objects remain alive. 18 | /// 19 | static Remoting() 20 | { 21 | TimeSpan oneSecond = TimeSpan.FromSeconds(1); 22 | LifetimeServices.LeaseManagerPollTime = oneSecond; // the default is 10 s 23 | LifetimeServices.LeaseTime = oneSecond; // the default is 5 minutes 24 | LifetimeServices.RenewOnCallTime = oneSecond; // the default is 2 minutes 25 | LifetimeServices.SponsorshipTimeout = oneSecond; // the default is 2 minutes 26 | } 27 | #endif 28 | 29 | public static void RegisterService(TService service) 30 | where TService : MarshalByRefObject, TInterface 31 | { 32 | RemotingServices.Marshal(service, GetName()); 33 | } 34 | 35 | public static T ConnectToService(string hostname) 36 | { 37 | return (T)Activator.GetObject(typeof(T), string.Format("ipc://{0}/{1}", hostname, GetName())); 38 | } 39 | 40 | private static string GetName() 41 | { 42 | return typeof(T).FullName; 43 | } 44 | 45 | public static void RegisterChannels(bool childProcess, string id) 46 | { 47 | string callback = id + ".Callback"; 48 | RegisterClientChannel(childProcess ? callback : id); 49 | RegisterServerChannel(childProcess ? id : callback); 50 | } 51 | 52 | private static void RegisterClientChannel(string id) 53 | { 54 | BinaryClientFormatterSinkProvider clientSinkProvider = new BinaryClientFormatterSinkProvider(); 55 | ChannelServices.RegisterChannel(new IpcClientChannel(id, new ClientChannelSinkProviderForParticularServer(clientSinkProvider, id)), false); 56 | } 57 | 58 | private static void RegisterServerChannel(string id) 59 | { 60 | BinaryServerFormatterSinkProvider serverSinkProvider = new BinaryServerFormatterSinkProvider { TypeFilterLevel = TypeFilterLevel.Full }; 61 | ChannelServices.RegisterChannel(new IpcServerChannel(id, id, serverSinkProvider), false); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /RedGate.AppHost.Server/ChildProcessFactory.cs: -------------------------------------------------------------------------------- 1 | namespace RedGate.AppHost.Server 2 | { 3 | public class ChildProcessFactory 4 | { 5 | public IChildProcessHandle Create(string assemblyName, bool openDebugConsole, bool is64Bit, bool monitorHostProcess) 6 | { 7 | IProcessStartOperation processStarter; 8 | 9 | if (is64Bit) 10 | { 11 | processStarter = new ProcessStarter64Bit(); 12 | } 13 | else 14 | { 15 | processStarter = new ProcessStarter32Bit(); 16 | } 17 | 18 | return new RemotedProcessBootstrapper( 19 | new StartProcessWithTimeout( 20 | new StartProcessWithJobSupport( 21 | processStarter))).Create(assemblyName, openDebugConsole, monitorHostProcess); 22 | } 23 | 24 | // the methods below are to support legacy versions of the API to the Create() method 25 | 26 | public IChildProcessHandle Create(string assemblyName, bool openDebugConsole, bool is64Bit) 27 | { 28 | return Create(assemblyName, openDebugConsole, is64Bit, false); 29 | } 30 | 31 | public IChildProcessHandle Create(string assemblyName, bool openDebugConsole) 32 | { 33 | return Create(assemblyName, openDebugConsole, false); 34 | } 35 | 36 | public IChildProcessHandle Create(string assemblyName) 37 | { 38 | return Create(assemblyName, false, false); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /RedGate.AppHost.Server/ChildProcessHandle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Runtime.Remoting; 4 | using System.Windows; 5 | using RedGate.AppHost.Interfaces; 6 | using RedGate.AppHost.Remoting.WPF; 7 | 8 | namespace RedGate.AppHost.Server 9 | { 10 | internal class ChildProcessHandle : IChildProcessHandle 11 | { 12 | private readonly ISafeChildProcessHandle m_SafeChildProcessHandle; 13 | private readonly Process m_Process; 14 | 15 | public ChildProcessHandle(ISafeChildProcessHandle safeChildProcessHandle, Process process) 16 | { 17 | m_SafeChildProcessHandle = safeChildProcessHandle; 18 | m_Process = process; 19 | } 20 | 21 | public FrameworkElement CreateElement(IAppHostServices services) 22 | { 23 | try 24 | { 25 | return m_SafeChildProcessHandle.CreateElement(services).ToFrameworkElement(); 26 | } 27 | catch (RemotingException) 28 | { 29 | if (m_Process != null) 30 | { 31 | m_Process.KillAndDispose(); 32 | } 33 | throw; 34 | } 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /RedGate.AppHost.Server/IChildProcessHandle.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using RedGate.AppHost.Interfaces; 3 | 4 | namespace RedGate.AppHost.Server 5 | { 6 | /// 7 | /// A handle to a process, which when initialized, returns a FrameworkElement for rendering 8 | /// 9 | public interface IChildProcessHandle 10 | { 11 | FrameworkElement CreateElement(IAppHostServices services); 12 | } 13 | } -------------------------------------------------------------------------------- /RedGate.AppHost.Server/IProcessStartOperation.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace RedGate.AppHost.Server 4 | { 5 | internal interface IProcessStartOperation 6 | { 7 | Process StartProcess(string assemblyName, string remotingId, bool openDebugConsole, bool monitorHostProcess); 8 | } 9 | } -------------------------------------------------------------------------------- /RedGate.AppHost.Server/Job.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Runtime.InteropServices; 4 | 5 | namespace RedGate.AppHost.Server 6 | { 7 | /// 8 | /// This class wraps CreateJobObject (http://msdn.microsoft.com/en-us/library/windows/desktop/ms682409(v=vs.85).aspx) 9 | /// 10 | /// It doesn't need to be disposable because "The job is destroyed when its last handle has been closed and all 11 | /// associated processes have exited." 12 | /// 13 | internal class Job 14 | { 15 | private static readonly Version s_Windows8 = new Version(6, 2, 0, 0); 16 | 17 | internal static bool CanAssignProcessToJobObject(Process process) 18 | { 19 | if (Environment.OSVersion.Version >= s_Windows8) 20 | { 21 | return true; //Windows 8 supports nesting of jobs, so a process in a job can be added to another job 22 | } 23 | else 24 | { 25 | bool ret = false; 26 | Native.ThrowOnFailure(() => Native.IsProcessInJob(process.Handle, IntPtr.Zero, out ret)); 27 | return !ret; 28 | } 29 | } 30 | 31 | private readonly IntPtr m_Job; 32 | 33 | internal Job() 34 | { 35 | m_Job = Native.CreateJobObject(IntPtr.Zero, null); 36 | Native.ThrowOnFailure(() => m_Job != IntPtr.Zero); 37 | 38 | var lpJobObjectInfo = new Native.JOBOBJECT_EXTENDED_LIMIT_INFORMATION 39 | { 40 | BasicLimitInformation = 41 | { 42 | LimitFlags = Native.JOB_OBJECT_LIMIT.JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE 43 | } 44 | }; 45 | 46 | Native.ThrowOnFailure(() => Native.SetInformationJobObject(m_Job, Native.JobObject.JobObjectExtendedLimitInformation, ref lpJobObjectInfo, (uint)Marshal.SizeOf(typeof(Native.JOBOBJECT_EXTENDED_LIMIT_INFORMATION)))); 47 | } 48 | 49 | internal void AssignProcessToJobObject(Process process) 50 | { 51 | Native.ThrowOnFailure(() => Native.AssignProcessToJobObject(m_Job, process.Handle)); 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /RedGate.AppHost.Server/Native.cs: -------------------------------------------------------------------------------- 1 | // ReSharper disable InconsistentNaming 2 | // ReSharper disable IdentifierTypo 3 | // ReSharper disable StringLiteralTypo 4 | using System; 5 | using System.Runtime.InteropServices; 6 | 7 | namespace RedGate.AppHost.Server 8 | { 9 | internal static class Native 10 | { 11 | internal static void ThrowOnFailure(Func action) 12 | { 13 | bool ret = action(); 14 | if (!ret) 15 | { 16 | int error = Marshal.GetLastWin32Error(); 17 | throw new ApplicationException(string.Format("ERROR: {0} failed with error code {1}", action.Method, error)); 18 | } 19 | } 20 | 21 | [DllImport("kernel32.dll", SetLastError = true)] 22 | internal static extern bool IsProcessInJob( 23 | [In] IntPtr ProcessHandle, 24 | [In] IntPtr JobHandle, 25 | [Out] out bool Result); 26 | 27 | [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] 28 | internal static extern IntPtr CreateJobObject( 29 | [In] IntPtr lpJobAttributes, 30 | [In] string lpName); 31 | 32 | [DllImport("kernel32.dll", SetLastError = true)] 33 | [return: MarshalAs(UnmanagedType.Bool)] 34 | internal static extern bool SetInformationJobObject( 35 | [In] IntPtr hJob, 36 | [In] JobObject JobObjectInfoClass, 37 | [In] ref JOBOBJECT_EXTENDED_LIMIT_INFORMATION lpJobObjectInfo, 38 | [In] uint cbJobObjectInfoLength); 39 | 40 | [DllImport("kernel32.dll", SetLastError = true)] 41 | [return: MarshalAs(UnmanagedType.Bool)] 42 | internal static extern bool AssignProcessToJobObject( 43 | [In] IntPtr hJob, 44 | [In] IntPtr hProcess); 45 | 46 | 47 | internal enum JobObject 48 | { 49 | JobObjectBasicLimitInformation = 2, 50 | JobObjectBasicUIRestrictions = 4, 51 | JobObjectSecurityLimitInformation, 52 | JobObjectEndOfJobTimeInformation, 53 | JobObjectAssociateCompletionPortInformation, 54 | JobObjectExtendedLimitInformation = 9, 55 | JobObjectGroupInformation = 11, 56 | JobObjectNotificationLimitInformation, 57 | JobObjectGroupInformationEx = 14, 58 | JobObjectCpuRateControlInformation 59 | } 60 | 61 | [StructLayout(LayoutKind.Sequential)] 62 | internal struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION 63 | { 64 | public JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation; 65 | public IO_COUNTERS IoInfo; 66 | public IntPtr ProcessMemoryLimit; 67 | public IntPtr JobMemoryLimit; 68 | public IntPtr PeakProcessMemoryUsed; 69 | public IntPtr PeakJobMemoryUsed; 70 | } 71 | 72 | [StructLayout(LayoutKind.Sequential)] 73 | internal struct IO_COUNTERS 74 | { 75 | public ulong ReadOperationCount; 76 | public ulong WriteOperationCount; 77 | public ulong OtherOperationCount; 78 | public ulong ReadTransferCount; 79 | public ulong WriteTransferCount; 80 | public ulong OtherTransferCount; 81 | } 82 | 83 | [StructLayout(LayoutKind.Sequential)] 84 | internal struct JOBOBJECT_BASIC_LIMIT_INFORMATION 85 | { 86 | public long PerProcessUserTimeLimit; 87 | public long PerJobUserTimeLimit; 88 | public JOB_OBJECT_LIMIT LimitFlags; 89 | public IntPtr MinimumWorkingSetSize; 90 | public IntPtr MaximumWorkingSetSize; 91 | public uint ActiveProcessLimit; 92 | public IntPtr Affinity; 93 | public uint PriorityClass; 94 | public uint SchedulingClass; 95 | } 96 | 97 | [Flags] 98 | internal enum JOB_OBJECT_LIMIT : uint 99 | { 100 | 101 | JOB_OBJECT_LIMIT_WORKINGSET = 0x00000001, 102 | JOB_OBJECT_LIMIT_PROCESS_TIME = 0x00000002, 103 | JOB_OBJECT_LIMIT_JOB_TIME = 0x00000004, 104 | JOB_OBJECT_LIMIT_ACTIVE_PROCESS = 0x00000008, 105 | 106 | JOB_OBJECT_LIMIT_AFFINITY = 0x00000010, 107 | JOB_OBJECT_LIMIT_PRIORITY_CLASS = 0x00000020, 108 | JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME = 0x00000040, 109 | JOB_OBJECT_LIMIT_SCHEDULING_CLASS = 0x00000080, 110 | JOB_OBJECT_LIMIT_PROCESS_MEMORY = 0x00000100, 111 | JOB_OBJECT_LIMIT_JOB_MEMORY = 0x00000200, 112 | JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION = 0x00000400, 113 | JOB_OBJECT_LIMIT_BREAKAWAY_OK = 0x00000800, 114 | JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK = 0x00001000, 115 | JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = 0x00002000, 116 | JOB_OBJECT_LIMIT_SUBSET_AFFINITY = 0x00004000 117 | } 118 | } 119 | } 120 | // ReSharper restore InconsistentNaming 121 | // ReSharper restore IdentifierTypo 122 | // ReSharper restore StringLiteralTypo -------------------------------------------------------------------------------- /RedGate.AppHost.Server/ProcessExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace RedGate.AppHost.Server 4 | { 5 | internal static class ProcessExtensions 6 | { 7 | internal static bool CanAssignToJobObject(this Process process) 8 | { 9 | return Job.CanAssignProcessToJobObject(process); 10 | } 11 | 12 | internal static void KillAndDispose(this Process process) 13 | { 14 | if (!process.HasExited) 15 | { 16 | process.Kill(); 17 | } 18 | process.Dispose(); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /RedGate.AppHost.Server/ProcessStarter.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.IO; 3 | using System.Reflection; 4 | 5 | namespace RedGate.AppHost.Server 6 | { 7 | internal abstract class ProcessStarter : IProcessStartOperation 8 | { 9 | protected abstract string ProcessFileName { get; } 10 | 11 | public Process StartProcess(string assemblyName, string remotingId, bool openDebugConsole, bool monitorHostProcess) 12 | { 13 | string executingDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); 14 | string quotedAssemblyArg = "\"" + Path.Combine(executingDirectory, assemblyName) + "\""; 15 | 16 | var processToStart = Path.Combine(executingDirectory, ProcessFileName); 17 | var processArguments = string.Join(" ", new[] 18 | { 19 | "-i " + remotingId, 20 | "-a " + quotedAssemblyArg, 21 | openDebugConsole ? "-d" : string.Empty, 22 | monitorHostProcess ? "-p " + Process.GetCurrentProcess().Id : string.Empty 23 | }); 24 | return Process.Start(processToStart, processArguments); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /RedGate.AppHost.Server/ProcessStarter32bit.cs: -------------------------------------------------------------------------------- 1 | namespace RedGate.AppHost.Server 2 | { 3 | internal class ProcessStarter32Bit : ProcessStarter 4 | { 5 | protected override string ProcessFileName 6 | { 7 | get { return "RedGate.AppHost.Client.exe"; } 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /RedGate.AppHost.Server/ProcessStarter64Bit.cs: -------------------------------------------------------------------------------- 1 | namespace RedGate.AppHost.Server 2 | { 3 | internal class ProcessStarter64Bit : ProcessStarter 4 | { 5 | protected override string ProcessFileName 6 | { 7 | get { return "RedGate.AppHost.Client.x64.exe"; } 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /RedGate.AppHost.Server/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("RedGate.AppHost.Server")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("RedGate.AppHost.Server")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("89f31b11-70bd-4188-8b3c-b5c9525f21e8")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /RedGate.AppHost.Server/RedGate.AppHost.Server.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {DA6AC02A-EAA5-4C61-81BD-1BA3BB615C44} 8 | Library 9 | Properties 10 | RedGate.AppHost.Server 11 | RedGate.AppHost.Server 12 | v3.5 13 | 512 14 | true 15 | \\red-gate.com\Files\RG_Build_Key\RedGate.snk 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | $(SolutionDir)Build\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | true 27 | 28 | 29 | pdbonly 30 | true 31 | $(SolutionDir)Build\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | true 36 | 37 | 38 | 39 | true 40 | 41 | true 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | {3084D987-50DD-43A5-9CF3-CE550513F8D0} 76 | RedGate.AppHost.Interfaces 77 | 78 | 79 | {24E71C6D-17CB-4D61-A092-EF1A37F7CD70} 80 | RedGate.AppHost.Remoting.WPF 81 | 82 | 83 | {B26AA798-4734-434A-9875-7E9000ED24F5} 84 | RedGate.AppHost.Remoting 85 | 86 | 87 | 88 | 89 | 96 | -------------------------------------------------------------------------------- /RedGate.AppHost.Server/RemotedProcessBootstrapper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using RedGate.AppHost.Interfaces; 4 | 5 | namespace RedGate.AppHost.Server 6 | { 7 | internal class RemotedProcessBootstrapper 8 | { 9 | private readonly IProcessStartOperation m_ProcessBootstrapper; 10 | private readonly string m_RemotingId = string.Format("RedGate.AppHost.IPC.{{{0}}}", Guid.NewGuid()); 11 | 12 | public RemotedProcessBootstrapper(IProcessStartOperation processBootstrapper) 13 | { 14 | if (processBootstrapper == null) 15 | throw new ArgumentNullException("processBootstrapper"); 16 | 17 | m_ProcessBootstrapper = processBootstrapper; 18 | } 19 | 20 | public IChildProcessHandle Create(string assemblyName, bool openDebugConsole, bool monitorHostProcess) 21 | { 22 | Process process = null; 23 | try 24 | { 25 | process = m_ProcessBootstrapper.StartProcess(assemblyName, m_RemotingId, openDebugConsole, monitorHostProcess); 26 | return new ChildProcessHandle(InitializeRemoting(), process); 27 | } 28 | catch 29 | { 30 | if (process != null) 31 | process.KillAndDispose(); 32 | 33 | throw; 34 | } 35 | } 36 | 37 | private ISafeChildProcessHandle InitializeRemoting() 38 | { 39 | Remoting.Remoting.RegisterChannels(false, m_RemotingId); 40 | 41 | return Remoting.Remoting.ConnectToService(m_RemotingId); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /RedGate.AppHost.Server/StartProcessWithJobSupport.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | namespace RedGate.AppHost.Server 5 | { 6 | internal class StartProcessWithJobSupport : IProcessStartOperation 7 | { 8 | private readonly IProcessStartOperation m_WrappedProcessStarter; 9 | 10 | public StartProcessWithJobSupport(IProcessStartOperation wrappedProcessStarter) 11 | { 12 | if (wrappedProcessStarter == null) 13 | throw new ArgumentNullException("wrappedProcessStarter"); 14 | 15 | m_WrappedProcessStarter = wrappedProcessStarter; 16 | } 17 | 18 | public Process StartProcess(string assemblyName, string remotingId, bool openDebugConsole, bool monitorHostProcess) 19 | { 20 | var process = m_WrappedProcessStarter.StartProcess(assemblyName, remotingId, openDebugConsole, monitorHostProcess); 21 | 22 | if (Job.CanAssignProcessToJobObject(process)) 23 | new Job().AssignProcessToJobObject(process); 24 | 25 | return process; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /RedGate.AppHost.Server/StartProcessWithTimeout.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Threading; 4 | 5 | namespace RedGate.AppHost.Server 6 | { 7 | internal class StartProcessWithTimeout : IProcessStartOperation 8 | { 9 | private readonly IProcessStartOperation m_WrappedProcessStarter; 10 | 11 | private static readonly TimeSpan s_TimeOut = TimeSpan.FromMinutes(2); 12 | 13 | public StartProcessWithTimeout(IProcessStartOperation wrappedProcessStarter) 14 | { 15 | if (wrappedProcessStarter == null) 16 | throw new ArgumentNullException("wrappedProcessStarter"); 17 | 18 | m_WrappedProcessStarter = wrappedProcessStarter; 19 | } 20 | 21 | public Process StartProcess(string assemblyName, string remotingId, bool openDebugConsole, bool monitorHostProcess) 22 | { 23 | using (var signal = new EventWaitHandle(false, EventResetMode.ManualReset, remotingId)) 24 | { 25 | var process = m_WrappedProcessStarter.StartProcess(assemblyName, remotingId, openDebugConsole, monitorHostProcess); 26 | WaitForReadySignal(signal); 27 | return process; 28 | } 29 | } 30 | 31 | private static void WaitForReadySignal(EventWaitHandle signal) 32 | { 33 | if (!signal.WaitOne(s_TimeOut)) 34 | throw new ApplicationException("WPF child process didn't respond quickly enough"); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /RedGate.AppHost.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.30501.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedGate.AppHost.Interfaces", "RedGate.AppHost.Interfaces\RedGate.AppHost.Interfaces.csproj", "{3084D987-50DD-43A5-9CF3-CE550513F8D0}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedGate.AppHost.Server", "RedGate.AppHost.Server\RedGate.AppHost.Server.csproj", "{DA6AC02A-EAA5-4C61-81BD-1BA3BB615C44}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedGate.AppHost.Remoting", "RedGate.AppHost.Remoting\RedGate.AppHost.Remoting.csproj", "{B26AA798-4734-434A-9875-7E9000ED24F5}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedGate.AppHost.Client", "RedGate.AppHost.Client\RedGate.AppHost.Client.csproj", "{99836D0F-4605-445C-8B4D-4BEF55963477}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedGate.AppHost.Example.Client", "RedGate.AppHost.Example.Client\RedGate.AppHost.Example.Client.csproj", "{01D94911-0A29-47FB-9691-10ABFD0B78AB}" 15 | EndProject 16 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Example", "Example", "{7B141F5F-D3EE-4D11-90A5-C65AD6F709B5}" 17 | EndProject 18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedGate.AppHost.Example.Server", "RedGate.AppHost.Example.Server\RedGate.AppHost.Example.Server.csproj", "{516C4CE3-F671-4E6A-A55D-952D08D3850E}" 19 | EndProject 20 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuSpec", "NuSpec", "{F17E9FBD-DD6E-4207-8C45-CFF4E643DDFD}" 21 | ProjectSection(SolutionItems) = preProject 22 | NuSpec\RedGate.AppHost.nuspec = NuSpec\RedGate.AppHost.nuspec 23 | EndProjectSection 24 | EndProject 25 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedGate.AppHost.Remoting.WPF", "RedGate.AppHost.Remoting.WPF\RedGate.AppHost.Remoting.WPF.csproj", "{24E71C6D-17CB-4D61-A092-EF1A37F7CD70}" 26 | EndProject 27 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedGate.AppHost.Example.Remote.Services", "RedGate.AppHost.Example.Remote.Services\RedGate.AppHost.Example.Remote.Services.csproj", "{EAFB4321-3E74-40D1-8369-D1667C374D9C}" 28 | EndProject 29 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedGate.AppHost.Client.x64", "RedGate.AppHost.Client\RedGate.AppHost.Client.x64.csproj", "{B9B7B458-D610-420E-89C5-96EBF49EFA01}" 30 | EndProject 31 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".SolutionItems", ".SolutionItems", "{9876CE58-F216-4DB8-9BD0-0079E5E5247C}" 32 | ProjectSection(SolutionItems) = preProject 33 | LICENSE.md = LICENSE.md 34 | README.md = README.md 35 | Install\RedGate.AppHost.wxs = Install\RedGate.AppHost.wxs 36 | EndProjectSection 37 | EndProject 38 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{7E97DF57-D9F8-4D87-AFA2-349057114EFC}" 39 | ProjectSection(SolutionItems) = preProject 40 | NuSpec\Build\RedGate.AppHost.targets = NuSpec\Build\RedGate.AppHost.targets 41 | EndProjectSection 42 | EndProject 43 | Global 44 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 45 | Debug|Any CPU = Debug|Any CPU 46 | Release|Any CPU = Release|Any CPU 47 | EndGlobalSection 48 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 49 | {3084D987-50DD-43A5-9CF3-CE550513F8D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 50 | {3084D987-50DD-43A5-9CF3-CE550513F8D0}.Debug|Any CPU.Build.0 = Debug|Any CPU 51 | {3084D987-50DD-43A5-9CF3-CE550513F8D0}.Release|Any CPU.ActiveCfg = Release|Any CPU 52 | {3084D987-50DD-43A5-9CF3-CE550513F8D0}.Release|Any CPU.Build.0 = Release|Any CPU 53 | {DA6AC02A-EAA5-4C61-81BD-1BA3BB615C44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 54 | {DA6AC02A-EAA5-4C61-81BD-1BA3BB615C44}.Debug|Any CPU.Build.0 = Debug|Any CPU 55 | {DA6AC02A-EAA5-4C61-81BD-1BA3BB615C44}.Release|Any CPU.ActiveCfg = Release|Any CPU 56 | {DA6AC02A-EAA5-4C61-81BD-1BA3BB615C44}.Release|Any CPU.Build.0 = Release|Any CPU 57 | {B26AA798-4734-434A-9875-7E9000ED24F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 58 | {B26AA798-4734-434A-9875-7E9000ED24F5}.Debug|Any CPU.Build.0 = Debug|Any CPU 59 | {B26AA798-4734-434A-9875-7E9000ED24F5}.Release|Any CPU.ActiveCfg = Release|Any CPU 60 | {B26AA798-4734-434A-9875-7E9000ED24F5}.Release|Any CPU.Build.0 = Release|Any CPU 61 | {99836D0F-4605-445C-8B4D-4BEF55963477}.Debug|Any CPU.ActiveCfg = Debug|x86 62 | {99836D0F-4605-445C-8B4D-4BEF55963477}.Debug|Any CPU.Build.0 = Debug|x86 63 | {99836D0F-4605-445C-8B4D-4BEF55963477}.Release|Any CPU.ActiveCfg = Release|x86 64 | {99836D0F-4605-445C-8B4D-4BEF55963477}.Release|Any CPU.Build.0 = Release|x86 65 | {01D94911-0A29-47FB-9691-10ABFD0B78AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 66 | {01D94911-0A29-47FB-9691-10ABFD0B78AB}.Debug|Any CPU.Build.0 = Debug|Any CPU 67 | {01D94911-0A29-47FB-9691-10ABFD0B78AB}.Release|Any CPU.ActiveCfg = Release|Any CPU 68 | {01D94911-0A29-47FB-9691-10ABFD0B78AB}.Release|Any CPU.Build.0 = Release|Any CPU 69 | {516C4CE3-F671-4E6A-A55D-952D08D3850E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 70 | {516C4CE3-F671-4E6A-A55D-952D08D3850E}.Debug|Any CPU.Build.0 = Debug|Any CPU 71 | {516C4CE3-F671-4E6A-A55D-952D08D3850E}.Release|Any CPU.ActiveCfg = Release|Any CPU 72 | {516C4CE3-F671-4E6A-A55D-952D08D3850E}.Release|Any CPU.Build.0 = Release|Any CPU 73 | {24E71C6D-17CB-4D61-A092-EF1A37F7CD70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 74 | {24E71C6D-17CB-4D61-A092-EF1A37F7CD70}.Debug|Any CPU.Build.0 = Debug|Any CPU 75 | {24E71C6D-17CB-4D61-A092-EF1A37F7CD70}.Release|Any CPU.ActiveCfg = Release|Any CPU 76 | {24E71C6D-17CB-4D61-A092-EF1A37F7CD70}.Release|Any CPU.Build.0 = Release|Any CPU 77 | {EAFB4321-3E74-40D1-8369-D1667C374D9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 78 | {EAFB4321-3E74-40D1-8369-D1667C374D9C}.Debug|Any CPU.Build.0 = Debug|Any CPU 79 | {EAFB4321-3E74-40D1-8369-D1667C374D9C}.Release|Any CPU.ActiveCfg = Release|Any CPU 80 | {EAFB4321-3E74-40D1-8369-D1667C374D9C}.Release|Any CPU.Build.0 = Release|Any CPU 81 | {B9B7B458-D610-420E-89C5-96EBF49EFA01}.Debug|Any CPU.ActiveCfg = Debug|x64 82 | {B9B7B458-D610-420E-89C5-96EBF49EFA01}.Debug|Any CPU.Build.0 = Debug|x64 83 | {B9B7B458-D610-420E-89C5-96EBF49EFA01}.Release|Any CPU.ActiveCfg = Release|x64 84 | {B9B7B458-D610-420E-89C5-96EBF49EFA01}.Release|Any CPU.Build.0 = Release|x64 85 | EndGlobalSection 86 | GlobalSection(SolutionProperties) = preSolution 87 | HideSolutionNode = FALSE 88 | EndGlobalSection 89 | GlobalSection(NestedProjects) = preSolution 90 | {01D94911-0A29-47FB-9691-10ABFD0B78AB} = {7B141F5F-D3EE-4D11-90A5-C65AD6F709B5} 91 | {516C4CE3-F671-4E6A-A55D-952D08D3850E} = {7B141F5F-D3EE-4D11-90A5-C65AD6F709B5} 92 | {EAFB4321-3E74-40D1-8369-D1667C374D9C} = {7B141F5F-D3EE-4D11-90A5-C65AD6F709B5} 93 | {7E97DF57-D9F8-4D87-AFA2-349057114EFC} = {F17E9FBD-DD6E-4207-8C45-CFF4E643DDFD} 94 | EndGlobalSection 95 | EndGlobal 96 | --------------------------------------------------------------------------------