예제 #1
0
 public Emote(string name, EmoteSource source)
 {
     Name = name;
     Source = source;
 }
예제 #2
0
 /// <summary>
 /// Creates an emote with a literal source of the same name.
 /// </summary>
 public Emote(string name)
 {
     Name = name;
     Source = new EmoteSource(string.Format("/{0}", name));
 }
예제 #3
0
        static void Main(string[] args)
        {
            string inputFolder;
            string outputFolder;
            string archiveFolder = null;

            switch(args.Length)
            {
                case 0:
                    //Use the current directory for both folders if no command line args are given.
                    inputFolder = outputFolder = ".";
                    break;

                case 1:
                   //Use the given directory for both folders if only one arg is given.
                    inputFolder = outputFolder = args[0];
                    break;

                case 2:
                    //Use the given input and output directories if 2 args are given.
                    inputFolder = args[0];
                    outputFolder = args[1];
                    break;

                case 3:
                    //Use the given input, output, and archive directories if 3 args are given.
                    inputFolder = args[0];
                    outputFolder = args[1];
                    archiveFolder = args[2];
                    break;

                default:
                    throw new ArgumentException("Too many arguments!");
            }

            string sourceFile = Path.Combine(inputFolder, "sources.txt");
            string allEmotesFile = Path.Combine(outputFolder, "allEmotes.txt");
            string conflictsFile = Path.Combine(outputFolder, "conflicts.txt");

            //Load emotes from all sources
            var sources = File.ReadAllText(sourceFile).Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
            var emoteSources = new List<EmoteSource>();
            foreach (string s in sources)
            {
                var source = new EmoteSource(s);
                source.Load();
                emoteSources.Add(source);
                _emotes.AddRange(source.Emotes);
                AddUniquesToList(source.Emotes);
            }

            //If an archive folder was specified, write the current 'all emotes' and 'conflicts' files
            // to the archive folder.
            if (archiveFolder != null)
            {
                string filename = DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss.fff") + ".txt";
                string archiveOutFile = Path.Combine(archiveFolder, "Emotes", filename);
                string archiveConflictFile = Path.Combine(archiveFolder, "Conflicts", filename);

                WriteAll(archiveOutFile);
                WriteConflicts(archiveConflictFile);
            }

            //Write the 'all emotes' file
            WriteAll(allEmotesFile);

            //Write the 'conflicts' file
            WriteConflicts(conflictsFile);
        }