Пример #1
0
        /// <summary>
        /// 创建项目
        /// </summary>
        /// <param name="dir">目录</param>
        private void createProject(String projectName, String dir, String identifier)
        {
            ArrayList <String> dirs = new ArrayList <String>();

            FCFile.getDirectories(dir, dirs);
            int dirsSize = dirs.Count;

            for (int i = 0; i < dirsSize; i++)
            {
                createProject(projectName, dirs.get(i), identifier);
            }
            ArrayList <String> files = new ArrayList <String>();

            FCFile.getFiles(dir, files);
            int filesSize = files.Count;

            for (int i = 0; i < filesSize; i++)
            {
                String file    = files.get(i);
                String content = "";
                if (file.Substring(file.LastIndexOf('\\')).IndexOf(identifier) != -1)
                {
                    FCFile.read(file, ref content);
                    String newFile = file.Replace(identifier, projectName);
                    FCFile.write(newFile, content);
                    FCFile.removeFile(file);
                    file = newFile;
                }
                FCFile.read(file, ref content);
                if (content.IndexOf(identifier) != -1)
                {
                    content = content.Replace(identifier, projectName);
                    FCFile.write(file, content);
                }
            }
            dirs.Clear();
            files.Clear();
        }