public static IStyleGalleryItem FindStyleGalleryItem(string string_0, string string_1, string string_2, string string_3) { IStyleGalleryItem styleGalleryItem; IStyleGallery myStyleGallery; try { if (File.Exists(string_1)) { string lower = Path.GetExtension(string_1).ToLower(); if (lower == ".style") { myStyleGallery = new MyStyleGallery(); } else if (lower != ".serverstyle") { styleGalleryItem = null; return(styleGalleryItem); } else { myStyleGallery = new ServerStyleGallery(); for (int i = (myStyleGallery as IStyleGalleryStorage).FileCount - 1; i >= 0; i--) { if (Path.GetExtension((myStyleGallery as IStyleGalleryStorage).File[i]).ToLower() != ".serverstyle") { (myStyleGallery as IStyleGalleryStorage).RemoveFile( (myStyleGallery as IStyleGalleryStorage).File[i]); } } } (myStyleGallery as IStyleGalleryStorage).AddFile(string_1); IStyleGalleryItem styleGalleryItem1 = SymbolFind.FindStyleGalleryItem(string_0, myStyleGallery, string_1, string_2, string_3); myStyleGallery = null; GC.Collect(); styleGalleryItem = styleGalleryItem1; } else { styleGalleryItem = null; } } catch (Exception exception) { styleGalleryItem = null; } return(styleGalleryItem); }
private IMarkerSymbol GetMarkerSymbol() { IMarkerSymbol markerSymbol; IStyleGallery serverStyleGalleryClass = new ServerStyleGallery(); IMarkerSymbol item = null; bool flag = false; string str = string.Concat(Application.StartupPath, "\\Styles\\ESRI.ServerStyle"); if (!File.Exists(str)) { markerSymbol = null; } else { string str1 = str; serverStyleGalleryClass.Clear(); (serverStyleGalleryClass as IStyleGalleryStorage).AddFile(str1); IEnumStyleGalleryItem items = serverStyleGalleryClass.Items["Marker Symbols", str1, "Default"]; items.Reset(); IStyleGalleryItem styleGalleryItem = items.Next(); while (true) { if (styleGalleryItem == null) { break; } else if (styleGalleryItem.Name == "Star 5") { flag = true; break; } else { styleGalleryItem = items.Next(); } } if (flag) { item = (IMarkerSymbol)styleGalleryItem.Item; } item.Size = 19; markerSymbol = item; } return(markerSymbol); }
public ISymbol GetLineSymbol(out string sLineSymbolName) { List <string> list = new List <string>(); //this.method_1(list); IStyleGallery styleGallery = new ServerStyleGallery(); ISymbol result; foreach (string current in _config.StyleFiles) { styleGallery.Clear(); ((IStyleGalleryStorage)styleGallery).AddFile(current); IEnumStyleGalleryItem enumStyleGalleryItem = styleGallery.get_Items("Line Symbols", current, ""); enumStyleGalleryItem.Reset(); for (IStyleGalleryItem styleGalleryItem = enumStyleGalleryItem.Next(); styleGalleryItem != null; styleGalleryItem = enumStyleGalleryItem.Next()) { if (this.lineName == "") { sLineSymbolName = styleGalleryItem.Name; ISymbol symbol = (ISymbol)styleGalleryItem.Item; result = symbol; return(result); } if (styleGalleryItem.Name == this.lineName) { IRgbColor rgbColor = new RgbColor(); rgbColor.RGB = (this.lineColor); ((ILineSymbol)styleGalleryItem.Item).Color = (rgbColor); ((ILineSymbol)styleGalleryItem.Item).Width = (this.lineWidth); sLineSymbolName = styleGalleryItem.Name; ISymbol symbol = (ISymbol)styleGalleryItem.Item; result = symbol; return(result); } } } sLineSymbolName = ""; result = null; return(result); }