/// <summary> /// Initializes a new instance of the <see cref="ArasHttpConnection"/> class. /// </summary> /// <param name="service">The service.</param> /// <param name="innovatorServerUrl">The innovator server URL.</param> /// <param name="itemFactory">The item factory.</param> public ArasHttpConnection(HttpClient service, string innovatorServerUrl, IItemFactory itemFactory) { Service = service; this.Compression = CompressionType.none; AmlContext = new ElementFactory(_context, itemFactory); if (innovatorServerUrl.EndsWith("Server/InnovatorServer.aspx", StringComparison.OrdinalIgnoreCase)) { innovatorServerUrl = innovatorServerUrl.Substring(0, innovatorServerUrl.Length - 20); } else if (innovatorServerUrl.EndsWith("/Server", StringComparison.OrdinalIgnoreCase) || innovatorServerUrl.EndsWith("/Server/", StringComparison.OrdinalIgnoreCase)) { innovatorServerUrl += (innovatorServerUrl.EndsWith("/") ? "" : "/"); } else { innovatorServerUrl += (innovatorServerUrl.EndsWith("/") ? "" : "/") + "Server/"; } this.Url = new Uri(innovatorServerUrl); this._innovatorServerUrl = new Uri(this.Url, "InnovatorServer.aspx"); this._innovatorClientBin = new Uri(this.Url, "../Client/cbin/"); _vaultConn = new ArasVaultConnection(this, Service); }
public ArasHttpConnection(IHttpService service, string innovatorServerUrl) { _service = service; this.Compression = CompressionType.none; _factory = new ElementFactory(_context); if (innovatorServerUrl.EndsWith("Server/InnovatorServer.aspx", StringComparison.OrdinalIgnoreCase)) { innovatorServerUrl = innovatorServerUrl.Substring(0, innovatorServerUrl.Length - 20); } else if (innovatorServerUrl.EndsWith("/Server", StringComparison.OrdinalIgnoreCase) || innovatorServerUrl.EndsWith("/Server/", StringComparison.OrdinalIgnoreCase)) { innovatorServerUrl += (innovatorServerUrl.EndsWith("/") ? "" : "/"); } else { innovatorServerUrl += (innovatorServerUrl.EndsWith("/") ? "" : "/") + "Server/"; } this._innovatorServerBaseUrl = new Uri(innovatorServerUrl); this._innovatorServerUrl = new Uri(this._innovatorServerBaseUrl, "InnovatorServer.aspx"); this._innovatorClientBin = new Uri(this._innovatorServerBaseUrl, "../Client/cbin/"); _vaultConn = new ArasVaultConnection(this); }