/// <summary> /// Creates a NDataReader from a <see cref="IDataReader" /> /// </summary> /// <param name="reader">The <see cref="IDataReader" /> to get the records from the Database.</param> /// <param name="isMidstream"><see langword="true" /> if we are loading the <see cref="IDataReader" /> in the middle of reading it.</param> /// <remarks> /// NHibernate attempts to not have to read the contents of an <see cref="IDataReader"/> into memory until it absolutely /// has to. What that means is that it might have processed some records from the <see cref="IDataReader"/> and will /// pick up the <see cref="IDataReader"/> midstream so that the underlying <see cref="IDataReader"/> can be closed /// so a new one can be opened. /// </remarks> public NDataReader(IDataReader reader, bool isMidstream) { ArrayList resultList = new ArrayList(2); try { // if we are in midstream of processing a DataReader then we are already // positioned on the first row (index=0) if (isMidstream) { currentRowIndex = 0; } // there will be atleast one result resultList.Add(new NResult(reader, isMidstream)); while (reader.NextResult()) { // the second, third, nth result is not processed midstream resultList.Add(new NResult(reader, false)); } results = (NResult[]) resultList.ToArray(typeof(NResult)); } catch (Exception e) { throw new ADOException("There was a problem converting an IDataReader to NDataReader", e); } finally { reader.Close(); } }
public override ClassDefinition GetClassDefinition(object instance) { Type type = instance.GetType(); BindingFlags bindingAttr = BindingFlags.Public | BindingFlags.Instance; PropertyInfo[] propertyInfos = type.GetProperties(bindingAttr); #if !(NET_1_1) List<ClassMember> classMemberList = new List<ClassMember>(); #else ArrayList classMemberList = new ArrayList(); #endif for (int i = 0; i < propertyInfos.Length; i++) { PropertyInfo propertyInfo = propertyInfos[i]; if (propertyInfo.Name != "HelpLink" && propertyInfo.Name != "TargetSite") { ClassMember classMember = new ClassMember(propertyInfo.Name, bindingAttr, propertyInfo.MemberType, null); classMemberList.Add(classMember); } } string customClassName = type.FullName; customClassName = FluorineConfiguration.Instance.GetCustomClass(customClassName); #if !(NET_1_1) ClassMember[] classMembers = classMemberList.ToArray(); #else ClassMember[] classMembers = classMemberList.ToArray(typeof(ClassMember)) as ClassMember[]; #endif ClassDefinition classDefinition = new ClassDefinition(customClassName, classMembers, GetIsExternalizable(instance), GetIsDynamic(instance)); return classDefinition; }
public Item[] ListChildrenOf(string url) { Logger.LogMethod(); try { using (new UserImpersonator()) { ArrayList list = new ArrayList(); object o = SharePointHelper.GetSharePointObject(url); if (o is SPWeb) { using (SPWeb web = o as SPWeb) { PopulateListOfSubWebs(web, ref list); PopulateListOfDocumentLibraries(web, ref list); return (Item[]) list.ToArray(typeof(Item)); } } else if (o is SPFolder) { SPFolder folder = o as SPFolder; PopulateListOfSubfolders( folder, ref list ); PopulateListOfFiles( folder, ref list ); return (Item[]) list.ToArray(typeof(Item)); } return new Item[0]; } } catch (Exception ex) { Logger.LogException(ex.Message, ex); throw; } }
internal bool ImportComComponent(string path, OutputMessageCollection outputMessages, string outputDisplayName) { ComImporter importer = new ComImporter(path, outputMessages, outputDisplayName); if (importer.Success) { ArrayList list = new ArrayList(); if (this.typeLibs != null) { list.AddRange(this.typeLibs); } if (importer.TypeLib != null) { list.Add(importer.TypeLib); } this.typeLibs = (TypeLib[]) list.ToArray(typeof(TypeLib)); list.Clear(); if (this.comClasses != null) { list.AddRange(this.comClasses); } if (importer.ComClasses != null) { list.AddRange(importer.ComClasses); } this.comClasses = (ComClass[]) list.ToArray(typeof(ComClass)); } return importer.Success; }
private void reloadBase() { this.removeAll (); SideMenu = new ArrayList (); Window = new ViewWindow (""); Window.setWidth (800); Window.setHeight (Screen.height - 200); Window.setLeft ((Screen.width-800)/2); Window.setTop (100); this.addComponent (Window); SideMenu.Add(new ViewButton("Current State", LoadCurrentState)); SideMenu.Add(new ViewButton("Space Stations", LoadSpaceStations)); SideMenu.Add(new ViewButton("Bases", LoadBases)); SideMenu.Add(new ViewButton("Sat Coverage", LoadSatelliteCoverage)); SideMenu.Add(new ViewButton("Science Stations", LoadScienceStations)); SideMenu.Add(new ViewButton("Mining Rigs", LoadMiningRigs)); SideMenu.Add(new ViewButton("Rovers", LoadRovers)); SideMenu.Add(new ViewButton("Kerbals", LoadKerbals)); SideMenu.Add(new ViewButton("Past Reviews", LoadPastReviews)); for (var i = 0; i < SideMenu.ToArray ().Length; i++) { ViewButton Btn = (ViewButton)SideMenu.ToArray () [i]; Btn.setRelativeTo (Window); Btn.setLeft (10); Btn.setTop (10 + i * 45); Btn.setWidth (120); Btn.setHeight (35); this.addComponent (Btn); } }
// Methods public void ReadTextStream(TextReader tr, StringBuilder errs) { GcodeOpCode code = null; ArrayList list = new ArrayList(); ArrayList list2 = new ArrayList(); long linenum = 1L; while (true) { GcodeToken token; do { token = GcodeToken.ReadToken(tr, errs, linenum); if (token.ID == 0xffff) { if (code != null) { code.Parameter = (GcodeParameter[])list2.ToArray(typeof(GcodeParameter)); list.Add(code); } goto Label_0150; } } while (token.ID == 'N'); if (token.ID == '\n') { linenum += 1L; if (code != null) { code.Parameter = (GcodeParameter[])list2.ToArray(typeof(GcodeParameter)); list.Add(code); code = null; } } else if ((token.ID == 'G') || (token.ID == 'M')) { if (code != null) { code.Parameter = (GcodeParameter[])list2.ToArray(typeof(GcodeParameter)); list.Add(code); } code = new GcodeOpCode(string.Format("{0}{1:02}", token.ID, token.Value.ToString("00"))); list2.Clear(); } else { if (code == null) { code = new GcodeOpCode(GcodeOpCode.OpCodes.Unknown); } GcodeParameter parameter = new GcodeParameter(token); if (parameter.OpCode != GcodeOpCode.OpCodes.Unknown) { list2.Add(parameter); } } } Label_0150: this.GCodes = (GcodeOpCode[])list.ToArray(typeof(GcodeOpCode)); }
/// <summary> /// Sections: /// GUIVideoArtistInfo, FanArt, IMDBposter, IMDBActors, /// IMPAwardsposter, TMDBPosters, TMDBActorImages /// IMDBActorInfoMain, IMDBActorInfoDetails, IMDBActorInfoMovies /// </summary> /// <param name="section"></param> /// <returns></returns> public static string[] GetParserStrings(string section) { ArrayList result = new ArrayList(); try { string parserIndexFile = Config.GetFile(Config.Dir.Config, "scripts\\VDBParserStrings.xml"); string parserIndexUrl = @"http://install.team-mediaportal.com/MP1/VDBParserStrings.xml"; XmlDocument doc = new XmlDocument(); if (!File.Exists(parserIndexFile)) { if (DownloadFile(parserIndexFile, parserIndexUrl) == false) { string parserIndexFileBase = Config.GetFile(Config.Dir.Base, "VDBParserStrings.xml"); if (File.Exists(parserIndexFileBase)) { File.Copy(parserIndexFileBase, parserIndexFile, true); } else { return result.ToArray(typeof(string)) as string[]; } } } doc.Load(parserIndexFile); if (doc.DocumentElement != null) { string sec = "/section/" + section; XmlNode dbSections = doc.DocumentElement.SelectSingleNode(sec); if (dbSections == null) { return result.ToArray(typeof(string)) as string[]; } XmlNodeList parserStrings = dbSections.SelectNodes("string"); if (parserStrings != null) { foreach (XmlNode parserString in parserStrings) { result.Add(parserString.InnerText); } } } } catch (Exception ex) { Log.Error(ex.Message); } return result.ToArray(typeof(string)) as string[]; }
protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { IList galleries = CmsImageGallery.FindAllRoot(); ArrayList paths = new ArrayList(); foreach (CmsImageGallery g in galleries) { paths.Add(g.FullPath); } TextBoxText.ImagesPaths = (string[])paths.ToArray(typeof(string)); TextBoxText.UploadImagesPaths = (string[])paths.ToArray(typeof(string)); } }
//rewritten by Corillian so if it doesn't work you know who to yell at ;) public void HandlePacket(GameClient client, GSPacketIn packet) { byte grouped = (byte)packet.ReadByte(); ArrayList list = new ArrayList(); if (grouped != 0x00) { ArrayList groups = GroupMgr.ListGroupByStatus(0x00); if (groups != null) { foreach (Group group in groups) if (GameServer.ServerRules.IsAllowedToGroup(group.Leader, client.Player, true)) { list.Add(group.Leader); } } } ArrayList Lfg = GroupMgr.LookingForGroupPlayers(); if (Lfg != null) { foreach (GamePlayer player in Lfg) { if (player != client.Player && GameServer.ServerRules.IsAllowedToGroup(client.Player, player, true)) { list.Add(player); } } } client.Out.SendFindGroupWindowUpdate((GamePlayer[])list.ToArray(typeof(GamePlayer))); }
public static PropertyDescriptorCollection GetMethodProperties( object obj ) { System.Type type = obj.GetType(); if ( obj is MethodPropertyDescriptor.MethodPropertyValueHolder ) { MethodPropertyDescriptor.MethodPropertyValueHolder mobj = obj as MethodPropertyDescriptor.MethodPropertyValueHolder; // if ( mobj.Method.IsVoidMethdod ) // return null; return mobj.Method.GetChildProperties( null, null ); } MethodInfo[] methods = type.GetMethods ( BindingFlags.Instance|BindingFlags.InvokeMethod|BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.FlattenHierarchy ); ArrayList methodDesc = new ArrayList(); for ( int i = 0; i < methods.Length; i++ ) { MethodInfo method = methods[i]; if ( /*method.IsPublic &&*/ !method.IsSpecialName ) { methodDesc.Add( new MethodPropertyDescriptor( obj, method ) ); } } methodDesc.Sort( new MethodNameComparer() ); MethodPropertyDescriptor[] methodsDesc = (MethodPropertyDescriptor[])methodDesc.ToArray ( typeof(MethodPropertyDescriptor)); return new PropertyDescriptorCollection(methodsDesc); }
private void EnsureRelevantMethodsAreVirtual(Type service, Type implementation) { if (service.IsInterface) return; MethodInfo[] methods = implementation.GetMethods( BindingFlags.Instance|BindingFlags.Public|BindingFlags.DeclaredOnly ); ArrayList problematicMethods = new ArrayList(); foreach( MethodInfo method in methods ) { if (!method.IsVirtual && method.IsDefined( typeof(PermissionAttribute), true )) { problematicMethods.Add( method.Name ); } } if (problematicMethods.Count != 0) { String[] methodNames = (String[]) problematicMethods.ToArray( typeof(String) ); String message = String.Format( "The class {0} wants to use security interception, " + "however the methods must be marked as virtual in order to do so. Please correct " + "the following methods: {1}", implementation.FullName, String.Join(", ", methodNames) ); throw new FacilityException(message); } }
public void Initialize(bool _includeDrafts) { // get the list of blogs, determine how many items we will be displaying, // and then have that drive the view mode string[] blogIds = BlogSettings.GetBlogIds(); int itemCount = (_includeDrafts ? 1 : 0) + 1 + blogIds.Length; _showLargeIcons = itemCount <= 5; // configure owner draw DrawMode = DrawMode.OwnerDrawFixed; SelectionMode = SelectionMode.One; HorizontalScrollbar = false; IntegralHeight = false; ItemHeight = CalculateItemHeight(_showLargeIcons); // populate list if (_includeDrafts) _draftsIndex = Items.Add(new PostSourceItem(new LocalDraftsPostSource(), this)); _recentPostsIndex = Items.Add(new PostSourceItem(new LocalRecentPostsPostSource(), this)); ArrayList blogs = new ArrayList(); foreach (string blogId in BlogSettings.GetBlogIds()) { blogs.Add(new PostSourceItem(Res.Get(StringId.Blog), new RemoteWeblogBlogPostSource(blogId), this)); } blogs.Sort(); Items.AddRange(blogs.ToArray()); }
public string[] GetSelectableNames(string prefixText) { ArrayList items = new ArrayList(); Encoding e = Encoding.GetEncoding("shift_jis"); string str = HttpUtility.UrlEncode(prefixText, e); XmlDocument document = new XmlDocument(); XmlReader reader = XmlReader.Create("http://api.kakaku.com/Ver1/ItemSearch.asp?Keyword=" + str + "&CategoryGroup=ALL&ResultSet=medium&SortOrder=popularityrank&PageNum=1"); document.Load(reader); XmlNodeList nodeList = document.SelectNodes(@"/ProductInfo/Item"); foreach (XmlNode node in nodeList) { ProductItem productItem = new ProductItem(); foreach (XmlNode attrnode in node) { switch (attrnode.Name) { case "ProductID": productItem.ProductID = attrnode.InnerText; break; case "ProductName": productItem.ProductName = attrnode.InnerText; break; } } items.Add(productItem.ProductID + ": " + productItem.ProductName); } return (String[])items.ToArray(typeof(String)); }
public WebsiteInstaller() { InstallerInfo info = InstallerInfo.GetInstallerInfo(); // Add a default one that we can always fall back to EventLogInstaller myEventLogInstaller = new EventLogInstaller(); myEventLogInstaller.Source = InstallerInfo.DefaultEventLogSource; Installers.Add(myEventLogInstaller); foreach (EventLogInfo source in info.EventLogInfos) { myEventLogInstaller = new EventLogInstaller(); myEventLogInstaller.Source = source.Source; Installers.Add(myEventLogInstaller); } foreach (PerformanceCounterCategoryInfo performanceCounter in info.PerformanceCounterCategoryInfos) { PerformanceCounterInstaller myCounterInstaller = new PerformanceCounterInstaller(); myCounterInstaller.CategoryHelp = performanceCounter.CategoryHelp; myCounterInstaller.CategoryName = performanceCounter.CategoryName; ArrayList counters = new ArrayList(); foreach (CounterCreationDataInfo creationDataInfo in performanceCounter.CounterCreationDataInfos) counters.Add(new CounterCreationData(creationDataInfo.CounterName, creationDataInfo.CounterHelp, creationDataInfo.CounterType)); myCounterInstaller.Counters.AddRange( (CounterCreationData[]) counters.ToArray(typeof (CounterCreationData))); Installers.Add(myCounterInstaller); } }
private void SelectLightmapUsers(object userData, string[] options, int selected) { int num = (int)userData; ArrayList arrayList = new ArrayList(); MeshRenderer[] array = UnityEngine.Object.FindObjectsOfType(typeof(MeshRenderer)) as MeshRenderer[]; MeshRenderer[] array2 = array; for (int i = 0; i < array2.Length; i++) { MeshRenderer meshRenderer = array2[i]; if (meshRenderer != null && meshRenderer.lightmapIndex == num) { arrayList.Add(meshRenderer.gameObject); } } Terrain[] array3 = UnityEngine.Object.FindObjectsOfType(typeof(Terrain)) as Terrain[]; Terrain[] array4 = array3; for (int j = 0; j < array4.Length; j++) { Terrain terrain = array4[j]; if (terrain != null && terrain.lightmapIndex == num) { arrayList.Add(terrain.gameObject); } } Selection.objects = (arrayList.ToArray(typeof(UnityEngine.Object)) as UnityEngine.Object[]); }
public DateTime[] GetTipTimes(string inFile) { ArrayList tipTimes = new ArrayList(); //open file if (!File.Exists(inFile)) { throw new Exception("file doesn't exist"); } // Open the file to read from.for each line, add tip time to an array using (StreamReader sr = File.OpenText(inFile)) { string s = ""; while ((s = sr.ReadLine()) != null) { if(DateIsValid(s)) { tipTimes.Add(DateTime.Parse(s)); } else Debug.WriteLine(s); } } return tipTimes.ToArray(Type.GetType("System.DateTime")) as DateTime []; }
public static string[] GetMXRecords(string domain) { IntPtr ptr1 = IntPtr.Zero; IntPtr ptr2 = IntPtr.Zero; MXRecord recMx; if (Environment.OSVersion.Platform != PlatformID.Win32NT) throw new NotSupportedException(); ArrayList list1 = new ArrayList(); int num1 = DnsMx.DnsQuery(ref domain, QueryTypes.DNS_TYPE_MX, QueryOptions.DNS_QUERY_BYPASS_CACHE, 0, ref ptr1, 0); if (num1 != 0) throw new Win32Exception(num1); for (ptr2 = ptr1; !ptr2.Equals(IntPtr.Zero); ptr2 = recMx.pNext) { recMx = (MXRecord)Marshal.PtrToStructure(ptr2, typeof(MXRecord)); if (recMx.wType == 15) { string text1 = Marshal.PtrToStringAuto(recMx.pNameExchange); list1.Add(text1); } } DnsMx.DnsRecordListFree(ptr1, 0); return (string[])list1.ToArray(typeof(string)); }
/// <summary> /// Parse and filter the supplied modifications. The position of each modification in the list is used as the ChangeNumber. /// </summary> /// <param name="history"></param> /// <param name="from"></param> /// <param name="to"></param> /// <returns></returns> public Modification[] Parse(TextReader history, DateTime from, DateTime to) { StringReader sr = new StringReader(string.Format(@"<ArrayOfModification xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">{0}</ArrayOfModification>" , history.ReadToEnd())); XmlSerializer serializer = new XmlSerializer(typeof(Modification[])); Modification[] mods; try { mods = (Modification[])serializer.Deserialize(sr); } catch (Exception ex) { throw new CruiseControlException("History Parsing Failed", ex); } ArrayList results = new ArrayList(); int change = 0; foreach (Modification mod in mods) { change++; mod.ChangeNumber = change; if ((mod.ModifiedTime >= from) & (mod.ModifiedTime <= to)) { results.Add(mod); } } return (Modification[])results.ToArray(typeof(Modification)); }
/// <summary> /// Prepare realtime inputs, and place them in an understandable one jagged input neuron array. /// you can use this method if you have many inputs and need to format them as inputs with a specified "window"/input size. /// You can add as many inputs as wanted to this input layer (parametrable inputs). /// </summary> /// <param name="inputsize">The inputsize.</param> /// <param name="firstinputt">The firstinputt.</param> /// <returns>a ready to use jagged array with all the inputs setup.</returns> public static double[][] AddInputs(int inputsize, params double[][] firstinputt) { ArrayList arlist = new ArrayList(4); ArrayList FirstList = new ArrayList(); List<double> listused = new List<double>(); int lenghtofArrays = firstinputt[0].Length; //There must be NO modulo...or the arrays would not be divisile by this input size. if (lenghtofArrays % inputsize != 0) return null; //we add each input one , after the other in a list of doubles till we reach the input size for (int i = 0; i < lenghtofArrays; i++) { for (int k = 0; k < firstinputt.Length; k++) { if (listused.Count < inputsize * firstinputt.Length) { listused.Add(firstinputt[k][i]); if (listused.Count == inputsize * firstinputt.Length) { FirstList.Add(listused.ToArray()); listused.Clear(); } } } } return (double[][])FirstList.ToArray(typeof(double[])); }
public override fsResult TryDeserialize(fsData data, ref object instance, Type storageType) { var result = fsResult.Success; // Verify that we actually have an List if ((result += CheckType(data, fsDataType.Array)).Failed) { return result; } Type elementType = storageType.GetElementType(); var serializedList = data.AsList; var list = new ArrayList(serializedList.Count); int existingCount = list.Count; for (int i = 0; i < serializedList.Count; ++i) { var serializedItem = serializedList[i]; object deserialized = null; if (i < existingCount) deserialized = list[i]; var itemResult = Serializer.TryDeserialize(serializedItem, elementType, ref deserialized); result.AddMessages(itemResult); if (itemResult.Failed) continue; if (i < existingCount) list[i] = deserialized; else list.Add(deserialized); } instance = list.ToArray(elementType); return result; }
public static string Text_Decryption(string text, int bits, string encryption_key) { string result = String.Empty; ArrayList list = new ArrayList(); try { RSACryptoServiceProvider rsacsp = new RSACryptoServiceProvider(bits); rsacsp.FromXmlString(encryption_key); int blockSizeBase64 = (bits / 8 % 3 != 0) ? (((bits / 8) / 3) * 4) + 4 : ((bits / 8) / 3) * 4; int iterations = text.Length / blockSizeBase64; for (int i = 0; i < iterations; i++) { Byte[] encrypted_bytes = Convert.FromBase64String(text.Substring(blockSizeBase64 * i, blockSizeBase64)); Array.Reverse(encrypted_bytes); list.AddRange(rsacsp.Decrypt(encrypted_bytes, true)); } } catch (Exception e) { result = "<Error>" + e.Message + "</Error>"; } result = Encoding.UTF32.GetString((Byte[])list.ToArray(typeof(Byte))); return result; }
public static HtmlElement[] GetElements(string text) { ArrayList list = new ArrayList(); int startIndex = 0; int index = 0; int num3 = 0; while (true) { num3 = index; startIndex = text.IndexOf('<', index); if (startIndex == -1) { list.Add(new HtmlElement(text.Substring(num3), ElementType.Text, null)); break; } index = text.IndexOf('>', startIndex + 1); if (index == -1) { list.Add(new HtmlElement(text.Substring(num3), ElementType.Text, null)); break; } if (startIndex != num3) { list.Add(new HtmlElement(text.Substring(num3, startIndex - num3), ElementType.Text, null)); } index++; list.Add(Parse(text.Substring(startIndex, index - startIndex))); } return (HtmlElement[]) list.ToArray(typeof(HtmlElement)); }
// Methods public new void Execute(CopyItemsArgs args) { Event.RaiseEvent("item:bucketing:cloning", args, this); Assert.ArgumentNotNull(args, "args"); var items = GetItems(args); if (args.IsNotNull()) { var itemId = args.Parameters["destination"]; if (itemId.IsNotNull()) { var database = GetDatabase(args); if (database.GetItem(itemId).IsBucketItemCheck()) { var list = new ArrayList(); foreach (var item3 in from item2 in items where item2.IsNotNull() let item = BucketManager.CreateAndReturnDateFolderDestination(database.GetItem(itemId), item2) let copyOfName = ItemUtil.GetCopyOfName(item, item2.Name) select item2.CloneTo(item, copyOfName, true)) { list.Add(item3); } args.Copies = list.ToArray(typeof(Item)) as Item[]; Event.RaiseEvent("item:bucketing:cloned", args, this); args.AbortPipeline(); } } } }
/// <summary> /// parse the config section /// </summary> /// <param name="parent"></param> /// <param name="configContext"></param> /// <param name="section"></param> /// <returns>an array of <see cref="MemCacheConfig"/> objects</returns> public object Create(object parent, object configContext, XmlNode section) { var configs = new ArrayList(); if (section != null) { XmlNodeList nodes = section.SelectNodes("memcached"); foreach (XmlNode node in nodes) { XmlAttribute h = node.Attributes["host"]; XmlAttribute p = node.Attributes["port"]; XmlAttribute w = node.Attributes["weight"]; if (h == null || p == null) { if (log.IsWarnEnabled) { log.Warn("incomplete node found - each memcached element must have a 'host' and a 'port' attribute."); } continue; } string host = h.Value; int port = ((string.IsNullOrEmpty(p.Value)) ? 0 : Convert.ToInt32(p.Value)); int weight = ((w == null || string.IsNullOrEmpty(w.Value)) ? 0 : Convert.ToInt32(w.Value)); configs.Add(new MemCacheConfig(host, port, weight)); } } return configs.ToArray(typeof (MemCacheConfig)); }
public static string[] Split( string src, char delimiter, params char[] quotedelims ) { ArrayList strings = new ArrayList(); StringBuilder sb = new StringBuilder(); ArrayList ar = new ArrayList(quotedelims); char quote_open = Char.MinValue; foreach (char c in src) { if (c == delimiter && quote_open == Char.MinValue) { strings.Add( sb.ToString() ); sb.Remove( 0, sb.Length ); } else if (ar.Contains(c)) { if (quote_open == Char.MinValue) quote_open = c; else if (quote_open == c) quote_open = Char.MinValue; sb.Append(c); } else sb.Append( c ); } if (sb.Length > 0) strings.Add( sb.ToString()); return (string[])strings.ToArray(typeof(string)); }
private static void LoadLocations() { string filePath = Path.Combine(Core.BaseDirectory, "Data/treasure.cfg"); ArrayList list = new ArrayList(); ArrayList havenList = new ArrayList(); if (File.Exists(filePath)) { using (StreamReader ip = new StreamReader(filePath)) { string line; while ((line = ip.ReadLine()) != null) { try { string[] split = line.Split(' '); int x = Convert.ToInt32(split[0]), y = Convert.ToInt32(split[1]); Point2D loc = new Point2D(x, y); list.Add(loc); } catch { } } } } m_Locations = (Point2D[])list.ToArray(typeof(Point2D)); }
public static string[] AllSites() { ArrayList allSites = new ArrayList(); allSites.AddRange(BatchSearchSites); string[] allSitesArray = (string[]) allSites.ToArray(typeof (string)); return allSitesArray; }
///<summary> ///</summary> ///<param name="args"></param> public CommandLine(string[] args) { ArrayList list = new ArrayList(); for (int i = 0; i < args.Length; i++) { char ch = args[i][0]; if ((ch != '/') && (ch != '-')) { list.Add(args[i]); } else { int index = args[i].IndexOf(':'); if (index == -1) { string strA = args[i].Substring(1); if ((string.Compare(strA, "help", StringComparison.OrdinalIgnoreCase) == 0) || strA.Equals("?")) { _showHelp = true; } else { Options[strA] = string.Empty; } } else { Options[args[i].Substring(1, index - 1)] = args[i].Substring(index + 1); } } } _arguments = (string[]) list.ToArray(typeof (string)); }
public static Device[] Scan(OneWire ow, params Family[] includeFamilies) { var addr = new byte[8]; var list = new ArrayList(); var all = false; var devs = ow.FindAllDevices(); if (includeFamilies != null) { foreach (var f in includeFamilies) { if (f == Family.Unknown) all = true; } } foreach (byte[] da in devs) { if (includeFamilies == null || includeFamilies.Length == 0 || all) { list.Add(new Device(da)); } else { foreach (var f in includeFamilies) { if (addr[0] == (byte)f) list.Add(new Device(da)); } } } return (Device[])list.ToArray(typeof(Device)); }
public IList FindProcessInstances(DateTime startedAfter, DateTime startedBefore, String initiatorActorId, String actorId, Int64 processDefinitionId, Relations relations, DbSession dbSession) { IList processInstances = null; String query = queryFindAllProcessInstances; ArrayList parameters = new ArrayList(); ArrayList types = new ArrayList(); if (startedAfter != DateTime.MinValue) { query += "and pi.StartNullable > ? "; parameters.Add(startedAfter); types.Add(DbType.DATE); } if (startedBefore != DateTime.MinValue) { query += "and pi.StartNullable < ? "; parameters.Add(startedBefore); types.Add(DbType.DATE); } if (initiatorActorId != null && initiatorActorId != "") { query += "and pi.InitiatorActorId = ? "; parameters.Add(initiatorActorId); types.Add(DbType.STRING); } if (actorId != null && actorId != "") { query += "and f.ActorId = ? "; parameters.Add(actorId); types.Add(DbType.STRING); } if (processDefinitionId != 0) { query += "and pi.ProcessDefinition.Id = ? "; parameters.Add(processDefinitionId); types.Add(DbType.LONG); } query += "order by pi.StartNullable desc"; log.Debug("query for searching process instances : '" + query + "'"); Object[] parameterArray = parameters.ToArray(); IType[] typeArray = (IType[]) types.ToArray(typeof (IType)); processInstances = dbSession.Find(query, parameterArray, typeArray); if (relations != null) { relations.Resolve(processInstances); } log.Debug("process instances : '" + processInstances + "'"); return processInstances; }