private void LoadStructureTemplates()
        {
            List <string> structures = new List <string>();

            //LOAD DEFAULT STRUCTURES
            string defaultStructurePath = GlobalPaths.StructureFolderPath;

            if (Directory.Exists(defaultStructurePath))
            {
                string[] files = Directory.GetFiles(defaultStructurePath, "*.fs");

                if (files != null)
                {
                    _defaultStructureCount = files.Length;
                    structures.AddRange(files);
                }
                else
                {
                    _defaultStructureCount = 0;
                }
            }


            //LOAD USER STRUCTURES
            string userStructurePath = GlobalPaths.UserStructuresFolderPath;

            if (Directory.Exists(userStructurePath))
            {
                string[] files = Directory.GetFiles(userStructurePath, "*.fs");

                if (files != null)
                {
                    structures.AddRange(files);
                }
            }


            //EXTRACT ALL STRUCTURE NAMES
            string[] structureNames = new string[structures.Count];

            for (int i = 0; i < structures.Count; i++)
            {
                string fileName = GlobalPaths.GetFolderNameFromPath(structures[i]);

                structureNames[i] = fileName.Replace(".fs", string.Empty);
            }

            _availableStructureNames = structureNames;
        }
Exemple #2
0
        private static bool IsEditorTemplate(string templatePath)
        {
            string fileName = GlobalPaths.GetFolderNameFromPath(templatePath);

            fileName = fileName.Replace("Template_", string.Empty);
            fileName = fileName.Replace(".cs.txt", string.Empty);

            if (fileName.StartsWith("Editor_"))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #3
0
        private static void LoadUserTemplates()
        {
            string path = GlobalPaths.UserTemplatesFolderPath;

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
                _userTemplateNames     = null;
                _userTemplatePaths     = null;
                _userTemplatesIsEditor = null;
                return;
            }

            _userTemplatePaths = Directory.GetFiles(path, "Template_*.cs.txt");

            if (_userTemplatePaths != null && _userTemplatePaths.Length > 0)
            {
                _userTemplateNames     = new string[_userTemplatePaths.Length];
                _userTemplatesIsEditor = new bool[_userTemplatePaths.Length];

                for (int i = 0; i < _userTemplatePaths.Length; i++)
                {
                    string fileName = GlobalPaths.GetFolderNameFromPath(_userTemplatePaths[i]);
                    fileName = fileName.Replace("Template_", string.Empty);
                    fileName = fileName.Replace(".cs.txt", string.Empty);

                    if (fileName.StartsWith("Editor_"))
                    {
                        fileName = fileName.Replace("Editor_", string.Empty);
                        _userTemplatesIsEditor[i] = true;
                    }
                    else
                    {
                        _userTemplatesIsEditor[i] = false;
                    }

                    _userTemplateNames[i] = fileName;
                }
            }
            else
            {
                _userTemplateNames = null;
            }
        }
Exemple #4
0
        private static string GetFilenameNoEditor(string projectPath)
        {
            string fileName = GlobalPaths.GetFolderNameFromPath(projectPath);

            int cutOffIndex = fileName.LastIndexOf("Editor.cs");

            if (cutOffIndex > -1)
            {
                return(fileName.Remove(cutOffIndex));
            }

            cutOffIndex = fileName.LastIndexOf("Inspector.cs");
            if (cutOffIndex > -1)
            {
                return(fileName.Remove(cutOffIndex));
            }

            cutOffIndex = fileName.LastIndexOf(".cs");
            fileName    = "YourClass";

            return(fileName);
        }