Exemple #1
0
 private void MigrateWeekTheotokions(PlaceYmnosSource source)
 {
     foreach (DayOfWeek day in Enum.GetValues(typeof(DayOfWeek)))
     {
         MigrateDayTheotokions(source, day);
     }
 }
Exemple #2
0
        private string CreateFakeXml(PlaceYmnosSource place, int ihos, DayOfWeek dayOfWeek)
        {
            string text = string.Format("[{0}] [глас {1}] [{2}] Богородичен из Приложения Ирмология", place, ihos, dayOfWeek);

            Ymnos ymnos = new Ymnos();

            ymnos.Text.AddElement("cs-ru", text);

            return(new TypiconSerializer().Serialize(ymnos));
        }
 public TheotokionApp Create(PlaceYmnosSource source, int ihos, DayOfWeek day, string stringDefinition)
 {
     return(new TheotokionApp()
     {
         Place = source,
         Ihos = ihos,
         DayOfWeek = day,
         Definition = stringDefinition
     });
 }
Exemple #4
0
        /// <summary>
        /// Воскресные богородичны первого приложения
        /// </summary>
        private void MigrateDayTheotokions(PlaceYmnosSource source, DayOfWeek day)
        {
            InsertTheotokionRequest request = new InsertTheotokionRequest();

            for (int ihos = 1; ihos <= 8; ihos++)
            {
                request.Theotokion = Factory.Create(source, ihos, day, FileReader.Read(source, ihos, day));

                Service.InsertTheotokion(request);
            }
        }
Exemple #5
0
        public string Read(PlaceYmnosSource place, int ihos, DayOfWeek dayOfWeek)
        {
            string result = _fileReader.Read(string.Format("{0}.{1}.{2}", place, ihos, dayOfWeek));

            if (string.IsNullOrEmpty(result))
            {
                //создаем фейковый объект
                result = CreateFakeXml(place, ihos, dayOfWeek);
            }

            return(result);
        }
        /// <summary>
        /// Возвращает тексты из определенного места в службе
        /// </summary>
        /// <param name="place">Место</param>
        /// <param name="count">Количество</param>
        /// <param name="startFrom">С какого по номеру песнопения начинать выборку</param>
        /// <returns></returns>
        public YmnosStructure GetYmnosStructure(PlaceYmnosSource place, int count, int startFrom)
        {
            YmnosStructure stichera = null;

            switch (place)
            {
            //kekragaria
            case PlaceYmnosSource.kekragaria:
                stichera = _dayContainer.Esperinos.Kekragaria.GetYmnosStructure(count, startFrom);
                break;

            case PlaceYmnosSource.kekragaria_doxastichon:
                stichera = new YmnosStructure()
                {
                    Doxastichon = new YmnosGroup(_dayContainer.Esperinos.Kekragaria.Doxastichon)
                };
                break;

            case PlaceYmnosSource.kekragaria_theotokion:
                //TODO: прамая ссылка без копирования и клонирования
                stichera = new YmnosStructure()
                {
                    Theotokion = _dayContainer.Esperinos.Kekragaria.Theotokion
                };
                break;

            //liti
            case PlaceYmnosSource.liti:
                stichera = _dayContainer.Esperinos.Liti.GetYmnosStructure(count, startFrom);
                break;

            case PlaceYmnosSource.liti_doxastichon:
                stichera = new YmnosStructure()
                {
                    Doxastichon = new YmnosGroup(_dayContainer.Esperinos.Liti.Doxastichon)
                };
                break;

            case PlaceYmnosSource.liti_theotokion:
                //TODO: прамая ссылка без копирования и клонирования
                stichera = new YmnosStructure()
                {
                    Theotokion = _dayContainer.Esperinos.Liti.Theotokion
                };
                break;

            //aposticha_esperinos
            case PlaceYmnosSource.aposticha_esperinos:
                stichera = _dayContainer.Esperinos.Aposticha.GetYmnosStructure(count, startFrom);
                break;

            case PlaceYmnosSource.aposticha_esperinos_doxastichon:
                stichera = new YmnosStructure()
                {
                    Doxastichon = new YmnosGroup(_dayContainer.Esperinos.Aposticha.Doxastichon)
                };
                break;

            case PlaceYmnosSource.aposticha_esperinos_theotokion:
                //TODO: прамая ссылка без копирования и клонирования
                stichera = new YmnosStructure()
                {
                    Theotokion = _dayContainer.Esperinos.Aposticha.Theotokion
                };
                break;

            //ainoi
            case PlaceYmnosSource.ainoi:
                stichera = _dayContainer.Orthros.Ainoi.GetYmnosStructure(count, startFrom);
                break;

            case PlaceYmnosSource.ainoi_doxastichon:
                stichera = new YmnosStructure()
                {
                    Doxastichon = new YmnosGroup(_dayContainer.Orthros.Ainoi.Doxastichon)
                };
                break;

            case PlaceYmnosSource.ainoi_theotokion:
                //TODO: прамая ссылка без копирования и клонирования
                stichera = new YmnosStructure()
                {
                    Theotokion = _dayContainer.Orthros.Ainoi.Theotokion
                };
                break;

            //aposticha_orthros
            case PlaceYmnosSource.aposticha_orthros:
                stichera = _dayContainer.Orthros.Aposticha.GetYmnosStructure(count, startFrom);
                break;

            case PlaceYmnosSource.aposticha_orthros_doxastichon:
                stichera = new YmnosStructure()
                {
                    Doxastichon = new YmnosGroup(_dayContainer.Orthros.Aposticha.Doxastichon)
                };
                break;

            case PlaceYmnosSource.aposticha_orthros_theotokion:
                //TODO: прамая ссылка без копирования и клонирования
                stichera = new YmnosStructure()
                {
                    Theotokion = _dayContainer.Orthros.Aposticha.Theotokion
                };
                break;
            }

            return(stichera);
        }
