private void CopyCommand_Execute(object sender, RoutedEventArgs e) { e.Handled = true; CharacterFile @char = ClothesViewModel.CharacterViewModel.Character; string tgt = ClipboardHelper.GetSuitPrefix(ClothesViewModel.Kind); var clothBytes = new byte[92]; ClothFile cf = ClothFile.Load(clothBytes); var attribs = cf.Attributes.Keys.Select (s => { string tgtKey = s.Replace("CLOTH", tgt); if (@char.CharAttributes.ContainsKey(tgtKey)) { return(@char.CharAttributes[tgtKey]); } return(null); }) .Where(wrapper => wrapper != null); String str = ClipboardHelper.GetAttributesString(attribs, ClipboardHelper.REIAA2_SUITFLAG); //[WXP] Replaced Lambda to new Func/Action Dispatcher.Invoke (new Action (() => { string clothesPrefix = ClipboardHelper.GetSuitPrefix(ClothesViewModel.Kind); Clipboard.SetText(str.Replace(clothesPrefix, "CLOTH")); })); }
private void LoadCommand_OnExecuted(object sender, ExecutedRoutedEventArgs e) { e.Handled = true; string clothPath = Path.Combine(Core.PlaySaveDir, "Cloth"); OpenFileDialog opfd = new OpenFileDialog { AddExtension = true, CheckFileExists = true, Filter = "Cloth Files (*.cloth)|*.cloth", InitialDirectory = clothPath }; opfd.CustomPlaces.Add(new FileDialogCustomPlace(clothPath)); if (!opfd.ShowDialog(Window.GetWindow(this)) .Value) { return; } var data = File.ReadAllBytes(opfd.FileName); ClothFile cf = ClothFile.Load(data); ApplyClothFile(cf); }