Ejemplo n.º 1
0
        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");
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void AddFiles(ClothData.Sex targetSex)
        {
            var 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)
            {
                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.Type.Component)
                        {
                            nextCloth.SearchForFPModel();
                            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.fpModelPath != "" ? "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");
                    }
                }
            }
        }