Added exception handling to ExportCharacterSeparatedRules

This commit is contained in:
Dmitri Suvorov
2015-07-05 02:32:24 +03:00
parent 27f492b793
commit 0457e58fe9

View File

@@ -23,10 +23,18 @@ namespace OpenRA.Mods.Common.UtilityCommands
Game.ModData = modData;
var table = ActorStatsExport.GenerateTable();
var filename = "{0}-mod-dps.csv".F(Game.ModData.Manifest.Mod.Id);
using (var outfile = new StreamWriter(filename))
outfile.Write(table.ToCharacterSeparatedValues(";", true));
Console.WriteLine("{0} has been saved.".F(filename));
Console.WriteLine("Open as values separated by semicolon.");
try
{
using (var outfile = new StreamWriter(filename))
outfile.Write(table.ToCharacterSeparatedValues(";", true));
Console.WriteLine("{0} has been saved.".F(filename));
Console.WriteLine("Open as values separated by semicolon.");
}
catch (UnauthorizedAccessException e)
{
Console.WriteLine(e.Message);
}
}
}
}