Ejemplo n.º 1
0
        static void ConfigureSmartClient(EncompassConnectionOptions options)
        {
            // This tool is meant to be run in automated environments.
            // That means no picking your instance with the AppLauncher.
            // If you regularly connect to multiple environments and they are running different
            // Encompass versions, you're likely to encounter VersionMismatchExceptions.

            // To remedy, let's manipulate the registry in the same way that AppLauncher does
            var path = Assembly.GetExecutingAssembly().Location;
            var dir  = Path.GetDirectoryName(path).Replace('\\', '/');

            var keyName = Environment.Is64BitProcess ? @"SOFTWARE\WOW6432Node\Ellie Mae\SmartClient" : @"SOFTWARE\Ellie Mae\SmartClient";
            var scKey   = Registry.LocalMachine.OpenSubKey(keyName, writable: true) ??
                          throw new Exception("Could not locate SmartClient registry key. Is SmartClient installed?");
            var key = scKey.OpenSubKey(dir, writable: true) ?? scKey.CreateSubKey(dir, writable: true) ??
                      throw new Exception("Could not locate or create registry key for this application. Check permissions?");

            key.SetValue("AutoSignOn", "1", RegistryValueKind.String);
            key.SetValue("Credentials", GetCredentials(options.InstanceName), RegistryValueKind.String);
            key.SetValue("SmartClientIDs", options.InstanceName, RegistryValueKind.String);
            key.Close();

            // Now we can fire up the Ellie stuff
            new EllieMae.Encompass.Runtime.RuntimeServices().Initialize();
            StartEncompassSession(options);
        }
Ejemplo n.º 2
0
 // Must start the session in a different method because .NET can't bind ClientSession.dll
 // into the execution context *at all* until the Encompass runtime is initialized
 static void StartEncompassSession(EncompassConnectionOptions options)
 {
     EllieMae.EMLite.RemotingServices.Session.Start(
         $"https://{options.InstanceName}.ea.elliemae.net${options.InstanceName}",
         options.UserId,
         options.Password,
         "encompass-deploy"
         );
 }