예제 #1
0
        private void insertSkinInLibraryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            String           character = comboBox1.SelectedItem.ToString();
            DataGridViewCell cell      = this.dataGridView1.CurrentCell;
            DataGridViewRow  row       = dataGridView1.Rows[cell.RowIndex];


            ArrayList library_skins = library.get_skins(character);
            Boolean   id_check      = false;

            foreach (String s in library_skins)
            {
                if (s.Split(';')[2] == row.Cells[0].Value.ToString())
                {
                    id_check = true;
                }
            }

            if (!id_check)
            {
                NewSkin skin = new NewSkin(int.Parse(row.Cells[0].Value.ToString()), comboBox1.SelectedItem.ToString(), library_skins.Count + 1, library, properties, filebank);

                library.add_skin(character, library_skins.Count + 1, row.Cells[1].Value.ToString());
                library.set_id(skin);
                main.skin_ListBox_reload();
                main.write(skin.libraryname + " was added from the Filebank", 2);
            }
        }
예제 #2
0
        //Gets the files from the workspace and puts the files into the filebank
        public void get_workspace_skin()
        {
            #region Variables
            String csp_list   = "";
            String model_list = "";
            #endregion

            #region Directories
            //Creating destination directories
            Directory.CreateDirectory(filebank_folder + "/meta");
            Directory.CreateDirectory(filebank_folder + "/csp");
            Directory.CreateDirectory(filebank_folder + "/model");
            Directory.CreateDirectory(filebank_folder + "/sounds");
            Directory.CreateDirectory(filebank_folder + "/nameplate");
            #endregion

            #region Model getter
            ArrayList models = library.get_models(fullname, cspslot);

            foreach (String model in models)
            {
                model_list += model + ";";
                String folder_path = extract_model_folder + "/" + model.Split('/')[0] + "/" + model.Split('/')[1].Substring(0, 1) + modelslot_text;

                if (!Directory.Exists(filebank_folder + "/model/" + model.Split('/')[0] + "/" + model.Split('/')[1]))
                {
                    Directory.CreateDirectory(filebank_folder + "/model/" + model.Split('/')[0] + "/" + model.Split('/')[1]);
                }


                if (Directory.GetFiles(folder_path).Length > 0)
                {
                    foreach (String file in Directory.GetFiles(folder_path))
                    {
                        File.Copy(file, filebank_folder + "/model/" + model.Split('/')[0] + "/" + model.Split('/')[1] + "/" + Path.GetFileName(file), true);
                    }
                }
            }
            #endregion

            #region Csp Getter
            ArrayList csps = library.get_csps(fullname, cspslot);

            foreach (String csp in csps)
            {
                String FilePath = "";

                if (dlc)
                {
                    FilePath = extract_dlc_csp_folder;
                }
                else
                {
                    FilePath = extract_csp_folder;
                }
                FilePath += csp + "/" + csp + "_" + csp_foldername + "_" + cspslot_text + ".nut";
                if (File.Exists(FilePath))
                {
                    if (csp == "chrn_11" | csp == "chr_10")
                    {
                        if (csp == "chrn_11")
                        {
                            File.Copy(FilePath, filebank_folder + "/nameplate/" + Path.GetFileName(FilePath));
                        }
                        else
                        {
                        }
                    }
                    else
                    {
                        File.Copy(FilePath, filebank_folder + "/csp/" + Path.GetFileName(FilePath));
                        csp_list += csp + ";";
                    }
                }
            }
            #endregion

            #region Meta
            if (File.Exists(extract_meta_folder + "/meta.xml"))
            {
                File.Copy(extract_meta_folder + "/meta.xml", filebank_folder + "/meta/meta.xml", true);
            }
            else
            {
                File.Copy(Application.StartupPath + "/mmsl_config/meta/Default_Meta.xml", filebank_folder + "/meta/meta.xml", true);
            }



            #endregion

            #region EmptyCheck
            if (Directory.GetFiles(filebank_folder + "/csp").Length == 0 &&
                Directory.GetFiles(filebank_folder + "/model").Length == 0 &&
                Directory.GetFiles(filebank_folder + "/nameplate").Length == 0 &&
                Directory.GetFiles(filebank_folder + "/sounds").Length == 0)
            {
                Directory.Delete(filebank_folder, true);
                this.id = 0;
            }
            else
            {
                filebank.add_skin(this, model_list, csp_list);
            }

            #endregion

            library.set_id(this);
        }