Пример #1
0
        public static void Refresh(string name)
        {
            var pathDirLib = pathRoot + @"\" + name;

            var pathFileConfig = pathDirLib + @"\" + name + ".cfg";
            var pathFileHolder = pathDirLib + @"\" + name + ".j";

            var publicFunctions  = new List <string>();
            var rePublicFunction = new Regex(@"public function ([a-zA-Z0-9]+)");

            XYFile.ForEachFile(pathDirLib, fullName => {
                var fileName = Path.GetFileName(fullName);
                if (fileName == name + ".cfg" || fileName == name + ".j")
                {
                    return;
                }

                var content = File.ReadAllText(fullName);
                var matches = rePublicFunction.Matches(content);
                foreach (Match match in matches)
                {
                    publicFunctions.Add(match.Groups[1].Value);
                }
            });

            File.WriteAllLines(pathFileConfig, publicFunctions, Encoding.Default);
        }
Пример #2
0
        public static void Create(string name)
        {
            var pathMpqUi = XYPath.Dir.MpqUi(name);

            XYFile.CopyDirectory(XYPath.Dir.MpqUiTemplateXywe, pathMpqUi);
            SaveEnable();
        }
Пример #3
0
 static void SyncSource()
 {
     XYFile.SyncDirectory(XYPath.Dir.SourceJass, XYPath.Dir.EditorJass);
     XYFile.SyncDirectory(XYPath.Dir.SourcePlugin, XYPath.Dir.EditorPlugin);
     XYFile.SyncDirectory(XYPath.Dir.SourceScript, XYPath.Dir.EditorShareScript,
                          ignoreFileName: new[] { "uiloader.lua", "ydwe_on_startup.lua" });
 }
Пример #4
0
        static void SyncPackage()
        {
            var enabled = XYPackage.GetCurrentEnabled();

            for (int i = 0; i < enabled.Count; i++)
            {
                var name         = enabled[i];
                var package      = XYPath.Dir.SourcePackage + "\\" + name + "\\";
                var scriptSource = package + "script";
                var uiSource     = package + "ui";
                var scriptTarget = XYPath.Dir.EditorJass + "\\package\\" + name;
                var uiTarget     = XYPath.Dir.EditorShareMpq + "\\" + name + "\\ui";
                XYFile.SyncDirectory(scriptSource, scriptTarget);
                XYFile.SyncDirectory(uiSource, uiTarget);
            }

            var disabled = XYPackage.GetCurrentDisabled();

            foreach (var name in disabled)
            {
                var scriptTarget = XYPath.Dir.EditorJass + "\\package\\" + name;
                var uiTarget     = XYPath.Dir.EditorShareMpq + "\\" + name; // 与上面不同的原因是在删除时要连ui本体目录一起删除
                XYFile.RemoveDirectory(scriptTarget);
                XYFile.RemoveDirectory(uiTarget);
            }
        }
Пример #5
0
        void OutputToPath(string targetRelativePath)
        {
            Output();
            var targetAbsolutePath = GetTargetFullPath(targetRelativePath);

            XYFile.CreateDirectoryForFile(targetAbsolutePath);
            File.WriteAllText(targetAbsolutePath, output);
        }
Пример #6
0
        /// <summary>
        /// Format: [0+2N]id [1+2N]name
        /// </summary>
        /// <returns></returns>
        public static List <string> GetMapTemplateNameList()
        {
            List <string> mapTemplateNameList = new List <string>();

            ForEachTemplateDirectory(fullName =>
            {
                var id   = System.IO.Path.GetFileName(fullName);
                var json = XYFile.LoadJson <JsonMapTemplate>(fullName + @"\" + configFileName);
                mapTemplateNameList.AddRange(new[] { id, json.name });
                return(false);
            });
            return(mapTemplateNameList);
        }
Пример #7
0
        public static JsonMapTemplate GetMapTemplateData(string name)
        {
            var path = XYPath.Dir.SourceTemplate + $@"\{name}\{configFileName}";

            return(XYFile.LoadJson <JsonMapTemplate>(path));
        }
Пример #8
0
 public static List <string> GetMapTemplateDirectoryNameList()
 {
     return(XYFile.GetSubDirectoriesName(XYPath.Dir.SourceTemplate));
 }
Пример #9
0
 private static void ForEachTemplateDirectory(ForDirectoryAction forDirectoryAction)
 {
     XYFile.ForEachSubDirectory(XYPath.Dir.SourceTemplate, forDirectoryAction, false);
 }
Пример #10
0
 void GetFile()
 {
     tableClass    = XYFile.LoadXlsx(uiPath + @"\Class.xlsx");
     tableFunction = XYFile.LoadXlsx(uiPath + @"\Function.xlsx");
 }