Skip to content

Instantly share code, notes, and snippets.

@thirdknife
Created August 15, 2017 10:59
Show Gist options
  • Save thirdknife/53168e5a21ef3ab54cbfa9ad1e50dfc7 to your computer and use it in GitHub Desktop.
Save thirdknife/53168e5a21ef3ab54cbfa9ad1e50dfc7 to your computer and use it in GitHub Desktop.
public static void DirSearch(string sDir)
{
try
{
foreach (string filePath in Directory.GetFiles(sDir, "*xml"))
{
string readXML = File.ReadAllText(filePath);
readXML = readXML.Replace("NDO Made/Fabric/Leather/Fine Leather", "Basic Materials/Fabric/Leather").Replace("Megascans/Brick/Broken/Old Brick", "Basic Materials/Construction/Brick_-_Old").Replace("Megascans/Brick/New/Smooth Brick", "Basic Materials/Construction/Brick_-_Smooth").Replace("Megascans/Concrete/Cracked/Cracked Concrete", "Basic Materials/Construction/Concrete_-_Cracked").Replace("Megascans/Concrete/Rough/Rough Concrete", "Basic Materials/Construction/Concrete_-_Rough").Replace("Megascans/Concrete/Smooth/Clean Concrete", "Basic Materials/Construction/Concrete_-_Clean").Replace("Megascans/Concrete/Smooth/Concrete", "Basic Materials/Construction/Concrete").Replace("Megascans/Dirt/Mud/Muddy Dirt", "Basic Materials/Dirt/Mud_-_Muddy_Dirt").Replace("Megascans/Dirt/Mud/Wet Mud", "Basic Materials/Dirt/Mud_-_Wet").Replace("Megascans/Dirt/Sand/beach", "Basic Materials/Dirt/Sand_-_Beach").Replace("Megascans/Dirt/Sand/sand", "Basic Materials/Dirt/Sand").Replace("Megascans/Fabric/Cotton/Cotton", "Basic Materials/Fabric/Cotton").Replace("Megascans/Fabric/Denim/Jeans", "Basic Materials/Fabric/Denim").Replace("Megascans/Fabric/Leather/Smooth Leather", "Basic Materials/Fabric/Leather_-_Smooth").Replace("Megascans/Fabric/Nylon/Ballistic Nylon", "Basic Materials/Fabric/Nylon_-_Ballistic").Replace("Megascans/Fabric/Silk/Silk", "Basic Materials/Fabric/Silk").Replace("Megascans/Grass/Cut Lawn", "Basic Materials/Vegetation/Grass_-_Lawn").Replace("Megascans/Human/Skin/Lips", "Basic Materials/Organic/Human_-_Lips").Replace("Megascans/Human/Skin/Skin", "Basic Materials/Organic/Human_-_Skin").Replace("Megascans/Liquid/Water/Hanging Drops", "Basic Materials/Liquid/Water_-_Droplets").Replace("Megascans/Metal/Aluminum/Aluminum", "Basic Materials/Metal/Aluminum").Replace("Megascans/Metal/Aluminum/Thumbprint Metal", "Basic Materials/Metal/Aluminum_-_Fingerprints").Replace("Megascans/Metal/Brushed/Brushed Metal", "Basic Materials/Metal/Steel_-_Brushed_Rough").Replace("Megascans/Metal/Galvanized/Galvanized Metal", "Basic Materials/Metal/Steel_-_Galvanized").Replace("Megascans/Metal/Grainy/Grainy Metal", "Basic Materials/Metal/Steel_-_Grainy").Replace("Megascans/Metal/Rust/Coarse Rust", "Basic Materials/Decay/Rust_-_Coarse").Replace("Megascans/Metal/Rust/Fine Rust", "Basic Materials/Decay/Rust_-_Fine").Replace("Megascans/Metal/Scratched/Dusty Metal", "Basic Materials/Metal/Steel_-_Dusty").Replace("Megascans/Metal/Scratched/Scratched Metal", "Basic Materials/Metal/Steel_-_Scratched").Replace("Megascans/Metal/Steel/Dirty Steel", "Basic Materials/Metal/Steel_-_Dirty").Replace("Megascans/Metal/Tin/Tin Metal", "Basic Materials/Metal/Tin").Replace("Megascans/Monster/Skin/Flipped Cow", "Basic Materials/Organic/Cow_-_Flipped_Hide").Replace("Megascans/Plaster/Rough/Rough Plaster", "Basic Materials/Construction/Plaster_-_Rough").Replace("Megascans/Plastic/Grainy/Grainy Plastic", "Basic Materials/Plastic/Plastic_-_Grainy").Replace("Megascans/Plastic/Grainy/Red PVC Plastic", "Basic Materials/Plastic/PVC").Replace("Megascans/Rock/Stone/Stone", "Basic Materials/Stone/Stone").Replace("Megascans/Rubber/Synthetic/Dirty Rubber", "Basic Materials/Plastic/Rubber_-_Synthetic").Replace("Megascans/Wood/Bare/Bare Wood", "Basic Materials/Wood/Wood_-_Bare").Replace("Basic Materials/Decay/Rust_-_Fine", "Basic Materials/Metal/Steel_-_Oxidized_01").Replace("Basic Materials/Decay/Rust_-_Coarse", "Basic Materials/Metal/Steel_-_Oxidized_03");
File.WriteAllText(filePath, readXML);
}
foreach (string d in Directory.GetDirectories(sDir))
{
DirSearch(d);
}
}
catch (System.Exception excpt)
{
Console.WriteLine(excpt);
}
}
string sourcePath = @"C:\Users\Shakeel\AppData\Roaming\Adobe\CEP\extensions\suite-three\Shared\core\presets\";
DirSearch(sourcePath);
Console.WriteLine("Writing files Complete! Press any key to continue.");
Console.ReadLine();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment