Код: Выделить всё
DisplayKey.get("Web.Admin.MessageDestinationStatisticsDV.Failed")Идеальный шаблон идет таким образом DisplayKey.get (& quot; xxx.xxx.xxx.xxx.xxx & quot;)
, где x может быть ny String , а шаблон должен закончить с & quot;). DisplayKey.get ("} < /code>, который не заканчивается {& quot;)} < /code> и исправить его. < /P>
Ниже приведен подход i запустил: < /p>
static void waldirectorytree (directoryinfo root)
{br /> fileinfo [] null; null; null; null; null; null; null; null; null; null; null; null;> null; null;> null; null; null;
files = root.getFiles (". < /em>"); < /p>
if (files != null)
{
try
{
foreach (FileInfo fi in files)
{
String errDSTR = "DisplayKey.get(\"";
string[] allLines = File.ReadAllLines(fi.FullName);
var writer = new StreamWriter(fi.FullName);
for (int i = 0; i < allLines.Length; i++)
{
string line = allLines;
// Find DisplayKey.get("
// Replace it with DisplayKey.get("
// LOGIC: HOW DO I APPROACH THIS?
foreach(char ch in line.ToCharArray())
{
//Sadly .IndexOf() only finds the First String and not the subsequet ones
}
}
}
catch(Exception e)
{
Console.WriteLine("Exception Occured :" + e.Message);
Console.ReadLine();
}
subDirs = root.GetDirectories();
foreach (System.IO.DirectoryInfo dirInfo in subDirs)
{
// Resursive call for each subdirectory.
WalkDirectoryTree(dirInfo);
}
}
}
< /code>
Я знаю file.writealltext (fi.fullname, file.readalltext (fi.fullname) .replace («Некоторый текст», «какой -то другой текст»)); мог бы решить общий текст, но мне интересно, как я пройти и исправить проблему с шаблоном!
Подробнее здесь: https://stackoverflow.com/questions/408 ... ix-them-fo
Мобильная версия