本文整理汇总了C#中System.Collections.ArrayList.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.ArrayList.Clear方法的具体用法?C# System.Collections.ArrayList.Clear怎么用?C# System.Collections.ArrayList.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.ArrayList
的用法示例。
在下文中一共展示了System.Collections.ArrayList.Clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getOutputdata
public override OutputQueueData getOutputdata()
{
//return base.getOutputdata();
System.Collections.ArrayList ary = new System.Collections.ArrayList();
int maxMode = -1000;
if (outputQueue.Count == 0)
return null;
System.Collections.IDictionaryEnumerator ie = outputQueue.GetEnumerator();
while (ie.MoveNext())
{
OutputQueueData quedata = (OutputQueueData)ie.Value;
if ((int)quedata.mode == maxMode)
{
ary.Add(quedata);
}
else if ((int)quedata.mode > maxMode)
{
ary.Clear();
ary.Add(quedata);
maxMode = (int)quedata.mode;
}
}
int maxSpd = -100;
OutputQueueData maxSpdQueData = null;
foreach (OutputQueueData data in ary)
{
if (data.data == null && maxSpdQueData == null)
{
maxSpdQueData = data;
continue;
}
System.Data.DataSet ds = ((RemoteInterface.HC.CSLSOutputData)data.data).dataset;
if (System.Convert.ToInt32(ds.Tables[0].Rows[0]["speed"]) > maxSpd)
{
maxSpdQueData = data;
maxSpd = System.Convert.ToInt32(ds.Tables[0].Rows[0]["speed"]);
}
}
return maxSpdQueData;
}
示例2: Ebayclassifieds
public void Ebayclassifieds(string statename)
{
if (stopebay)
{
int varcount = 0;
string sname = ""; string price = ""; string location = "";
string pho = ""; string desc = ""; string url = ""; string title = "";
string mainurl = "http://www.ebayclassifieds.com/state/";
string state = statename.ToLower();
if (state.Contains(" "))
state = state.Replace(" ", "+");
mainurl = mainurl + state;
FillCurrentPageData(mainurl);
Regex r1 = new Regex("<li>(.*?)</li>");
str = content;
str = content.Replace('\n', ' ');
System.Collections.ArrayList al1 = new System.Collections.ArrayList();
System.Text.RegularExpressions.MatchCollection mc1 = null;
mc1 = r1.Matches(str);
al1.Clear();
al1.InsertRange(al1.Count, mc1);
if (stopebay)
{
if (al1.Count > 0)
{
for (int i = 0; i < al1.Count; i++)
{
int page = 0;
string a = al1[i].ToString().Replace("<li>", "");
a = a.Substring(0, a.IndexOf(">"));
a = a.Replace("<a href=", "");
a = a.Replace("\"", "");
FillCurrentPageData(a + "cars/?catId=100028");
Regex r2 = new Regex("<span class=\"ec-breadcrumb\" style=\"padding-left: 5px;\">(.*?)</span>");
System.Collections.ArrayList al2 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc2 = null;
mc2 = r2.Matches(str);
al2.Clear();
al2.InsertRange(al2.Count, mc2);
if (al2.Count > 0)
{
string res = al2[0].ToString();
res = Regex.Replace(res, "[A-Za-z]", "");
string[] res1 = Regex.Split(res, @"\D+");
page = (int.Parse(res1[res1.Length - 2]) / 24) + 1;
}
if (stopebay)
{
for (int j = 0; j <= page; j++)
{
if (stopebay)
{
#region ebay
FillCurrentPageData(a + "cars/?catId=100028&page=" + j);
Regex r3 = new Regex("<div class=\"ad-title\"><p>(.*?)</p></div>");//<span class=\"h2\">(.*?)</span>
// <div class=\"h1gray\">(.*?)</div>
System.Collections.ArrayList al3 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc3 = null;
mc3 = r3.Matches(str);
al3.Clear();
al3.InsertRange(al3.Count, mc3);
if (al3.Count > 0)
{
for (int k = 0; k < al3.Count; k++)
{
url = al3[k].ToString();
url = url.Substring(url.IndexOf("href="), url.IndexOf("id=") - url.IndexOf("href="));
url = url.Replace("href=", "");
url = url.Replace("\"", "");
FillCurrentPageData(url);
Regex r4 = new Regex("<h1 id=\"ad-title\">(.*?)</span></h1>");
System.Collections.ArrayList al4 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc4 = null;
mc4 = r4.Matches(str);
al4.Clear();
al4.InsertRange(al4.Count, mc4);
if (al4.Count > 0)
{
for (int l = 0; l < al4.Count; l++)
{
string tot = al4[l].ToString();
if (tot.IndexOf("<span class=\"price\">") != -1)
{
title = tot.Substring(tot.IndexOf("<span>"), tot.IndexOf("<span class=\"price\">") - tot.IndexOf("<span>"));
tot = tot.Replace(title, "");
title = title.Replace("<span>", "");
title = title.Replace("</span>", "");
}
if (tot.IndexOf("<span class=\"location\">") != -1)
//.........这里部分代码省略.........
示例3: TestPhrasePrefix
public virtual void TestPhrasePrefix()
{
RAMDirectory indexStore = new RAMDirectory();
IndexWriter writer = new IndexWriter(indexStore, new SimpleAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
Add("blueberry pie", writer);
Add("blueberry strudel", writer);
Add("blueberry pizza", writer);
Add("blueberry chewing gum", writer);
Add("bluebird pizza", writer);
Add("bluebird foobar pizza", writer);
Add("piccadilly circus", writer);
writer.Optimize();
writer.Close();
IndexSearcher searcher = new IndexSearcher(indexStore);
// search for "blueberry pi*":
MultiPhraseQuery query1 = new MultiPhraseQuery();
// search for "strawberry pi*":
MultiPhraseQuery query2 = new MultiPhraseQuery();
query1.Add(new Term("body", "blueberry"));
query2.Add(new Term("body", "strawberry"));
System.Collections.ArrayList termsWithPrefix = new System.Collections.ArrayList();
IndexReader ir = IndexReader.Open(indexStore);
// this TermEnum gives "piccadilly", "pie" and "pizza".
System.String prefix = "pi";
TermEnum te = ir.Terms(new Term("body", prefix));
do
{
if (te.Term().Text().StartsWith(prefix))
{
termsWithPrefix.Add(te.Term());
}
}
while (te.Next());
query1.Add((Term[]) termsWithPrefix.ToArray(typeof(Term)));
Assert.AreEqual("body:\"blueberry (piccadilly pie pizza)\"", query1.ToString());
query2.Add((Term[]) termsWithPrefix.ToArray(typeof(Term)));
Assert.AreEqual("body:\"strawberry (piccadilly pie pizza)\"", query2.ToString());
ScoreDoc[] result;
result = searcher.Search(query1, null, 1000).scoreDocs;
Assert.AreEqual(2, result.Length);
result = searcher.Search(query2, null, 1000).scoreDocs;
Assert.AreEqual(0, result.Length);
// search for "blue* pizza":
MultiPhraseQuery query3 = new MultiPhraseQuery();
termsWithPrefix.Clear();
prefix = "blue";
te = ir.Terms(new Term("body", prefix));
do
{
if (te.Term().Text().StartsWith(prefix))
{
termsWithPrefix.Add(te.Term());
}
}
while (te.Next());
query3.Add((Term[]) termsWithPrefix.ToArray(typeof(Term)));
query3.Add(new Term("body", "pizza"));
result = searcher.Search(query3, null, 1000).scoreDocs;
Assert.AreEqual(2, result.Length); // blueberry pizza, bluebird pizza
Assert.AreEqual("body:\"(blueberry bluebird) pizza\"", query3.ToString());
// test slop:
query3.SetSlop(1);
result = searcher.Search(query3, null, 1000).scoreDocs;
Assert.AreEqual(3, result.Length); // blueberry pizza, bluebird pizza, bluebird foobar pizza
MultiPhraseQuery query4 = new MultiPhraseQuery();
try
{
query4.Add(new Term("field1", "foo"));
query4.Add(new Term("field2", "foobar"));
Assert.Fail();
}
catch (System.ArgumentException e)
{
// okay, all terms must belong to the same field
}
searcher.Close();
indexStore.Close();
}
示例4: getConfigDataTable
private static DataTable getConfigDataTable()
{
try
{
DataTable dt = new DataTable();
_tab = Globals.FindTable(ArcMap.Document.FocusMap, _defaultsTableName);
if (_tab == null)
return null;
for (int i = 0; i < _tab.Fields.FieldCount; i++)
{
if (_tab.Fields.get_Field(i).Type == esriFieldType.esriFieldTypeString)
dt.Columns.Add(_tab.Fields.get_Field(i).Name, typeof(string));
else if (_tab.Fields.get_Field(i).Type == esriFieldType.esriFieldTypeGlobalID)
dt.Columns.Add(_tab.Fields.get_Field(i).Name, typeof(string));
else if (_tab.Fields.get_Field(i).Type == esriFieldType.esriFieldTypeGUID)
dt.Columns.Add(_tab.Fields.get_Field(i).Name, typeof(string));
else if (_tab.Fields.get_Field(i).Type == esriFieldType.esriFieldTypeDate)
dt.Columns.Add(_tab.Fields.get_Field(i).Name, typeof(string));
else
dt.Columns.Add(_tab.Fields.get_Field(i).Name, typeof(int));
}
ICursor cur = _tab.Search(null, true);
IRow row;
System.Collections.ArrayList ar = new System.Collections.ArrayList();
while ((row = cur.NextRow()) != null)
{
for (int i = 0; i < _tab.Fields.FieldCount; i++)
{
ar.Add(row.get_Value(i));
}
dt.Rows.Add(ar.ToArray());
ar.Clear();
}
if (row != null)
{
Marshal.ReleaseComObject(row);
GC.WaitForFullGCComplete();
row = null;
}
if (cur != null)
{
Marshal.ReleaseComObject(cur);
GC.Collect(300);
GC.WaitForFullGCComplete();
cur = null;
}
return dt;
}
catch (Exception ex)
{
MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain0") + ex.Message);
return null;
}
}
开发者ID:rlwarford,项目名称:local-government-desktop-addins,代码行数:60,代码来源:AttributeAssistantEditorExtension.cs
示例5: UpdateMyBuffsListInternal
private void UpdateMyBuffsListInternal()
{
System.Collections.ArrayList dirty_items = new System.Collections.ArrayList();
for (int i = 0; i < listView_mybuffs_data.Items.Count; i++)
{
uint id = Util.GetUInt32(((ListViewItem)listView_mybuffs_data_items[i]).SubItems[3].Text);
if (Globals.gamedata.mybuffs.ContainsKey(id))
{
CharBuff cb = Util.GetBuff(id);
cb.InList = true;
if (cb.ExpiresTime == -1)
{
((ListViewItem)listView_mybuffs_data_items[i]).SubItems[2].Text = "ON";
}
else
{
System.TimeSpan remain = new System.TimeSpan(cb.ExpiresTime - System.DateTime.Now.Ticks);
//update it
//((ListViewItem)listView_npc_data_items[i]).SubItems[0].Text = Util.GetNPCName(npc.NPCID);
//((ListViewItem)listView_npc_data_items[i]).SubItems[1].Text = npc.Title;
((ListViewItem)listView_mybuffs_data_items[i]).SubItems[2].Text = ((int)remain.TotalMinutes).ToString() + ":" + remain.Seconds.ToString();
//((ListViewItem)listView_mybuffs_data_items[i]).SubItems[2].Text = cb.ID.ToString();
}
}
else
{
dirty_items.Add(i);
}
}
//need to remove all dirty items now
for (int i = dirty_items.Count - 1; i >= 0; i--)
{
listView_mybuffs_data_items.RemoveAt((int)dirty_items[i]);
}
dirty_items.Clear();
foreach (CharBuff cb in Globals.gamedata.mybuffs.Values)
{
if (!cb.InList)
{
cb.InList = true;
System.TimeSpan remain = new System.TimeSpan(0);
if (cb.ExpiresTime == -1)
{
}
else
{
remain = new System.TimeSpan(cb.ExpiresTime - System.DateTime.Now.Ticks);
}
//add it
System.Windows.Forms.ListViewItem ObjListItem;
ObjListItem = new ListViewItem(Util.GetSkillName(cb.ID,cb.SkillLevel));//Name
ObjListItem.SubItems.Add(cb.SkillLevel.ToString());//Title
if (cb.ExpiresTime == -1)
{
ObjListItem.SubItems.Add("ON");
}
else
{
ObjListItem.SubItems.Add(((int)remain.TotalMinutes).ToString() + ":" + remain.Seconds.ToString());//Remaining Time
}
ObjListItem.SubItems.Add(cb.ID.ToString());//ObjID
ObjListItem.ImageIndex = AddInfo.Get_Skill_Image_Index(cb.ID);
listView_mybuffs_data_items.Add(ObjListItem);
}
}
}
示例6: UpdateNPCListInternal
private void UpdateNPCListInternal()
{
System.Collections.ArrayList dirty_items = new System.Collections.ArrayList();
for (int i = 0; i < listView_npc_data.Items.Count; i++)
{
uint id = Util.GetUInt32(((ListViewItem)listView_npc_data_items[i]).SubItems[2].Text);
if (Globals.gamedata.nearby_npcs.ContainsKey(id))
{
NPCInfo npc = Util.GetNPC(id);
npc.InList = true;
//update it
//((ListViewItem)listView_npc_data_items[i]).SubItems[0].Text = Util.GetNPCName(npc.NPCID);
//((ListViewItem)listView_npc_data_items[i]).SubItems[1].Text = npc.Title;
//((ListViewItem)listView_npc_data_items[i]).SubItems[2].Text = npc.ID.ToString();
//((ListViewItem)listView_npc_data_items[i]).SubItems[3].Text = npc.NPCID.ToString();
}
else
{
dirty_items.Add(i);
}
}
//need to remove all dirty items now
for (int i = dirty_items.Count - 1; i >= 0; i--)
{
listView_npc_data_items.RemoveAt((int)dirty_items[i]);
}
dirty_items.Clear();
foreach (NPCInfo npc in Globals.gamedata.nearby_npcs.Values)
{
if (!npc.InList)
{
npc.InList = true;
if (npc.isInvisible != 1)
{
//add it
System.Windows.Forms.ListViewItem ObjListItem;
ObjListItem = new ListViewItem(Util.GetNPCName(npc.NPCID));//Name
ObjListItem.SubItems.Add(npc.Title);//Title
ObjListItem.SubItems.Add(npc.ID.ToString());//ObjID
ObjListItem.SubItems.Add(npc.NPCID.ToString());//TypeID
listView_npc_data_items.Add(ObjListItem);
}
}
}
}
示例7: UpdatePlayerListInternal
private void UpdatePlayerListInternal()
{
bool Active = true;
float x = Globals.gamedata.my_char.X;
float y = Globals.gamedata.my_char.Y;
float z = Globals.gamedata.my_char.Z;
System.Collections.ArrayList dirty_items = new System.Collections.ArrayList();
for (int i = 0; i < listView_players_data_items.Count; i++)
{
uint id = Util.GetUInt32(((ListViewItem)listView_players_data_items[i]).SubItems[5].Text);
if (Globals.gamedata.nearby_chars.ContainsKey(id))
{
CharInfo player = Util.GetChar(id);
player.InList = true;
//update it
((ListViewItem)listView_players_data_items[i]).SubItems[0].Text = player.WarState.ToString();
//((ListViewItem)listView_players_data_items[i]).SubItems[1].Text = player.Name;
if (Active)
{
((ListViewItem)listView_players_data_items[i]).SubItems[2].Text = Util.GetClass(player.Class) + (player.isAlikeDead == 0x00 ? " :A: " : " :D: ") + ((int)Util.Distance(x, y, z, player.X, player.Y, player.Z)).ToString("0000");
}
else
{
((ListViewItem)listView_players_data_items[i]).SubItems[2].Text = Util.GetClass(player.Class);
}
((ListViewItem)listView_players_data_items[i]).SubItems[3].Text = player.ClanName;//clan
((ListViewItem)listView_players_data_items[i]).SubItems[4].Text = player.AllyName;//ally
//((ListViewItem)listView_players_data_items[i]).SubItems[5].Text = player.ID.ToString();//didnt change
((ListViewItem)listView_players_data_items[i]).ImageIndex = player.ClanCrestIndex;
}
else
{
dirty_items.Add(i);
}
}
//need to remove all dirty items now
for (int i = dirty_items.Count - 1; i >= 0; i--)
{
listView_players_data_items.RemoveAt((int)dirty_items[i]);
}
dirty_items.Clear();
foreach (CharInfo player in Globals.gamedata.nearby_chars.Values)
{
//find the item in our arraylist...
if (!player.InList)
{
player.InList = true;
//add it
System.Windows.Forms.ListViewItem ObjListItem;
ObjListItem = new ListViewItem(player.WarState.ToString());//war
ObjListItem.SubItems.Add(player.Name);//name
if (Active)
{
ObjListItem.SubItems.Add(Util.GetClass(player.Class) + (player.isAlikeDead == 0x00 ? " :A: " : " :D: ") + ((int)Util.Distance(x, y, z, player.X, player.Y, player.Z)).ToString("0000"));//class
}
else
{
ObjListItem.SubItems.Add(Util.GetClass(player.Class));//class
}
ObjListItem.SubItems.Add(player.ClanName);//clan
ObjListItem.SubItems.Add(player.AllyName);//ally
ObjListItem.SubItems.Add(player.ID.ToString());//ID
//UpdateClanInfo(ObjListItem);
if (player.ClanCrestIndex != 0)
{
ObjListItem.ImageIndex = player.ClanCrestIndex;
}
else
{
ObjListItem.ImageIndex = -1;
}
//oop cache
if (Globals.gamedata.botoptions.OOPNamesArray.Contains(player.Name.ToUpperInvariant()))
{
if (!Globals.gamedata.botoptions.OOPIDs.Contains(player.ID))
{
Globals.gamedata.botoptions.OOPIDs.Add(player.ID);
}
}
listView_players_data_items.Add(ObjListItem);
}
}
}
示例8: loadTravelSetting
public void loadTravelSetting()
{
System.Collections.ArrayList ary = new System.Collections.ArrayList();
System.Collections.ArrayList mainary = new System.Collections.ArrayList();
OdbcConnection cn = new OdbcConnection(Global.Db2ConnectionString);
OdbcDataReader rdMain, rd;
OdbcCommand cmd = new OdbcCommand();
OdbcCommand cmdMain = new OdbcCommand();
cmd.Connection = cn;
cmdMain.Connection = cn;
try
{
cn.Open();
cmdMain.CommandText = "select DISPLAY_PART ,g_code_id,message1,message2,msg1forecolor,msg2forecolor,msg1backcolor,msg2backcolor,uppertravelTime,lowerTravelTime,offset,enable from tblRGSTravelTime where devicename='" + this.deviceName + "' and enable='Y' order by display_part";
//if (deviceName == "CMS-T78-E-28.5")
// Console.WriteLine();
rdMain = cmdMain.ExecuteReader();
while (rdMain.Read())
{
ary.Clear();
int displaypart = System.Convert.ToInt32(rdMain[0]);
int iconid = System.Convert.ToInt32(rdMain[1]);
string mesg1 = rdMain[2].ToString();
string mesg2 = rdMain[3].ToString();
string[] tmp = rdMain[4].ToString().Split(new char[] { ',' });
byte[] fcolor1 = new byte[mesg1.Length];
// if (mesg1.Length != 0)
for (int i = 0; i < fcolor1.Length; i++)
fcolor1[i] = System.Convert.ToByte(tmp[i]);
tmp = rdMain[5].ToString().Split(new char[] { ',' });
byte[] fcolor2 = new byte[mesg2.Length];
for (int i = 0; i < fcolor2.Length; i++)
fcolor2[i] = System.Convert.ToByte(tmp[i]);
tmp = rdMain[6].ToString().Split(new char[] { ',' });
int upperTravelTime = System.Convert.ToInt32(rdMain[8]);
int lowerTraveltime = System.Convert.ToInt32(rdMain[9]);
int offset = System.Convert.ToInt32(rdMain[10]);
bool enable = rdMain[11].ToString().ToUpper() == "Y" ? true : false;
//byte[] bcolor1 = new byte[tmp.Length];
//for (int i = 0; i < bcolor1.Length; i++)
// bcolor1[i] = System.Convert.ToByte(tmp[i]);
//tmp = rdMain[7].ToString().Split(new char[] { ',' });
//byte[] bcolor2 = new byte[tmp.Length];
//for (int i = 0; i < bcolor2.Length; i++)
// bcolor2[i] = System.Convert.ToByte(tmp[i]);
#region read detail
cmd.CommandText = "select start_lineid, direction, display_part,start_mileage,end_mileage, isXml from tblRgsTravelTimeDetail where devicename='" + this.deviceName + "' and Display_part=" + displaypart;
rd = cmd.ExecuteReader();
while (rd.Read())
{
string lineid = rd[0].ToString();
string direction = rd[1].ToString();
int displaypartd = System.Convert.ToInt32(rd[2]);
int startmile = System.Convert.ToInt32(rd[3]);
int endmile = System.Convert.ToInt32(rd[4]);
bool isXml = (System.Convert.ToString(rd[5])=="Y")?true:false;;
ary.Add(new TravelDisplayDetailData(displaypartd, lineid, direction, startmile, endmile,isXml));
}
rd.Close();
TravelDisplayDetailData[] ddata = new TravelDisplayDetailData[ary.Count];
for (int i = 0; i < ddata.Length; i++)
ddata[i] = (TravelDisplayDetailData)ary.ToArray()[i];
#endregion
mainary.Add(new TravelDisplaySettingData(displaypart, iconid, mesg1, mesg2, fcolor1, fcolor2, null, null, ddata,upperTravelTime,lowerTraveltime,offset,enable));
}
rdMain.Close();
travelDisplaySettingData = new TravelDisplaySettingData[mainary.Count];
for (int i = 0; i < travelDisplaySettingData.Length; i++)
travelDisplaySettingData[i] = (TravelDisplaySettingData)mainary.ToArray()[i];
}
catch (Exception ex)
{
RemoteInterface.ConsoleServer.WriteLine(this.deviceName+ex.Message + ex.StackTrace);
}
finally
{
cn.Close();
}
}
示例9: RemoveAllAppointments_costumer
/// <summary>
/// Remove all instances of Appointment from the collection
/// </summary>
/// <pdGenerated>Default removeAll</pdGenerated>
public void RemoveAllAppointments_costumer()
{
if (appointments_costumer != null)
{
System.Collections.ArrayList tmpAppointments_costumer = new System.Collections.ArrayList();
foreach (Appointment oldAppointment in appointments_costumer)
tmpAppointments_costumer.Add(oldAppointment);
appointments_costumer.Clear();
foreach (Appointment oldAppointment in tmpAppointments_costumer)
oldAppointment.Costumers_Appointments = null;
tmpAppointments_costumer.Clear();
}
}
示例10: BuildCalculate
/// <summary>
/// Constrói dados do grupo.
/// Percorre tabela de dados do relatório, filtrando e distinguindo os dados pela coluna do grupo.
/// Também calcula os valores de cada grupo, totalizando-os.
/// </summary>
/// <param name="p_table">Tabela de dados do relatório.</param>
/// <param name="p_parentgroupcolumn">Coluna do grupo pai.</param>
public void BuildCalculate(System.Data.DataTable p_table, string p_parentgroupcolumn)
{
System.Collections.ArrayList v_allcolumns_temp;
string[] v_allcolumns;
int i, j, k;
// PASSO 1: PEGANDO COLUNAS E DADOS DO GRUPO
// alocando lista de colunas
v_allcolumns_temp = new System.Collections.ArrayList();
// adicionando coluna do grupo pai
if (p_parentgroupcolumn != null && p_parentgroupcolumn != "")
v_allcolumns_temp.Add(p_parentgroupcolumn);
// adicionando coluna do grupo
v_allcolumns_temp.Add(this.v_column);
// adicionando todas as colunas do cabeçalho do grupo (exceto as colunas de valor)
for (k = 0; k < this.v_headerfields.Count; k++)
{
if (((Spartacus.Reporting.Field)this.v_headerfields [k]).v_column != "" &&
!((Spartacus.Reporting.Field)this.v_headerfields [k]).v_groupedvalue &&
!v_allcolumns_temp.Contains(((Spartacus.Reporting.Field)this.v_headerfields [k]).v_column))
v_allcolumns_temp.Add(((Spartacus.Reporting.Field)this.v_headerfields [k]).v_column);
}
// adicionando todas as colunas do rodapé do grupo (exceto as colunas de valor)
for (k = 0; k < this.v_footerfields.Count; k++)
{
if (((Spartacus.Reporting.Field)this.v_footerfields [k]).v_column != "" &&
!((Spartacus.Reporting.Field)this.v_footerfields [k]).v_groupedvalue &&
!v_allcolumns_temp.Contains(((Spartacus.Reporting.Field)this.v_footerfields [k]).v_column))
v_allcolumns_temp.Add(((Spartacus.Reporting.Field)this.v_footerfields [k]).v_column);
}
// alocando vetor de string
v_allcolumns = new string[v_allcolumns_temp.Count];
// copiando nomes de colunas para o vetor de string
for (k = 0; k < v_allcolumns_temp.Count; k++)
v_allcolumns [k] = (string)v_allcolumns_temp [k];
// filtrando dados distintos pela lista de colunas, e armazenando em tabela
if (p_parentgroupcolumn != null && p_parentgroupcolumn != "")
p_table.DefaultView.Sort = p_parentgroupcolumn + ", " + this.v_column;
else
p_table.DefaultView.Sort = this.v_column;
this.v_table = p_table.DefaultView.ToTable(true, v_allcolumns);
// PASSO 2: PREENCHENDO VALORES
// limpando array temporario
v_allcolumns_temp.Clear();
// adicionando todas as colunas do cabeçalho do grupo (somente as colunas de valor)
for (k = 0; k < this.v_headerfields.Count; k++)
{
if (((Spartacus.Reporting.Field)this.v_headerfields [k]).v_column != "" &&
((Spartacus.Reporting.Field)this.v_headerfields [k]).v_groupedvalue &&
! v_allcolumns_temp.Contains(((Spartacus.Reporting.Field)this.v_headerfields [k]).v_column))
v_allcolumns_temp.Add(((Spartacus.Reporting.Field)this.v_headerfields [k]).v_column);
}
// adicionando todas as colunas do rodapé do grupo (somente as colunas de valor)
for (k = 0; k < this.v_footerfields.Count; k++)
{
if (((Spartacus.Reporting.Field)this.v_footerfields [k]).v_column != "" &&
((Spartacus.Reporting.Field)this.v_footerfields [k]).v_groupedvalue &&
! v_allcolumns_temp.Contains(((Spartacus.Reporting.Field)this.v_footerfields [k]).v_column))
v_allcolumns_temp.Add(((Spartacus.Reporting.Field)this.v_footerfields [k]).v_column);
}
// criando colunas de valor na tabela do grupo
for (k = 0; k < v_allcolumns_temp.Count; k++)
this.v_table.Columns.Add((string)v_allcolumns_temp [k]);
// preenchendo valores sumarizados
for (i = 0; i < this.v_table.Rows.Count; i++)
{
for (j = 0; j < v_allcolumns_temp.Count; j++)
this.v_table.Rows [i] [(string)v_allcolumns_temp [j]] = p_table.Compute("Sum(" + ((string)v_allcolumns_temp [j]) + ")", this.v_column + " = '" + this.v_table.Rows [i] [this.v_column].ToString() + "'").ToString();
}
}
示例11: TestPatch
/*
public static void TestPatch(FpuSegment seg) {
ArrayList TempCode;
//Generate the code
TempCode=new ArrayList(Program.ReadFileBytes("out"));
byte[] sseCode=(byte[])TempCode.ToArray(typeof(byte));
TempCode.Clear();
StreamWriter sr=new StreamWriter("tout.txt");
sr.WriteLine("bits 32");
foreach(string s in seg.TestData) {
sr.WriteLine(s);
}
sr.Close();
Process p=new Process();
p.StartInfo.FileName="nasm.exe";
p.StartInfo.Arguments="-o tout tout.txt";
p.StartInfo.UseShellExecute=false;
p.StartInfo.CreateNoWindow=true;
p.Start();
p.WaitForExit();
p.Close();
FileInfo fi=new FileInfo("tout");
if(fi.Length==0) throw new OptimizationException("Patcher: patch tester produced uncompilable code");
TempCode.AddRange(Program.ReadFileBytes("tout"));
byte[] fpuCode=(byte[])TempCode.ToArray(typeof(byte));
//inject and run the code
if(sseCode.Length>InjectionLength||fpuCode.Length>InjectionLength)
throw new OptimizationException("Checker: Injection site is too short");
try {
File.Delete("asmTester2.exe");
} catch { }
try {
File.Copy("asmTester.exe","asmTester2.exe");
FileStream fs=File.Open("asmTester2.exe",FileMode.Open);
fs.Position=TestPoint1;
fs.Write(fpuCode,0,fpuCode.Length);
fs.Position=TestPoint2;
fs.Write(sseCode,0,sseCode.Length);
fs.Close();
p=new Process();
p.StartInfo.UseShellExecute=false;
p.StartInfo.CreateNoWindow=true;
p.StartInfo.FileName="asmTester2.exe";
p.Start();
p.WaitForExit();
if(!p.HasExited) {
p.Kill();
p.Close();
throw new OptimizationException("Checker: Process has not exited");
}
if(p.ExitCode!=1) {
p.Close();
throw new OptimizationException("Checker: Patch appears to be corrupt");
}
p.Close();
} catch (Exception e) {
if(e is OptimizationException) throw;
throw new OptimizationException("Checker: Something threw an exception");
}
}
*/
public static void Benchmark(FpuSegment seg)
{
ArrayList TempCode;
//Get the sse code
TempCode=new ArrayList(Program.ReadFileBytes("out"));
TempCode.AddRange(JumpCode);
byte[] bytes=(byte[])TempCode.ToArray(typeof(byte));
TempCode.Clear();
//Get the fpu code
int a=0;
for(int i=0;i<seg.Lines.Length;i++) {
if(a==CodeGenerator.FpuLines.Length) break;
if(CodeGenerator.FpuLines[a]==i) {
TempCode.AddRange(HexToString(seg.Lines[i].code));
a++;
}
}
TempCode.AddRange(JumpCode);
byte[] bytes2=(byte[])TempCode.ToArray(typeof(byte));
Benchmark(bytes,bytes2);
if(!Program.IgnoreBenchmark) {
if(SseTime>=FpuTime+Bias) throw new OptimizationException("Benchmarker: Patch was slower than original code");
}
}
示例12: GetLeadsForOodle
public void GetLeadsForOodle(string state)
{
int varcount = 0;
string mainurl = "http://cars.oodle.com/used-cars/for-sale/" + state + "/condition_used/?o=";
int res = 0;
for (int i = 0; i <= 267; i++)
{
res = i * 15;
string url1 = mainurl + res;
FillCurrentPageData(url1);
//url list
Regex r11 = new Regex("<span class=\"listing-title\">(.*?)</span>");
str = content;
str = content.Replace('\n', ' ');
System.Collections.ArrayList al11 = new System.Collections.ArrayList();
System.Text.RegularExpressions.MatchCollection mc11 = null;
mc11 = r11.Matches(str);
al11.Clear();
al11.InsertRange(al11.Count, mc11);
if (al11.Count > 0)
{
if (stopoodle)
{
for (int k = 0; k < al11.Count; k++)
{
string sname = ""; string title = ""; string url = "";
string price = ""; string phno = "";
string location = ""; string description = "";
string statename = ""; string city = "";
if (stopoodle)
{
#region data
if (al11[k].ToString().IndexOf("href=") != -1)
url = al11[k].ToString().Substring(al11[k].ToString().IndexOf("href="));
if(url.IndexOf("title=\"\"") !=-1)
url = url.Substring(0, url.IndexOf("title=\"\""));
url = url.Replace(",,", "");
url = url.Replace("href=", "");
url = url.Replace("\"", "");
url = "http://cars.oodle.com" + url;
FillCurrentPageData(url);
//seller-name
Regex r1 = new Regex("<span id=\"seller-name\">(.*?)</span>");
str = content;
str = content.Replace('\n', ' ');
System.Collections.ArrayList al1 = new System.Collections.ArrayList();
System.Text.RegularExpressions.MatchCollection mc1 = null;
mc1 = r1.Matches(str);
al1.Clear();
al1.InsertRange(al1.Count, mc1);
if (al1.Count > 0)
{
for (int j = 0; j < al1.Count; j++)
{
sname = al1[j].ToString();
if (sname.IndexOf("</a>") != -1)
{
sname = sname.Substring(0, sname.IndexOf("</a>"));
sname = sname.Replace("</a>", "");
sname = sname.Substring(sname.LastIndexOf(">"));
sname = sname.Replace(">", "");
}
else
{
sname = sname.Replace("<span>", "");
sname = sname.Replace("</span>", "");
}
}
}
//title
Regex r2 = new Regex("<h2 id=\"detail-title-text\">(.*?)</h2>");
System.Collections.ArrayList al2 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc2 = null;
mc2 = r2.Matches(str);
al2.Clear();
al2.InsertRange(al2.Count, mc2);
if (al2.Count > 0)
{
for (int j = 0; j < al2.Count; j++)
{
title = al2[j].ToString();
title = title.Replace("<h2 id=\"detail-title-text\">", "");
title = title.Replace("</h2>", "");
title = title.Replace("\t", "").Trim();
}
}
//price
Regex r3 = new Regex("<div id=\"listing-price\">(.*?)</div>(.*?)</div>");//<span class=\"h2\">(.*?)</span>
// <div class=\"h1gray\">(.*?)</div>
System.Collections.ArrayList al3 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc3 = null;
//.........这里部分代码省略.........
示例13: GetLeadsForLocanto
public void GetLeadsForLocanto(string statecode)
{
string pages = ""; int page = 0;
//string mainurl = "http://www.locanto.com/Vehicles/H/?professional=0&page=";
string mainurl = "http://" + statecode + ".locanto.com/Vehicles/H/";
if (stoplocanto)
{
FillCurrentPageData(mainurl);
Regex regexindividual31 = new Regex("<div style=\"padding:3px 0 0 240px;\">(.*?)</div>");
str = content;
str = content.Replace('\n', ' ');
System.Collections.ArrayList individualCararraylist31 = new System.Collections.ArrayList();
System.Text.RegularExpressions.MatchCollection regexindividualCollec31 = null;
regexindividualCollec31 = regexindividual31.Matches(str);
individualCararraylist31.Clear();
individualCararraylist31.InsertRange(individualCararraylist31.Count, regexindividualCollec31);
if (individualCararraylist31.Count > 0)
{
pages = individualCararraylist31[0].ToString().Replace("<div style=\"padding:3px 0 0 240px;\">", "");
pages = Regex.Replace(pages, "[^0-9]", "");
pages = (int.Parse(pages) / 25).ToString();
page = int.Parse(pages);
if (page > 79)
page = 79;
}
for (int p = 0; p <= page; p++)
{
if (stoplocanto)
{
#region tot
FillCurrentPageData(mainurl + p + "/");
Regex regexindividual3 = new Regex("<span class=\"textHeader \">(.*?)</span>");
str = content;
str = content.Replace('\n', ' ');
System.Collections.ArrayList individualCararraylist3 = new System.Collections.ArrayList();
System.Text.RegularExpressions.MatchCollection regexindividualCollec3 = null;
regexindividualCollec3 = regexindividual3.Matches(str);
individualCararraylist3.Clear();
individualCararraylist3.InsertRange(individualCararraylist3.Count, regexindividualCollec3);
for (int dj = 0; dj < individualCararraylist3.Count; dj++)
{
string desc = ""; string title = ""; string price = "";
string pubDate = ""; string name = "";
string location = ""; string place = ""; string phno = string.Empty;
string state = ""; string city = "";
#region fetch
string url = individualCararraylist3[dj].ToString();
url = url.Substring(url.IndexOf("href="));
url = url.Replace("href=", "");
url = url.Substring(0, url.IndexOf("onclick"));
//url = url.Replace(">", "");
url = url.Replace("\"", "");
title = individualCararraylist3[dj].ToString();
title = title.Replace("<span class=\"textHeader \">", "");
title = title.Substring(title.IndexOf(">"));
title = title.Replace(">", "").Trim();
if (title.IndexOf("<span") != -1)
{
//location = title.Substring(title.IndexOf("<span"));
title = title.Substring(0, title.IndexOf("<span"));
//location = location.Replace("<span class=\"textLoc\"", "");
//location = location.Replace("</span", "").Trim();
//if (location.IndexOf(",") != -1)
// city = location.Substring(0, location.IndexOf(","));
//else
// city = location;
//state = location.Replace(city, "");
//state = state.Replace(",", "");
//state = Regex.Replace(state, "[0-9]", "");
}
else
title = title.Replace("</span", "");
//location = title.Substring(title.IndexOf("<span"));
FillCurrentPageData(url);
Regex r3 = new Regex("<div class=\"user_content\">(.*?)</div>");//<span class=\"h2\">(.*?)</span>
// <div class=\"h1gray\">(.*?)</div>
System.Collections.ArrayList al3 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc3 = null;
mc3 = r3.Matches(str);
al3.Clear();
al3.InsertRange(al3.Count, mc3);
for (int x = 0; x < al3.Count; x++)
{
desc = al3[x].ToString();
desc = desc.Replace("<div class=\"user_content\">", "");
desc = desc.Replace("</div>", "");
//desc = desc.Substring(0, desc.IndexOf("<!-- AddThis Button BEGIN -->"));
string phone = Regex.Replace(desc, "[A-Za-z]", "");
string[] digits = Regex.Split(phone, @"\D+");
//.........这里部分代码省略.........
示例14: GetLeadsForGlobal
public void GetLeadsForGlobal()
{
int varcount = 0;
for (int a = 1; a <= 43; a++)
{
string mainurl = "http://usa.global-free-classified-ads.com/cars-cid-14-page-" + a;
FillCurrentPageData(mainurl);
//<span class="location">
Regex r2 = new Regex("<span class=\"location\">(.*?)</span>");
System.Collections.ArrayList al2 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc2 = null;
mc2 = r2.Matches(str);
al2.Clear();
al2.InsertRange(al2.Count, mc2);
Regex regexindividual31 = new Regex("<h1>(.*?)</h1>");
str = content;
str = content.Replace('\n', ' ');
System.Collections.ArrayList individualCararraylist31 = new System.Collections.ArrayList();
System.Text.RegularExpressions.MatchCollection regexindividualCollec31 = null;
regexindividualCollec31 = regexindividual31.Matches(str);
individualCararraylist31.Clear();
individualCararraylist31.InsertRange(individualCararraylist31.Count, regexindividualCollec31);
for (int p = 0; p < individualCararraylist31.Count; p++)
{
string desc = ""; string title = ""; string price = "";
string pubDate = ""; string name = "";
string location = ""; string place = ""; string phno = string.Empty;
string city = ""; string state = "";
string url = individualCararraylist31[p].ToString();
url = url.Substring(url.IndexOf("href="));
url = url.Replace("href=", "");
url = url.Substring(0, url.IndexOf(">"));
url = url.Replace("\"", "");
location = al2[p].ToString().Replace("<span class=\"location\">", "");
location = location.Replace("</span>", "");
location = location.Replace("</a>", "");
if(location.IndexOf(">") != -1)
location = location.Substring(location.IndexOf(">"));
location = location.Replace("Cars", "");
location = location.Replace(">", "");
location = location.Replace(":", "");
if (location.IndexOf(",") != -1)
{
city = location.Substring(0, location.IndexOf(","));
state = location.Replace(city + ",", "");
if (state.IndexOf(",") != -1)
state = state.Substring(0, state.IndexOf(","));
}
else
{
state = location;
city = "";
}
FillCurrentPageData(url);
Regex r3 = new Regex("<div class=\"content_box_1\">(.*?)</div>");
System.Collections.ArrayList al3 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc3 = null;
mc3 = r3.Matches(str);
al3.Clear();
al3.InsertRange(al3.Count, mc3);
for (int x = 0; x < al3.Count; x++)
{
if (al3[x].ToString().Contains("Seller's Comments and Description:"))
{
desc = al3[x].ToString();
desc = desc.Replace("<div class=\"user_content\">", "");
desc = desc.Replace("</div>", "");
desc = desc.Replace("<div class=\"content_box_1\">", "");
desc = desc.Replace("<h3>Seller's Comments and Description:</h3>", "");
desc = desc.Replace("<p>", "");
string phone = Regex.Replace(desc, "[A-Za-z]", "");
string[] digits = Regex.Split(phone, @"\D+");
for (int ph = 0; ph < digits.Length; ph++)
{
if (digits[ph].Length == 10)
{
phno = digits[ph];
}
else if (digits[ph].Length == 3 && digits[ph + 1].Length == 3 && digits[ph + 2].Length == 4)
{
phno = digits[ph] + digits[ph + 1] + digits[ph + 2];
}
else if (digits[ph].Length == 3 && digits[ph + 1].Length == 7)
{
phno = digits[ph] + digits[ph + 1];
}
}
}
//.........这里部分代码省略.........
示例15: BackPage
public void BackPage(string state)
{
string phno = ""; string title = ""; string price = "";
int varcount = 0; string city = "";
for (int j = 1; j <= 100; j++)
{
string mainurl = "http://" + state.Replace(" ", "").ToLower() + ".backpage.com/AutosForSale/" + "?page=" + j;
FillCurrentPageData(mainurl);
Regex r1 = new Regex("<div class=\"cat\">(.*?)</div>");
str = content;
str = content.Replace('\n', ' ');
System.Collections.ArrayList al1 = new System.Collections.ArrayList();
System.Text.RegularExpressions.MatchCollection mc1 = null;
mc1 = r1.Matches(str);
al1.Clear();
al1.InsertRange(al1.Count, mc1);
if (al1.Count > 0)
{
if (stopbackpage)
{
for (int i = 0; i < al1.Count; i++)
{
if (stopbackpage)
{
string url = al1[i].ToString();
url = url.Replace("<div class=\"cat\">", "");
url = url.Substring(0, url.IndexOf(">"));
url = url.Replace("<a href=", "");
url = url.Replace("\r", "");
url = url.Replace("\"", "").Trim();
FillCurrentPageData(url);
Regex r21 = new Regex("<div style=\"padding-left:2em;\">(.*?)</div>");
System.Collections.ArrayList al21 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc21 = null;
mc21 = r21.Matches(str);
al21.Clear();
al21.InsertRange(al21.Count, mc21);
if (al21.Count > 0)
{
city = al21[0].ToString();
city = city.Replace("<div style=\"padding-left:2em;\">", "");
city = city.Replace("• Location:", "").Trim();
city = city.Replace("</div>", "").Trim();
if (city.IndexOf(",") != -1)
{
city = city.Substring(0, city.IndexOf(","));
city = city.Replace(",", "");
}
}
Regex r2 = new Regex("<a class=\"h1link\" href=\"javascript:void;\">(.*?)</a>");
System.Collections.ArrayList al2 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc2 = null;
mc2 = r2.Matches(str);
al2.Clear();
al2.InsertRange(al2.Count, mc2);
if (al2.Count > 0)
{
for (int k = 0; k < al2.Count; k++)
{
title = al2[k].ToString();
title = title.Replace("<a class=\"h1link\" href=\"javascript:void;\">", "");
title = title.Replace("</a>", "");
title = title.Replace("<h1>", "");
title = title.Replace("</h1>", "");
if (title.Contains("$"))
{
title = title.Replace(",", "");
price = title.Substring(0, title.IndexOf(" "));
}
}
}
Regex r3 = new Regex("<div class=\"postingBody\">(.*?)</div>(.*?)<p class=\"metaInfoDisplay\">");
//<span class=\"h2\">(.*?)</span>
// <div class=\"h1gray\">(.*?)</div>
System.Collections.ArrayList al3 = new System.Collections.ArrayList();
str = content;
str = content.Replace('\n', ' ');
System.Text.RegularExpressions.MatchCollection mc3 = null;
mc3 = r3.Matches(str);
al3.Clear();
al3.InsertRange(al3.Count, mc3);
phno = "";
if (al3.Count > 0)
{
for (int l = 0; l < al3.Count; l++)
{
string desc = al3[l].ToString();
string phone = Regex.Replace(desc, "[A-Za-z]", "");
string[] digits = Regex.Split(phone, @"\D+");
//.........这里部分代码省略.........