private Preset GetPresetForSelection() { Pair <String, Group> gPair = __bitmaps.SelectedItem as Pair <String, Group>; Group group = gPair.Y; Pair <String, WallpaperExtraOperation> wPair = __wallpaper.SelectedItem as Pair <String, WallpaperExtraOperation>; WallpaperExtraOperation wop = wPair.Y; Pair <String, VisualStyleExtraOperation> vPair = __visualStyles.SelectedItem as Pair <String, VisualStyleExtraOperation>; VisualStyleExtraOperation vop = vPair.Y; Pair <String, ResPatchOperation> lPair = __logon.SelectedItem as Pair <String, ResPatchOperation>; ResPatchOperation lop = lPair.Y; foreach (Preset preset in __presets.Items) { if (preset.Group == group && preset.VisualStyle == vop && preset.Wallpaper == wop && preset.WelcomeScreen == lop) { return(preset); } } // Set the custom preset then _customPreset.Group = group; _customPreset.VisualStyle = vop; _customPreset.Wallpaper = wop; _customPreset.WelcomeScreen = lop; return(_customPreset); }
private void ProcessDirectory(Group group, DirectoryInfo directory) { // only act if directory's name matches a filename String relativeFn = directory.FullName.Substring(group.Package.RootDirectory.FullName.Length); if (directory.Name.IndexOf('.') > -1) { ResPatchOperation op = new ResPatchOperation(group, relativeFn.Substring(1)); FileInfo[] files = directory.GetFiles(); Array.Sort(files, new Comparison <FileInfo>(CompareFiles)); foreach (FileInfo file in files) { String type; String ext = file.Extension.ToUpperInvariant(); switch (ext) { case ".ICO": type = "icon"; break; case ".BMP": type = "bitmap"; break; case ".AVI": case ".PNG": case ".GIF": case ".JPG": case ".JPEG": type = ext.Substring(1); break; case ".CUR": type = "cursor"; break; default: type = null; _ignoredFiles.Add(file); break; } if (type != null) { PatchResource patch = new PatchResource(); patch.Type = type; patch.Name = Path.GetFileNameWithoutExtension(file.FullName); patch.Source = Path.Combine(relativeFn, file.Name).Substring(1); op.ResourceSet.Resources.Add(patch); } } group.Operations.Add(op); } //if foreach (DirectoryInfo child in directory.GetDirectories()) { ProcessDirectory(group, child); } // also, build a list of ignored directories and files }