Esempio n. 1
0
        /// <summary>
        /// Extracts the first folder name of the path.
        /// </summary>
        /// <param name="path">The path to get the first folder name of.</param>
        /// <returns>The first folder name of the path.</returns>
        private static string GetCraftFolder(string path)
        {
            string folder = KSPPathHelper.GetRelativePath(path).Replace(Constants.KSPFOLDERTAG + Path.DirectorySeparatorChar, string.Empty);

            folder = folder.Substring(0, folder.IndexOf(Path.DirectorySeparatorChar));
            return(folder);
        }
        /// <summary>
        /// Creates a new default TreeNodePart.
        /// </summary>
        /// <param name="file">The full path of the part cfg file.</param>
        /// <returns>The new created PartNode from the passed file.</returns>
        private static PartNode CreateNewPartNode(string file)
        {
            PartNode partNode = new PartNode();

            partNode.FilePath = KSPPathHelper.GetRelativePath(file);
            if (file.Contains(Constants.GAMEDATA))
            {
                string mod = file.Substring(file.IndexOf(Constants.GAMEDATA) + 9);
                mod          = mod.Substring(0, mod.IndexOf(Path.DirectorySeparatorChar));
                partNode.Mod = mod;

                if (!allModFilter.Contains(mod))
                {
                    allModFilter.Add(mod);
                }
            }

            return(partNode);
        }