public void AddFiles(ClothData.Sex targetSex) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.CheckFileExists = true; openFileDialog.Filter = "Clothes geometry (*.ydd)|*.ydd"; openFileDialog.FilterIndex = 1; openFileDialog.DefaultExt = "ydd"; openFileDialog.Multiselect = true; openFileDialog.Title = "Adding " + ((targetSex == ClothData.Sex.Male) ? "male" : "female") + " clothes"; if (openFileDialog.ShowDialog() == true) { foreach (string filename in openFileDialog.FileNames) { string baseFileName = Path.GetFileName(filename); ClothNameResolver cData = new ClothNameResolver(baseFileName); if (!cData.isVariation) { ClothData nextCloth = new ClothData(filename, cData.clothType, cData.drawableType, cData.bindedNumber, cData.postfix, targetSex); nextCloth.SearchForFPModel(); nextCloth.SearchForTextures(); MainWindow.clothes.Add(nextCloth); StatusController.SetStatus(nextCloth.ToString() + " added (FP model found: " + (nextCloth.fpModelPath != "" ? "Yes": "No") + ", Textures: " + (nextCloth.textures.Count) + "). Total: " + MainWindow.clothes.Count); } else { StatusController.SetStatus("Item " + baseFileName + " can't be added. Looks like it's variant of another item"); } } } }
public static void LoadProject(string inputFile) { var data = JsonConvert.DeserializeObject <List <ClothData> >(File.ReadAllText(inputFile)); MainWindow.Clothes.Clear(); var clothes = data.OrderBy(x => x.Name, new AlphanumericComparer()).ToList(); foreach (var cd in clothes) { MainWindow.Clothes.Add(cd); } StatusController.SetStatus("Project loaded. Total clothes: " + MainWindow.Clothes.Count); }
private void BuildButton_Click(object sender, RoutedEventArgs e) { TargetResourceType resType = TargetResourceType.AltV; if (isSinglePlayerRadio.IsChecked == true) { resType = TargetResourceType.Single; } else if (isFivemResourceRadio.IsChecked == true) { resType = TargetResourceType.FiveM; } CollectionName = collectionNameText.Text; if (FilePathHasInvalidChars(OutputFolder)) { MessageBox.Show("Output folder path contains invalid characters.\nPlease choose another output location."); StatusController.SetStatus("Error: Invalid build output folder."); return; } try { switch (resType) { case TargetResourceType.AltV: ResourceBuilder.BuildResourceAltv(OutputFolder, CollectionName); MessageBox.Show("alt:V Resource built!"); break; case TargetResourceType.Single: ResourceBuilder.BuildResourceSingle(OutputFolder, CollectionName); MessageBox.Show("Singleplayer Resource built!"); break; case TargetResourceType.FiveM: ResourceBuilder.BuildResourceFiveM(OutputFolder, CollectionName); MessageBox.Show("FiveM Resource built!"); break; } } catch (Exception exception) { ShowExceptionErrorDialog(exception); } }
private void RemoveUnderCursor_Click(object sender, RoutedEventArgs e) { if (_selectedCloth == null) { return; } var removedClothName = _selectedCloth.Name; var clothes = Clothes.OrderBy(x => x.Name, new AlphanumericComparer()).ToList(); Clothes.Clear(); foreach (var cloth in clothes.Where(c => c != _selectedCloth)) { Clothes.Add(cloth); } _selectedCloth = null; editGroupBox.Visibility = Visibility.Collapsed; clothEditWindow.Visibility = Visibility.Collapsed; pedPropEditWindow.Visibility = Visibility.Collapsed; StatusController.SetStatus($"Removed '{removedClothName}'. Total clothes: " + Clothes.Count); }
public void AddFiles(ClothData.Sex targetSex) { OpenFileDialog openFileDialog = new OpenFileDialog { CheckFileExists = true, Filter = "Clothes geometry (*.ydd)|*.ydd", FilterIndex = 1, DefaultExt = "ydd", Multiselect = true, Title = "Adding " + (targetSex == ClothData.Sex.Male ? "male" : "female") + " clothes" }; if (openFileDialog.ShowDialog() != true) { return; } foreach (string filename in openFileDialog.FileNames) { string baseFileName = Path.GetFileName(filename); ClothNameResolver cData = new ClothNameResolver(baseFileName); if (!cData.IsVariation) { ClothData nextCloth = new ClothData(filename, cData.ClothType, cData.DrawableType, cData.BindedNumber, cData.Postfix, targetSex); if (cData.ClothType == ClothNameResolver.ClothTypes.Component) { nextCloth.SearchForFirstPersonModel(); nextCloth.SearchForTextures(); var clothes = MainWindow.Clothes.ToList(); clothes.Add(nextCloth); clothes = clothes.OrderBy(x => x.Name, new AlphanumericComparer()).ToList(); MainWindow.Clothes.Clear(); foreach (var cloth in clothes) { MainWindow.Clothes.Add(cloth); } StatusController.SetStatus(nextCloth + " added (FP model found: " + (nextCloth.FirstPersonModelPath != "" ? "Yes" : "No") + ", Textures: " + nextCloth.Textures.Count + "). Total: " + MainWindow.Clothes.Count); } else { nextCloth.SearchForTextures(); var clothes = MainWindow.Clothes.ToList(); clothes.Add(nextCloth); clothes = clothes.OrderBy(x => x.Name, new AlphanumericComparer()).ToList(); MainWindow.Clothes.Clear(); foreach (var cloth in clothes) { MainWindow.Clothes.Add(cloth); } StatusController.SetStatus(nextCloth + " added, Textures: " + nextCloth.Textures.Count + "). Total: " + MainWindow.Clothes.Count); } } else { StatusController.SetStatus("Item " + baseFileName + " can't be added. Looks like it's variant of another item"); } } }