Skip to content

Instantly share code, notes, and snippets.

@flibitijibibo
Created February 26, 2015 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flibitijibibo/c1aa675e23c1bc450cc4 to your computer and use it in GitHub Desktop.
Save flibitijibibo/c1aa675e23c1bc450cc4 to your computer and use it in GitHub Desktop.
I wrote this for one of my smaller ports. Seems to work well enough for basic content management!
/* ContentCaseCheck - XNA Content Case Sensitivity Verification Tool
* Written by Ethan "flibitijibibo" Lee
* http://www.flibitijibibo.com/
*
* Released under public domain.
* No warranty implied; use at your own risk.
*/
using System;
using System.IO;
class ContentCaseCheck
{
static void Main(string[] args)
{
/* Acquired with `find .` in Content/ folder */
string[] files = File.ReadAllLines("file.txt");
/* Acquired with some grep of Content.Load<T> in game source */
string[] lines = File.ReadAllLines("list.txt");
/* Trim out ./ from files list */
for (int i = 1; i < files.Length; i += 1)
{
files[i] = files[i].Substring(2);
}
for (int i = 0; i < lines.Length; i += 1)
{
/* Trim out all text except for Content.Load param */
string line = lines[i];
int start = line.IndexOf('\"') + 1;
int end = line.LastIndexOf('\"');
lines[i] = lines[i].Substring(start, end - start);
/* Check for the string in the file list */
bool exists = false;
foreach (string file in files)
{
if (file.Contains(lines[i]))
{
exists = true;
break;
}
}
if (!exists)
{
System.Console.WriteLine(lines[i]);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment