void LoadAppDomain ()
		{
            var extensionPath = new FileInfo(typeof(ProtobuildDomainBehaviour).Assembly.Location).DirectoryName;
            var commonPath = string.Empty;
            for (var i = 0; i < AppDomain.CurrentDomain.BaseDirectory.Length; i++)
            {
                if (i >= extensionPath.Length)
                {
                    break;
                }

                if (AppDomain.CurrentDomain.BaseDirectory[i] == extensionPath[i])
                {
                    commonPath += extensionPath[i];
                }
            }

            var relToBaseApp = AppDomain.CurrentDomain.BaseDirectory.Substring(commonPath.Length);
            var relToExtensionPath = extensionPath.Substring(commonPath.Length);

			appDomain = AppDomain.CreateDomain(
				"Protobuild Executable", 
				null,
                commonPath,
                relToBaseApp + Path.PathSeparator + relToExtensionPath,
				true);

			// Modern versions of Protobuild pack their internal behaviour into
			// an LZMA compressed embedded resource, with the LZMA decompressor
			// as a class inside the Protobuild executable.

			domainBehaviour = (ProtobuildDomainBehaviour)
				appDomain.CreateInstanceAndUnwrap(
					typeof(ProtobuildDomainBehaviour).Assembly.FullName,
					typeof(ProtobuildDomainBehaviour).FullName);
			domainBehaviour.Init(protobuildPath);

		    HostPlatform = domainBehaviour.GetHostPlatform ();
		}
		public void UnloadAppDomain()
		{
			if (appDomain == null)
			{
				return;
			}

			domainBehaviour = null;
			AppDomain.Unload(appDomain);
			appDomain = null;
		}