遗忘海岸

江湖程序员 -Feiph(LM战士)

导航

读取嵌入的资源文件

              var ass = Assembly.Load("cn.fstudio.me.report");
                var names = ass.GetManifestResourceInfo("cn.fstudio.me.report.Alarm.rdlc");
                using (var stream = ass.GetManifestResourceStream("cn.fstudio.me.report.Alarm.rdlc"))
                {
                    StreamReader sr = new StreamReader(stream);
                    var xml= sr.ReadToEnd();
                    sr.Close();
                }
                //using (var ms = new MemoryStream())
                //{
                //    Stream stream=   ass.GetManifestResourceStream("cn.fstudio.me.report.Alarm.rdlc");
                //    byte[] buffer=new byte[1024];
                //    int readLen=stream.Read(buffer,0,buffer.Length);
                //    while(readLen>0){
                //        ms.Write(buffer, 0, readLen);
                //        readLen = stream.Read(buffer, 0, buffer.Length);
                //    }
                //    stream.Close();

                //    //ms.Seek(0, SeekOrigin.Begin);
                //    ms.Position = 0;
                //    StreamReader sr = new StreamReader(ms, Encoding.UTF8);
                //    var xml= sr.ReadToEnd();
                //    sr.Close();
                //}

posted on 2013-09-27 12:53  遗忘海岸  阅读(342)  评论(0编辑  收藏  举报