July 2023 Changelog - Better Code Display

FateKid

DEVIL DID IT

Admin

Status

offline

Posts

14,963

Likes

131,344

Resources

3,400

Bits Credits

503

LEVEL

11

5,910 XP

We've made some slight changes to our Codebox rich editor, making it easier and more elegant to display your own code.
With this change, you'll be able to set titles, provide copy-paste solutions for other members of the community.

Codebox Example:
[CODE lang="csharp" title="Snippit of BMCleaner Functions"]// COLLECTION OF MODIFIABLE FILE INFORMATION - GENERAL UTILITY FUNCTION
private void collectInfoBtn_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(jarDirectory))
{
MessageBox.Show("Please set the JAR folder path first.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}

int ymlFileCount = 0;
int classpathsFileCount = 0;
int projectsFileCount = 0;
int manifestFileCount = 0;
int jsonFileCount = 0;

List<string> jarTitles = GetJarTitles(jarDirectory);
if (jarTitles.Count > 0)
{
foreach (string file in Directory.GetFiles(jarDirectory, "*.jar"))
{
using (ZipArchive zip = ZipFile.OpenRead(file))
{
ymlFileCount += GetFileCountInArchive(zip, "*.yml");
classpathsFileCount += GetFileCountInArchive(zip, "*.classpaths");
projectsFileCount += GetFileCountInArchive(zip, "*.projects");
manifestFileCount += GetFileCountInArchive(zip, "MANIFEST");
jsonFileCount += GetFileCountInArchive(zip, "plugin-date.json");
}
}

string infoMessage = $"Scanned Files Information:{Environment.NewLine}" +
$"{Environment.NewLine}" +
$".yml Files: {ymlFileCount}{Environment.NewLine}" +
$".json Files: {jsonFileCount}{Environment.NewLine}" +
$".classpaths Files: {classpathsFileCount}{Environment.NewLine}" +
$".projects Files: {projectsFileCount}{Environment.NewLine}" +
$"MANIFEST Files: {manifestFileCount}{Environment.NewLine}";

MessageBox.Show(infoMessage, "Collected Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("No JAR files found in the specified folder.", "Scan Results", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}[/CODE]
 
Liked by:

Latest threads

Forum statistics

Threads
59,096
Messages
90,295
Members
56,033
Latest member
alichka
Top Bottom