日期:2014-05-17 浏览次数:20977 次
public MainWindow()
{
InitializeComponent();
string flashPath = Environment.CurrentDirectory;
flashPath += @"\Binary2CTest.swf";
flashShow.Movie = flashPath;
}
public string EncodeInvoke(string Fname, string arg)
{
StringBuilder sb = new StringBuilder();
XmlTextWriter xw = new XmlTextWriter(new StringWriter(sb));
xw.WriteStartElement("invoke");
xw.WriteAttributeString("name", Fname);
xw.WriteAttributeString("returntype", "xml");
xw.WriteStartElement("arguments");
xw.WriteStartElement("string"); //此处直接创建string类型,没做别的类型判断
xw.WriteString(arg);
xw.WriteEndElement();
xw.WriteEndElement();
xw.WriteEndElement();
xw.Flush();
xw.Close();
return sb.ToString();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Stream stream = File.Open("1.jpg", FileMode.Open);
int leng = 0;
if (stream.Length < Int32.MaxValue)
leng = (int)stream.Length;
byte[] by = new byte[leng];
stream.Read(by, 0, leng);//把图片读到字节数组中
stream.Close();