62,242
社区成员




string filename = Server.MapPath("~/file/3333.xml");
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(filename);
XmlNode cNodes = xmldoc.SelectSingleNode("title");
for (int i = 0; i < cNodes.ChildNodes.Count; i++)
{
XmlNode c = cNodes.ChildNodes[i];
c.Attributes["stream"].Value = jiema(c.Attributes["stream"].Value);
}
xmldoc.Save("~/file/3333.xml");//保存
public static string jiema(string s)
{
System.Text.RegularExpressions.CaptureCollection cs =
System.Text.RegularExpressions.Regex.Match(s, @"([01]{8})+").Groups[1].Captures;
byte[] data = new byte[cs.Count];
for (int i = 0; i < cs.Count; i++)
{
data[i] = Convert.ToByte(cs[i].Value, 2);
}
return Encoding.Unicode.GetString(data, 0, data.Length);
}
string filename = Server.MapPath("~/file/3333.xml");
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(filename);
XmlNode cNodes = xmldoc.SelectSingleNode("title");
for (int i = 0; i < cNodes.ChildNodes.Count; i++)
{
XmlNode c = cNodes.ChildNodes[i];
c.Attributes["stream"].Value = Convert.ToInt32(c.Attributes["stream"].Value, 2).ToString();
}
xmldoc.Save("~/file/3333.xml");//保存
string filename = Server.MapPath("~/file/3333.xml");
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load(filename);
XmlNode cNodes = xmldoc.SelectSingleNode("title");
for (int i = 0; i < cNodes.ChildNodes.Count; i++)
{
XmlNode c = cNodes.ChildNodes[i];
c.InnerText = Convert.ToInt32(c.Attributes["stream"].Value,2).ToString();
}
xmldoc.Save("~/file/3333.xml");//保存