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 void SearchForTextures() { textures.Clear(); string rootPath = Path.GetDirectoryName(mainPath); if (IsComponent()) { for (int i = 0; ; ++i) { string relPath = rootPath + "\\" + ClothNameResolver.DrawableTypeToString(drawableType) + "_diff_" + origNumerics + "_" + (char)(offsetLetter + i) + "_uni.ytd"; if (!File.Exists(relPath)) { break; } textures.Add(relPath); } for (int i = 0; ; ++i) { string relPath = rootPath + "\\" + ClothNameResolver.DrawableTypeToString(drawableType) + "_diff_" + origNumerics + "_" + (char)(offsetLetter + i) + "_whi.ytd"; if (!File.Exists(relPath)) { break; } textures.Add(relPath); } } else { for (int i = 0; ; ++i) { string relPath = rootPath + "\\" + ClothNameResolver.DrawableTypeToString(drawableType) + "_diff_" + origNumerics + "_" + (char)(offsetLetter + i) + ".ytd"; if (!File.Exists(relPath)) { break; } textures.Add(relPath); } } }
public string GetPrefix() { return(ClothNameResolver.DrawableTypeToString(drawableType)); }
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"); } } }