Exemple #7
0
        /// <summary>
        /// Возвращает тексты из определенного места в службе
        /// </summary>
        /// <param name="place">Место</param>
        /// <param name="count">Количество</param>
        /// <param name="startFrom">С какого по номеру песнопения начинать выборку</param>
        /// <returns></returns>
        public YmnosStructure GetYmnosStructure(PlaceYmnosSource place, int count, int startFrom)
        {
            ThrowExceptionIfInvalid();

            YmnosStructure stichera = null;

            switch (place)
            {
            //kekragaria
            case PlaceYmnosSource.kekragaria:
                stichera = Esperinos?.Kekragaria?.GetYmnosStructure(count, startFrom);
                break;

            case PlaceYmnosSource.kekragaria_doxastichon:
                if (Esperinos?.Kekragaria?.Doxastichon != null)
                {
                    stichera = new YmnosStructure()
                    {
                        Doxastichon = new YmnosGroup(Esperinos.Kekragaria.Doxastichon)
                    };
                }
                break;

            case PlaceYmnosSource.kekragaria_theotokion:
                if (Esperinos?.Kekragaria?.Theotokion != null)
                {
                    stichera = new YmnosStructure()
                    {
                        Theotokion = Esperinos.Kekragaria.Theotokion
                    };
                }
                break;

            case PlaceYmnosSource.kekragaria_stavrostheotokion:
                if (Esperinos?.Kekragaria?.Theotokion != null &&
                    Esperinos.Kekragaria.Theotokion.Exists(c => c.Kind == YmnosGroupKind.Stavros))
                {
                    //Оставляем только крестобородичен
                    stichera = new YmnosStructure()
                    {
                        Theotokion = Esperinos.Kekragaria.Theotokion
                    };
                    stichera.Theotokion.RemoveAll(c => c.Kind == YmnosGroupKind.Undefined);
                }
                break;

            //liti
            case PlaceYmnosSource.liti:
                stichera = Esperinos?.Liti?.GetYmnosStructure(count, startFrom);
                break;

            case PlaceYmnosSource.liti_doxastichon:
                if (Esperinos?.Liti?.Doxastichon != null)
                {
                    stichera = new YmnosStructure()
                    {
                        Doxastichon = new YmnosGroup(Esperinos.Liti.Doxastichon)
                    };
                }
                break;

            case PlaceYmnosSource.liti_theotokion:
                if (Esperinos?.Liti?.Theotokion != null)
                {
                    stichera = new YmnosStructure()
                    {
                        Theotokion = Esperinos.Liti.Theotokion
                    };
                }
                break;

            //aposticha_esperinos
            case PlaceYmnosSource.aposticha_esperinos:
                stichera = Esperinos?.Aposticha?.GetYmnosStructure(count, startFrom);
                break;

            case PlaceYmnosSource.aposticha_esperinos_doxastichon:
                if (Esperinos?.Aposticha?.Doxastichon != null)
                {
                    stichera = new YmnosStructure()
                    {
                        Doxastichon = new YmnosGroup(Esperinos.Aposticha.Doxastichon)
                    };
                }
                break;

            case PlaceYmnosSource.aposticha_esperinos_theotokion:
                if (Esperinos?.Aposticha?.Theotokion != null)
                {
                    stichera = new YmnosStructure()
                    {
                        Theotokion = Esperinos.Aposticha.Theotokion
                    };
                }
                break;

            //ainoi
            case PlaceYmnosSource.ainoi:
                stichera = Orthros?.Ainoi?.GetYmnosStructure(count, startFrom);
                break;

            case PlaceYmnosSource.ainoi_doxastichon:
                if (Orthros?.Ainoi?.Doxastichon != null)
                {
                    stichera = new YmnosStructure()
                    {
                        Doxastichon = new YmnosGroup(Orthros.Ainoi.Doxastichon)
                    };
                }
                break;

            case PlaceYmnosSource.ainoi_theotokion:
                if (Orthros?.Ainoi?.Theotokion != null)
                {
                    stichera = new YmnosStructure()
                    {
                        Theotokion = Orthros.Ainoi.Theotokion
                    };
                }
                break;

            //aposticha_orthros
            case PlaceYmnosSource.aposticha_orthros:
                stichera = Orthros?.Aposticha?.GetYmnosStructure(count, startFrom);
                break;

            case PlaceYmnosSource.aposticha_orthros_doxastichon:
                if (Orthros?.Aposticha?.Doxastichon != null)
                {
                    stichera = new YmnosStructure()
                    {
                        Doxastichon = new YmnosGroup(Orthros.Aposticha.Doxastichon)
                    };
                }
                break;

            case PlaceYmnosSource.aposticha_orthros_theotokion:
                if (Orthros?.Aposticha?.Theotokion != null)
                {
                    stichera = new YmnosStructure()
                    {
                        Theotokion = Orthros.Aposticha.Theotokion
                    };
                }
                break;

            //troparion
            case PlaceYmnosSource.troparion:
                //Выбираем либо из Малой вечерни, либо с Вечерни тропарь
                YmnosStructure y = (MikrosEsperinos?.Troparion != null) ? MikrosEsperinos.Troparion
                                        : Esperinos.Troparion;

                stichera = new YmnosStructure(y);
                break;

            //sedalen1
            case PlaceYmnosSource.sedalen1:
                stichera = Orthros?.SedalenKathisma1?.GetYmnosStructure(count, startFrom);
                break;

            case PlaceYmnosSource.sedalen1_doxastichon:
                if (Orthros?.SedalenKathisma1?.Doxastichon != null)
                {
                    stichera = new YmnosStructure()
                    {
                        Doxastichon = new YmnosGroup(Orthros.SedalenKathisma1.Doxastichon)
                    };
                }
                break;

            case PlaceYmnosSource.sedalen1_theotokion:
                if (Orthros?.SedalenKathisma1?.Theotokion != null)
                {
                    stichera = new YmnosStructure()
                    {
                        Theotokion = Orthros.SedalenKathisma1.Theotokion
                    };
                }
                break;

            //sedalen2
            case PlaceYmnosSource.sedalen2:
                stichera = Orthros?.SedalenKathisma2?.GetYmnosStructure(count, startFrom);
                break;

            case PlaceYmnosSource.sedalen2_doxastichon:
                if (Orthros?.SedalenKathisma2?.Doxastichon != null)
                {
                    stichera = new YmnosStructure()
                    {
                        Doxastichon = new YmnosGroup(Orthros.SedalenKathisma2.Doxastichon)
                    };
                }
                break;

            case PlaceYmnosSource.sedalen2_theotokion:
                if (Orthros?.SedalenKathisma2?.Theotokion != null)
                {
                    stichera = new YmnosStructure()
                    {
                        Theotokion = Orthros.SedalenKathisma2.Theotokion
                    };
                }
                break;

            //sedalen3
            case PlaceYmnosSource.sedalen3:
                stichera = Orthros?.SedalenKathisma3?.GetYmnosStructure(count, startFrom);
                break;

            case PlaceYmnosSource.sedalen3_doxastichon:
                if (Orthros?.SedalenKathisma3?.Doxastichon != null)
                {
                    stichera = new YmnosStructure()
                    {
                        Doxastichon = new YmnosGroup(Orthros.SedalenKathisma3.Doxastichon)
                    };
                }
                break;

            case PlaceYmnosSource.sedalen3_theotokion:
                if (Orthros?.SedalenKathisma3?.Theotokion != null)
                {
                    stichera = new YmnosStructure()
                    {
                        Theotokion = Orthros.SedalenKathisma3.Theotokion
                    };
                }
                break;
            }

            return(stichera);
        }
