コード例 #1
0
        /// <exclude />
        public static string BuildTopLevelClassNames(IEnumerable <string> scriptFilenames, string folderPath, string targetPath)
        {
            var classes = new StringBuilder();

            classes.AppendLine("var topLevelClassNames = [ // Don't edit! This file is automatically generated.");

            bool first = true;

            foreach (string scriptFilename in scriptFilenames)
            {
                string scriptPath = scriptFilename.Replace("${root}", folderPath);
                if (scriptPath.IndexOf("/scripts/source/page/") == -1)
                {
                    if (first)
                    {
                        first = false;
                    }
                    else
                    {
                        classes.AppendLine(",");
                    }

                    int _start  = scriptPath.LastIndexOf("/") + 1;
                    int _length = scriptPath.LastIndexOf(".js") - _start;

                    string className = scriptPath.Substring(_start, _length);

                    classes.Append("\t\"" + className + "\"");
                }
            }

            classes.AppendLine("];");

            string classesFilename = targetPath + "\\" + "toplevelclassnames.js";

            FileUtils.RemoveReadOnly(classesFilename);

            C1File.WriteAllText(classesFilename, string.Empty /* GetTimestampString() */);
            C1File.AppendAllText(classesFilename, classes.ToString());

            return(classesFilename);
        }
コード例 #2
0
        /// <exclude />
        public static string MergeScripts(string type, IEnumerable <string> scriptFilenames, string folderPath, string targetPath)
        {
            string sourcesFilename = targetPath + "\\" + type + "-uncompressed.js";

            FileUtils.RemoveReadOnly(sourcesFilename);

            C1File.WriteAllText(sourcesFilename, string.Empty /* GetTimestampString() */);

            foreach (string scriptFilename in scriptFilenames)
            {
                string scriptPath = scriptFilename.Replace("${root}", folderPath).Replace("/", "\\");

                string lines = C1File.ReadAllText(scriptPath);


                C1File.AppendAllText(sourcesFilename, lines);
                C1File.AppendAllText(sourcesFilename, Environment.NewLine + Environment.NewLine);
            }

            return(sourcesFilename);
        }