Beispiel #1
0
        public void changeFilesTime()
        {
            List <string> templist = ChangedFilesManager.GetInstance().filePathList;

            Log.trace("=====修改config.json配置开始=====");
            int num = 0;

            foreach (var path in templist)
            {
                if (path.Contains("Main.swf"))
                {
                    continue;
                }
                string filename      = System.IO.Path.GetFileNameWithoutExtension(path);
                string fileextension = System.IO.Path.GetExtension(path);
                // System.Console.WriteLine(System.IO.Path.GetFileName(path));
                System.Console.WriteLine(path);
                string re0         = "(\"" + filename + ")";
                string re01        = "(\\.)";
                string re02        = "(" + fileextension.Replace(".", "") + ")";
                string re03        = "(\\?t=)";
                string re1         = "(\\d+)"; // Integer Number 1
                string re2         = "(\\.*)"; // Any Single Character 1
                string re3         = "(\\d+)"; // Integer Number 2
                string re4         = "(\\.*)"; // Any Single Character 2
                string re5         = "(\\d+)"; // Integer Number 3
                string currenttime = DateTime.Now.ToString("yyMMddhhmm");
                bool   isfox;
                writefile.TxtPath = PathManager.GetInstance().ProgramPath + debugPath + configName;
                isfox             = writefile.replaceLineWithReg(re0 + re01 + re02 + re03 + re1 + re2 + re3 + re4 + re5, "\"" + filename + fileextension + "?t=" + currenttime);
                Log.trace(debugPath + "    " + filename + fileextension + " " + (isfox ? "成功" : "失败"));
                writefile.TxtPath = PathManager.GetInstance().ProgramPath + mayaPath + configName;
                isfox             = writefile.replaceLineWithReg(re0 + re01 + re02 + re03 + re1 + re2 + re3 + re4 + re5, "\"" + filename + fileextension + "?t=" + currenttime);
                Log.trace(mayaPath + "    " + filename + fileextension + " " + (isfox ? "成功" : "失败"));
                writefile.TxtPath = PathManager.GetInstance().ProgramPath + classicPath + configName;
                isfox             = writefile.replaceLineWithReg(re0 + re01 + re02 + re03 + re1 + re2 + re3 + re4 + re5, "\"" + filename + fileextension + "?t=" + currenttime);
                Log.trace(classicPath + "    " + filename + fileextension + " " + (isfox ? "成功" : "失败"));
                writefile.TxtPath = PathManager.GetInstance().ProgramPath + junboPath + configName;
                isfox             = writefile.replaceLineWithReg(re0 + re01 + re02 + re03 + re1 + re2 + re3 + re4 + re5, "\"" + filename + fileextension + "?t=" + currenttime);
                Log.trace(junboPath + "    " + filename + fileextension + " " + (isfox?"成功":"失败"));
                num++;
            }
            Log.trace("有 " + num + " 个文件修改");
            num = 0;
        }
Beispiel #2
0
        public static void addIndexXml(string path)
        {
            if (write == null)
            {
                write = new FileTextChangeManager();
            }
            write.TxtPath = path + @"\Index.xml";
            //"匹配 Game.swf?v=2.3.10.1601191154   "
            string re0  = "(" + "Game.swf" + ")";
            string re03 = "(\\?v=)";
            string re1  = "(\\d+)";     // Integer Number 1
            string re2  = "(\\.*)";     // Any Single Character 1
            string re3  = "(\\d+)";     // Integer Number 2
            string re4  = "(\\.*)";     // Any Single Character 2
            string re5  = "(\\d+)";     // Integer Number 3
            string re6  = "(\\.*)";     // Any Single Character 2
            string re7  = "(\\d+)";     // Integer Number 3
            ////首先清除掉所有的内容;
            //if (FilesAndDirsChangeManager.hasSomeFile(path + @"/Index.xml", false))
            //{
            //    write.clearAllLine();
            //}
            bool isfox = write.replaceLineWithReg(re0 + re03 + re1 + re2 + re3 + re4 + re5 + re6 + re7, "Game.swf?v=" + PathManager.GetInstance().VersionTxt);

            Log.trace(write.TxtPath + "  Game.swf?v=" + PathManager.GetInstance().VersionTxt + " " + (isfox ? "成功" : "失败"));
            if (isfox)
            {
                Log.ftpLog(write.TxtPath);
            }

            //            {
//                string p = @"<?xml version=""1.0"" encoding=""utf-8""?>
//<index>
//	<brand>
//		<main>brand/Main.swf?v=1.0.01291356</main>
//		<skin>brand/Skin.swf?v=1.0.01291356</skin>
//	</brand>
//	<app>game/Game.swf?v=" + PathManager.GetInstance().VersionTxt + @"</app>
//</index>";
//                write.addOneLine(p);
//                Log.trace(write.TxtPath + " 文件创建成功");
//            };
        }