Exemple #8
0
        /// <summary>
        /// Возвращает тексты из определенного места в службе
        /// </summary>
        /// <param name="place">Место</param>
        /// <param name="count">Количество</param>
        /// <param name="startFrom">С какого по номеру песнопения начинать выборку</param>
        /// <returns></returns>
        public static YmnosGroupCollection GetYmnosGroups(this DayContainer container, PlaceYmnosSource place, int count, int startFrom)
        {
            container.ThrowExceptionIfInvalid();

            YmnosGroupCollection result = default(YmnosGroupCollection);

            switch (place)
            {
            //kekragaria
            case PlaceYmnosSource.kekragaria:
                result = container.Esperinos?.Kekragaria?.Groups.GetYmnis(count, startFrom);
                break;

            case PlaceYmnosSource.kekragaria_doxastichon:
            {
                result = GetDoxastichon(container.Esperinos?.Kekragaria);
            }
            break;

            case PlaceYmnosSource.kekragaria_theotokion:
            {
                result = GetTheotokion(container.Esperinos?.Kekragaria);
            }
            break;

            case PlaceYmnosSource.kekragaria_stavrostheotokion:
            {
                result = GetTheotokion(container.Esperinos?.Kekragaria, YmnosGroupKind.Stavros);
            }
            break;

            //liti
            case PlaceYmnosSource.liti:
                result = container.Esperinos?.Liti?.Groups.GetYmnis(count, startFrom);
                break;

            case PlaceYmnosSource.liti_doxastichon:
            {
                result = GetDoxastichon(container.Esperinos?.Liti);
            }
            break;

            case PlaceYmnosSource.liti_theotokion:
            {
                result = GetTheotokion(container.Esperinos?.Liti);
            }
            break;

            //aposticha_esperinos
            case PlaceYmnosSource.aposticha_esperinos:
                result = container.Esperinos?.Aposticha?.Groups.GetYmnis(count, startFrom);
                break;

            case PlaceYmnosSource.aposticha_esperinos_doxastichon:
            {
                result = GetDoxastichon(container.Esperinos?.Aposticha);
            }
            break;

            case PlaceYmnosSource.aposticha_esperinos_theotokion:
            {
                result = GetTheotokion(container.Esperinos?.Aposticha);
            }
            break;

            //ainoi
            case PlaceYmnosSource.ainoi:
                result = container.Orthros?.Ainoi?.Groups.GetYmnis(count, startFrom);
                break;

            case PlaceYmnosSource.ainoi_doxastichon:
            {
                result = GetDoxastichon(container.Orthros?.Ainoi);
            }
            break;

            case PlaceYmnosSource.ainoi_theotokion:
            {
                result = GetTheotokion(container.Orthros?.Ainoi);
            }
            break;

            //aposticha_orthros
            case PlaceYmnosSource.aposticha_orthros:
                result = container.Orthros?.Aposticha?.Groups.GetYmnis(count, startFrom);
                break;

            case PlaceYmnosSource.aposticha_orthros_doxastichon:
            {
                result = GetDoxastichon(container.Orthros?.Aposticha);
            }
            break;

            case PlaceYmnosSource.aposticha_orthros_theotokion:
            {
                result = GetTheotokion(container.Orthros?.Aposticha);
            }
            break;

            //troparion
            case PlaceYmnosSource.troparion:
            {
                //Выбираем либо из Малой вечерни, либо с Вечерни тропарь
                YmnosStructure y = container.MikrosEsperinos?.Troparion ?? container.Esperinos.Troparion ?? null;

                result = y?.Groups.GetYmnis(count, startFrom);
            }
            break;

            case PlaceYmnosSource.troparion_doxastichon:
            {
                result = GetDoxastichon(container.MikrosEsperinos?.Troparion ?? container.Esperinos?.Troparion);
            }
            break;

            case PlaceYmnosSource.troparion_theotokion:
            {
                result = GetTheotokion(container.MikrosEsperinos?.Troparion ?? container.Esperinos?.Troparion);
            }
            break;

            //sedalen1
            case PlaceYmnosSource.sedalen1:
            {
                result = container.Orthros?.SedalenKathisma1?.Groups.GetYmnis(count, startFrom);
            }
            break;

            case PlaceYmnosSource.sedalen1_doxastichon:
            {
                result = GetDoxastichon(container.Orthros?.SedalenKathisma1);
            }
            break;

            case PlaceYmnosSource.sedalen1_theotokion:
            {
                result = GetTheotokion(container.Orthros?.SedalenKathisma1);
            }
            break;

            //sedalen2
            case PlaceYmnosSource.sedalen2:
            {
                result = container.Orthros?.SedalenKathisma2?.Groups.GetYmnis(count, startFrom);
            }
            break;

            case PlaceYmnosSource.sedalen2_doxastichon:
            {
                result = GetDoxastichon(container.Orthros?.SedalenKathisma2);
            }
            break;

            case PlaceYmnosSource.sedalen2_theotokion:
            {
                result = GetTheotokion(container.Orthros?.SedalenKathisma2);
            }
            break;

            //sedalen3
            case PlaceYmnosSource.sedalen3:
            {
                result = container.Orthros?.SedalenKathisma3?.Groups.GetYmnis(count, startFrom);
            }
            break;

            case PlaceYmnosSource.sedalen3_doxastichon:
            {
                result = GetDoxastichon(container.Orthros?.SedalenKathisma3);
            }
            break;

            case PlaceYmnosSource.sedalen3_theotokion:
            {
                result = GetTheotokion(container.Orthros?.SedalenKathisma3);
            }
            break;

            //sedalen_kanonas
            case PlaceYmnosSource.sedalen_kanonas:
            {
                result = container.Orthros?.SedalenKanonas?.Groups.GetYmnis(count, startFrom);
            }
            break;

            case PlaceYmnosSource.sedalen_kanonas_theotokion:
            {
                result = GetTheotokion(container.Orthros?.SedalenKanonas);
            }
            break;

            case PlaceYmnosSource.sedalen_kanonas_stavrostheotokion:
            {
                result = GetTheotokion(container.Orthros?.SedalenKanonas, YmnosGroupKind.Stavros);
            }
            break;
            }

            return(result);

            YmnosGroupCollection GetDoxastichon(YmnosStructure structure)
            {
                var found = structure?.Doxastichon?.GetGroupWithSingleYmnos(0);

                return((structure?.Doxastichon is YmnosGroup d) ? new YmnosGroupCollection()
                {
                    new YmnosGroup(d)
                } : default(YmnosGroupCollection));
            }

            YmnosGroupCollection GetTheotokion(YmnosStructure structure, YmnosGroupKind kind = YmnosGroupKind.Undefined)
            {
                var found = structure?.Theotokion?.FirstOrDefault(c => c.Kind == kind)?.GetGroupWithSingleYmnos(0);

                return((found != null) ? new YmnosGroupCollection()
                {
                    found
                } : default(YmnosGroupCollection));
            }
        }