MakeCode 반복 생성 리소스 파일

1660 단어
static void yieldDir(DirectoryInfo dir, int depth, StringBuilder sb1, StringBuilder sb2) {

			var firstFlag = "";
			var firstFlag1 = "";
			var dirtmp = dir;
			for (int a = 0; a < depth; a++) {
				var dirtmpname = Regex.Replace(dirtmp.Name, @"[^\w]", "_");
				firstFlag = string.Concat(dirtmp.Name, @"\", firstFlag);
				firstFlag1 = string.Concat(dirtmpname, @"_", firstFlag1);
				dirtmp = dirtmp.Parent;
			}

			foreach (var f11 in dir.GetFiles()) {
				var f = f11.Name;
				var f1 = Regex.Replace(f, @"[^\w]", "_");
				sb1.Append($@"
  
    ..\Resources\{firstFlag}{f};System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8
  ");
				sb2.Append($@"
loc1.Add(new BuildInfo(string.Concat(CONST.corePath, @""Common\{firstFlag}{f}""), Deflate.Compress(Properties.Resources.{firstFlag1}{f1})));");
			}
			foreach(var d11 in dir.GetDirectories()) {
				yieldDir(d11, depth + 1, sb1, sb2);
			}
		}



			var dir = new DirectoryInfo(@"C:\Users\Administrator\Desktop\mc(core+mysql)\Server\Resources\CSRedis");
			StringBuilder sb1 = new StringBuilder();
			StringBuilder sb2 = new StringBuilder();
			yieldDir(dir, 1, sb1, sb2);
			File.WriteAllText(@"test.txt", sb1.ToString() + sb2.ToString());

좋은 웹페이지 즐겨찾기