예제 #1
0
        public void add_csp(String csp_path)
        {
            logger.log("- Add CSP");
            String csp_name = Path.GetFileName(csp_path).Split('_')[0] + "_" + Path.GetFileName(csp_path).Split('_')[1];


            //Action for certain types

            //If DLC
            if (dlc)
            {
                logger.log("DLC");
                //If moved, include a copy in regular data folder
                if (Library.get_moved_dlc_status(fullname))
                {
                    logger.log("moved");
                    //Copy to regular folder
                    if (csp_path != csppath + csp_name + "/" + csp_name + "_" + cspfolder + "_" + slotstring + ".nut")
                    {
                        if (!Directory.Exists(csppath))
                        {
                            Directory.CreateDirectory(csppath + csp_name);
                            logger.log("create destination directory");
                        }
                        if (!File.Exists(csppath + csp_name + "/" + csp_name + "_" + cspfolder + "_" + slotstring + ".nut"))
                        {
                            logger.log("copy to :" + csppath + csp_name + "/" + csp_name + "_" + cspfolder + "_" + slotstring + ".nut");
                            //Copy to regular folder
                            try
                            {
                                File.Copy(csp_path, csppath + csp_name + "/" + csp_name + "_" + cspfolder + "_" + slotstring + ".nut", true);
                            }
                            catch (Exception e)
                            {
                                logger.log("DLC COPY ERRORs");
                                logger.log(e.Message);
                                logger.log(e.StackTrace);
                            }

                            Library.set_csp_workspace_status(fullname, slot, csp_name, "new");
                        }
                    }
                }

                if (!Directory.Exists(dlc_csppath + csp_name))
                {
                    Directory.CreateDirectory(dlc_csppath + csp_name);
                    logger.log("create dlc destination directory");
                }
                if (!File.Exists(dlc_csppath + csp_name + "/" + csp_name + "_" + cspfolder + "_" + slotstring + ".nut"))
                {
                    logger.log("copy to :" + dlc_csppath + csp_name + "/" + csp_name + "_" + cspfolder + "_" + slotstring + ".nut");
                    //Copy to append folder
                    try
                    {
                        File.Copy(csp_path, dlc_csppath + csp_name + "/" + csp_name + "_" + cspfolder + "_" + slotstring + ".nut", true);
                    }
                    catch (Exception e)
                    {
                        logger.log("DLC COPY ERRORs");
                        logger.log(e.Message);
                        logger.log(e.StackTrace);
                    }

                    Library.set_csp_workspace_status(fullname, slot, csp_name, "new");
                }
            }
            else
            {
                if (!Directory.Exists(csppath + csp_name))
                {
                    Directory.CreateDirectory(csppath + csp_name);
                    logger.log("create destination directory");
                }
                if (!File.Exists(csppath + csp_name + "/" + csp_name + "_" + cspfolder + "_" + slotstring + ".nut"))
                {
                    logger.log("copy to :" + csppath + csp_name + "/" + csp_name + "_" + cspfolder + "_" + slotstring + ".nut");
                    //Copy to regular folder
                    try
                    {
                        File.Copy(csp_path, csppath + csp_name + "/" + csp_name + "_" + cspfolder + "_" + slotstring + ".nut", true);
                    }
                    catch (Exception e)
                    {
                        logger.log("NON DLC COPY ERRORs");
                        logger.log(e.Message);
                        logger.log(e.StackTrace);
                    }

                    Library.set_csp_workspace_status(fullname, slot, csp_name, "new");
                }
            }

            this.csps.Add(csp_path);
            Library.add_skin_csp(this.fullname, this.slot, csp_name);
        }