listbox 排序 取行号问题? 救命!!!!!!!!!!!

hellomaina 2008-07-08 03:41:57
ListBox1 listbox2
a c
b f
c a
d
e
f
首先要看listbox1 在listbox2中是否存在。
如果存在 就要排列成对象的显示行号。例如 a 对应的就是2 ; c 对应的就是 0; f 对应的就是 1;
如果不存在就依次往下排。
上面我想要出来的结果就是 。 2,3,0,4,5,1
求助
...全文
277 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
nattystyle 2008-07-08
  • 打赏
  • 举报
回复

System.Text.StringBuilder sb = new System.Text.StringBuilder();
int iTemp = 0;
bool bFlag = false;
for (int i = 0; i < listBox1.Items.Count; i++)
if (listBox2.Items.Contains(listBox1.Items[i]))
{
sb.Append((int)listBox2.Items.IndexOf(listBox1.Items[i]));
if (!bFlag)
{
iTemp = (int)listBox2.Items.IndexOf(listBox1.Items[i]);
bFlag = true;
}
}
else
sb.Append(++iTemp);
MessageBox.Show(sb.ToString());
Ador3 2008-07-08
  • 打赏
  • 举报
回复
遍历,遍历,再遍历就ok了!
zzyhuian06142 2008-07-08
  • 打赏
  • 举报
回复
int _count = this.listBox2.Items.Count;
int[] _index = new int[this.listBox1.Items.Count];
int i = 0;
foreach(object _obj1 in this.listBox1.Items)
{
int ii=0;
bool _islive =false;
foreach(object _obj2 in this.listBox2.Items)
{
if(_obj1.ToString()==_obj2.ToString())
{
_islive =true;
break;
}
ii = ii+1;
}
if(_islive)
{
_index[i] = ii;
}
else
{
_index[i] = _count;
_count = _count +1;
}
i = i+1;
}
string _str="";
for(int iii = 0;iii<_index.Length;iii++)
{
_str =_str + _index[iii] + ";";
}
MessageBox.Show(_str);
ericzhangbo1982111 2008-07-08
  • 打赏
  • 举报
回复
ListBox l = new ListBox();
ListBox l2 = new ListBox();
l.Items.Add("a");
l.Items.Add("b");
l.Items.Add("c");
l.Items.Add("d");
l.Items.Add("e");
l.Items.Add("f");

l2.Items.Add("c");
l2.Items.Add("f");
l2.Items.Add("a");

ArrayList list = new ArrayList();
int count = l2.Items.Count;
foreach (object o in l.Items)
{
int index = l2.Items.IndexOf(o);
if (index == -1)
{
list.Add(count + "");
count++;

}
else
{
list.Add(index.ToString());
}
}



输出
2,3 0, 4, 5,1
pupo 2008-07-08
  • 打赏
  • 举报
回复
int tmpIndex = this.listBox2.Items.Count;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
int index;
foreach (string s in this.listBox1.Items)
{
index = this.listBox2.Items.IndexOf(s);
if (index != -1)
sb.Append(index + ",");
else
{
sb.Append(tmpIndex.ToString() + ",");
tmpIndex++;
}
}
MessageBox.Show(sb.ToString());
huming_h 2008-07-08
  • 打赏
  • 举报
回复
如果不存在就依次往下排。
那3,4,5是什么意思?
ericzhangbo1982111 2008-07-08
  • 打赏
  • 举报
回复
3 ,4, 5
那来的?
内容概要:本文详细记录了对一个Android ARM64静态ELF文件中字符串加密机制的逆向分析过程。该ELF文件的所有字符串均被加密,无法通过常规strings命令或IDA直接识别。作者通过分析发现,加密字符串存储在.rodata段,其解密所需信息(包括密文地址、长度和16位密钥)保存在.data.rel.ro段的40字节描述符中。核心解密函数sub_10F408采用自反的双pass流密码算法,结合固定密钥KEY_TERM(由.data段24字节数据计算得出),实现字节级非线性、位置与长度相关的加密。文章还复现了完整的Python解密脚本,并揭示了该保护机制的本质为代码混淆而非强加密,最终成功批量解密全部956条字符串,暴露程序真实行为,如shell命令模板、设备标识篡改、网络重置等操作。此外,文中还提及未启用的自定义壳框架及其反dump设计。; 适合人群:具备逆向工程基础的安全研究人员、二进制分析人员及对ELF保护技术感兴趣的开发者。; 使用场景及目标:①学习ELF二进制中字符串加密的典型实现方式与逆向突破口;②掌握从结构识别、函数追踪到算法还原的完整逆向流程;③理解“绑定二进制”的完整性校验设计及其局限性;④实践编写IDAPython脚本自动化提与解密敏感数据。; 阅读建议:此资源以实战案例驱动,不仅展示技术细节,更强调逆向思维与验证方法,建议读者结合IDA调试环境,逐步跟随文中步骤进行动态分析与算法验证,深入理解每一步的推理依据。

111,131

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