Skip to content

Commit

Permalink
Small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiHatti committed Jun 8, 2020
1 parent 1f4439c commit baebedf
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 9 deletions.
16 changes: 8 additions & 8 deletions LPHP-Preprocessor/LPHP_Preprocessor/LPHPCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ private static string ReplaceFromPosition(string pFileContent, int startIndex, i
{
StringBuilder sb = new StringBuilder(pFileContent);
sb.Remove(startIndex, length);
sb.Insert(startIndex, new String(' ', length));
sb.Insert(startIndex, new String(replaceChar, length));
return sb.ToString();
}

Expand All @@ -354,11 +354,12 @@ private static string SourceCleanup(string rawFileContent)

private static string WSReplace(string pFileContent)
{
Dictionary<int, Tuple<string, string>> beatufifyFlags = new Dictionary<int, Tuple<string, string>>();

beatufifyFlags.Add(0, new Tuple<string, string>("<?php", "?>"));
beatufifyFlags.Add(1, new Tuple<string, string>("<?=", "?>"));
beatufifyFlags.Add(2, new Tuple<string, string>("<script", "</script>"));
Dictionary<int, Tuple<string, string>> beatufifyFlags = new Dictionary<int, Tuple<string, string>>
{
{ 0, new Tuple<string, string>("<?php", "?>") },
{ 1, new Tuple<string, string>("<?=", "?>") },
{ 2, new Tuple<string, string>("<script", "</script>") }
};


StringBuilder sb = new StringBuilder();
Expand Down Expand Up @@ -541,8 +542,7 @@ private static void SaveFile(string pOriginalFilename, string pFileContent)
private static void DeleteFile(string pOriginalFilename)
{
string targetFile = Path.Combine(Path.GetDirectoryName(pOriginalFilename), Path.GetFileNameWithoutExtension(pOriginalFilename) + ".php");

File.Delete(targetFile);
if (File.Exists(targetFile)) File.Delete(targetFile);
}

private static object ValueParser(string pVariableValue)
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ H:\Git\LPHP\LPHP-Preprocessor\LPHP_Preprocessor\bin\Release\LPHP_Preprocessor.ex
H:\Git\LPHP\LPHP-Preprocessor\LPHP_Preprocessor\bin\Release\LPHP_Preprocessor.pdb
H:\Git\LPHP\LPHP-Preprocessor\LPHP_Preprocessor\obj\Release\LPHP_Preprocessor.exe
H:\Git\LPHP\LPHP-Preprocessor\LPHP_Preprocessor\obj\Release\LPHP_Preprocessor.pdb
H:\Git\LPHP\LPHP-Preprocessor\LPHP_Preprocessor\obj\Release\LPHP_Preprocessor.csprojAssemblyReference.cache
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit baebedf

Please sign in to comment.