예제 #1
0
    //生成lua mvc line
    public static string GetSingletonLuaLine(string filePath, LuaFolder folder)
    {
        string fileName = Path.GetFileNameWithoutExtension(filePath);
        string viewName = fileName.Replace(folder.ToString(), "");
        string packName = string.Format("Modules.{0}.{1}.{2}", viewName, folder.ToString(), fileName);

        return(string.Format(Format_Shingleton_Line, packName));
    }
예제 #2
0
        string GetLuaCodeLine(string filePath, string format, LuaFolder folder, bool isSingle)
        {
            string fileName = Path.GetFileNameWithoutExtension(filePath);
            string viewName = fileName.Replace(folder.ToString(), "");
            string packName = string.Format("Modules.{0}.{1}.{2}", viewName, folder.ToString(), fileName);

            if (isSingle)
            {
                return(string.Format(format, packName));
            }
            else
            {
                return(string.Format(format, packName, viewName));
            }
        }
예제 #3
0
    //生成lua mvc line
    public static string GetMdrLuaLine(string filePath, string moduleName, LuaFolder folder)
    {
        string fileName = Path.GetFileNameWithoutExtension(filePath);
        string viewName = fileName.Replace(folder.ToString(), "");
        string packName = string.Format("Modules.{0}.View.{1}", moduleName, fileName);

        return(string.Format(Format_Mdr_Line, packName, viewName));
    }
예제 #4
0
        public static LuaFileStatus GetFileStatus(string moduleDirPath, LuaFolder folder, string fileName = null)
        {
            LuaFolder moduleFolder = folder == LuaFolder.Mdr ? LuaFolder.View : folder;

            moduleDirPath = moduleDirPath + Folder2Directory(moduleFolder);
            if (Directory.Exists(moduleDirPath))
            {
                string[] lusFiles = Directory.GetFiles(moduleDirPath, "*.lua");
                if (lusFiles.Length == 0)
                {
                    return(LuaFileStatus.Folder_Only);
                }
                else
                {
                    bool hasFolderFile = false;
                    for (int i = 0; i < lusFiles.Length; i++)
                    {
                        if (lusFiles[i].LastIndexOf(folder.ToString()) != -1)
                        {
                            hasFolderFile = true;
                            break;
                        }
                    }

                    if (fileName != null)
                    {
                        for (int i = 0; i < lusFiles.Length; i++)
                        {
                            var tempFileName = lusFiles[i].Replace(folder.ToString(), "");
                            tempFileName = Path.GetFileNameWithoutExtension(tempFileName);
                            if (tempFileName == fileName)
                            {
                                return(LuaFileStatus.Folder_And_TagLuaFile);
                            }
                        }
                    }

//                    if (hasFolderFile)
                    return(LuaFileStatus.Folder_And_LuaFile);
//                    else
//                        return LuaFileStatus.Nothing;
                }
            }

            return(LuaFileStatus.Nothing);
        }
예제 #5
0
 public static string Folder2Directory(LuaFolder folder)
 {
     return("/" + folder.ToString() + "/");
 }