From 1a54edfe871d75412298b5b9fa538fce98862187 Mon Sep 17 00:00:00 2001 From: artyfarty Date: Tue, 24 Jan 2012 23:43:09 +0400 Subject: [PATCH] more rfactoring example map commented --- UniversalEmoticonPackBuilderLib/main.cs | 30 ++++++++++++++++--------- examplePack/map.txt | 11 +++++++-- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/UniversalEmoticonPackBuilderLib/main.cs b/UniversalEmoticonPackBuilderLib/main.cs index e0502b6..6a8e2ee 100644 --- a/UniversalEmoticonPackBuilderLib/main.cs +++ b/UniversalEmoticonPackBuilderLib/main.cs @@ -9,7 +9,7 @@ namespace UniversalEmoticonPackBuilderLib { public static class UniversalEmoticonPackBuilder { - public static void BuildPacks(PackInfo packinfo, string build_dir, List requested_builders, string mapfile) + public static void BuildPacks(PackInfo packinfo, string build_dir, List requested_builders, Dictionary map) { // Cleanup and create build dir try @@ -47,15 +47,22 @@ public static void BuildPacks(PackInfo packinfo, string build_dir, List break; } + // Build! + foreach (var s in map) + builders.ForEach(c => c.CopySmiley(s.Key, s.Value.Split(','))); + + builders.ForEach(c => c.Finish()); + } + public static void BuildPacks(PackInfo packinfo, string build_dir, List requested_builders, string mapfile) { // Load pack - Dictionary pack = new Dictionary(); + Dictionary map = new Dictionary(); if (mapfile.Length > 0) { string line; - var map = new StreamReader(mapfile); - while ((line = map.ReadLine()) != null) + var mapStream = new StreamReader(mapfile); + while ((line = mapStream.ReadLine()) != null) { if (line.IndexOf('#') == 0) continue; var spl = line.Split(new[] { ':' }, 2); @@ -63,17 +70,18 @@ public static void BuildPacks(PackInfo packinfo, string build_dir, List var sname = spl[0]; var scode = spl[1]; - pack.Add(sname, scode); + map.Add(sname, scode); } } else - throw new Exception("No map defined");// pack = Config.Pack; + throw new Exception("No map defined"); - // Build! - foreach (var s in pack) - builders.ForEach(c => c.CopySmiley(s.Key, s.Value.Split(','))); - - builders.ForEach(c => c.Finish()); + BuildPacks( + packinfo, + build_dir, + requested_builders, + map + ); } public static void BuildPacks(BuilderConfig Config) diff --git a/examplePack/map.txt b/examplePack/map.txt index 9659a82..b947ee1 100644 --- a/examplePack/map.txt +++ b/examplePack/map.txt @@ -1,4 +1,11 @@ -ff.gif:(fuu) +# Comment + +# empty lines ok +# +# Entry format: +# imagefile:code[,alternativecode[,alternativecode[,alternativecode ... ]]] + +ff.gif:(fuu) fi.gif:(gyay) fl.gif:(aha) -ft.gif:(troll) \ No newline at end of file +ft.gif:(troll),troll.jpg \ No newline at end of file