Exemplo n.º 1
0
        private Dictionary <string, CharacterStats> BuildCharacterDictionary(int episodes)
        {
            Dictionary <string, CharacterStats> dictionary = new Dictionary <string, CharacterStats>(StringComparer.CurrentCultureIgnoreCase);

            for (int index = 0; index < episodes; ++index)
            {
                ExcelScript excelScript = new ExcelScript();
                excelScript.Load(m_path, index + 1);
                foreach (string character in excelScript.Characters)
                {
                    if (!dictionary.ContainsKey(character))
                    {
                        dictionary.Add(character, new CharacterStats());
                    }
                    int left;
                    int total;
                    excelScript.GetLinesLeft(character, out left, out total);
                    while (dictionary[character].Episodes.Count < index + 1)
                    {
                        dictionary[character].Episodes.Add(new EpisodeStats());
                    }
                    dictionary[character].Episodes[index].done  = total - left;
                    dictionary[character].Episodes[index].total = total;
                }
            }
            foreach (CharacterStats characterStats in dictionary.Values)
            {
                while (characterStats.Episodes.Count < episodes + 1)
                {
                    characterStats.Episodes.Add(new EpisodeStats());
                }
            }
            return(dictionary);
        }
Exemplo n.º 2
0
        private void GetLinesLeft(string character, int episode, out int left, out int total)
        {
            ExcelScript excelScript = new ExcelScript();

            excelScript.Load(m_path, episode);
            left  = 0;
            total = 0;
            for (ScriptLine scriptLine = excelScript.Lines.GetFirstLine(character); scriptLine != null; scriptLine = scriptLine.NextByCharacter)
            {
                ++total;
                if (!scriptLine.IsDone)
                {
                    ++left;
                }
            }
        }