• Welcome to MX Bikes Official Forum. Please login or sign up.
 
April 24, 2024, 02:19:30 PM

News:

MX Bikes beta18j available! :)


MX Bikes folder creator

Started by [GH]Cody, March 18, 2019, 12:50:02 AM

Previous topic - Next topic

[GH]Cody

Im not quite sure where this thread belongs since its just a simple tool, but this was created just to save some annoyance for myself/friends who are new to the game so they dont have to manually create the folders. If you already have some of the folders then it will not replace them or the contents inside.

This will create the necessary sub directories for your bikes/rider(Sub folders)/tracks in your MX Bikes directory.
Creates:

bikes

rider
rider\boots
rider\fonts
rider\gloves
rider\goggles
rider\helmets
rider\paints
rider\protections
rider\protections\full
rider\protections\neck

tracks
tracks\enduro
tracks\motocross
tracks\supercross
tracks\supermoto


Download:
https://www.dropbox.com/s/8hq3v27d45gedrp/MX%20Bikes%20Folder%20Creator.exe?dl=0

Video Example:
https://www.youtube.com/watch?v=lqN6uJRf17k&feature=youtu.be

Source if anyones curious(a bit sloppy but this was just a quick whip up :) ):

public MainWindow()
{
InitializeComponent();
this.ResizeMode = ResizeMode.CanMinimize;
SetDefaultPossiblePath();
}

private void SetDefaultPossiblePath()
{
string Path = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\MX Bikes\";
if (Directory.Exists(Path))
{
TBFolderPath.Text = Path;
}
else
{
TBFolderPath.Text = "Could NOT find default path. Manually select it ->";
}
}

private void Button_Click(object sender, RoutedEventArgs e)
{
var FileBrowser = new Microsoft.Win32.OpenFileDialog();
FileBrowser.Title = "Select ANY file in your MX Bikes folder directory";
FileBrowser.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);

Nullable<bool> Result = FileBrowser.ShowDialog();
if (Result == true)
{
TBFolderPath.Text = FileBrowser.FileName.Replace(FileBrowser.SafeFileName, "");
}
}

private void CreateRiderSubDirectories(string Path)
{
string RiderPath = Path + @"rider\";
string[] RiderSubFolders = { @"boots\", @"fonts\", @"gloves\", @"goggles\", @"helmets\", @"paints\", @"protections\" };

string ProtectionPath = RiderPath + @"protections\";
string[] ProtectionsSubFolders = { @"full\", @"neck\" };
foreach (string Sub in RiderSubFolders)
{
string NewPath = RiderPath + Sub;
if (Directory.Exists(NewPath))
{
continue;
}
else
{
Directory.CreateDirectory(NewPath);
}
}

foreach (string Sub in ProtectionsSubFolders)
{
string NewPath = ProtectionPath + Sub;
if (Directory.Exists(NewPath))
{
continue;
}
else
{
Directory.CreateDirectory(NewPath);
}
}
}

private void CreateTrackSubDirectories(string Path)
{
string TrackPath = Path + @"tracks\";
string[] TrackSubFolders = { @"motocross\", @"supercross\", @"supermoto\", @"enduro\" };

foreach (string Sub in TrackSubFolders)
{
string NewPath = TrackPath + Sub;
if (Directory.Exists(NewPath))
{
continue;
}
else
{
Directory.CreateDirectory(NewPath);
}
}
}

private void CreateBaseSubDirectories(string Path)
{
string[] BaseSubFolders = { @"bikes\", @"tracks\" };
foreach (string Sub in BaseSubFolders)
{
string NewPath = Path + Sub;
if (Directory.Exists(NewPath))
{
continue;
}
else
{
Directory.CreateDirectory(NewPath);
}
}

}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
string Path = TBFolderPath.Text;

if (Directory.Exists(Path))
{
CreateBaseSubDirectories(Path);
CreateRiderSubDirectories(Path);
CreateTrackSubDirectories(Path);
System.Windows.MessageBox.Show("Sub directories created");
}
else
{
System.Windows.MessageBox.Show(Path + " Does NOT Exist");
}
}