private bool RefreshConnection(AGSConnection connection) { Mouse.OverrideCursor = Cursors.Wait; if (!connection.Refresh()) { Mouse.OverrideCursor = null; ErrorReport.ShowErrorMessage(connection.ErrorMessage); return(false); } Mouse.OverrideCursor = null; bool result; try { if (this.lbConnections.Items != null) { this.lbConnections.Items.Refresh(); } result = true; } catch { ErrorReport.ShowErrorMessage(AfaStrings.UnknownError); result = false; } return(result); }
private void RenameItem(TextBox tb) { try { AGSConnection aGSConnection = this.lbConnections.SelectedItem as AGSConnection; if (!(tb.Name == aGSConnection.Name)) { if (AGSConnection.NameAlreadyExists(tb.Text)) { int num = 1; string text = tb.Text; bool flag = true; string text2 = text; while (flag && num < 500) { text2 = string.Format("{0}{1}", text, num); flag = AGSConnection.NameAlreadyExists(text2); num++; } tb.Text = text2; } aGSConnection.RemoveFile(); aGSConnection.Name = tb.Text; aGSConnection.SaveToFile(); ListBoxItem listBoxItem = this.lbConnections.ItemContainerGenerator.ContainerFromItem(aGSConnection) as ListBoxItem; if (listBoxItem != null) { listBoxItem.ContentTemplate = (base.FindResource("ConnectionTemplate") as DataTemplate); } } } catch { } }
private void TextBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { TextBox textBox = sender as TextBox; if (string.IsNullOrEmpty(textBox.Text)) { return; } this.RenameItem(textBox); e.Handled = true; } if (e.Key == Key.Escape) { TextBox textBox2 = sender as TextBox; AGSConnection aGSConnection = this.lbConnections.SelectedItem as AGSConnection; textBox2.Text = aGSConnection.Name; ListBoxItem listBoxItem = this.lbConnections.ItemContainerGenerator.ContainerFromItem(aGSConnection) as ListBoxItem; if (listBoxItem != null) { listBoxItem.ContentTemplate = (base.FindResource("ConnectionTemplate") as DataTemplate); } e.Handled = true; } }
public void RefreshService() { if (!this.ParentServiceConnected) { AGSConnection.ReestablishConnection(this.ConnectionURL, this.ConnectionName, this.UserName); } if (!this.ReconnectService()) { Mouse.OverrideCursor = null; ErrorReport.ShowErrorMessage(AfaStrings.UnableToConnectService + this.Name); return; } if (!this.ParentDataset.ParentDocument.IsActive) { return; } Mouse.OverrideCursor = System.Windows.Input.Cursors.Wait; Editor editor = this.ParentDataset.ParentDocument.Editor; if (!this.RequestUpdateNow()) { editor.WriteMessage(AfaStrings.InvalidExtent); } if (!string.IsNullOrEmpty(this.ParentService.ErrorMessage)) { editor.WriteMessage(this.ParentService.ErrorMessage); } this.CancelRequests = false; Mouse.OverrideCursor = null; }
public object ESRI_GetConnections(ResultBuffer rb) { object result; try { if (!AGSConnection.bConnectionsLoaded) { AGSConnection.LoadConnections(); } if (App.Connections.Count > 0) { ResultBuffer resultBuffer = new ResultBuffer(); foreach (AGSConnection current in App.Connections) { resultBuffer.Add(new TypedValue(5005, current.Name)); } result = resultBuffer; } else { result = null; } } catch { result = null; } return(result); }
private void tbServerName_LostFocus(object sender, RoutedEventArgs e) { if (this.tbServerName.Text.Length != 0 && this.tbServerURL.Text.Length == 0) { string text = "http://" + this.tbServerName.Text + "/arcgis/services"; string text2 = this.ReplaceSpecialCharacters(this.tbServerName.Text); if (Uri.IsWellFormedUriString(text, UriKind.Absolute)) { this.tbServerURL.Text = text; } this.tbServerName.Text = text2; } try { if (AGSConnection.NameAlreadyExists(this.tbServerName.Text)) { int num = 1; string text3 = this.tbServerName.Text; string text4 = text3; bool flag = true; while (flag && num < 500) { text4 = string.Format("{0}{1}", text3, num); flag = AGSConnection.NameAlreadyExists(text4); num++; } this.tbServerName.Text = text4; } } catch { } }
protected override bool ReconnectService() { bool result; try { if (this.ParentService != null) { if (this.ParentService.IsValid) { result = true; } else { result = this.ParentService.Challenge(); } } else if (string.IsNullOrEmpty(base.ConnectionURL)) { result = false; } else { AGSConnection connection = AGSConnection.GetConnection(base.ConnectionURL, base.ConnectionName, base.UserName); if (connection != null) { if (!connection.ConnectionFailed) { if (connection.LoadConnectionProperties()) { this.ParentService = new AGSMapService(this.ServiceFullName, base.ConnectionURL, connection); result = this.ParentService.Challenge(); } else { this.ErrorMessage = connection.ErrorMessage; result = false; } } else { this.ErrorMessage = connection.ErrorMessage; result = false; } } else { this.ErrorMessage = AfaStrings.ErrorConnectingToServer; result = false; } } } catch { this.ErrorMessage = AfaStrings.ErrorConnectingToServer; result = false; } return(result); }
public AGSImageService(string name, AGSConnection parent) : base(name, parent) { base.Properties = new Dictionary <string, object>(); this.Fields = new Dictionary <string, AGSField>(); this.Version = parent.Version; this.RefreshProperties(); this.InitializeExportProperties(); }
private void mnu_Delete_Click(object sender, RoutedEventArgs e) { AGSConnection aGSConnection = this.lbConnections.SelectedItem as AGSConnection; aGSConnection.RemoveFile(); App.Connections.Remove(aGSConnection); this.lbConnections.Items.Refresh(); }
public AGSFolder(string name, string URL, AGSConnection parent) { this.Parent = parent; this.FullName = name; this.Name = name; this.URL = URL; this.Type = AGSType.AGSFolder; this.Children = new List <object>(); this.ErrMsg = ""; }
public AGSRasterService(string serviceFullName, AGSConnection parent) { base.Parent = parent; base.FullName = serviceFullName; base.Name = Path.GetFileName(base.FullName); base.Type = AGSType.AGSService; base.Properties = new Dictionary <string, object>(); base.Properties.Add("Name", base.FullName); base.Properties.Add("Server", base.Parent.URL); }
private void mnu_Rename_Click(object sender, RoutedEventArgs e) { AGSConnection item = this.lbConnections.SelectedItem as AGSConnection; ListBoxItem listBoxItem = this.lbConnections.ItemContainerGenerator.ContainerFromItem(item) as ListBoxItem; if (listBoxItem != null) { listBoxItem.Background = Brushes.White; listBoxItem.ContentTemplate = (base.FindResource("EditConnectionTemplate") as DataTemplate); } }
public SelectConnection() { SelectConnection.IsInitializing = true; if (!AGSConnection.bConnectionsLoaded) { AGSConnection.LoadConnections(); } SelectConnection.WindowOpen = true; this.InitializeComponent(); this.lbConnections.AddHandler(UIElement.MouseDownEvent, new MouseButtonEventHandler(this.ListBox_MouseDown), true); SelectConnection.IsInitializing = false; }
private bool PopulateConnection(AGSConnection connection) { if (!connection.LoadConnectionProperties()) { return(false); } if (!connection.FoldersLoaded) { connection.LoadChildren(); } return(connection.FoldersLoaded); }
private bool SelectService() { bool result; try { this.btnCancel.IsEnabled = false; this.btnNext.IsEnabled = false; base.IsEnabled = false; AGSConnection aGSConnection = this.lbConnections.SelectedItem as AGSConnection; if (aGSConnection.ConnectionFailed) { this.RefreshConnection(aGSConnection); } if (!aGSConnection.ConnectionFailed) { if (this.PopulateConnection(aGSConnection)) { base.Close(); SelectService selectService = new SelectService(aGSConnection); if (selectService.IsValid) { this.ClearProgressBar(); Application.ShowModelessWindow(selectService); base.Close(); result = true; return(result); } } else { this.btnCancel.IsEnabled = true; this.btnNext.IsEnabled = true; base.IsEnabled = true; SelectConnection.WindowOpen = false; string text = aGSConnection.ErrorMessage; if (string.IsNullOrEmpty(text)) { text = "Populating Connection failed"; } ErrorReport.ShowErrorMessage(text); aGSConnection.ErrorMessage = ""; } } result = false; } catch { result = false; } return(result); }
public object ESRI_TestConnection(ResultBuffer rb) { object result; try { TypedValue[] array = rb.AsArray(); if (array.Count <TypedValue>() < 1) { result = null; } else { TypedValue typedValue = array[0]; if (typedValue.TypeCode != 5005) { result = null; } else { string b = typedValue.Value.ToString(); if (!AGSConnection.bConnectionsLoaded) { AGSConnection.LoadConnections(); } if (App.Connections.Count > 0) { foreach (AGSConnection current in App.Connections) { if (string.Equals(current.Name, b, StringComparison.CurrentCultureIgnoreCase)) { if (current.Challenge(false)) { result = LspUtil.LispTrue; return(result); } result = null; return(result); } } } result = null; } } } catch { result = null; } return(result); }
public static AGSImageService BuildImageServiceFromURL(string Name, string URL) { AGSImageService aGSImageService = null; AGSImageService result; try { string text = AGSConnection.BuildConnectionURL(URL); if (string.IsNullOrEmpty(text)) { result = aGSImageService; } else { AGSConnection aGSConnection = AGSConnection.ReestablishConnection(text, null, ""); if (aGSConnection != null) { try { string name = AGSImageService.BuildFullNameFromURL(URL); if (string.IsNullOrEmpty(Name)) { Name = AGSImageService.BuildNameFromURL(URL); } aGSImageService = new AGSImageService(name, aGSConnection); aGSImageService.Name = Name; if (aGSImageService.IsValid) { result = aGSImageService; return(result); } result = null; return(result); } catch { result = null; return(result); } } result = null; } } catch { result = null; } return(result); }
public AGSGeometryServer(AGSConnection parent, string soapURL) : base("Geometry", parent) { base.ErrorMessage = ""; this._GeomServer = new Geometry_GeometryServer(); this._GeomServer.Proxy = WebRequest.DefaultWebProxy; this._GeomServer.Credentials = base.Parent.Credentials; if (this._GeomServer.Credentials == null) { this._GeomServer.UseDefaultCredentials = true; } if (string.IsNullOrEmpty(soapURL)) { throw new Exception("Invalid geometry server"); } this._GeomServer.Url = soapURL; parent.GeometryService = this; }
public static AGSGeometryServer GetSampleServer() { AGSGeometryServer result; try { if (AGSGeometryServer.SampleServer == null) { if (AGSGeometryServer.SampleServerConnection == null) { AGSGeometryServer.SampleServerConnection = new AGSConnection("Sample Geometry Server", "http://sampleserver3.arcgisonline.com/ArcGIS/services"); } AGSGeometryServer.SampleServer = new AGSGeometryServer(AGSGeometryServer.SampleServerConnection, "http://sampleserver3.arcgisonline.com/ArcGIS/services/Geometry/GeometryServer"); } result = AGSGeometryServer.SampleServer; } catch { result = null; } return(result); }
public GPService(string name, AGSConnection parent) : base(name, parent) { base.Properties.Add("Type", "Geoprocessing Server"); }
private void Next_Click(object sender, RoutedEventArgs e) { base.Visibility = Visibility.Collapsed; this.tbServerName.Text = AGSConnection.FixName(this.tbServerName.Text); AGSConnection aGSConnection = null; try { aGSConnection = new AGSConnection(this.tbServerName.Text, this.tbServerURL.Text); } catch { ErrorReport.ShowErrorMessage(AfaStrings.ErrorConnectingToServer); base.Visibility = Visibility.Visible; this.Succeeded = false; } if (aGSConnection != null && !aGSConnection.ConnectionFailed) { aGSConnection.UserName = this.tbUserName.Text; aGSConnection.Password = this.tbPassword.Password; Mouse.OverrideCursor = Cursors.Wait; if (!aGSConnection.LoadConnectionProperties()) { Mouse.OverrideCursor = null; ErrorReport.ShowErrorMessage(aGSConnection.ErrorMessage); base.Visibility = Visibility.Visible; this.Succeeded = false; return; } Mouse.OverrideCursor = null; base.Close(); Mouse.OverrideCursor = Cursors.Wait; if (!aGSConnection.LoadChildren()) { Mouse.OverrideCursor = null; string text = aGSConnection.ErrorMessage; if (string.IsNullOrEmpty(text)) { text = AfaStrings.ErrorConnectingToServer; } ErrorReport.ShowErrorMessage(text); return; } Mouse.OverrideCursor = null; if (aGSConnection.FoldersLoaded && !aGSConnection.ConnectionFailed) { this.Succeeded = true; aGSConnection.SaveToFile(); App.Connections.Add(aGSConnection); SelectService selectService = new SelectService(aGSConnection); if (selectService.IsValid) { Autodesk.AutoCAD.ApplicationServices.Core.Application.ShowModalWindow(selectService); if (selectService.DialogResult.HasValue) { bool arg_165_0 = selectService.DialogResult.Value; } } } } }
public object ESRI_Image_Get(ResultBuffer rb) { object result; try { string argument = LspUtil.GetArgument(rb, 0, null); MSCImageService mSCImageService = null; if (!string.IsNullOrEmpty(argument)) { mSCImageService = this.GetImageService(argument); } else { mSCImageService = AfaDocData.ActiveDocData.CurrentImageService; } if (mSCImageService == null) { result = null; } else { List <TypedValue> list = new List <TypedValue>(); list.Add(new TypedValue(5016, null)); if (mSCImageService.ExportOptions != null) { LspUtil.AppendDottedPair(ref list, 5005, "DYNAMIC", 5003, mSCImageService.ExportOptions.Dynamic); LspUtil.AppendDottedPair(ref list, 5005, "TRANSPARENCY", 5003, mSCImageService.ExportOptions.Transparency); try { if (mSCImageService.BoundaryExtent.IsValid()) { LspUtil.AppendDottedPair(ref list, "EXT", mSCImageService.BoundaryExtent); } } catch { } LspUtil.AppendDottedPair(ref list, 5005, "VISIBILE", 5003, mSCImageService.GetVisibility()); if (!string.IsNullOrEmpty(mSCImageService.ExportOptions.Format)) { LspUtil.AppendDottedPair(ref list, 5005, "FORMAT", 5005, mSCImageService.ExportOptions.Format); } if (!string.IsNullOrEmpty(mSCImageService.ConnectionURL)) { LspUtil.AppendDottedPair(ref list, 5005, "URL", 5005, mSCImageService.RestEndpoint); } if (!string.IsNullOrEmpty(mSCImageService.RestEndpoint)) { LspUtil.AppendDottedPair(ref list, 5005, "RESTURL", 5005, mSCImageService.RestEndpoint); } LspUtil.AppendDottedPair(ref list, "COMPRESSION", mSCImageService.ExportOptions.TransCompression); LspUtil.AppendDottedPair(ref list, "MOSAICMETHOD", mSCImageService.ExportOptions.MosaicMethod); LspUtil.AppendDottedPair(ref list, "MOSAICOPERATOR", mSCImageService.ExportOptions.MosaicOperator); LspUtil.AppendDottedPair(ref list, "MOSAICRULE", mSCImageService.ExportOptions.MosaicRule); LspUtil.AppendDottedPair(ref list, "ASCENDING", mSCImageService.ExportOptions.Ascending); LspUtil.AppendDottedPair(ref list, "BANDIDS", mSCImageService.ExportOptions.BandIds); LspUtil.AppendDottedPair(ref list, "INTERPOLATION", mSCImageService.ExportOptions.Interpolation); LspUtil.AppendDottedPair(ref list, "LOCKRASTERID", mSCImageService.ExportOptions.LockRasterID); LspUtil.AppendDottedPair(ref list, "NODATAVALUE", mSCImageService.ExportOptions.NoDataValue); LspUtil.AppendDottedPair(ref list, "ORDERBASEVALUE", mSCImageService.ExportOptions.OrderBaseValue); LspUtil.AppendDottedPair(ref list, "ORDERFIELD", mSCImageService.ExportOptions.OrderField); LspUtil.AppendDottedPair(ref list, "RENDERINGRULE", mSCImageService.ExportOptions.RenderingRule); LspUtil.AppendDottedPair(ref list, "PIXELTYPE", mSCImageService.ExportOptions.PixelType); LspUtil.AppendDottedPair(ref list, "QUALITY", mSCImageService.ExportOptions.Quality); } LspUtil.AppendDottedPair(ref list, 5005, "NAME", 5005, mSCImageService.Name); LspUtil.AppendDottedPair(ref list, 5005, "ENAME", 5006, mSCImageService.RasterObjectId); if (!string.IsNullOrEmpty(mSCImageService.ConnectionURL)) { LspUtil.AppendDottedPair(ref list, 5005, "URL", 5005, mSCImageService.ConnectionURL); } try { AGSConnection parent = mSCImageService.ParentService.Parent; if (!string.IsNullOrEmpty(parent.Name)) { LspUtil.AppendDottedPair(ref list, 5005, "CONNECTION_NAME", 5005, parent.Name); } } catch { } try { if (!string.IsNullOrEmpty(mSCImageService.CurrentFileName)) { LspUtil.AppendDottedPair(ref list, "CURRENTFILE", 5005, mSCImageService.CurrentFileName); } mSCImageService.ParentService.GetWKT(); if (mSCImageService.ParentService != null) { foreach (KeyValuePair <string, object> current in mSCImageService.ParentService.Properties) { try { LspUtil.AppendDottedPair(ref list, current.Key, current.Value); } catch { } } } } catch { } list.Add(new TypedValue(5017, null)); ResultBuffer resultBuffer = new ResultBuffer(list.ToArray()); result = resultBuffer; } } catch { result = null; } return(result); }
public object ESRI_Map_Get(ResultBuffer rb) { object result; try { string argument = LspUtil.GetArgument(rb, 0, null); MSCMapService mSCMapService = null; if (!string.IsNullOrEmpty(argument)) { mSCMapService = this.GetMapService(argument); } else { mSCMapService = AfaDocData.ActiveDocData.CurrentMapService; } if (mSCMapService == null) { result = null; } else { List <TypedValue> list = new List <TypedValue>(); list.Add(new TypedValue(5016, null)); if (mSCMapService.ExportOptions != null) { LspUtil.AppendDottedPair(ref list, 5005, "DYNAMIC", 5003, mSCMapService.ExportOptions.Dynamic); LspUtil.AppendDottedPair(ref list, 5005, "TRANSPARENCY", 5003, mSCMapService.ExportOptions.Transparency); try { if (mSCMapService.BoundaryExtent.IsValid()) { LspUtil.AppendDottedPair(ref list, "EXT", mSCMapService.BoundaryExtent); } } catch { } if (!string.IsNullOrEmpty(mSCMapService.ExportOptions.Format)) { LspUtil.AppendDottedPair(ref list, 5005, "FORMAT", 5005, mSCMapService.ExportOptions.Format); } } LspUtil.AppendDottedPair(ref list, 5005, "VISIBILE", 5003, mSCMapService.GetVisibility()); LspUtil.AppendDottedPair(ref list, 5005, "NAME", 5005, mSCMapService.Name); LspUtil.AppendDottedPair(ref list, 5005, "ENAME", 5006, mSCMapService.RasterObjectId); if (!string.IsNullOrEmpty(mSCMapService.ConnectionURL)) { LspUtil.AppendDottedPair(ref list, 5005, "URL", 5005, mSCMapService.ConnectionURL); } if (!string.IsNullOrEmpty(mSCMapService.RestEndpoint)) { LspUtil.AppendDottedPair(ref list, 5005, "RESTURL", 5005, mSCMapService.RestEndpoint); } try { AGSConnection parent = mSCMapService.ParentService.Parent; if (!string.IsNullOrEmpty(parent.Name)) { LspUtil.AppendDottedPair(ref list, 5005, "CONNECTION_NAME", 5005, parent.Name); } } catch { } try { if (!string.IsNullOrEmpty(mSCMapService.CurrentFileName)) { LspUtil.AppendDottedPair(ref list, "CURRENTFILE", 5005, mSCMapService.CurrentFileName); } mSCMapService.ParentService.GetWKT(); if (mSCMapService.ParentService != null) { foreach (KeyValuePair <string, object> current in mSCMapService.ParentService.Properties) { try { LspUtil.AppendDottedPair(ref list, current.Key, current.Value); } catch { } } } } catch { } list.Add(new TypedValue(5017, null)); ResultBuffer resultBuffer = new ResultBuffer(list.ToArray()); result = resultBuffer; } } catch { result = null; } return(result); }
public object ESRI_AddConnection(ResultBuffer rb) { object result; try { TypedValue[] array = rb.AsArray(); if (array.Count <TypedValue>() < 2) { result = null; } else { string text = null; string text2 = null; string text3 = null; string text4 = null; string text5 = null; string text6 = null; bool promptForCredentials = true; object obj = null; object obj2 = null; TypedValue[] array2 = array; for (int i = 0; i < array2.Length; i++) { TypedValue typedValue = array2[i]; if (typedValue.TypeCode == 5016) { obj = null; obj2 = null; } else if (typedValue.TypeCode == 5017) { obj = null; obj2 = null; } else if (typedValue.TypeCode == 5018) { if (obj != null && obj2 != null) { TypedValue typedValue2 = (TypedValue)obj; TypedValue typedValue3 = (TypedValue)obj2; string a = typedValue2.Value.ToString(); if (string.Equals(a, "Name", StringComparison.CurrentCultureIgnoreCase)) { text = typedValue3.Value.ToString(); } else if (string.Equals(a, "URL", StringComparison.CurrentCultureIgnoreCase)) { text2 = typedValue3.Value.ToString(); } else if (string.Equals(a, "tokenUser", StringComparison.CurrentCultureIgnoreCase)) { text3 = typedValue3.Value.ToString(); } else if (string.Equals(a, "tokenPassword", StringComparison.CurrentCultureIgnoreCase)) { text4 = typedValue3.Value.ToString(); } else if (string.Equals(a, "ServerUser", StringComparison.CurrentCultureIgnoreCase)) { text5 = typedValue3.Value.ToString(); } else if (string.Equals(a, "ServerPassword", StringComparison.CurrentCultureIgnoreCase)) { text6 = typedValue3.Value.ToString(); } else if (string.Equals(a, "PromptCredentials", StringComparison.CurrentCultureIgnoreCase)) { string a2 = typedValue3.Value.ToString(); if (string.Equals(a2, "No", StringComparison.CurrentCultureIgnoreCase)) { promptForCredentials = false; } } } obj2 = (obj = null); } else if (obj == null) { obj = typedValue; } else { obj2 = typedValue; } } if (string.IsNullOrEmpty(text)) { result = null; } else if (string.IsNullOrEmpty(text2)) { result = null; } else if (!Uri.IsWellFormedUriString(text2, UriKind.Absolute)) { result = null; } else { if (!AGSConnection.bConnectionsLoaded) { AGSConnection.LoadConnections(); } if (!string.IsNullOrEmpty(text2) && !Uri.IsWellFormedUriString(text2, UriKind.Absolute)) { result = null; } else { AGSConnection aGSConnection = new AGSConnection(text, text2); if (!string.IsNullOrEmpty(text3)) { aGSConnection.UserName = text3; } if (!string.IsNullOrEmpty(text4)) { aGSConnection.Password = text4; } if (!string.IsNullOrEmpty(text5)) { if (string.IsNullOrEmpty(text6)) { text6 = ""; } NetworkCredential credentials = new NetworkCredential(text5, text6); aGSConnection.Credentials = credentials; } aGSConnection.PromptForCredentials = promptForCredentials; if (!aGSConnection.LoadConnectionProperties()) { result = null; } else if (!aGSConnection.LoadChildren()) { result = null; } else { aGSConnection.PromptForCredentials = true; if (aGSConnection.FoldersLoaded) { aGSConnection.SaveToFile(); App.Connections.Add(aGSConnection); ResultBuffer resultBuffer = new ResultBuffer(); resultBuffer.Add(new TypedValue(5005, text)); result = this.ESRI_GetConnection(resultBuffer); } else { result = null; } } } } } } catch { result = null; } return(result); }
public object ESRI_UpdateConnection(ResultBuffer rb) { object result; try { TypedValue[] array = rb.AsArray(); if (array.Count <TypedValue>() < 1) { result = null; } else { string text = null; string text2 = null; string text3 = null; string text4 = null; string text5 = null; string text6 = null; object obj = null; object obj2 = null; TypedValue[] array2 = array; for (int i = 0; i < array2.Length; i++) { TypedValue typedValue = array2[i]; if (typedValue.TypeCode == 5016) { obj = null; obj2 = null; } else if (typedValue.TypeCode == 5017) { obj = null; obj2 = null; } else if (typedValue.TypeCode == 5018) { if (obj != null && obj2 != null) { string a = obj.ToString(); if (string.Equals(a, "Name", StringComparison.CurrentCultureIgnoreCase)) { text = obj2.ToString(); } else if (string.Equals(a, "URL", StringComparison.CurrentCultureIgnoreCase)) { text2 = obj2.ToString(); } else if (string.Equals(a, "tokenUser", StringComparison.CurrentCultureIgnoreCase)) { text3 = obj2.ToString(); } else if (string.Equals(a, "tokenPassword", StringComparison.CurrentCultureIgnoreCase)) { text4 = obj2.ToString(); } else if (string.Equals(a, "ServerUser", StringComparison.CurrentCultureIgnoreCase)) { text5 = obj2.ToString(); } else if (string.Equals(a, "ServerPassword", StringComparison.CurrentCultureIgnoreCase)) { text6 = obj2.ToString(); } } } else if (obj == null) { obj = typedValue; } else { obj2 = typedValue; } } if (string.IsNullOrEmpty(text)) { result = null; } else { if (!AGSConnection.bConnectionsLoaded) { AGSConnection.LoadConnections(); } if (App.Connections.Count > 0) { foreach (AGSConnection current in App.Connections) { if (string.Equals(current.Name, text, StringComparison.CurrentCultureIgnoreCase)) { if (!string.IsNullOrEmpty(text3)) { current.UserName = text3; } if (!string.IsNullOrEmpty(text4)) { current.Password = text4; } if (!string.IsNullOrEmpty(text5)) { if (string.IsNullOrEmpty(text6)) { text6 = ""; } NetworkCredential credentials = new NetworkCredential(text5, text6); current.Credentials = credentials; } if (!string.IsNullOrEmpty(text2) && Uri.IsWellFormedUriString(text2, UriKind.Absolute)) { current.SetURL(text2); } if (!current.LoadConnectionProperties()) { result = null; return(result); } current.SaveToFile(); ResultBuffer resultBuffer = new ResultBuffer(); resultBuffer.Add(new TypedValue(5005, text)); result = this.ESRI_GetConnection(resultBuffer); return(result); } } } result = null; } } } catch { result = null; } return(result); }
public object ESRI_SendWebRequest(ResultBuffer rb) { object result; try { TypedValue[] array = rb.AsArray(); if (array.Count <TypedValue>() < 2) { result = null; } else { string text = array[0].Value.ToString(); string text2 = array[1].Value.ToString(); if (string.IsNullOrEmpty(text)) { result = null; } else if (string.IsNullOrEmpty(text2)) { result = null; } else if (!Uri.IsWellFormedUriString(text2, UriKind.Absolute)) { result = null; } else { if (!AGSConnection.bConnectionsLoaded) { AGSConnection.LoadConnections(); } if (!string.IsNullOrEmpty(text2) && !Uri.IsWellFormedUriString(text2, UriKind.Absolute)) { result = null; } else { AGSConnection aGSConnection = null; foreach (AGSConnection current in App.Connections) { if (string.Equals(current.Name, text, StringComparison.CurrentCultureIgnoreCase)) { aGSConnection = current; } } if (aGSConnection == null) { result = null; } else if (!aGSConnection.LoadConnectionProperties()) { result = null; } else { try { string text3 = aGSConnection.MakeRequest(text2); if (string.IsNullOrEmpty(text3)) { if (!string.IsNullOrEmpty(aGSConnection.ErrorMessage)) { result = aGSConnection.ErrorMessage; } else { result = null; } } else { result = text3; } } catch { if (!string.IsNullOrEmpty(aGSConnection.ErrorMessage)) { result = aGSConnection.ErrorMessage; } else { result = null; } } } } } } } catch { result = null; } return(result); }
public object ESRI_GetConnection(ResultBuffer rb) { object result; try { TypedValue[] array = rb.AsArray(); if (array.Count <TypedValue>() < 1) { result = null; } else { TypedValue typedValue = array[0]; if (typedValue.TypeCode != 5005) { result = null; } else { string b = typedValue.Value.ToString(); if (!AGSConnection.bConnectionsLoaded) { AGSConnection.LoadConnections(); } if (App.Connections.Count > 0) { foreach (AGSConnection current in App.Connections) { if (string.Equals(current.Name, b, StringComparison.CurrentCultureIgnoreCase)) { List <TypedValue> list = new List <TypedValue>(); list.Add(new TypedValue(5016, null)); LspUtil.AppendDottedPair(ref list, 5005, "NAME", 5005, current.Name); LspUtil.AppendDottedPair(ref list, 5005, "URL", 5005, current.URL); if (!string.IsNullOrEmpty(current.Version)) { LspUtil.AppendDottedPair(ref list, 5005, "VERSION", 5005, current.Version.ToString()); } if (!string.IsNullOrEmpty(current.UserName)) { LspUtil.AppendDottedPair(ref list, 5005, "USER", 5005, current.UserName); } list.Add(new TypedValue(5017, null)); ResultBuffer resultBuffer = new ResultBuffer(list.ToArray()); result = resultBuffer; return(result); } } result = null; } else { result = null; } } } } catch { result = null; } return(result); }
private void mnu_Refresh_Click(object sender, RoutedEventArgs e) { AGSConnection connection = this.lbConnections.SelectedItem as AGSConnection; this.RefreshConnection(connection); }
public UpdateRasterImageTask(AGSConnection parent) { this.Parent = parent; this.UpdateForm = null; this.OutputSpatialReference = null; }
public AGSLocator(string name, string url) { this.Name = name; this.ErrorMessage = ""; if (string.IsNullOrEmpty(this.Name)) { this.IsVerified = false; this.ErrorMessage = AfaStrings.InvalidServerURL; return; } if (!Uri.IsWellFormedUriString(url, UriKind.Absolute)) { this.IsVerified = false; this.ErrorMessage = AfaStrings.InvalidServerURL; return; } this.URL = url; try { string[] separator = new string[] { "/rest/services" }; string[] array = url.Split(separator, StringSplitOptions.None); string text = array[0] + "/rest/services"; if (text.ToLower() == AGSLocator.ArcGISOnlineLocatorsURL) { if (AGSLocator.ArcGISOnlineLocatorConnection == null) { AGSLocator.ArcGISOnlineLocatorConnection = new AGSConnection("ArcGIS Online Locators", AGSLocator.ArcGISOnlineLocatorsURL); } this.ParentConnection = AGSLocator.ArcGISOnlineLocatorConnection; } else if (text.ToLower() == AGSLocator.ArcGISComLocatorsURL) { if (AGSLocator.ArcGISComLocatorConnection == null) { AGSLocator.ArcGISComLocatorConnection = new AGSConnection("ArcGIS.Com Locators", AGSLocator.ArcGISComLocatorsURL); } this.ParentConnection = AGSLocator.ArcGISComLocatorConnection; } else if (text.ToLower() == AGSLocator.ArcGISGeocoderURL) { if (AGSLocator.ArcGISGeocoderConnection == null) { AGSLocator.ArcGISGeocoderConnection = new AGSConnection("ArcGIS Geocoder", AGSLocator.ArcGISGeocoderURL); } } else { this.ParentConnection = AGSConnection.FindExistingConnection(text); if (this.ParentConnection == null) { try { this.ParentConnection = new AGSConnection(name + " Connection", text); if (this.ParentConnection == null) { this.IsVerified = false; this.ErrorMessage = AfaStrings.InvalidServerURL; return; } App.Connections.Add(this.ParentConnection); } catch { this.IsVerified = false; this.ErrorMessage = AfaStrings.InvalidServerURL; return; } } } } catch { this.IsVerified = false; this.ErrorMessage = AfaStrings.InvalidServerURL; return; } this.Properties = new Dictionary <string, string>(); if (!this.GetServerInfo()) { this.IsVerified = false; return; } this.IsVerified = true; }