Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public static void Create(string name)
        {
            var pathMpqUi = XYPath.Dir.MpqUi(name);

            XYFile.CopyDirectory(XYPath.Dir.MpqUiTemplateXywe, pathMpqUi);
            SaveEnable();
        }
Ejemplo n.º 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" });
 }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 5
0
        void OutputToPath(string targetRelativePath)
        {
            Output();
            var targetAbsolutePath = GetTargetFullPath(targetRelativePath);

            XYFile.CreateDirectoryForFile(targetAbsolutePath);
            File.WriteAllText(targetAbsolutePath, output);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 7
0
        public static JsonMapTemplate GetMapTemplateData(string name)
        {
            var path = XYPath.Dir.SourceTemplate + $@"\{name}\{configFileName}";

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