CodeTranslator 1.0.0
dotnet add package CodeTranslator --version 1.0.0
NuGet\Install-Package CodeTranslator -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CodeTranslator" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CodeTranslator --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CodeTranslator, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CodeTranslator as a Cake Addin #addin nuget:?package=CodeTranslator&version=1.0.0 // Install CodeTranslator as a Cake Tool #tool nuget:?package=CodeTranslator&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
class Program { ...
private static void CodeConverter()
{
DirectoryInfo d = new DirectoryInfo(source);
// Process the list of files found in the directory.
FileInfo[] Files = d.GetFiles("*.cs", SearchOption.AllDirectories);
if (Files.Length == 0)
return;
Translator code = new Translator(Language.Csharp, Language.Java);
foreach (FileInfo file in Files)
{
Console.WriteLine("fileName: " + file.Name);
// Read entire text file content in one string
string plain = File.ReadAllText(file.FullName);
// Read each line of the file into a string array. Each element
// of the array is one line of the file.
string[] lines = File.ReadAllLines(file.FullName);
//string output = code.Convert(plain);
string output = code.Convert(lines);
//Console.WriteLine(output);
if (output != null && output.Length > 0)
{
File.WriteAllText(target + "/" + file.Name.Replace(".cs", ".java"), output);
}
}
}
private static void Csharp2Java()
{
DirectoryInfo d = new DirectoryInfo(source);
// Process the list of files found in the directory.
FileInfo[] Files = d.GetFiles("*.cs", SearchOption.AllDirectories);
if (Files.Length == 0)
return;
Translator code = new Translator();
foreach (FileInfo file in Files)
{
Console.WriteLine("fileName: " + file.Name);
// Read entire text file content in one string
//string plain = File.ReadAllText(file.FullName);
// Read each line of the file into a string array. Each element
// of the array is one line of the file.
string[] lines = File.ReadAllLines(file.FullName);
string output = code.Csharp2Java(lines);
//Console.WriteLine(output);
if (output != null && output.Length > 0)
{
File.WriteAllText(target + "/" + file.Name.Replace(".cs", ".java"), output);
}
}
}
private static void Java2Csharp()
{
DirectoryInfo d = new DirectoryInfo(source);
// Process the list of files found in the directory.
FileInfo[] Files = d.GetFiles("*.java", SearchOption.AllDirectories);
if (Files.Length == 0)
return;
Translator code = new Translator();
foreach (FileInfo file in Files)
{
Console.WriteLine("fileName: " + file.Name);
// Read entire text file content in one string
string plain = File.ReadAllText(file.FullName);
// Read each line of the file into a string array. Each element
// of the array is one line of the file.
string[] lines = File.ReadAllLines(file.FullName);
string output = code.Csharp2Java(lines);
//Console.WriteLine(output);
if (output != null && output.Length > 0)
{
File.WriteAllText(target + "/" + file.Name.Replace(".java", ".cs"), output);
}
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net40 is compatible. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 663 | 10/4/2020 |
C# to Java Converter produces great Java code.