Example #1
0
        private IRange FindActorCell(IWorksheet ws, string actor)
        {
            IRange range = ws.Cells[ActorOverviewColumnStart];

            while (!string.IsNullOrEmpty(range.Formula) && !actor.Equals(range.Formula, StringComparison.CurrentCultureIgnoreCase))
            {
                range = range.Offset(1, 0);
            }
            if (string.IsNullOrEmpty(range.Formula))
            {
                range = null;
            }
            return(range);
        }
Example #2
0
        private IRange FindCharacterCell(IWorksheet ws, string character)
        {
            IRange range = ws.Cells[TranslatedColumnStart];

            while (!string.IsNullOrEmpty(range.Formula) && !character.Equals(range.Formula, StringComparison.CurrentCultureIgnoreCase))
            {
                range = range.Offset(1, 0);
            }
            if (string.IsNullOrEmpty(range.Formula))
            {
                range = null;
            }
            return(range);
        }
Example #3
0
        private void UpdateCharacters(IWorksheet ws)
        {
            Dictionary <string, ActorData> dictionary = new Dictionary <string, ActorData>();

            for (IRange range = ws.Cells[TranslatedColumnStart]; !string.IsNullOrEmpty(range.Formula); range = range.Offset(1, 0))
            {
                if (Convert.ToInt32(ws.Cells[range.Row, LinesLeftMatrixColumn + m_episodes].Value) == 0)
                {
                    range.Interior.Color = DoneColor;
                }
                else
                {
                    bool flag = false;
                    for (int index = 0; index < m_episodes; ++index)
                    {
                        IRange cell = ws.Cells[range.Row, LinesLeftMatrixColumn + index];
                        if (cell.Interior.Color == DoneColor || cell.Interior.Color == InProgressColor)
                        {
                            flag = true;
                            break;
                        }
                    }
                    range.Interior.Color = !flag ? NotStartedColor : InProgressColor;
                }
            }
        }
Example #4
0
        private void UpdateActors(IWorksheet ws)
        {
            Dictionary <string, ActorData> dictionary = BuildActorsList(ws);

            for (IRange range = ws.Cells[ActorOverviewColumnStart]; !string.IsNullOrEmpty(range.Formula); range = range.Offset(1, 0))
            {
                ActorData actorData = dictionary[range.Formula];
                range.Interior.Color = actorData.left != 0 ? (!actorData.started ? NotStartedColor : InProgressColor) : DoneColor;
                for (int index = 0; index < m_episodes; ++index)
                {
                    IRange cell = ws.Cells[range.Row, LinesLeftMatrixColumn + index];
                    cell.Value          = actorData.epleft[index];
                    cell.Interior.Color = actorData.epleft[index] != 0 ? (!actorData.epstarted[index] ? NotStartedColor : InProgressColor) : DoneColor;
                }
            }
            for (IRange range = ws.Cells[ActorColumnStart]; !string.IsNullOrEmpty(range.Formula); range = range.Offset(1, 0))
            {
                ActorData actorData = dictionary[range.Formula];
                range.Interior.Color = actorData.left != 0 ? (!actorData.started ? NotStartedColor : InProgressColor) : DoneColor;
            }
        }
Example #5
0
        private Dictionary <string, ActorData> BuildActorsList(IWorksheet ws)
        {
            Dictionary <string, ActorData> dictionary = new Dictionary <string, ActorData>();

            for (IRange range = ws.Cells[ActorColumnStart]; !string.IsNullOrEmpty(range.Formula); range = range.Offset(1, 0))
            {
                string formula = range.Formula;
                if (!dictionary.ContainsKey(formula))
                {
                    dictionary[formula] = new ActorData
                    {
                        Name      = formula,
                        started   = false,
                        epleft    = new int[m_episodes],
                        epstarted = new bool[m_episodes]
                    }
                }
                ;
                ActorData actorData = dictionary[formula];
                if (Convert.ToInt32(ws.Cells[range.Row, LinesLeftMatrixColumn + m_episodes].Value) != 0)
                {
                    for (int index = 0; index < m_episodes; ++index)
                    {
                        IRange cell  = ws.Cells[range.Row, LinesLeftMatrixColumn + index];
                        int    int32 = Convert.ToInt32(cell.Value);
                        actorData.epleft[index] += int32;
                        actorData.left          += int32;
                        if (cell.Interior.Color == DoneColor || cell.Interior.Color == InProgressColor)
                        {
                            actorData.epstarted[index] = true;
                            actorData.started          = true;
                        }
                    }
                }
            }
            return(dictionary);
        }