分类: 默认

ZipHelper

public class ZipHelper { public static void ZipFile(string strFile, string strZip) { if (strFile[strFile.Length – 1] != Path.DirectorySeparatorChar) strFile += Path.DirectorySeparatorChar; ZipOutputStream s = new ZipOutputStream(File.Create(strZip)); s.SetLevel(6); zip(strFile, s, strFile); s.Finish(); s.Close(); } private static void zip(string strFile, ZipOutputStream s, string staticFile) { if (strFile[strFile.Length – 1] != Path.DirectorySeparatorChar) strFile += Path.DirectorySeparatorChar; Crc32 crc = new Crc32(); string[] filenames = Directory.GetFileSystemEntries(strFile); foreach (string file in filenames) { if (Directory.Exists(file)) { zip(file, s, staticFile); } else // 否则直接压缩文件 { //打开压缩文件 FileStream fs = File.OpenRead(file); byte[] buffer = new byte[fs.Length]; fs.Read(buffer,

继续阅读

数据模板中的判断

  <Grid x:Name=”C”> <ListBox Margin=”32″ Name=”dadtbox” BorderThickness=”0″ ItemsSource=”{Binding DataList}”> <ListBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel/> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ItemTemplate> <DataTemplate DataType=”data:CardModel”> <Border Background=”#FFDFEDF1″ Margin=”5″ Width=”100″ Height=”100″ BorderThickness=”1″ CornerRadius=”7,7,7,7″> <StackPanel Margin=”1″ > <Image x:Name=”img”> <Image.Style> <Style TargetType=”Image”> <Setter Property=”Width” Value=”16″/> <Setter Property=”Height” Value=”16″/> <Style.Triggers> <DataTrigger Binding=”{Binding IsSelected,RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}}” Value=”true”&gt

继续阅读