silverlight
发布时间:2022-05-03 发布网站:大佬教程 code.js-code.com
大佬教程收集整理的这篇文章主要介绍了不错的开源压缩组件(可惜没能用上),大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
概述
今天继续在研究Silverlight的发布优化方法,由于项目需要开启OOB,没有办法再选中 这两个选项只能选择其中一个,很遗憾不能利用自身的功能合并项目了,
这里说明一下,第一个选项的好处 如果
你的解决方案中有两个Silverlight项目,那么如果选择了第一项,则两个
项目中共同的DLL会被压缩放在ClientBin目录下,这样做的好处是避免了两个SL
项目中引用重复的DLL,但是选择OOB之后,我
今天继续在研究Silverlight的发布优化方法,由于项目需要开启OOB,没有办法再选中
这两个选项只能选择其中一个,很遗憾不能利用自身的功能合并项目了,这里说明一下,第一个选项的好处
如果你的解决方案中有两个Silverlight项目,那么如果选择了第一项,则两个项目中共同的DLL会被压缩放在ClientBin目录下,这样做的好处是避免了两个SL项目中引用重复的DLL,但是选择OOB之后,我们便不能选择这个项了,于是我想到在OOB的基础上,将打包好的XAP改成压缩文件,再解压,将两个项目中的公共DLL抽取出来放到ClientBin下,当然这样做还涉及到Xap包中的一个文件
@H_
489_37@
代码
<
Deployment
xmlns
="<a href="
http://scheR_384_11845@as.microsoft.com/client/2007/deployment""
>
http://scheR_384_11845@as.microsoft.com/client/2007/deployment"
</
a
>
xmlns:x="
<
a
href
="http://scheR_384_11845@as.microsoft.com/winfx/2006/xaml"
"
>
http://scheR_384_11845@as.microsoft.com/winfx/2006/xaml"
</
a
>
EntryPointAssembly="ProjectA"
EntryPointType="ProjectA.App" runtimeVersion="4.0.50401.0">
<
Deployment.outOfBrowserSetTings
>
<
OutOfBrowserSetTings
ShortName
="ProjectA Application"
EnableGPUAcceleration
="false"
ShowInstallMenuItem
="True"
>
<
OutOfBrowserSetTings.blurb
>
ProjectA Application on your desktop; at home, at work or on the
go.
</
OutOfBrowserSetTings.blurb
>
<
OutOfBrowserSetTings.WindowSetTings
>
<
WindowSetTings
title
="ProjectA Application"
/>
</
OutOfBrowserSetTings.WindowSetTings
>
<
OutOfBrowserSetTings.Icons
/>
</
OutOfBrowserSetTings
>
</
Deployment.outOfBrowserSetTings
>
<
Deployment.Parts
>
<
AssemblyPart
x:Name
="ProjectA"
source
="ProjectA.dll"
/>
<
AssemblyPart
x:Name
="ProjectB"
source
="ProjectB.dll"
/>
<
AssemblyPart
x:Name
="Sy@L_944_12@.Windows.Controls"
source
="Sy@L_944_12@.Windows.Controls.dll"
/>
<
AssemblyPart
x:Name
="Telerik.Windows.Controls"
source
="Telerik.Windows.Controls.dll"
/>
</
Deployment.Parts
>
</
Deployment
>
我想将最后两个DLL抽取出来或者改变一下配置路径,但两种方法都没有用,有了解的朋友还请指点。
在解决问题的过程中我下载了一个挺不错的压缩组件
SharpZipLib 有兴趣的朋友可以试试
http://www.icsharpcode.net/OpenSource/SharpZipLib/
简单写了一个类实现压缩和解压缩功能。
@H_
489_37@
代码
using
Sy@L_944_12@;
using
Sy@L_944_12@.Collections.Generic;
using
Sy@L_944_12@.Linq;
using
Sy@L_944_12@.Web;
using
Sy@L_944_12@.IO;
using
ICSharpCode.SharpZipLib.Zip;
namespace
SLProjectsDownLoad.Web
{
public
class
Zip
{
public
static
void
ZipFiles(
String
ZipFilename,
String
FromDirectory)
{
FastZip fz
=
new
FastZip();
fz.CreateEmptyDirectories
=
true
;
fz.CreateZip(ZipFilename, FromDirectory,
true
,
""
);
fz
=
null
;
}
public
static
void
UnZipFiles(
String
ZipFilename,
String
ToDirectory)
{
if
(
!
Directory.Exists(ToDirectory))
directory.CreateDirectory(ToDirectory);
ZipInputStream s
=
new
ZipInputStream(File.openRead(ZipFileName));
ZipEntry theEntry;
while
((theEntry
=
s.GetNextEntry())
!=
null
)
{
String
directoryName
=
Path.GetDirectoryName(theEntry.Name);
String
filename
=
Path.GetFilename(theEntry.Name);
if
(directoryName
!=
String.Empty)
directory.CreateDirectory(ToDirectory
+
directoryName);
if
(filename
!=
String.Empty)
{
FileStream streamWriter
=
File.Create(ToDirectory
+
theEntry.Name);
int
size
=
2048
;
byte
[] data
=
new
byte
[
2048
];
while
(
true
)
{
size
=
s.Read(data,
0
, data.Length);
if
(size
>
0
)
{
streamWriter.Write(data, sizE);
}
else
{
break
; } } streamWriter.Close(); } } s.Close(); } } }
大佬总结
以上是大佬教程为你收集整理的不错的开源压缩组件(可惜没能用上)全部内容,希望文章能够帮你解决不错的开源压缩组件(可惜没能用上)所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。