public virtual string getLAChars() { StringBuilder la = new StringBuilder(); // copy buffer contents to array before looping thru contents (it's usually faster) char[] fastBuf = new char[queue.Count - markerOffset]; queue.CopyTo(fastBuf, markerOffset); la.Append(fastBuf); return(la.ToString()); }
public virtual string[] Validate() { System.Collections.ArrayList missingValues = new System.Collections.ArrayList(); if ((((bool)(System.Convert.ChangeType(this._validationDict["TableName"], typeof(bool)))) == false)) { missingValues.Add("TableName"); } if ((((bool)(System.Convert.ChangeType(this._validationDict["RowCount"], typeof(bool)))) == false)) { missingValues.Add("RowCount"); } if ((((bool)(System.Convert.ChangeType(this._validationDict["HasUpdateTrigger"], typeof(bool)))) == false)) { missingValues.Add("HasUpdateTrigger"); } if ((missingValues.Count > 0)) { string[] missingVals = new string[missingValues.Count]; missingValues.CopyTo(missingVals); return(missingVals); } else { return(null); } }
private System.String[] getDeclaredProfileIDs(Message theMessage) { Terser t = new Terser(theMessage); bool noMore = false; int c = 0; System.Collections.ArrayList declaredProfiles = new System.Collections.ArrayList(8); while (!noMore) { System.String path = "MSH-21(" + c++ + ")"; System.String idRep = t.get_Renamed(path); //FIXME fails if empty rep precedes full rep ... should add getAll() to Terser and use that if (idRep == null || idRep.Equals("")) { noMore = true; } else { declaredProfiles.Add(idRep); } } String[] retVal = new String[declaredProfiles.Count]; declaredProfiles.CopyTo(retVal); return(retVal); }
/// <include file='doc\FileDialog.uex' path='docs/doc[@for="FileDialog.GetMultiselectFiles"]/*' /> /// <devdoc> /// Extracts the filename(s) returned by the file dialog. /// </devdoc> private string[] GetMultiselectFiles(CharBuffer charBuffer) { string directory = charBuffer.GetString(); string fileName = charBuffer.GetString(); if (fileName.Length == 0) { return new string[] { directory } } ; if (directory[directory.Length - 1] != '\\') { directory = directory + "\\"; } ArrayList names = new ArrayList(); do { if (fileName[0] != '\\' && (fileName.Length <= 3 || fileName[1] != ':' || fileName[2] != '\\')) { fileName = directory + fileName; } names.Add(fileName); fileName = charBuffer.GetString(); } while (fileName.Length > 0); string[] temp = new string[names.Count]; names.CopyTo(temp, 0); return(temp); }
/// <summary> Given a string that contains HL7 messages, and possibly other junk, /// returns an array of the HL7 messages. /// An attempt is made to recognize segments even if there is other /// content between segments, for example if a log file logs segments /// individually with timestamps between them. /// /// </summary> /// <param name="theSource">a string containing HL7 messages /// </param> /// <returns> the HL7 messages contained in theSource /// </returns> private static System.String[] getHL7Messages(System.String theSource) { System.Collections.ArrayList messages = new System.Collections.ArrayList(20); Match startMatch = new Regex("^MSH", RegexOptions.Multiline).Match(theSource); foreach (Group group in startMatch.Groups) { System.String messageExtent = getMessageExtent(theSource.Substring(group.Index), "^MSH"); char fieldDelim = messageExtent[3]; Match segmentMatch = Regex.Match(messageExtent, "^[A-Z]{3}\\" + fieldDelim + ".*$", RegexOptions.Multiline); System.Text.StringBuilder msg = new System.Text.StringBuilder(); foreach (Group segGroup in segmentMatch.Groups) { msg.Append(segGroup.Value.Trim()); msg.Append('\r'); } messages.Add(msg.ToString()); } String[] retVal = new String[messages.Count]; messages.CopyTo(retVal); return retVal; }
public CreditBillItemDetails[] setArrayDetails(System.Data.DataTable dt) { System.Collections.ArrayList arrItems = new System.Collections.ArrayList(); CreditBillItemDetails Details = new CreditBillItemDetails(); foreach (System.Data.DataRow dr in dt.Rows) { Details = new CreditBillItemDetails(); Details.CreditBillDetailID = Int64.Parse(dr["CreditBillDetailID"].ToString()); Details.CreditBillHeaderID = Int64.Parse(dr["CreditBillHeaderID"].ToString()); Details.TransactionDate = DateTime.Parse(dr["TransactionDate"].ToString()); Details.Description = dr["Description"].ToString(); Details.Amount = decimal.Parse(dr["Amount"].ToString()); Details.TransactionTypeID = Int32.Parse(dr["TransactionTypeID"].ToString()); Details.TransactionRefID = Int64.Parse(dr["TransactionRefID"].ToString()); Details.TerminalNoRefID = dr["TerminalNoRefID"].ToString(); Details.BranchIDRefID = Int32.Parse(dr["BranchIDRefID"].ToString()); arrItems.Add(Details); } CreditBillItemDetails[] retDetails = new Data.CreditBillItemDetails[0]; if (arrItems.Count > 0) { retDetails = new Data.CreditBillItemDetails[arrItems.Count]; arrItems.CopyTo(retDetails); } return(retDetails); }
public virtual string[] Validate() { System.Collections.ArrayList missingValues = new System.Collections.ArrayList(); if ((((bool)(System.Convert.ChangeType(this._validationDict["ObjectName"], typeof(bool)))) == false)) { missingValues.Add("ObjectName"); } if ((((bool)(System.Convert.ChangeType(this._validationDict["ObjectType"], typeof(bool)))) == false)) { missingValues.Add("ObjectType"); } if ((((bool)(System.Convert.ChangeType(this._validationDict["CreateDate"], typeof(bool)))) == false)) { missingValues.Add("CreateDate"); } if ((((bool)(System.Convert.ChangeType(this._validationDict["AlteredDate"], typeof(bool)))) == false)) { missingValues.Add("AlteredDate"); } if ((((bool)(System.Convert.ChangeType(this._validationDict["SchemaOwner"], typeof(bool)))) == false)) { missingValues.Add("SchemaOwner"); } if ((missingValues.Count > 0)) { string[] missingVals = new string[missingValues.Count]; missingValues.CopyTo(missingVals); return(missingVals); } else { return(null); } }
/// <summary> /// Identifys and aranges all time codes in order for play back /// </summary> private Int64[] OrderTimeCodes() { Int64[] otc = new Int64[AudioEngineGlobalSettings.Tracks * AudioEngineGlobalSettings.TrackEvents]; System.Collections.ArrayList timeCodeList = new System.Collections.ArrayList(); for (int i = 0; i < _tracks.Length; i++) { if (_tracks[i] != null) { Int64[] orderTime = new Int64[AudioEngineGlobalSettings.TrackEvents]; orderTime = _tracks[i].GetEventTimeCodes(true, true); for (int q = 0; q < AudioEngineGlobalSettings.TrackEvents; q++) { // So that non negative (i.e. unasigned) time codes are not added to the list if (orderTime[q] >= 0) { timeCodeList.Add(orderTime[q]); } } } } // Sort the time codes in to assending order timeCodeList.Sort(); // Copy the time codes back to Int64[] timeCodeList.CopyTo(otc); return(otc); }
/// <summary> /// /// </summary> /// <param name="p_To">null if not used</param> /// <param name="p_Cc">null if not used</param> /// <param name="p_Bcc">null if not used</param> /// <param name="p_Subject">null if not used</param> /// <param name="p_Body">null if not used</param> /// <returns></returns> public static string FormatMailToCommand(string[] p_To, string[] p_Cc, string[] p_Bcc, string p_Subject, string p_Body) { string l_To = FormatEMailAddress(p_To); string l_CC = FormatEMailAddress(p_Cc); string l_Bcc = FormatEMailAddress(p_Bcc); string l_Command = "mailto:"; if (l_To!=null) l_Command+=l_To; System.Collections.ArrayList l_Parameters = new System.Collections.ArrayList(); if (l_CC!=null) l_Parameters.Add("CC="+l_CC); if (l_Bcc!=null) l_Parameters.Add("BCC="+l_Bcc); if (p_Subject!=null) l_Parameters.Add("subject="+p_Subject); if (p_Body!=null) l_Parameters.Add("body="+p_Body); if (l_Parameters.Count>0) { string[] l_tmp = new string[l_Parameters.Count]; l_Parameters.CopyTo(l_tmp,0); l_Command+="?"; l_Command+=string.Join("&",l_tmp); } return l_Command; }
protected static BO.Taxonomy.BOTaxon[] GetTaxonDescendants(BO.Taxonomy.BOTaxon Taxon, BO.Taxonomy.TaxonTypeEnum RequiredDescendant, CustomConditionTaxaDelegate CustomCondition) { System.Collections.ArrayList BadParents = new System.Collections.ArrayList(); BO.Taxonomy.BOTaxon[] Descendants = new BO.Taxonomy.BOTaxon [0]; BO.Taxonomy.BOTaxon Descendant = GetTaxonDescendant(Taxon, RequiredDescendant); //Get the parent of the found required type. BO.Taxonomy.BOTaxon DescendantParent = Descendant.GetParentTaxon(); bool DescendantsFound = false; while (DescendantParent != null & !DescendantsFound) { //Get the children of the parent. Descendants = DescendantParent.GetLowerTaxa(); if ((CustomCondition != null && CustomCondition(Descendants).Length == 0) & Descendants.Length == 0) { //This parent is no good so get another. BadParents.Add(DescendantParent); BO.Taxonomy.BOTaxon [] BadParentsArray = new BO.Taxonomy.BOTaxon [BadParents.Count]; BadParents.CopyTo(BadParentsArray); DescendantParent = GetTaxonDescendant(Taxon, DescendantParent.TaxonType, new CustomConditionDelegate(CustomConditionGetTaxonNotIn), BadParentsArray); } else { DescendantsFound = true; } } return(Descendants); }
/// <summary> /// Find all available Exporters in the Plugin Folder (everything with the Extension *.exporter.dll) /// </summary> static void LoadExporters() { string[] files = System.IO.Directory.GetFiles(Helper.SimPePluginPath, "*.exporter.dll"); System.Collections.ArrayList list = new System.Collections.ArrayList(); System.Collections.ArrayList imlist = new System.Collections.ArrayList(); foreach (string file in files) { object[] plugs = SimPe.LoadFileWrappers.LoadPlugins(file, typeof(SimPe.Plugin.Gmdc.IGmdcExporter)); foreach (IGmdcExporter p in plugs) { if (p.Version == 1) { list.Add(p); } } //foreach plugs = SimPe.LoadFileWrappers.LoadPlugins(file, typeof(SimPe.Plugin.Gmdc.IGmdcImporter)); foreach (IGmdcImporter p in plugs) { if (p.Version == 1) { imlist.Add(p); } } //foreach } exporters = new IGmdcExporter[list.Count]; list.CopyTo(exporters); importers = new IGmdcImporter[imlist.Count]; imlist.CopyTo(importers); }
public virtual string[] Validate() { System.Collections.ArrayList missingValues = new System.Collections.ArrayList(); if ((((bool)(System.Convert.ChangeType(this._validationDict["ColumnName"], typeof(bool)))) == false)) { missingValues.Add("ColumnName"); } if ((((bool)(System.Convert.ChangeType(this._validationDict["DataType"], typeof(bool)))) == false)) { missingValues.Add("DataType"); } if ((((bool)(System.Convert.ChangeType(this._validationDict["CharMaximum"], typeof(bool)))) == false)) { missingValues.Add("CharMaximum"); } if ((missingValues.Count > 0)) { string[] missingVals = new string[missingValues.Count]; missingValues.CopyTo(missingVals); return(missingVals); } else { return(null); } }
public virtual string[] Validate() { System.Collections.ArrayList missingValues = new System.Collections.ArrayList(); if ((((bool)(System.Convert.ChangeType(this._validationDict["BuildFileName"], typeof(bool)))) == false)) { missingValues.Add("BuildFileName"); } if ((((bool)(System.Convert.ChangeType(this._validationDict["ScriptCount"], typeof(bool)))) == false)) { missingValues.Add("ScriptCount"); } if ((((bool)(System.Convert.ChangeType(this._validationDict["CommitDate"], typeof(bool)))) == false)) { missingValues.Add("CommitDate"); } if ((((bool)(System.Convert.ChangeType(this._validationDict["Database"], typeof(bool)))) == false)) { missingValues.Add("Database"); } if ((missingValues.Count > 0)) { string[] missingVals = new string[missingValues.Count]; missingValues.CopyTo(missingVals); return(missingVals); } else { return(null); } }
public virtual string[] Validate() { System.Collections.ArrayList missingValues = new System.Collections.ArrayList(); if ((((bool)(System.Convert.ChangeType(this._validationDict["Connection"], typeof(bool)))) == false)) { missingValues.Add("Connection"); } if ((((bool)(System.Convert.ChangeType(this._validationDict["Transaction"], typeof(bool)))) == false)) { missingValues.Add("Transaction"); } if ((((bool)(System.Convert.ChangeType(this._validationDict["DatabaseName"], typeof(bool)))) == false)) { missingValues.Add("DatabaseName"); } if ((((bool)(System.Convert.ChangeType(this._validationDict["ServerName"], typeof(bool)))) == false)) { missingValues.Add("ServerName"); } if ((((bool)(System.Convert.ChangeType(this._validationDict["HasLoggingTable"], typeof(bool)))) == false)) { missingValues.Add("HasLoggingTable"); } if ((missingValues.Count > 0)) { string[] missingVals = new string[missingValues.Count]; missingValues.CopyTo(missingVals); return(missingVals); } else { return(null); } }
/// <summary> /// Returns an array of all active events, ordered in time code, from all Tracks /// </summary> /// <returns>All active ordered Events</returns> private Events[] GetOrderedEvents() { Events[] OrderedEventCollection = new Events[AudioEngineGlobalSettings.Tracks * AudioEngineGlobalSettings.TrackEvents]; System.Collections.ArrayList theEvents = new System.Collections.ArrayList(); for (int i = 0; i < _tracks.Length; i++) { if (_tracks[i] != null) { Events[] EventCollection = new Events[AudioEngineGlobalSettings.TrackEvents]; EventCollection = _tracks[i].GetEvents(true); for (int q = 0; q < AudioEngineGlobalSettings.TrackEvents; q++) { // So that non negative (i.e. unasigned) time codes are not added to the list if (EventCollection[q] != null) { theEvents.Add(EventCollection[q]); } } } } // Sort the time codes in to assending order theEvents.Sort(); // Copy the time codes back to Int64[] theEvents.CopyTo(OrderedEventCollection); return(OrderedEventCollection); }
/// <summary> Given a string that contains HL7 messages, and possibly other junk, /// returns an array of the HL7 messages. /// An attempt is made to recognize segments even if there is other /// content between segments, for example if a log file logs segments /// individually with timestamps between them. /// /// </summary> /// <param name="theSource">a string containing HL7 messages /// </param> /// <returns> the HL7 messages contained in theSource /// </returns> public static System.String[] getHL7Messages(System.String theSource) { System.Collections.ArrayList messages = new System.Collections.ArrayList(20); Match m = Regex.Match(theSource, "^MSH", RegexOptions.Multiline); foreach (Group g in m.Groups) { String messageExtent = getMessageExtent(theSource.Substring(g.Index), "^MSH"); char fieldDelim = messageExtent[3]; Match segmatch = new Regex("^[A-Z\\d]{3}\\" + fieldDelim + ".*$", RegexOptions.Multiline).Match(messageExtent); System.Text.StringBuilder msg = new System.Text.StringBuilder(); foreach (Group group in segmatch.Groups) { msg.Append(g.Value.Trim()); msg.Append('\r'); } messages.Add(msg.ToString()); } String[] retVal = new String[messages.Count]; messages.CopyTo(retVal); return(retVal); }
/// <summary> /// 格納されているデータを先読みする。 /// </summary> /// <param name="buffer"> /// null を指定した場合、要素数が count の配列が作成されます。 offset は無視されます。 /// 読み込んだ情報を格納するのに領域が狭すぎる時は、延長します。 /// </param> /// <param name="offset">負の値が指定された場合、0 と解釈します。</param> /// <param name="count">負の値が指定された場合何もしません。</param> /// <returns> /// 読み取る事の出来た byte 数を返す。 /// 要求されたとおり読み取る事が出来たかは、 /// <code>count==MyBytes.PreRead(buffer,offset,count)</code> /// などで確かめる事が出来る。 /// </returns> public int PreRead(byte[] buffer, int offset, int count) { if (count <= 0) { return(0); } if (buffer == null) { buffer = new byte[count]; offset = 0; } if (offset < 0) { offset = 0; } if (buffer.Length < offset + count) { byte[] na = new byte[offset + count]; buffer.CopyTo(na, 0); buffer = na; } this.Flush(); int i = 0; for (; i < count; i++) { buffer[offset + i] = this.data[this.position + i]; if (this.position == this.data.Length) { return(i + 1); } } return(i); }
/// <summary> /// Get only the points where issues were found /// If the captured image is smaller than the expected image, throw an exception and refuse to compare them. /// Otherwise, compare the expected image with the matching region (the upper left corner) of the rendered image. /// We'll do the comparison by x,y coordinates and not pointer math (ie: y*width +x) to ensure correct matching. /// </summary> /// <returns>Array of points where failures ocurred</returns> public static Point[] GetPointsWithFailures(Color[,] captured, RenderBuffer expected) { //we'll do the comparison by x,y coordinates and not pointer math (ie: y*width +x) to ensure correct matching. if (expected.Width > captured.GetLength(0) || expected.Height > captured.GetLength(1)) { throw new ApplicationException(exceptionCapturedRenderedEqual); } System.Collections.ArrayList failures = new System.Collections.ArrayList(); Point[] failPoints; for (int y = 0; y < expected.Height; y++) { for (int x = 0; x < expected.Width; x++) { if (!ColorOperations.AreWithinTolerance( captured[x, y], expected.FrameBuffer[x, y], expected.ToleranceBuffer[x, y])) { failures.Add(new Point(x, y)); } } } // Always return an array, even an empty one failPoints = new Point[failures.Count]; if (failures.Count != 0) { failures.CopyTo(failPoints); } return(failPoints); }
/// <summary>Returns the HL7 exceptions in the given arraylist in an array </summary> private NuGenHL7Exception[] toArray(System.Collections.ArrayList list) { NuGenHL7Exception[] retVal = new NuGenHL7Exception[list.Count]; list.CopyTo(retVal); return(retVal); }
public void SetBrushPoints(System.Collections.ArrayList pointList) { if (pointList.Count > 0) { this.Points = new Point[pointList.Count]; pointList.CopyTo(this.Points); } }
/// <summary> Creates a ROIScaler object. The Quantizer is the source of data to /// scale. /// /// <p>The ROI Scaler creates a ROIMaskGenerator depending on what ROI /// information is in the ParameterList. If only rectangular ROI are used, /// the fast mask generator for rectangular ROI can be used.</p> /// /// </summary> /// <param name="src">The source of data to scale /// /// </param> /// <param name="pl">The parameter list (or options). /// /// </param> /// <param name="encSpec">The encoder specifications for addition of roi specs /// /// </param> /// <exception cref="IllegalArgumentException">If an error occurs while parsing /// the options in 'pl' /// /// </exception> public static ROIScaler createInstance(Quantizer src, ParameterList pl, EncoderSpecs encSpec) { System.Collections.ArrayList roiVector = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10)); ROIMaskGenerator maskGen = null; // Check parameters pl.checkList(OPT_PREFIX, CSJ2K.j2k.util.ParameterList.toNameArray(pinfo)); // Get parameters and check if there are and ROIs specified System.String roiopt = pl.getParameter("Rroi"); if (roiopt == null) { // No ROIs specified! Create ROIScaler with no mask generator return(new ROIScaler(src, null, false, -1, false, encSpec)); } // Check if the lowest resolution levels should belong to the ROI int sLev = pl.getIntParameter("Rstart_level"); // Check if the ROIs are block-aligned bool useBlockAligned = pl.getBooleanParameter("Ralign"); // Check if generic mask generation is specified bool onlyRect = !pl.getBooleanParameter("Rno_rect"); // Parse the ROIs parseROIs(roiopt, src.NumComps, roiVector); ROI[] roiArray = new ROI[roiVector.Count]; roiVector.CopyTo(roiArray); // If onlyRect has been forced, check if there are any non-rectangular // ROIs specified. Currently, only the presence of circular ROIs will // make this false if (onlyRect) { for (int i = roiArray.Length - 1; i >= 0; i--) { if (!roiArray[i].rect) { onlyRect = false; break; } } } if (onlyRect) { // It's possible to use the fast ROI mask generation when only // rectangular ROIs are specified. maskGen = new RectROIMaskGenerator(roiArray, src.NumComps); } else { // It's necessary to use the generic mask generation maskGen = new ArbROIMaskGenerator(roiArray, src.NumComps, src); } return(new ROIScaler(src, maskGen, true, sLev, useBlockAligned, encSpec)); }
public void CopyTo(Array array, int index) { System.Collections.IList nonGenericList = new System.Collections.ArrayList(); foreach (ENTITY entity in _selectedList) { nonGenericList.Add(entity); } nonGenericList.CopyTo(array, index); }
PropertyDescriptorCollection ITypedList.GetItemProperties(System.ComponentModel.PropertyDescriptor[] listAccessors) { System.Collections.ArrayList descriptors = new System.Collections.ArrayList(); descriptors.Add(new PropertyDescriptor("Name")); descriptors.Add(new PropertyDescriptor("Address")); descriptors.Add(new PropertyDescriptor("Address_City")); System.ComponentModel.PropertyDescriptor[] propertyDescriptors = new System.ComponentModel.PropertyDescriptor[descriptors.Count]; descriptors.CopyTo(propertyDescriptors, 0); return(new PropertyDescriptorCollection(propertyDescriptors)); }
void System.Collections.ICollection.CopyTo(System.Array AnyArray, int Index) { Validate(); if (AnyArray == null) { return; } try { Buffer.CopyTo(AnyArray, Index); } catch (System.Exception Excpt) { Err.Add(Excpt); } }
/// <summary> /// 绑定无限级下拉框 /// </summary> /// <param name="ddlst">下拉控件</param> /// <param name="dt">数据表</param> /// <param name="id">值ID</param> /// <param name="parentid">父节点ID</param> /// <param name="name">文本</param> public static void CreateLevelDropDown(System.Web.UI.WebControls.ListBox lib, DataTable dt, string id, string parentid, string name, string pVal) { System.Collections.ArrayList allItems = new System.Collections.ArrayList(); DataRow[] rows = dt.Select(parentid + "=" + pVal); foreach (DataRow row in rows) { CreateLevelDropDownAssistant(dt, ref allItems, row, string.Empty, id, parentid, name); } System.Web.UI.WebControls.ListItem[] items = new System.Web.UI.WebControls.ListItem[allItems.Count]; allItems.CopyTo(items); lib.Items.AddRange(items); }
/// <summary> /// Split string according the dilimer, this function is equea to /// String.Split(char[], StringSplitOptions.RemoveEmptyEntries) /// which is not supported by .net cf /// </summary> /// <param name="splitStr"></param> /// <returns></returns> public static string[] SplitString(string str, char[] separator) { string[] splitStr = str.Split(separator); System.Collections.ArrayList list = new System.Collections.ArrayList(); for (int i = 0; i < splitStr.Length; i++) { if (splitStr[i] != string.Empty && splitStr[i] != null) { list.Add(splitStr[i]); } } splitStr = new string[list.Count]; list.CopyTo(splitStr); return(splitStr); }
/// <summary>Return all HDUs for the Fits object. If the /// FITS file is associated with an external stream make /// sure that we have exhausted the stream.</summary> /// <returns> an array of all HDUs in the Fits object. Returns /// null if there are no HDUs associated with this object. /// </returns> public virtual BasicHDU[] Read() { ReadToEnd(); int size = NumberOfHDUs; if (size == 0) { return(null); } BasicHDU[] hdus = new BasicHDU[size]; hduList.CopyTo(hdus); return(hdus); }
/// <summary> /// The interception of the specified string length and transfers for an array of characters , spaces are ignored /// </summary> /// <param name="strValue"></param> /// <param name="nLength"></param> /// <returns></returns> public static string[] StringToStringArray(string strValue, int nLength) { string[] strAryResult = null; if (!string.IsNullOrEmpty(strValue)) { System.Collections.ArrayList strListResult = new System.Collections.ArrayList(); string strTemp = string.Empty; int nTemp = 0; for (int nloop = 0; nloop < strValue.Length; nloop++) { if (strValue[nloop] == ' ') { continue; } else { nTemp++; //Check character is taken in A ~ F, 0 ~ 9 range, is not directly exit System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(@"^(([A-F])*(\d)*)$"); if (!reg.IsMatch(strValue.Substring(nloop, 1))) { return(strAryResult); } strTemp += strValue.Substring(nloop, 1); //To determine whether the length of the interception arrival if ((nTemp == nLength) || (nloop == strValue.Length - 1 && !string.IsNullOrEmpty(strTemp))) { strListResult.Add(strTemp); nTemp = 0; strTemp = string.Empty; } } } if (strListResult.Count > 0) { strAryResult = new string[strListResult.Count]; strListResult.CopyTo(strAryResult); } } return(strAryResult); }
/// <summary> /// 将字符串按照指定长度截取并转存为字符数组,空格忽略 /// </summary> /// <param name="strValue"></param> /// <param name="nLength"></param> /// <returns></returns> public static string[] StringToStringArray(string strValue, int nLength) { string[] strAryResult = null; if (!string.IsNullOrEmpty(strValue)) { System.Collections.ArrayList strListResult = new System.Collections.ArrayList(); string strTemp = string.Empty; int nTemp = 0; for (int nloop = 0; nloop < strValue.Length; nloop++) { if (strValue[nloop] == ' ') { continue; } else { nTemp++; //校验截取的字符是否在A~F、0~9区间,不在则直接退出 System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(@"^(([A-F])*(\d)*)$"); if (!reg.IsMatch(strValue.Substring(nloop, 1))) { return(strAryResult); } strTemp += strValue.Substring(nloop, 1); //判断是否到达截取长度 if ((nTemp == nLength) || (nloop == strValue.Length - 1 && !string.IsNullOrEmpty(strTemp))) { strListResult.Add(strTemp); nTemp = 0; strTemp = string.Empty; } } } if (strListResult.Count > 0) { strAryResult = new string[strListResult.Count]; strListResult.CopyTo(strAryResult); } } return(strAryResult); }
/// <summary> /// Returns a list of files in a give directory. /// </summary> /// <param name="fullName">The full path name to the directory.</param> /// <param name="indexFileNameFilter"></param> /// <returns>An array containing the files.</returns> public static System.String[] GetLuceneIndexFiles(System.String fullName, Index.IndexFileNameFilter indexFileNameFilter) { System.IO.DirectoryInfo dInfo = new System.IO.DirectoryInfo(fullName); System.Collections.ArrayList list = new System.Collections.ArrayList(); foreach (System.IO.FileInfo fInfo in dInfo.GetFiles()) { if (indexFileNameFilter.Accept(fInfo, fInfo.Name) == true) { list.Add(fInfo.Name); } } System.String[] retFiles = new System.String[list.Count]; list.CopyTo(retFiles); return(retFiles); }
internal static String[] GetAllDateTimes(DateTime dateTime, DateTimeFormatInfo dtfi) { ArrayList results = new ArrayList(DEFAULT_ALL_DATETIMES_SIZE); for (int i = 0; i < allStandardFormats.Length; i++) { String[] strings = GetAllDateTimes(dateTime, allStandardFormats[i], dtfi); for (int j = 0; j < strings.Length; j++) { results.Add(strings[j]); } } String[] value = new String[results.Count]; results.CopyTo(0, value, 0, results.Count); return(value); }
/// <summary> /// Returns a list of files in a give directory. /// </summary> /// <param name="fullName">The full path name to the directory.</param> /// <param name="indexFileNameFilter"></param> /// <returns>An array containing the files.</returns> public static System.String[] GetLuceneIndexFiles(System.String fullName, Index.IndexFileNameFilter indexFileNameFilter) { System.IO.DirectoryInfo dInfo = new System.IO.DirectoryInfo(fullName); System.Collections.ArrayList list = new System.Collections.ArrayList(); foreach (System.IO.FileInfo fInfo in dInfo.GetFiles()) { if (indexFileNameFilter.Accept(fInfo, fInfo.Name) == true) { list.Add(fInfo.Name); } } System.String[] retFiles = new System.String[list.Count]; list.CopyTo(retFiles); return retFiles; }
/// <summary> /// Returns all Filedescriptors for Files starting with the given Value /// </summary> /// <param name="start">The string the FIlename starts with</param> /// <returns>A List of File Descriptors</returns> public Interfaces.Files.IPackedFileDescriptor[] FindFiles(string start) { start = start.Trim().ToLower(); System.Collections.ArrayList a = new System.Collections.ArrayList(); foreach (Interfaces.Files.IPackedFileDescriptor pfd in items) { if (pfd.Filename.Trim().ToLower().StartsWith(start)) { a.Add(pfd); } } Interfaces.Files.IPackedFileDescriptor[] pfds = new Interfaces.Files.IPackedFileDescriptor[a.Count]; a.CopyTo(pfds); return(pfds); }
public override object ReadObject(XmlReader reader) { ArrayOfLoanStateCompositeType ArrayOfLoanStateCompositeTypeField = null; if (IsParentStartElement(reader, false, true)) { ArrayOfLoanStateCompositeTypeField = new ArrayOfLoanStateCompositeType(); reader.Read(); LoanStateCompositeTypeDataContractSerializer LoanStateCompositeTypeDCS = new LoanStateCompositeTypeDataContractSerializer("LoanStateCompositeType", "http://schemas.datacontract.org/2004/07/", "http://schemas.datacontract.org/2004/07/"); System.Collections.ArrayList LoanStateCompositeType_List = new System.Collections.ArrayList(); for (int i = 0; (i > -1); i = (i + 1)) { if (!IsChildStartElement(reader, "LoanStateCompositeType", false, false)) { ArrayOfLoanStateCompositeTypeField.LoanStateCompositeType = new LoanStateCompositeType[LoanStateCompositeType_List.Count]; LoanStateCompositeType_List.CopyTo(ArrayOfLoanStateCompositeTypeField.LoanStateCompositeType); break; } LoanStateCompositeType_List.Add(((LoanStateCompositeType)(LoanStateCompositeTypeDCS.ReadObject(reader)))); } reader.ReadEndElement(); } return ArrayOfLoanStateCompositeTypeField; }
/// <summary> Sets the source reader to point to the given file, and tests /// all the messages therein (if a directory, processes all contained /// files recursively). /// </summary> public virtual NuGenHL7Exception[] testAll(System.IO.FileInfo source) { System.Collections.ArrayList list = new System.Collections.ArrayList(); System.Console.Out.WriteLine("Testing " + source.FullName); if (System.IO.Directory.Exists(source.FullName)) { System.IO.FileInfo[] contents = SupportClass.FileSupport.GetFiles(source); for (int i = 0; i < contents.Length; i++) { NuGenHL7Exception[] exceptions = testAll(contents[i]); for (int j = 0; j < exceptions.Length; j++) { list.Add(exceptions[j]); } } } else if (System.IO.File.Exists(source.FullName)) { System.IO.StreamReader in_Renamed = new System.IO.StreamReader(source.FullName, System.Text.Encoding.Default); Source = in_Renamed; Context = source.FullName; NuGenHL7Exception[] exceptions = testAll(); for (int i = 0; i < exceptions.Length; i++) { list.Add(exceptions[i]); } } else { System.Console.Out.WriteLine("Warning: " + source.FullName + " is not a normal file"); } NuGenHL7Exception[] retVal = new NuGenHL7Exception[list.Count]; list.CopyTo(retVal); return retVal; }
//TODO: Исправить этот метод, так чтобы он работал только с корневыми или со всеми пространствами имен. /// <summary> /// Просматривает список модулей, и объединяет одни и те-же пространства имен разных модулей. /// </summary> /// <param name="units">Список модулей.</param> /// <returns>Список пространств имен.</returns> private static common_namespace_node[] get_units_namespaces(common_unit_node_list units) { /*System.Collections.Generic.Dictionary<string, common_namespace_node> namespaces = new System.Collections.Generic.Dictionary<string, common_namespace_node>( SystemLibrary.SystemLibrary.string_comparer); foreach (common_unit_node un in units) { foreach (common_namespace_node cnn in un.namespaces) { string full_name = cnn.namespace_full_name; common_namespace_node new_namespace; if (!(namespaces.TryGetValue(full_name,out new_namespace))) { new_namespace = cnn.clone(); namespaces[full_name] = new_namespace; } else { new_namespace.merge_with_namespace(cnn); } } } common_namespace_node[] ret = new common_namespace_node[namespaces.Count]; namespaces.Values.CopyTo(ret, 0); return ret;*/ System.Collections.Hashtable ht = new System.Collections.Hashtable(); System.Collections.ArrayList al = new System.Collections.ArrayList(); common_namespace_node main_cnn = null; foreach (common_unit_node un in units) { foreach (common_namespace_node cnn in un.namespaces) { //if (cnn.namespace_full_name != "") //{ if (ht[cnn.namespace_name] == null) { al.Add(cnn); ht[cnn.namespace_name] = cnn; } //else // throw new Errors.CompilerInternalError("MergeNamespaces", new Errors.LocatedError("Dupblicate nammespace name: "+cnn.namespace_name)); //} //else main_cnn = cnn; } } int num = 0; if (main_cnn != null) num++; common_namespace_node[] namespaces_to_ret = new common_namespace_node[al.Count + num]; if (main_cnn != null) namespaces_to_ret[0] = main_cnn; al.CopyTo(namespaces_to_ret, num); return namespaces_to_ret; /*System.Collections.Hashtable ht = new System.Collections.Hashtable(); System.Collections.ArrayList al = new System.Collections.ArrayList(); foreach (common_unit_node un in units) { foreach (common_namespace_node cnn in un.namespaces) if (ht[cnn.namespace_name] == null) { al.Add(cnn); ht[cnn.namespace_name] = cnn; } } common_namespace_node[] namespaces_to_ret = new common_namespace_node[al.Count]; al.CopyTo(namespaces_to_ret); return namespaces_to_ret;*/ }
private System.String[] getDeclaredProfileIDs(Message theMessage) { Terser t = new Terser(theMessage); bool noMore = false; int c = 0; System.Collections.ArrayList declaredProfiles = new System.Collections.ArrayList(8); while (!noMore) { System.String path = "MSH-21(" + c++ + ")"; System.String idRep = t.get_Renamed(path); //FIXME fails if empty rep precedes full rep ... should add getAll() to Terser and use that if (idRep == null || idRep.Equals("")) { noMore = true; } else { declaredProfiles.Add(idRep); } } String[] retVal = new String[declaredProfiles.Count]; declaredProfiles.CopyTo(retVal); return retVal; }
//字符截取,即不区分输入字符是否输入空格,均以两个字符处理为一个串 private string[] strCutLength(string str, int iLength) { string[] reslut = null; if (!string.IsNullOrEmpty(str)) { int iTemp = 0; string strTemp = null; System.Collections.ArrayList strArr = new System.Collections.ArrayList(); for (int i = 0; i < str.Length; i++) { if (str[i] == ' ') { continue; } else { iTemp++; strTemp += str.Substring(i, 1); } //校验截取的字符是否在A~F、0~9区间 System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(@"^(([A-F])*(\d)*)$"); if (!reg.IsMatch(strTemp)) { return reslut; } if ((iTemp == iLength) || (i == str.Length - 1 && !string.IsNullOrEmpty(strTemp))) { strArr.Add(strTemp); iTemp = 0; strTemp = null; } } if (strArr.Count > 0) { reslut = new string[strArr.Count]; strArr.CopyTo(reslut); } } return reslut; }
public static void ApplyPatch(FpuSegment seg) { Process p=new Process(); p.StartInfo.FileName="nasm.exe"; p.StartInfo.Arguments="out.txt"; p.StartInfo.UseShellExecute=false; p.StartInfo.CreateNoWindow=true; p.Start(); p.WaitForExit(); p.Close(); FileInfo fi=new FileInfo("out"); if(fi.Length==0) throw new OptimizationException("Patcher: Code generator produced uncompilable code"); ArrayList code=new ArrayList(); for(int i=0;i<seg.Pre.Length;i++) { code.AddRange(HexToString(seg.Pre[i].code)); } code.AddRange(Program.ReadFileBytes("out")); for(int i=0;i<seg.Post.Length;i++) { code.AddRange(HexToString(seg.Post[i].code)); } if(code.Count>seg.End-seg.Start) throw new OptimizationException("Patcher: Patch to big to fit into code"); /*if(Program.TestPatches) { TestPatch(seg); //TESTPATCH CALL }*/ if(Program.Benchmark) { Benchmark(seg); //BENCHMARK CALL!!!!!!!!!!!!!!!!!!!!!!!! <---------------- OVER HERE } byte[] Code=new byte[seg.End-seg.Start]; code.CopyTo(Code); for(int i=code.Count;i<(seg.End-seg.Start);i++) { Code[i]=144; //Fill the rest of the code up with nop's } long a=(seg.End-seg.Start)-code.Count; if(a>255) { throw new OptimizationException("Patcher: Patch end address out of range of a short jump"); } else if(a>2) { Code[code.Count]=235; Code[code.Count+1]=(byte)(a-2); } if(Program.Restrict) { if(PatchCount<Program.FirstPatch||PatchCount>Program.LastPatch) { PatchCount++; throw new OptimizationException("Patcher: Patch restricted"); } PatchCount++; } #if emitpatch FileStream fs2=File.Create("emittedpatch.patch",4096); BinaryWriter bw=new BinaryWriter(fs2); bw.Write(seg.Start); bw.Write(Code.Length); bw.Write(Code,0,Code.Length); bw.Close(); #endif FileStream fs=File.Open("code",FileMode.Open); fs.Position=seg.Start; fs.Write(Code,0,Code.Length); fs.Close(); }
/// <include file='doc\FileDialog.uex' path='docs/doc[@for="FileDialog.GetMultiselectFiles"]/*' /> /// <devdoc> /// Extracts the filename(s) returned by the file dialog. /// </devdoc> private string[] GetMultiselectFiles(CharBuffer charBuffer) { string directory = charBuffer.GetString(); string fileName = charBuffer.GetString(); if (fileName.Length == 0) return new string[] { directory }; if (directory[directory.Length - 1] != '\\') { directory = directory + "\\"; } ArrayList names = new ArrayList(); do { if (fileName[0] != '\\' && (fileName.Length <= 3 || fileName[1] != ':' || fileName[2] != '\\')) { fileName = directory + fileName; } names.Add(fileName); fileName = charBuffer.GetString(); } while (fileName.Length > 0); string[] temp = new string[names.Count]; names.CopyTo(temp, 0); return temp; }
public ProductDetails[] List(int BranchID = 0) { try { System.Collections.ArrayList items = new System.Collections.ArrayList(); System.Data.DataTable dtProductIDs = ProductIDAsDataTable(); foreach (System.Data.DataRow drProductID in dtProductIDs.Rows) { items.Add(Details1(BranchID, long.Parse(drProductID["ProductID"].ToString()))); } ProductDetails[] arrProductDetails = new ProductDetails[0]; if (items != null) { arrProductDetails = new ProductDetails[items.Count]; items.CopyTo(arrProductDetails); } return arrProductDetails; } catch (Exception ex) { throw base.ThrowException(ex); } }
private static string normalize_query_string(string uri) { System.Collections.ArrayList escaped_params = new System.Collections.ArrayList(); System.Uri main_uri = new Uri(uri); string[] query_params = main_uri.Query.Substring(1).Split("&".ToCharArray()); foreach (string i_param in query_params) { if (i_param.Trim().Length > 0) { string key = i_param.Split("=".ToCharArray())[0]; string val = i_param.Split("=".ToCharArray())[1]; val = System.Uri.UnescapeDataString(val); escaped_params.Add(key + "=" + System.Uri.EscapeDataString(val).Replace("+", "%20")); } } escaped_params.Sort(); string[] clone_array = new string[escaped_params.Count]; escaped_params.CopyTo(clone_array); return string.Join("\n", clone_array); }
public string[] Split(string expression, string delimiter, string qualifier, bool ignoreCase) { bool _QualifierState = false; int _StartIndex = 0; System.Collections.ArrayList _Values = new System.Collections.ArrayList(); for (int _CharIndex = 0; _CharIndex < expression.Length - 1; _CharIndex++) { if ((qualifier != null) & (string.Compare(expression.Substring (_CharIndex, qualifier.Length), qualifier, ignoreCase) == 0)) { _QualifierState = !(_QualifierState); } else if (!(_QualifierState) & (delimiter != null) & (string.Compare(expression.Substring (_CharIndex, delimiter.Length), delimiter, ignoreCase) == 0)) { _Values.Add(expression.Substring (_StartIndex, _CharIndex - _StartIndex)); _StartIndex = _CharIndex + 1; } } if (_StartIndex < expression.Length) _Values.Add(expression.Substring (_StartIndex, expression.Length - _StartIndex)); string[] _returnValues = new string[_Values.Count]; _Values.CopyTo(_returnValues); return _returnValues; }
/// <seealso cref="Genetibase.NuGenHL7.validation.ValidationContext.getDataTypeRules(java.lang.String, java.lang.String)"> /// </seealso> /// <param name="theType">ignored /// </param> public virtual NuGenPrimitiveTypeRule[] getPrimitiveRules(System.String theVersion, System.String theTypeName, Primitive theType) { System.Collections.IList active = new System.Collections.ArrayList(myPrimitiveRuleBindings.Count); for (int i = 0; i < myPrimitiveRuleBindings.Count; i++) { System.Object o = myPrimitiveRuleBindings[i]; if (!(o is NuGenRuleBinding)) { throw new System.InvalidCastException("Item in rule binding list is not a RuleBinding"); } NuGenRuleBinding binding = (NuGenRuleBinding) o; if (binding.Active && binding.appliesToVersion(theVersion) && binding.appliesToScope(theTypeName)) { active.Add(binding.Rule); } } NuGenPrimitiveTypeRule[] retVal = new NuGenPrimitiveTypeRule[active.Count]; active.CopyTo(retVal, 0); return retVal; }
/// <summary> /// Split a string by a delimiter, respecting quoted text /// </summary> /// <remarks> /// From http://www.codeproject.com/KB/dotnet/TextQualifyingSplit.aspx /// </remarks> /// <param name="expression"></param> /// <param name="delimiter"></param> /// <param name="qualifier"></param> /// <param name="ignoreCase"></param> /// <returns></returns> public List<string> Split(string expression, string delimiter, string qualifier, bool ignoreCase) { bool _QualifierState = false; int _StartIndex = 0; System.Collections.ArrayList _Values = new System.Collections.ArrayList(); for (int _CharIndex = 0; _CharIndex < expression.Length - 1; _CharIndex++) { if ((qualifier != null) & (string.Compare(expression.Substring (_CharIndex, qualifier.Length), qualifier, ignoreCase) == 0)) { _QualifierState = !(_QualifierState); } else if (!(_QualifierState) & (delimiter != null) & (string.Compare(expression.Substring (_CharIndex, delimiter.Length), delimiter, ignoreCase) == 0)) { _Values.Add(expression.Substring (_StartIndex, _CharIndex - _StartIndex)); _StartIndex = _CharIndex + 1; } } if (_StartIndex < expression.Length) _Values.Add(expression.Substring (_StartIndex, expression.Length - _StartIndex)); string[] _returnValues = new string[_Values.Count]; _Values.CopyTo(_returnValues); List<string> list = _returnValues.ToList<string>(); List<string> output = new List<string>(); foreach (string item in list) { string thisitem = item.Trim(); if (thisitem.StartsWith("\"") && thisitem.EndsWith("\"")) { output.Add(thisitem.Trim('"')); } else { output.Add(thisitem); } } return output; }
/// <summary> /// Splits a string into an array of strings on regular expression boundaries. /// This function works the same way as the Perl function of the same name. /// Given a regular expression of "[ab]+" and a string to split of /// "xyzzyababbayyzabbbab123", the result would be the array of Strings /// "[xyzzy, yyz, 123]". /// <p>Please note that the first string in the resulting array may be an empty /// string. This happens when the very first character of input string is /// matched by the pattern.</p> /// </summary> /// <param name="s">String to split on this regular exression</param> /// <param name="maxMatches">The maximum number of matches to split</param> /// <param name="start">The offset in the string to start at</param> /// <returns>Array of strings</returns> public String[] Split(String s, int maxMatches, int start, int length) { if (maxMatches < 0) maxMatches = int.MaxValue; // Create new System.Collections.ArrayList System.Collections.ArrayList v = new System.Collections.ArrayList(); // Start at position 0 and search the whole string int pos = start; //int len = s.Length; int len = length; int matchCount = 0; // Try a match at each position while (pos < len && IsMatch(s, pos) && matchCount < maxMatches) { //increment matches ++matchCount; // Get start of match start = start0; // Get end of match int newpos = end0; // Check if no progress was made if (newpos == pos) { v.Add(s.Substring(pos, start + 1)); ++newpos; } else v.Add(s.Substring(pos, start - pos)); // Move to new position pos = newpos; } // Push remainder if it's not empty String remainder = s.Substring(pos); if (remainder.Length != 0) v.Add(remainder); // Return System.Collections.ArrayList as an array of strings String[] ret = new String[v.Count]; v.CopyTo(ret); return ret; }
/// <summary> /// 将字符串按照指定长度截取并转存为字符数组,空格忽略 /// </summary> /// <param name="strValue"></param> /// <param name="nLength"></param> /// <returns></returns> public static string[] StringToStringArray(string strValue, int nLength) { string[] strAryResult = null; if (!string.IsNullOrEmpty(strValue)) { System.Collections.ArrayList strListResult = new System.Collections.ArrayList(); string strTemp = string.Empty; int nTemp = 0; for (int nloop = 0; nloop < strValue.Length; nloop++ ) { if (strValue[nloop] == ' ') { continue; } else { nTemp++; //校验截取的字符是否在A~F、0~9区间,不在则直接退出 System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(@"^(([A-F])*(\d)*)$"); if (!reg.IsMatch(strValue.Substring(nloop, 1))) { return strAryResult; } strTemp += strValue.Substring(nloop, 1); //判断是否到达截取长度 if ((nTemp == nLength) || (nloop == strValue.Length - 1 && !string.IsNullOrEmpty(strTemp))) { strListResult.Add(strTemp); nTemp = 0; strTemp = string.Empty; } } } if (strListResult.Count > 0) { strAryResult = new string[strListResult.Count]; strListResult.CopyTo(strAryResult); } } return strAryResult; }
internal static String[] GetAllDateTimes(DateTime dateTime, DateTimeFormatInfo dtfi) { ArrayList results = new ArrayList(DEFAULT_ALL_DATETIMES_SIZE); for (int i = 0; i < allStandardFormats.Length; i++) { String[] strings = GetAllDateTimes(dateTime, allStandardFormats[i], dtfi); for (int j = 0; j < strings.Length; j++) { results.Add(strings[j]); } } String[] value = new String[results.Count]; results.CopyTo(0, value, 0, results.Count); return (value); }
/// <param name="theMessage">an HL7 message from which data are to be queried /// </param> /// <param name="theQuery">the query (see class docs for syntax) /// </param> /// <returns> data from the message that are selected by the query /// </returns> public static NuGenMessageQuery.Result query(Message theMessage, System.String theQuery) { System.Collections.Specialized.NameValueCollection clauses = getClauses(theQuery); //parse select clause SupportClass.Tokenizer select = new SupportClass.Tokenizer(clauses.Get("select"), ", ", false); System.Collections.ArrayList fieldPaths = new System.Collections.ArrayList(10); System.Collections.Hashtable names = new System.Collections.Hashtable(10); while (select.HasMoreTokens()) { System.String token = select.NextToken(); if (token.Equals("as")) { if (!select.HasMoreTokens()) { throw new System.ArgumentException("Keyword 'as' must be followed by a field label"); } names[select.NextToken()] = (System.Int32) (fieldPaths.Count - 1); } else { fieldPaths.Add(token); } } //parse loop clause SupportClass.Tokenizer loop = new SupportClass.Tokenizer(clauses["loop"] == null?"":clauses["loop"], ",", false); System.Collections.ArrayList loopPoints = new System.Collections.ArrayList(10); System.Collections.Hashtable loopPointNames = new System.Collections.Hashtable(10); while (loop.HasMoreTokens()) { System.String pointDecl = loop.NextToken(); SupportClass.Tokenizer tok = new SupportClass.Tokenizer(pointDecl, "=", false); System.String name = tok.NextToken().Trim(); System.String path = tok.NextToken().Trim(); loopPoints.Add(path); loopPointNames[name] = (System.Int32) (loopPoints.Count - 1); } //parse where clause //TODO: this will do for now but it should really be evaluated like an expression //rather than a list SupportClass.Tokenizer where = new SupportClass.Tokenizer(clauses["where"] == null?"":clauses["where"], ",", false); System.Collections.ArrayList filters = new System.Collections.ArrayList(); while (where.HasMoreTokens()) { filters.Add(where.NextToken()); } System.String[] filterPaths = new System.String[filters.Count]; System.String[] filterPatterns = new System.String[filters.Count]; bool[] exactFlags = new bool[filters.Count]; for (int i = 0; i < filters.Count; i++) { exactFlags[i] = true; System.String filter = (System.String) filters[i]; System.String[] parts = splitFromEnd(filter, "="); if (parts[1] != null) { parts[1] = parts[1].Substring(1); } else { exactFlags[i] = false; parts = splitFromEnd(filter, "like"); parts[1] = parts[1].Substring(4); } filterPaths[i] = parts[0].Trim(); parts[1] = parts[1].Trim(); filterPatterns[i] = parts[1].Substring(1, (parts[1].Length - 1) - (1)); } String[] retVal1 = new String[loopPoints.Count]; loopPoints.CopyTo(retVal1); String[] retVal2 = new String[fieldPaths.Count]; fieldPaths.CopyTo(retVal2); return new ResultImpl(theMessage, retVal1, loopPointNames, retVal2, names, filterPaths, filterPatterns, exactFlags); }
public void ReadDefinitionFrom( BinaryReader reader ) { // Read bounds int top = IPAddress.NetworkToHostOrder( reader.ReadInt32() ); int left = IPAddress.NetworkToHostOrder( reader.ReadInt32() ); int bottom = IPAddress.NetworkToHostOrder( reader.ReadInt32() ); int right = IPAddress.NetworkToHostOrder( reader.ReadInt32() ); bounds = Rectangle.FromLTRB( left, top, right, bottom ); maskbounds = bounds; hasmask = false; channels = new Channels( reader ); // Blend info Utils.CheckSignature( reader, "8BIM", new InvalidBlendSignature() ); blendkey = new string( reader.ReadChars( 4 ) ); opacity = reader.ReadByte(); clipping = reader.ReadByte() == 0 ? LayerClipping.Base : LayerClipping.NonBase; // Flags byte flags = reader.ReadByte(); protecttrans = (flags & 1) != 0; visible = (flags & 2) == 0; reader.ReadByte(); // filler // extra data (?) int extradatasize = IPAddress.NetworkToHostOrder( reader.ReadInt32() ); if ( extradatasize > 0 ) extradatasize += (int)reader.BaseStream.Position; // Layer mask data int datasize = IPAddress.NetworkToHostOrder( reader.ReadInt32() ); if ( datasize > 0 ) { top = IPAddress.NetworkToHostOrder( reader.ReadInt32() ); left = IPAddress.NetworkToHostOrder( reader.ReadInt32() ); bottom = IPAddress.NetworkToHostOrder( reader.ReadInt32() ); right = IPAddress.NetworkToHostOrder( reader.ReadInt32() ); maskbounds = Rectangle.FromLTRB( left, top, right, bottom ); hasmask = true; // layer mask data datasize = IPAddress.NetworkToHostOrder( reader.ReadInt32() ); } // Range data datasize = IPAddress.NetworkToHostOrder( reader.ReadInt32() ); if ( datasize > 0 ) { reader.ReadBytes( datasize ); // throw away } name = Utils.ReadPascalString( reader, 4 ); // Read rest System.Collections.ArrayList list = new System.Collections.ArrayList(); while ( (int)reader.BaseStream.Position < extradatasize ) { LayerAdjustment adj = LayerAdjustment.Construct( reader ); if ( adj == null ) break; list.Add( adj ); } if ( list.Count > 0 ) { adjustments = new LayerAdjustment[list.Count]; list.CopyTo( adjustments, 0 ); } else adjustments = new LayerAdjustment[0]; if ( channels.Mask != null ) channels.Mask.Size = maskbounds.Size; if ( channels.Alpha != null ) channels.Alpha.Size = bounds.Size; if ( channels.Red != null ) { // Let's assume that a valid Red channel also means valid Green and Blue channels channels.Red.Size = bounds.Size; channels.Green.Size = bounds.Size; channels.Blue.Size = bounds.Size; } }
/// <summary> /// Returns all the selected rows index /// </summary> /// <returns></returns> public virtual int[] GetRowsIndex() { System.Collections.ArrayList indexList = new System.Collections.ArrayList(); RangeCollection ranges = GetRanges(); for (int iRange = 0; iRange < ranges.Count; iRange++) { for (int r = ranges[iRange].Start.Row; r <= ranges[iRange].End.Row; r++) { if (indexList.Contains(r) == false) indexList.Add(r); } } int[] ret = new int[indexList.Count]; indexList.CopyTo(ret, 0); return ret; }
public override object ReadObject(XmlReader reader) { ArrayOfstring ArrayOfstringField = null; if (IsParentStartElement(reader, false, true)) { ArrayOfstringField = new ArrayOfstring(); reader.Read(); System.Collections.ArrayList string_List = new System.Collections.ArrayList(); for (int i = 0; (i > -1); i = (i + 1)) { if (!IsChildStartElement(reader, "string", false, false)) { ArrayOfstringField.STRING = new string[string_List.Count]; string_List.CopyTo(ArrayOfstringField.STRING); break; } string_List.Add(ReadString(reader)); } reader.ReadEndElement(); } return ArrayOfstringField; }
public CarverLabUtility.Window[] GetWindows() { alWindowArray = new System.Collections.ArrayList(); CarverLabUtility.Win32Wrapper myWrap = new CarverLabUtility.Win32Wrapper(); myWrap.EnumWindowsExReceived += new EnumWindowsExProc(GetWindows_EnumWindowsExReceived); myWrap.EnumWindowsEx(null); if (alWindowArray.Count > 0) { WindowArray = new CarverLabUtility.Window[alWindowArray.Count]; alWindowArray.CopyTo(WindowArray); } return WindowArray; }
public static void EmmitPatch(string address,string endaddress) { int start=HexParse(address); int end=HexParse(endaddress); Process p=new Process(); p.StartInfo.FileName="nasm.exe"; p.StartInfo.Arguments="patch.asm"; p.StartInfo.UseShellExecute=false; p.StartInfo.CreateNoWindow=true; p.Start(); p.WaitForExit(); FileInfo fi=new FileInfo("patch"); if(fi.Length==0) throw new Exception("Patcher: Code generator produced uncompilable code"); ArrayList al=new ArrayList(ReadFileBytes("patch")); byte[] b=new byte[end-start]; al.CopyTo(b); for(int i=al.Count;i<b.Length;i++) { b[i]=144; } int a=(end-start)-al.Count; if(a>127) { b[al.Count]=235; b[al.Count+1]=127; //throw new OptimizationException("Patcher: Patch end address out of range of a short jump"); } else if(a>2) { b[al.Count]=235; b[al.Count+1]=(byte)(a-2); } BinaryWriter bw=new BinaryWriter(File.Create("emittedpatch.patch",4096)); bw.Write(HexParse(address)); bw.Write(b.Length); bw.Write(b,0,b.Length); bw.Close(); }
private string[] ProcessHoldingResponse(string xmlResponse) { System.Collections.ArrayList alist = new System.Collections.ArrayList(); string sMessage = ""; System.Xml.XmlDocument objXML = new System.Xml.XmlDocument(); objXML.LoadXml(xmlResponse); System.Xml.XmlNamespaceManager nsmgr = new System.Xml.XmlNamespaceManager(objXML.NameTable); nsmgr.AddNamespace("x", "http://www.w3.org/2005/Atom"); nsmgr.AddNamespace("os", "http://a9.com/-/spec/opensearch/1.1/"); nsmgr.AddNamespace("oclc", "http://worldcat.org/rb/holdinglibrary"); sMessage = ""; System.Xml.XmlNodeList nodes = objXML.SelectNodes("/x:feed/x:entry", nsmgr); if (nodes != null) { foreach (System.Xml.XmlNode node in nodes) { sMessage = node.SelectSingleNode("x:content/oclc:library/oclc:holdingCode", nsmgr).InnerText; alist.Add(sMessage); } } if (alist.Count > 0) { string[] arrOut = new string[alist.Count]; alist.CopyTo(arrOut); return arrOut; } return null; }
/// <summary> Tests all remaining messages available from the currrent source.</summary> public virtual NuGenHL7Exception[] testAll() { System.Collections.ArrayList list = new System.Collections.ArrayList(); System.String message = null; while ((message = NextMessage).Length > 0) { NuGenHL7Exception e = parsesCorrectly(this.context, message); if (e != null) list.Add(e); } NuGenHL7Exception[] retVal = new NuGenHL7Exception[list.Count]; list.CopyTo(retVal); return retVal; }
public CreditBillItemDetails[] setArrayDetails(System.Data.DataTable dt) { System.Collections.ArrayList arrItems = new System.Collections.ArrayList(); CreditBillItemDetails Details = new CreditBillItemDetails(); foreach (System.Data.DataRow dr in dt.Rows) { Details = new CreditBillItemDetails(); Details.CreditBillDetailID = Int64.Parse(dr["CreditBillDetailID"].ToString()); Details.CreditBillHeaderID = Int64.Parse(dr["CreditBillHeaderID"].ToString()); Details.TransactionDate = DateTime.Parse(dr["TransactionDate"].ToString()); Details.Description = dr["Description"].ToString(); Details.Amount = decimal.Parse(dr["Amount"].ToString()); Details.TransactionTypeID = Int32.Parse(dr["TransactionTypeID"].ToString()); Details.TransactionRefID = Int64.Parse(dr["TransactionRefID"].ToString()); Details.TerminalNoRefID = dr["TerminalNoRefID"].ToString(); Details.BranchIDRefID = Int32.Parse(dr["BranchIDRefID"].ToString()); arrItems.Add(Details); } CreditBillItemDetails[] retDetails = new Data.CreditBillItemDetails[0]; if (arrItems.Count > 0) { retDetails = new Data.CreditBillItemDetails[arrItems.Count]; arrItems.CopyTo(retDetails); } return retDetails; }
/// <summary> /// Split string according the dilimer, this function is equea to /// String.Split(char[], StringSplitOptions.RemoveEmptyEntries) /// which is not supported by .net cf /// </summary> /// <param name="splitStr"></param> /// <returns></returns> public static string[] SplitString(string str, char[] separator) { string[] splitStr = str.Split(separator); System.Collections.ArrayList list = new System.Collections.ArrayList(); for (int i = 0; i < splitStr.Length; i++) { if (splitStr[i] != string.Empty && splitStr[i] != null) { list.Add(splitStr[i]); } } splitStr = new string[list.Count]; list.CopyTo(splitStr); return splitStr; }
public override object ReadObject(XmlReader reader) { ArrayOfFileInfo ArrayOfFileInfoField = null; if (IsParentStartElement(reader, false, true)) { ArrayOfFileInfoField = new ArrayOfFileInfo(); reader.Read(); FileInfoDataContractSerializer FileInfoDCS = new FileInfoDataContractSerializer("FileInfo", "http://schemas.datacontract.org/2004/07/WcfMtomService", "http://schemas.datacontract.org/2004/07/WcfMtomService"); System.Collections.ArrayList FileInfo_List = new System.Collections.ArrayList(); for (int i = 0; (i > -1); i = (i + 1)) { if (!IsChildStartElement(reader, "FileInfo", false, false)) { ArrayOfFileInfoField.FileInfo = new FileInfo[FileInfo_List.Count]; FileInfo_List.CopyTo(ArrayOfFileInfoField.FileInfo); break; } FileInfo_List.Add(((FileInfo)(FileInfoDCS.ReadObject(reader)))); } reader.ReadEndElement(); } return ArrayOfFileInfoField; }
/// <seealso cref="Genetibase.NuGenHL7.validation.MessageRule.test(Genetibase.NuGenHL7.model.Message)"> /// </seealso> public virtual NuGenValidationException[] test(Message msg) { System.Collections.ArrayList problems = new System.Collections.ArrayList(20); System.String[] ids = new System.String[]{myProfileID}; try { if (myProfileID == null) { ids = getDeclaredProfileIDs(msg); } for (int i = 0; i < ids.Length; i++) { try { NuGenValidationException[] shortList = testAgainstProfile(msg, ids[i]); for (int j = 0; j < shortList.Length; j++) { problems.Add(shortList[j]); } } catch (ProfileException e) { problems.Add(new NuGenValidationException("Can't validate", e)); } } } catch (NuGenHL7Exception e) { problems.Add(new NuGenValidationException("Can't validate", e)); } NuGenValidationException[] retVal = new NuGenValidationException[problems.Count]; problems.CopyTo(retVal); return retVal; }