/// <summary> /// 设置语言文件 /// </summary> /// <param name="langFile">文件名不含路径,但包含后缀名。</param> public static void SetLang(string langFile = "") { if (!String.IsNullOrWhiteSpace(langFile)) { LangHelper.langFile = langFile; } else { LangHelper.langFile = LangHelper.langDefaultFile; } if (dictionaryLangs == null) { dictionaryLangs = new System.Collections.Specialized.HybridDictionary(); } dictionaryLangs.Clear(); if (languages != null && languages.Count > 0) { var language = languages.FirstOrDefault(o => o.LanguageFile == langFile); if (language != null) { var culture = System.Globalization.CultureInfo.CreateSpecificCulture(language.ID); System.Threading.Thread.CurrentThread.CurrentCulture = culture; System.Threading.Thread.CurrentThread.CurrentUICulture = culture; } } }
// Источник исходного кода: https://www.codeproject.com/Articles/4544/Insert-Plain-Text-and-Images-into-RichTextBox-at-R // Insert Plain Text and Images into RichTextBox at Runtime /// <summary> /// Initializes the text colors, creates dictionaries for RTF colors and /// font families, and stores the horizontal and vertical resolution of /// the RichTextBox's graphics context. /// </summary> public RichTextBoxCustom() : base() { // Initialize default text and background colors textColor = RtfColor.Black; highlightColor = RtfColor.White; // Initialize the dictionary mapping color codes to definitions rtfColor = new System.Collections.Specialized.HybridDictionary(); rtfColor.Add(RtfColor.Aqua, RtfColorDef.Aqua); rtfColor.Add(RtfColor.Black, RtfColorDef.Black); rtfColor.Add(RtfColor.Blue, RtfColorDef.Blue); rtfColor.Add(RtfColor.Fuchsia, RtfColorDef.Fuchsia); rtfColor.Add(RtfColor.Gray, RtfColorDef.Gray); rtfColor.Add(RtfColor.Green, RtfColorDef.Green); rtfColor.Add(RtfColor.Lime, RtfColorDef.Lime); rtfColor.Add(RtfColor.Maroon, RtfColorDef.Maroon); rtfColor.Add(RtfColor.Navy, RtfColorDef.Navy); rtfColor.Add(RtfColor.Olive, RtfColorDef.Olive); rtfColor.Add(RtfColor.Purple, RtfColorDef.Purple); rtfColor.Add(RtfColor.Red, RtfColorDef.Red); rtfColor.Add(RtfColor.Silver, RtfColorDef.Silver); rtfColor.Add(RtfColor.Teal, RtfColorDef.Teal); rtfColor.Add(RtfColor.White, RtfColorDef.White); rtfColor.Add(RtfColor.Yellow, RtfColorDef.Yellow); // Initialize the dictionary mapping default Framework font families to // RTF font families rtfFontFamily = new System.Collections.Specialized.HybridDictionary(); rtfFontFamily.Add(FontFamily.GenericMonospace.Name, RtfFontFamilyDef.Modern); rtfFontFamily.Add(FontFamily.GenericSansSerif, RtfFontFamilyDef.Swiss); rtfFontFamily.Add(FontFamily.GenericSerif, RtfFontFamilyDef.Roman); rtfFontFamily.Add(FF_UNKNOWN, RtfFontFamilyDef.Unknown); }
public int ExecuteNonQuery(string ProcedureName, System.Collections.Specialized.HybridDictionary Parameters) { int success = -1; try { _cmd1 = new MySqlCommand(); _cmd1.CommandText = ProcedureName; _cmd1.CommandType = CommandType.StoredProcedure; foreach (System.Collections.DictionaryEntry Parameter in Parameters) { _cmd1.Parameters.AddWithValue(Parameter.Key.ToString(), Parameter.Value.ToString()); } _cmd1.Connection = conn; conn.Open(); success = _cmd1.ExecuteNonQuery(); } catch (Exception ex) { //success = -1; throw ex; } finally { if (conn.State != ConnectionState.Closed) { conn.Close(); } } return(success); }
public CSVBasedList( EU2.Install install, string csvHeaderLine, System.Type itemType, System.Collections.Specialized.HybridDictionary list ) : base(install) { this.list = new System.Collections.Specialized.HybridDictionary(); this.csvHeaderLine = csvHeaderLine; this.itemType = itemType; }
public DataSet ReturnDataset(string ProcedureName, System.Collections.Specialized.HybridDictionary Parameters) { DataSet Result = new DataSet("ResultTable"); try { _cmd1 = new MySqlCommand(); _cmd1.CommandText = ProcedureName; _cmd1.CommandType = CommandType.StoredProcedure; foreach (System.Collections.DictionaryEntry Parameter in Parameters) { _cmd1.Parameters.AddWithValue(Parameter.Key.ToString(), Parameter.Value.ToString()); } _cmd1.Connection = conn; conn.Open(); MySqlDataAdapter Adapter = new MySqlDataAdapter(_cmd1); Adapter.Fill(Result); } catch (Exception ex) { throw; } finally { if (conn.State != ConnectionState.Closed) { conn.Close(); } } return(Result); }
protected bool ResolveInitializers(ParseContext ec) { if (_initializer == null) { return(_dimensions.Any()); } // // We use this to store all the date values in the order in which we // will need to store them in the byte blob later // var arrayData = new List <Expression>(); var bounds = new System.Collections.Specialized.HybridDictionary(); if (_dimensions != null && _dimensions.Count != 0) { return(CheckIndices(ec, _initializer.Values, 0, true, _resolvedDimensions)); } if (!CheckIndices(ec, _initializer.Values, 0, false, _resolvedDimensions)) { return(false); } //UpdateIndices(); return(true); }
///<summary>Validator deligate checks that there are no duplicate entries.</summary> protected void CheckDuplicate(ValidatorAttribute Source, ValidatingSerializerEventArgs e) { bool IsValid = true; string key = String.Empty; System.Collections.Specialized.HybridDictionary CheckList = new System.Collections.Specialized.HybridDictionary(); foreach (InsuranceLineItem C in this) { key = C.ProductType.ToString() + " " + C.Policy + " " + C.RevenueType.ToString(); if (CheckList.Contains(key)) { IsValid = false; } else { CheckList.Add(key, C.RevenueType); } if (IsValid == false) { e.Error = new ErrorInfo(Source, "Duplicates"); } } }
/// <summary> /// 获取实例 /// </summary> /// <param name="ip"></param> /// <param name="port"></param> /// <returns></returns> public static UdpHost GetInstence(string ip = "127.0.0.1", int port = 12333) { if (udpHosts == null) { udpHosts = new System.Collections.Specialized.HybridDictionary(); } UdpHost udpHost = null; var key = ip + ":" + port; lock (udpHosts) { if (udpHosts.Contains(key)) { udpHost = udpHosts[key] as UdpHost; } } if (udpHost == null) { udpHost = new UdpHost(); udpHost.IP = ip; udpHost.Port = port; udpHost.Receive(); udpHost.Connection(); lock (udpHosts) { udpHosts.Add(key, udpHost); } } return(udpHost); }
// INSTRUCTIONS: // // 1. Create the following directories on your hard drive: // C:\gp // C:\gp\AirportsAndGolf // C:\gp\output // // 2. Copy the RunModel.xml file in this sample to C:\gp // // 3. Copy all of the shapefile sample data in the directory: // <your ArcGIS Developer Kit installation location>\Samples\data\AirportsAndGolf // to: // C:\gp\AirportsAndGolf // // 4. You must create a .NET Assembly from the custom model MY_CUSTOM_TOOLBOX.tbx // that is provided with this sample. To create the .NET Assembly do the following: // Right click on the project name in the Solution Explorer and choose 'Add ArcGIS Toolbox Reference...' // In the ArcGIS Toolbox Reference dialog that opens: // - For the Toolbox: Navigate to the MY_CUSTOM_TOOLBOX.tbx in this sample // - Accept the defaults for the 'Generated Assembly Name' and 'Generated Assembly Namespace' // - Specify the 'Generated Assembly Version' to be: 1.0.0.0 // - Uncheck the 'Sign the Generated Assembly' // - Click OK // // 5. You should now be able to compile this sample and run it. /// <summary> /// Main execution of our application /// </summary> /// <remarks></remarks> public static void RunTheApp() { // Give message prompting the user for input Console.WriteLine("Enter the full path/filename of the xml driver file for the application."); Console.WriteLine("Example: C:\\gp\\RunModel.xml"); Console.Write(">"); // Obtain the input from the user System.String xmlPathFile = Console.ReadLine(); // Let the user know something is happening Console.WriteLine("Processing..."); //Get all of the models parameters System.Collections.Specialized.HybridDictionary modelParametersHybridDictionary = ReadXMLConfigurationFile(xmlPathFile); // Run the model System.String modelProcessingResultsString = ExecuteCustomGeoprocessingFunction(modelParametersHybridDictionary); // Display the results to the user Console.WriteLine(modelProcessingResultsString); // Close the application after the users hits any key Console.ReadLine(); }
public AllObjectCollections( System.Collections.ArrayList prop0, System.Collections.IEnumerable prop1, System.Collections.ICollection prop2, System.Collections.IList prop3, System.Collections.Hashtable prop4, System.Collections.IDictionary prop5, System.Collections.Specialized.HybridDictionary prop6, System.Collections.Specialized.NameValueCollection prop7, System.Collections.BitArray prop8, System.Collections.Queue prop9, System.Collections.Stack prop10, System.Collections.SortedList prop11) { Prop0 = prop0; Prop1 = prop1; Prop2 = prop2; Prop3 = prop3; Prop4 = prop4; Prop5 = prop5; Prop6 = prop6; Prop7 = prop7; Prop8 = prop8; Prop9 = prop9; Prop10 = prop10; Prop11 = prop11; }
public HeaderInfo(System.Collections.Specialized.HybridDictionary headers) { this.TopLevelMediaType = new MimeTopLevelMediaType(); this.Enc = null; try { this.ContentType = MimeTools.parseHeaderFieldBody("Content-Type", headers["Content-Type"].ToString()); this.TopLevelMediaType = (MimeTopLevelMediaType)System.Enum.Parse(TopLevelMediaType.GetType(), this.ContentType["Content-Type"].Split('/')[0], true); this.Subtype = this.ContentType["Content-Type"].Split('/')[1]; this.Enc = MimeTools.parseCharSet(this.ContentType["charset"]); } catch (System.Exception) { this.Enc = default_encoding; this.ContentType = MimeTools.parseHeaderFieldBody("Content-Type", System.String.Concat("text/plain; charset=", this.Enc.BodyName)); this.TopLevelMediaType = MimeTopLevelMediaType.text; this.Subtype = "plain"; } if (this.Enc == null) { this.Enc = default_encoding; } // TODO: rework this try { this.ContentdisPosition = MimeTools.parseHeaderFieldBody("Content-Disposition", headers["Content-Disposition"].ToString()); } catch (System.Exception) { this.ContentdisPosition = new System.Collections.Specialized.StringDictionary(); } try { this.ContentLocation = MimeTools.parseHeaderFieldBody("Content-Location", headers["Content-Location"].ToString()); } catch (System.Exception) { this.ContentLocation = new System.Collections.Specialized.StringDictionary(); } }
internal MimeHeader(MimeMessageStream message, long startpoint) { this._startpoint = startpoint; this._message = message; if (this._startpoint == 0) { System.String line = this._message.ReadLine(); // Perhaps there is part of the POP3 response if (line != null && line.Length > 3 && line[0] == '+' && line[1] == 'O' && line[2] == 'K') { #if LOG if (log.IsDebugEnabled) { log.Debug("+OK present at top of the message"); } #endif this._startpoint = this._message.Position; } else { this._message.ReadLine_Undo(line); } } this._headers = new System.Collections.Specialized.HybridDictionary(2, true); this.Parse(); }
/// <summary> /// 获取实例 /// </summary> /// <param name="ip"></param> /// <param name="port"></param> /// <returns></returns> public static TcpHost GetInstence(string ip = "127.0.0.1", int port = 12333) { if (tcpHosts == null) { tcpHosts = new System.Collections.Specialized.HybridDictionary(); } TcpHost tcpHost = null; var key = ip + ":" + port; lock (tcpHosts) { if (tcpHosts.Contains(key)) { tcpHost = tcpHosts[key] as TcpHost; } } if (tcpHost == null) { tcpHost = new TcpHost(); tcpHost.IP = ip; tcpHost.Port = port; tcpHost.Connection(); lock (tcpHosts) { tcpHosts.Add(key, tcpHost); } } return(tcpHost); }
private void TestAvailableCultures() { availablecultures = new System.Collections.Specialized.HybridDictionary(); foreach (System.Globalization.CultureInfo item in System.Globalization.CultureInfo.GetCultures(System.Globalization.CultureTypes.AllCultures)) { if (!item.Equals(System.Globalization.CultureInfo.InvariantCulture) && !availablecultures.Contains(item.Name) && resources.GetResourceSet(item, true, false) != null) { availablecultures.Add(item.Name, item.EnglishName); } } }
public DictionaryService(IDictionary initialState) { if (initialState == null) { arguments = new System.Collections.Specialized.HybridDictionary(); } else { arguments = initialState; } }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); var settings = LogCategoryConfigSection.GetConfig(); if (settings == null) { throw new System.Configuration.ConfigurationErrorsException("未找到日志类别配置"); } var nodeGenerl = new DeluxeTreeNode("用户操作", "G") { Expanded = true }; var nodeAd = new DeluxeTreeNode("活动目录同步", "AD") { Expanded = true, NodeCloseImg = "../images/ad.png", NodeOpenImg = "../images/ad.png" }; var nodeAdReverse = new DeluxeTreeNode("活动目录反向同步", "RAD"); this.tree.Nodes.Add(nodeGenerl); this.tree.Nodes.Add(nodeAd); this.tree.Nodes.Add(nodeAdReverse); System.Collections.Specialized.HybridDictionary dic = new System.Collections.Specialized.HybridDictionary(); foreach (LogCategoryConfigurationElement item in settings.Categories) { var node = new DeluxeTreeNode(item.Title, nodeGenerl.Value + "." + item.Name); node.Expanded = false; nodeGenerl.Nodes.Add(node); dic.Add(item.Name, node); } var categoris = LogCategoryAdapter.Instance.LoadCategories(); foreach (var item in categoris) { if (dic.Contains(item.Category)) { var nodeParent = (DeluxeTreeNode)dic[item.Category]; var node = new DeluxeTreeNode(item.Description, nodeParent.Value + "." + item.OperationType); nodeParent.Nodes.Add(node); } } }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); var settings = LogCategoryConfigSection.GetConfig(); if (settings == null) throw new System.Configuration.ConfigurationErrorsException("未找到日志类别配置"); var nodeGenerl = new DeluxeTreeNode("用户操作", "G") { Expanded = true }; var nodeAd = new DeluxeTreeNode("活动目录同步", "AD") { Expanded = true, NodeCloseImg = "../images/ad.png", NodeOpenImg = "../images/ad.png" }; var nodeAdReverse = new DeluxeTreeNode("活动目录反向同步", "RAD"); this.tree.Nodes.Add(nodeGenerl); this.tree.Nodes.Add(nodeAd); this.tree.Nodes.Add(nodeAdReverse); System.Collections.Specialized.HybridDictionary dic = new System.Collections.Specialized.HybridDictionary(); foreach (LogCategoryConfigurationElement item in settings.Categories) { var node = new DeluxeTreeNode(item.Title, nodeGenerl.Value + "." + item.Name); node.Expanded = false; nodeGenerl.Nodes.Add(node); dic.Add(item.Name, node); } var categoris = LogCategoryAdapter.Instance.LoadCategories(); foreach (var item in categoris) { if (dic.Contains(item.Category)) { var nodeParent = (DeluxeTreeNode)dic[item.Category]; var node = new DeluxeTreeNode(item.Description, nodeParent.Value + "." + item.OperationType); nodeParent.Nodes.Add(node); } } }
static void Main(string[] args) { System.Collections.Specialized.HybridDictionary hybridDictionary = new System.Collections.Specialized.HybridDictionary(); hybridDictionary.Add("Test1", "Test@123"); hybridDictionary.Add("Admin", "Admin@123"); hybridDictionary.Add("Temp", "Temp@123"); hybridDictionary.Add("Demo", "Demo@123"); hybridDictionary.Add("Test2", "Test@123"); hybridDictionary.Add("Test4", "Test@123"); hybridDictionary.Add("Test3", "Test@123"); hybridDictionary.Add("Test5", "Test@123"); hybridDictionary.Add("Test12", "Test@123"); hybridDictionary.Add("Test6", "Test@123"); hybridDictionary.Add("Test7", "Test@123"); hybridDictionary.Add("Test8", "Test@123"); hybridDictionary.Add("Test9", "Test@123"); hybridDictionary.Add("Test10", "Test@123"); hybridDictionary.Add("Test11", "Test@123"); hybridDictionary.Remove("Admin"); if (hybridDictionary.Contains("Admin")) { Console.WriteLine("UserName already Esists"); } else { hybridDictionary.Add("Admin", "Admin@123"); Console.WriteLine("User added succesfully."); } // Copies the HybridDictionary to an array with DictionaryEntry elements. DictionaryEntry[] myArr = new DictionaryEntry[hybridDictionary.Count]; hybridDictionary.CopyTo(myArr, 0); // Displays the values in the array. Console.WriteLine("Displays the elements in the array:"); Console.WriteLine(" KEY VALUE"); for (int i = 0; i < myArr.Length; i++) { Console.WriteLine(" {0} {1}", myArr[i].Key, myArr[i].Value); } Console.WriteLine(); // Get a collection of the keys. Console.WriteLine("UserName" + ": " + "Password"); foreach (DictionaryEntry entry in hybridDictionary) { Console.WriteLine(entry.Key + ": " + entry.Value); } Console.ReadKey(); }
public void Reload() { list = new System.Collections.Specialized.HybridDictionary(); System.Xml.XmlDocument x = new System.Xml.XmlDocument(); if (!File.Exists(GetPathName())) { return; //Nothing to load } x.Load(GetPathName()); foreach (System.Xml.XmlNode node in x.SelectNodes("//Timer")) { if (node.Attributes["name"] == null) { continue; } string name = node.Attributes["name"].Value; if (name == null) { continue; } Timer timer = Create(name); foreach (System.Xml.XmlNode lap in node.SelectNodes("lap")) { string startText = (lap.Attributes["start"] != null) ? lap.Attributes["start"].Value : null; DateTime start = DateTime.Parse(startText, GetCulture()); string task = (lap.Attributes["task"] != null) ? lap.Attributes["task"].Value : null; if (lap.Attributes["end"] == null) { timer.AddFluent(start, task); } else { string endText = lap.Attributes["end"].Value; DateTime end = DateTime.Parse(endText, GetCulture()); timer.AddFluent(start, end, task); } } } foreach (System.Xml.XmlNode node in x.SelectNodes("//Group")) { Groups.Add(TimerGroup.Parse(node, this)); } }
internal MimeHeader(MimeMessageStream message, long startpoint) { this._startpoint = startpoint; this._message = message; if ( this._startpoint==0 ) { System.String line = this._message.ReadLine(); // Perhaps there is part of the POP3 response if ( line!=null && line.Length>3 && line[0]=='+' && line[1]=='O' && line[2]=='K' ) { #if LOG if ( log.IsDebugEnabled ) log.Debug ("+OK present at top of the message"); #endif this._startpoint = this._message.Position; } else this._message.ReadLine_Undo(line); } this._headers = new System.Collections.Specialized.HybridDictionary(2, true); this.Parse(); }
public DataTable Getdeployementdata(string Type) { DataTable Result = new DataTable(); try { System.Collections.Specialized.HybridDictionary Parameters = new System.Collections.Specialized.HybridDictionary(); Parameters.Add("typename", Type); Result = helper.ReturnDataTable("sp_getdeployementdetails", Parameters); } catch (Exception ex) { throw; } return(Result); }
public DataTable Getbuildversion(string component) { DataTable Result = new DataTable(); try { System.Collections.Specialized.HybridDictionary Parameters = new System.Collections.Specialized.HybridDictionary(); Parameters.Add("componentname", component); Result = helper.ReturnDataTable("sp_getbuildversionformapping", Parameters); } catch (Exception ex) { throw; } return(Result); }
public DataTable Getreleasedetails(string releaseno) { DataTable Result = new DataTable(); try { System.Collections.Specialized.HybridDictionary Parameters = new System.Collections.Specialized.HybridDictionary(); Parameters.Add("releasename", releaseno); Result = helper.ReturnDataTable("sp_getreleasedetails", Parameters); } catch (Exception ex) { throw; } return(Result); }
public DataTable GetUserinfo(string username, string password) { DataTable Result = new DataTable(); try { System.Collections.Specialized.HybridDictionary Parameters = new System.Collections.Specialized.HybridDictionary(); Parameters.Add("user", username); Parameters.Add("pwd", password); Result = helper.ReturnDataTable("sp_getuserinfo", Parameters); } catch (Exception ex) { throw; } return(Result); }
/// <summary> /// Parses the InnerMarkup as data nodes /// </summary> /// <returns></returns> protected System.Collections.Specialized.HybridDictionary ParseElementValues() { if (elementValuesParsed) { return(ElementValues); } elementValuesParsed = true; if (!IsParsed) { this.Parse(); } if (IsEmptyTag || !InnerMarkup.Contains("<")) { _elementValues = new System.Collections.Specialized.HybridDictionary(); return(ElementValues); } //TODO - Replace with brute force parser try { _elementValues = new System.Collections.Specialized.HybridDictionary(); XmlDocument doc = new XmlDocument(); doc.LoadXml(this.RawTag); XmlNode rootElement = doc.SelectSingleNode("/*"); for (int i = 0; i < rootElement.ChildNodes.Count; i++) { XmlNode node = rootElement.ChildNodes.Item(i); if (_elementValues.Contains(node.Name)) { _elementValues[node.Name] += node.InnerXml; } else { _elementValues.Add(node.Name, node.InnerXml); } } } catch { _elementValues = new System.Collections.Specialized.HybridDictionary(); return(ElementValues); } return(ElementValues); }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (string.IsNullOrEmpty(this.ObjectSchemaType) == false) { System.Collections.Specialized.HybridDictionary dic = Util.GetSchemaCatgoryDictionary(); if (dic.Contains(this.ObjectSchemaType)) { switch ((string)dic[this.ObjectSchemaType]) { case "Roles": case "Applications": case "Groups": this.Attributes["onclick"] = "return $pc.modalPopup(this);"; break; default: break; } if (string.IsNullOrEmpty(this.ObjectID) == false) { switch ((string)dic[this.ObjectSchemaType]) { case "Organizations": this.NavigateUrl = this.OUViewMode ? ("~/lists/OUExplorerView.aspx?ou=" + HttpUtility.UrlEncode(this.ObjectID)) : ("~/lists/OUExplorer.aspx?ou=" + HttpUtility.UrlEncode(this.ObjectID)); break; case "Roles": this.NavigateUrl = "~/lists/AppRoleMembers.aspx?role=" + HttpUtility.UrlEncode(this.ObjectID); break; case "Applications": this.NavigateUrl = "~/lists/AppRoles.aspx?app=" + HttpUtility.UrlEncode(this.ObjectID); break; case "Groups": this.NavigateUrl = "~/lists/GroupConstMembers.aspx?id=" + HttpUtility.UrlEncode(this.ObjectID); break; } } } } }
public int Addrelease(string releaseticketno, string username) { int Result = -1; try { System.Collections.Specialized.HybridDictionary Parameters = new System.Collections.Specialized.HybridDictionary(); Parameters.Add("releaseticketno", releaseticketno); Parameters.Add("username", username); Result = helper.ExecuteNonQuery("sp_addreleaseticket", Parameters); } catch (Exception ex) { throw; } return(Result); }
/// <summary> /// Read in the arguments from the .xml file that we be used to run our model /// </summary> /// <param name="xmlPathFile">The full path and filename of the .xml file. Example: "C:\gp\RunModel.xml"</param> /// <returns>A HybridDictionary that contains the arguments to run our model.</returns> /// <remarks></remarks> public static System.Collections.Specialized.HybridDictionary ReadXMLConfigurationFile(System.String xmlPathFile) { System.Collections.Specialized.HybridDictionary modelParametersHybridDictionary = new System.Collections.Specialized.HybridDictionary(); try { //Read the XML configuration file System.Xml.XmlDocument XMLdoc = new System.Xml.XmlDocument(); XMLdoc.Load(xmlPathFile); // MY_CUSTOM_TOOLBOX System.Xml.XmlNode xMY_CUSTOM_TOOLBOX = XMLdoc["MY_CUSTOM_TOOLBOX"]; // GolfFinder System.Xml.XmlNode xGolfFinder = xMY_CUSTOM_TOOLBOX["GolfFinder"]; // BufferDistance System.Xml.XmlNode xBufferDistance = xGolfFinder["BufferDistance"]; modelParametersHybridDictionary.Add("BufferDistance", xBufferDistance.InnerText); // Airports System.Xml.XmlNode xAirports = xGolfFinder["Airports"]; modelParametersHybridDictionary.Add("Airports", xAirports.InnerText); // Golf System.Xml.XmlNode xGolf = xGolfFinder["Golf"]; modelParametersHybridDictionary.Add("Golf", xGolf.InnerText); // AirportBuffer System.Xml.XmlNode xAirportBuffer = xGolfFinder["AirportBuffer"]; modelParametersHybridDictionary.Add("AirportBuffer", xAirportBuffer.InnerText); // GolfNearAirports System.Xml.XmlNode xGolfNearAirports = xGolfFinder["GolfNearAirports"]; modelParametersHybridDictionary.Add("GolfNearAirports", xGolfNearAirports.InnerText); return(modelParametersHybridDictionary); } catch (Exception ex) { //The XML read was unsuccessful. Return an empty HybridDictionary return(modelParametersHybridDictionary); } }
/// <summary> /// Run the Geoprocessing model /// </summary> /// <param name="modelParametersHybridDictionary">A HybridDictionary that contains all of the arguments to run the model</param> /// <returns>A message of how well the model executed</returns> /// <remarks></remarks> public static System.String ExecuteCustomGeoprocessingFunction(System.Collections.Specialized.HybridDictionary modelParametersHybridDictionary) { try { // Create a Geoprocessor object ESRI.ArcGIS.Geoprocessor.Geoprocessor gp = new ESRI.ArcGIS.Geoprocessor.Geoprocessor(); // Set the OverwriteOutput setting to True gp.OverwriteOutput = true; // Create a new instance of our custom model MYCUSTOMTOOLBOX.GolfFinder myModel = new MYCUSTOMTOOLBOX.GolfFinder(); // Set the custom models parameters. myModel.BufferDistance = modelParametersHybridDictionary["BufferDistance"]; myModel.AIRPORT = modelParametersHybridDictionary["Airports"]; myModel.GOLF = modelParametersHybridDictionary["Golf"]; myModel.AirportBuffer = modelParametersHybridDictionary["AirportBuffer"]; myModel.Golf_Courses_Near_Airports = modelParametersHybridDictionary["GolfNearAirports"]; // Execute the model and obtain the result from the run ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult geoProcessorResult = (ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult)gp.Execute(myModel, null); if (geoProcessorResult == null) { // We have an error running the model. // If the run fails a Nothing (VB.NET) or null (C#) is returned from the gp.Execute object sev = 2; string messages = gp.GetMessages(ref sev); return(messages); } else { // The model completed successfully return("Output successful. The shapefiles are locacted at: " + geoProcessorResult.ReturnValue.ToString()); } } catch (Exception ex) { // Catch any other errors return("Error running the model. Debug the application and test again."); } }
public TemplateDictionaryService(Dictionary <string, string> replacementDictionary) { this.replacementDictionary = replacementDictionary; this.arguments = new System.Collections.Specialized.HybridDictionary(); // Context parameters are processed first, so that replacement dictionary values // may replace them. if (VszWizard.ContextParams != null) { foreach (DictionaryEntry entry in VszWizard.ContextParams) { arguments[entry.Key] = entry.Value; } } foreach (KeyValuePair <String, String> keyValuePair in replacementDictionary) { string key = keyValuePair.Key.Substring(1, keyValuePair.Key.Length - 2); arguments[key] = keyValuePair.Value; } }
public DataTable Getbuildlogurl(string Type, string environment, string component, string version) { DataTable Result = new DataTable(); try { System.Collections.Specialized.HybridDictionary Parameters = new System.Collections.Specialized.HybridDictionary(); Parameters.Add("typename", Type); Parameters.Add("environmentname", environment); Parameters.Add("componentname", component); Parameters.Add("versionname", version); Result = helper.ReturnDataTable("sp_getdeployementdetails", Parameters); } catch (Exception ex) { throw; } return(Result); }
public static System.Collections.Specialized.HybridDictionary GetSchemaCatgoryDictionary() { System.Collections.Specialized.HybridDictionary dic = null; if (HttpContext.Current.Items.Contains(Util.TheDicKey) == false) { dic = new System.Collections.Specialized.HybridDictionary(); foreach (ObjectSchemaConfigurationElement schema in ObjectSchemaSettings.GetConfig().Schemas) { dic.Add(schema.Name, schema.Category); } HttpContext.Current.Items.Add(Util.TheDicKey, dic); } else { dic = (System.Collections.Specialized.HybridDictionary)HttpContext.Current.Items[Util.TheDicKey]; } return(dic); }
/// <summary> /// Sets a new attribute value /// </summary> /// <param name="name"></param> /// <param name="value"></param> public void SetAttribute(string name, string value) { if (string.IsNullOrEmpty(name)) { return; } if (name.IndexOf(' ') > -1) { name = name.Trim(); } if (null == _attributes) { _attributes = new System.Collections.Specialized.HybridDictionary(); _attributesCaseSensitive = new System.Collections.Specialized.HybridDictionary(); } string invariantName = name.ToLowerInvariant(); if (_attributes.Contains(invariantName)) { _attributes[invariantName] = value; } else { _attributes.Add(invariantName, value); } if (_attributesCaseSensitive.Contains(name)) { _attributesCaseSensitive[name] = value; } else { _attributesCaseSensitive.Add(name, value); } }
public FileSystemTemplateLoader(string locationRoot, Encoding encoding, bool raiseExceptionForEmptyTemplate) : base(locationRoot, raiseExceptionForEmptyTemplate) { if ((locationRoot == null) || (locationRoot.Trim().Length == 0)) { this.locationRoot = AppDomain.CurrentDomain.BaseDirectory; } this.encoding = encoding; fileSet = new HybridDictionary(true); }
private void TestAvailableCultures() { availablecultures = new System.Collections.Specialized.HybridDictionary(); foreach ( System.Globalization.CultureInfo item in System.Globalization.CultureInfo.GetCultures( System.Globalization.CultureTypes.AllCultures) ) { if ( !item.Equals(System.Globalization.CultureInfo.InvariantCulture) && !availablecultures.Contains(item.Name) && resources.GetResourceSet(item, true, false)!=null ) availablecultures.Add(item.Name, item.EnglishName); } }
public void testMapKeys() { StringTemplateGroup group = new StringTemplateGroup("test", typeof(AngleBracketTemplateLexer)); StringTemplate t = new StringTemplate(group, "<aMap.keys:{k|<k>:<aMap.(k)>}; separator=\", \">"); HybridDictionary map = new HybridDictionary(); map.Add("int", "0"); map.Add("float", "0.0"); t.SetAttribute("aMap", map); Assert.AreEqual("int:0, float:0.0", t.ToString()); }
public virtual void testLengthOpWithHybridDictionary() { StringTemplate e = new StringTemplate("$length(names)$"); e = e.GetInstanceOf(); IDictionary m = new HybridDictionary(); m.Add("Tom", "Tom"); m.Add("Sriram", "Sriram"); m.Add("Doug", "Doug"); e.SetAttribute("names", m); string expecting = "3"; Assert.AreEqual(expecting, e.ToString()); }
public virtual void testDumpHashtableAndHybridDictionary() { StringTemplate st = new StringTemplate("$items; separator=\",\"$"); IDictionary m = new Hashtable(); m["a"] = "1"; m["b"] = "2"; m["c"] = "3"; st.SetAttribute("items", m); string expecting = "1,2,3"; Assert.AreEqual(expecting, st.ToString()); st = st.GetInstanceOf(); IDictionary s = new HybridDictionary(); s.Add("1", "1"); s.Add("2", "2"); s.Add("3", "3"); st.SetAttribute("items", s); expecting = "1,2,3"; Assert.AreEqual(expecting, st.ToString()); }
public virtual void testApplyAnonymousTemplateToHashtableAndHybridDictionary() { StringTemplate st = new StringTemplate("$items:{<li>$it$</li>}$"); IDictionary m = new Hashtable(); m["a"] = "1"; m["b"] = "2"; m["c"] = "3"; st.SetAttribute("items", m); string expecting = "<li>1</li><li>2</li><li>3</li>"; Assert.AreEqual(expecting, st.ToString()); st = st.GetInstanceOf(); IDictionary s = new HybridDictionary(); s.Add("1", "1"); s.Add("2", "2"); s.Add("3", "3"); st.SetAttribute("items", s); expecting = "<li>1</li><li>2</li><li>3</li>"; Assert.AreEqual(expecting, st.ToString()); }
private void btnView_Click(object sender, System.EventArgs e) { frmSessionPlayback frmSP = new frmSessionPlayback(); if(lvSearchResults.SelectedItems[0].Tag is OCL.RecordingSession) { try { // if(PreviewPlayer.IsUMPlayer) // ((AxUMediaControlLib.AxUMediaPlayer)PreviewPlayer.Player).Stop(); // else ((AxWMPLib.AxWindowsMediaPlayer)PreviewPlayer.Player).Ctlcontrols.stop(); } catch(Exception Err) { string peek = Err.Message; } System.Collections.Specialized.HybridDictionary RecordingCollection = new System.Collections.Specialized.HybridDictionary(false); OCL.RecordingSession RS = (OCL.RecordingSession)lvSearchResults.SelectedItems[0].Tag; bool IsPresentation = RS.IsPresentation; frmSP.PreviewPlayer.Text = RS.Description; frmSP.RS = RS; int CamCount = 0; foreach(OCL.Recording R in RS.CurrentRecordings(LUser)) { OCL.VideoStorageServer VSS2 = R.CurrentVideoStorageServer; string sDirectory = @"\Data"; try { string[] checkPath = VSS2.FileStorageDirectory.Split(@"\".ToCharArray()); if(checkPath[0] == "") sDirectory = VSS2.FileStorageDirectory; else sDirectory = @"\" + VSS2.FileStorageDirectory; if(checkPath.Length > 1) { if(checkPath[checkPath.Length - 1] != @"") sDirectory += @"\"; } } catch(Exception Err) { String peekThisFunky = Err.Message; } string sURL = sLocalDrive + sDirectory + R.Description; OysterPlaybackControls.PlayListItem PLI = null; PreviewPlayer.CurrentPlayerType = OysterPlaybackControls.PlayerType.WindowMediaPlayer; // if(PreviewPlayer.IsUMPlayer) // { // PLI = new OysterPlaybackControls.PlayListItem(R.DisplayName,OysterPlaybackControls.PlaybackTransportType.TCP, // OysterPlaybackControls.PlaybackMediaType.File,sURL,VSS2.ControlAddress,VSS2.ControlPort); // } // else { PLI = new OysterPlaybackControls.PlayListItem(R.DisplayName,OysterPlaybackControls.PlaybackTransportType.WMPStream, OysterPlaybackControls.PlaybackMediaType.WMPFile,sURL,VSS2.ControlAddress,VSS2.ControlPort); } //frmSP.PreviewPlayer.PlayList.Add(PLI); /// IF CURRENT RECORDING IS THE DEFAULT CAMERA THEN SET THE PLAYLIST TO SHOW THIS RECORDING FIRST if(R.IsPrimaryCamera) { RecordingCollection.Add("Primary",PLI); //frmSP.PreviewPlayer.CurrentPlayListItem = frmSP.PreviewPlayer.PlayList.Count - 1; } else if(R.IsDesktopCapture) { RecordingCollection.Add("Presentation",PLI); //frmSP.psPlayer.Add(R.DisplayName,PLI,true); } else { RecordingCollection.Add("Camera" + CamCount.ToString(),PLI); CamCount++; //frmSP.psPlayer.Add(R.DisplayName,PLI,true); } } /////////////////////////////////////////////////////// /// Load appropriate PlayerWindows in the correct Order OysterPlaybackControls.PlayListItem StoredPLI = null; /// Primary Camera if((StoredPLI = RetrieveRecording(RecordingCollection,"Primary")) != null) { frmSP.PreviewPlayer.PlayList.Add(StoredPLI); } /// All Non-Primary Cameras for(int i=0;i<CamCount;i++) { if((StoredPLI = RetrieveRecording(RecordingCollection,"Camera" + i.ToString())) != null) { frmSP.PreviewPlayer.PlayList.Add(StoredPLI); if(!RS.IsPresentation) { frmSP.psPlayer.Add(StoredPLI.Name,StoredPLI,true); } } } /// Presentation Capture if((StoredPLI = RetrieveRecording(RecordingCollection,"Presentation")) != null) { frmSP.PreviewPlayer.PlayList.Add(StoredPLI); frmSP.psPlayer.Add(StoredPLI.Name,StoredPLI,true); } frmSP.PreviewPlayer.CurrentPlayListItem = 0; // /// IF CURRENT RECORDING IS THE DEFAULT CAMERA THEN SET THE PLAYLIST TO SHOW THIS RECORDING FIRST // if(R.IsPrimaryCamera) // { // frmSP.PreviewPlayer.CurrentPlayListItem = frmSP.PreviewPlayer.PlayList.Count - 1; // } // else if(R.IsDesktopCapture) // { // frmSP.psPlayer.Add(R.DisplayName,PLI,true); // } // else // { // frmSP.psPlayer.Add(R.DisplayName,PLI,true); // } } frmSP.lblRecordingIdentifier.Text = "1 of " + frmSP.PreviewPlayer.PlayList.Count.ToString(); lblRecordingIdentifier.Visible = true; frmSP.PreviewPlayer.OpenPlayList(); //this.Visible = false; frmSP.ShowDialog(this); this.Visible = true; frmSP.Dispose(); }
/// <summary> /// Validates syntax and existence of the given address and returns valid addresses. /// </summary> /// <param name="addresses">The collection to be filtered.</param> /// <param name="dnsServers">Name Servers to be used for MX records search.</param> /// <returns>A collection containing the valid addresses.</returns> public static AddressCollection Filter(AddressCollection addresses, ServerCollection dnsServers) { ActiveUp.Net.Mail.AddressCollection valids = new ActiveUp.Net.Mail.AddressCollection(); ActiveUp.Net.Mail.AddressCollection valids1 = new ActiveUp.Net.Mail.AddressCollection(); System.Collections.Specialized.HybridDictionary ads = new System.Collections.Specialized.HybridDictionary(); for (int i = 0; i < addresses.Count; i++) if (ActiveUp.Net.Mail.Validator.ValidateSyntax(addresses[i].Email)) valids.Add(addresses[i]); #if !PocketPC System.Array domains = System.Array.CreateInstance(typeof(string), new int[] { valids.Count }, new int[] { 0 }); System.Array adds = System.Array.CreateInstance(typeof(ActiveUp.Net.Mail.Address), new int[] { valids.Count }, new int[] { 0 }); #else System.Array domains = System.Array.CreateInstance(typeof(string), new int[] { valids.Count }); System.Array adds = System.Array.CreateInstance(typeof(ActiveUp.Net.Mail.Address), new int[] { valids.Count }); #endif for (int i = 0; i < valids.Count; i++) { domains.SetValue(valids[i].Email.Split('@')[1], i); adds.SetValue(valids[i], i); } System.Array.Sort(domains, adds, null); string currentDomain = ""; string address = ""; ActiveUp.Net.Mail.SmtpClient smtp = new ActiveUp.Net.Mail.SmtpClient(); bool isConnected = false; for (int i = 0; i < adds.Length; i++) { address = ((ActiveUp.Net.Mail.Address)adds.GetValue(i)).Email; if (((string)domains.GetValue(i)) == currentDomain) { if (!smtp.Verify(address)) { try { //smtp.MailFrom("postmaster@"+System.Net.Dns.GetHostName()); //smtp.MailFrom("postmaster@"+currentDomain); smtp.RcptTo(address); valids1.Add((ActiveUp.Net.Mail.Address)adds.GetValue(i)); } catch { } } else valids1.Add((ActiveUp.Net.Mail.Address)adds.GetValue(i)); } else { currentDomain = (string)domains.GetValue(i); try { if (isConnected == true) { isConnected = false; smtp.Disconnect(); smtp = new ActiveUp.Net.Mail.SmtpClient(); } smtp.Connect(ActiveUp.Net.Mail.Validator.GetMxRecords(currentDomain, dnsServers).GetPrefered().Exchange); isConnected = true; try { smtp.Ehlo(System.Net.Dns.GetHostName()); } catch { smtp.Helo(System.Net.Dns.GetHostName()); } if (!smtp.Verify(address)) { try { //smtp.MailFrom("postmaster@"+System.Net.Dns.GetHostName()); //smtp.MailFrom("*****@*****.**"); smtp.MailFrom("postmaster@" + currentDomain); smtp.RcptTo(address); valids1.Add((ActiveUp.Net.Mail.Address)adds.GetValue(i)); } catch { } } else valids1.Add((ActiveUp.Net.Mail.Address)adds.GetValue(i)); } catch { } } } if (isConnected == true) smtp.Disconnect(); return valids1; }
public static System.Collections.Specialized.HybridDictionary GetSchemaCatgoryDictionary() { System.Collections.Specialized.HybridDictionary dic = null; if (HttpContext.Current.Items.Contains(Util.TheDicKey) == false) { dic = new System.Collections.Specialized.HybridDictionary(); foreach (ObjectSchemaConfigurationElement schema in ObjectSchemaSettings.GetConfig().Schemas) { dic.Add(schema.Name, schema.Category); } HttpContext.Current.Items.Add(Util.TheDicKey, dic); } else { dic = (System.Collections.Specialized.HybridDictionary)HttpContext.Current.Items[Util.TheDicKey]; } return dic; }
/// <summary> /// Read in the arguments from the .xml file that we be used to run our model /// </summary> /// <param name="xmlPathFile">The full path and filename of the .xml file. Example: "C:\gp\RunModel.xml"</param> /// <returns>A HybridDictionary that contains the arguments to run our model.</returns> /// <remarks></remarks> public static System.Collections.Specialized.HybridDictionary ReadXMLConfigurationFile(System.String xmlPathFile) { System.Collections.Specialized.HybridDictionary modelParametersHybridDictionary = new System.Collections.Specialized.HybridDictionary(); try { //Read the XML configuration file System.Xml.XmlDocument XMLdoc = new System.Xml.XmlDocument(); XMLdoc.Load(xmlPathFile); // MY_CUSTOM_TOOLBOX System.Xml.XmlNode xMY_CUSTOM_TOOLBOX = XMLdoc["MY_CUSTOM_TOOLBOX"]; // GolfFinder System.Xml.XmlNode xGolfFinder = xMY_CUSTOM_TOOLBOX["GolfFinder"]; // BufferDistance System.Xml.XmlNode xBufferDistance = xGolfFinder["BufferDistance"]; modelParametersHybridDictionary.Add("BufferDistance", xBufferDistance.InnerText); // Airports System.Xml.XmlNode xAirports = xGolfFinder["Airports"]; modelParametersHybridDictionary.Add("Airports", xAirports.InnerText); // Golf System.Xml.XmlNode xGolf = xGolfFinder["Golf"]; modelParametersHybridDictionary.Add("Golf", xGolf.InnerText); // AirportBuffer System.Xml.XmlNode xAirportBuffer = xGolfFinder["AirportBuffer"]; modelParametersHybridDictionary.Add("AirportBuffer", xAirportBuffer.InnerText); // GolfNearAirports System.Xml.XmlNode xGolfNearAirports = xGolfFinder["GolfNearAirports"]; modelParametersHybridDictionary.Add("GolfNearAirports", xGolfNearAirports.InnerText); return modelParametersHybridDictionary; } catch (Exception ex) { //The XML read was unsuccessful. Return an empty HybridDictionary return modelParametersHybridDictionary; } }