Skip to content

Commit

Permalink
Update code to fix #520 and #527 when tool is used with Jars (#529)
Browse files Browse the repository at this point in the history
  • Loading branch information
masesdevelopers authored Sep 19, 2024
1 parent a9fc64e commit 5ab9f91
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/net/JNetReflector/InternalMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ static void ReportTrace(ReflectionTraceLevel level, string format, params object

static void WriteFile(string path, string content)
{
if (path.EndsWith(FileNameAndDirectory.AllPackageClassesFileName)) Interlocked.Increment(ref namespaces);
if (path.EndsWith(FileNameAndDirectory.AllPackageClassesFileName))
{
Interlocked.Increment(ref namespaces);
return; // do not write anymore AllPackageClasses.cs
}
else Interlocked.Increment(ref classes);

if (!JNetReflectorCore.DryRun)
Expand Down Expand Up @@ -336,17 +340,14 @@ static void AnalyzeSubItems(string package, IDictionary<string, IDictionary<stri
.Replace(AllPackageClasses.NAMESPACE, package)
.Replace(AllPackageClasses.CLASSES, sb.ToString());

if (path.EndsWith(FileNameAndDirectory.AllPackageClassesFileName)) Interlocked.Increment(ref namespaces);
//WriteFile(path, itemPackage);
WriteFile(path, itemPackage);
_allPackages.Add(path, itemPackage);
}
else
{
var packageContent = File.ReadAllText(path);
var itemPackage = packageContent.Replace(AllPackageClasses.CLASSES, sb.ToString());
var itemPackage = _allPackages[path].Replace(AllPackageClasses.CLASSES, sb.ToString());

if (path.EndsWith(FileNameAndDirectory.AllPackageClassesFileName)) Interlocked.Increment(ref namespaces);
//WriteFile(path, itemPackage);
WriteFile(path, itemPackage);
_allPackages[path] = itemPackage;
}
}
Expand All @@ -359,8 +360,7 @@ static void AnalyzeSubItems(string package, IDictionary<string, IDictionary<stri
.Replace(AllPackageClasses.NAMESPACE, package)
.Replace(AllPackageClasses.CLASSES, sb.ToString());

if (path.EndsWith(FileNameAndDirectory.AllPackageClassesFileName)) Interlocked.Increment(ref namespaces);
//WriteFile(path, itemPackage);
WriteFile(path, itemPackage);
}
}

Expand Down

0 comments on commit 5ab9f91

Please sign in to comment.