コード例 #1
0
ファイル: GPEventList.cs プロジェクト: vijeetgv/GCAL
        private static XmlElement SaveEventElement(XmlDocument doc, GPEvent eve, XmlElement elem)
        {
            // ---
            elem.SetAttribute("class", eve.nClass.ToString());
            elem.SetAttribute("visible", eve.nVisible.ToString());
            elem.SetAttribute("used", eve.nUsed.ToString());
            // ---
            // save fast subject
            SaveElementChild(elem, "fastsubjectstringid", eve.fastSubjectStringId.ToString());
            SaveElementChild(elem, "fastsubject", eve.getRawFastSubject());

            // save text
            SaveElementChild(elem, "textstringid", eve.textStringId.ToString());
            SaveElementChild(elem, "text", eve.getRawText());

            // save others
            SaveElementChild(elem, "startyear", eve.nStartYear.ToString());
            SaveElementChild(elem, "specid", eve.nSpec.ToString());
            SaveElementChild(elem, "offset", eve.nOffset.ToString());
            SaveElementChild(elem, "deleted", eve.nDeleted.ToString());
            SaveElementChild(elem, "eventid", eve.eventId.ToString());
            SaveElementChild(elem, "fasttype", eve.getRawFastType().ToString());

            return(elem);
        }
コード例 #2
0
ファイル: GPEvent.cs プロジェクト: vijeetgv/GCAL
 public void addChildrenItem(GPEvent ev)
 {
     if (childrenItems == null)
     {
         childrenItems = new List <GPEvent>();
     }
     childrenItems.Add(ev);
 }
コード例 #3
0
ファイル: GPEventList.cs プロジェクト: vijeetgv/GCAL
        public GPEventList()
        {
            InitializeFromResources();

            foreach (GPEventRelative rel in relativeEvents)
            {
                GPEvent ev = GetSpecialEvent(rel.nSpecRef);
                if (ev != eventNotFound && ev != rel)
                {
                    ev.addChildrenItem(rel);
                    rel.addChildrenItem(ev);
                }
            }

            Modified = false;
        }
コード例 #4
0
ファイル: GPCalendarDay.cs プロジェクト: vijeetgv/GCAL
        public void AddFestivalCopy(GPEvent pEvx)
        {
            GPCalendarDay.Festival fest = null;
            if (pEvx.hasFasting())
            {
                fest = new GPCalendarDay.Festival(((pEvx.nClass >= 0) ? pEvx.nClass * 5 + 30 : 200), GPDisplays.Keys.FestivalClass(pEvx.nClass), pEvx.getText(), pEvx.getFastType(), pEvx.getFastSubject());
            }
            else
            {
                fest = new GPCalendarDay.Festival(((pEvx.nClass >= 0) ? pEvx.nClass * 5 + 30 : 200), GPDisplays.Keys.FestivalClass(pEvx.nClass), pEvx.getText());
            }
            Festivals.Add(fest);

            if (GPDisplays.Calendar.AnniversaryType() != 2 && pEvx.nStartYear > -7000)
            {
                int years = astrodata.nGaurabdaYear - (pEvx.nStartYear - 1496);
                fest.Text += " ";
                if (GPDisplays.Calendar.AnniversaryType() == 0)
                {
                    fest.Text += string.Format(GPStrings.getString(962), years);
                }
                else
                {
                    fest.Text += string.Format(GPStrings.getString(963), years);
                }
            }

            if (pEvx.hasChildrenItems())
            {
                foreach (GPEvent ev in pEvx.childrenItems)
                {
                    if (ev is GPEventRelative)
                    {
                        GPEventRelative relev = ev as GPEventRelative;
                        GPCalendarDay   vd    = GetDayWithOffset(relev.nOffset);
                        if (vd != null)
                        {
                            vd.AddFestivalCopy(relev);
                        }
                    }
                }
            }
        }
コード例 #5
0
ファイル: GPEventList.cs プロジェクト: vijeetgv/GCAL
        public void InsertEvent(XmlElement elem)
        {
            string  evType = elem.GetAttribute("type");
            GPEvent e      = null;

            if (evType.Equals("TITHI"))
            {
                GPEventTithi et = new GPEventTithi();
                et.nTithi = GetSubelementIntValue(elem, "tithi", 0);
                et.nMasa  = GetSubelementIntValue(elem, "masa", 0);
                e         = et;
            }
            else if (evType.Equals("REL"))
            {
                GPEventRelative er = new GPEventRelative();
                er.nSpecRef = GetSubelementIntValue(elem, "specref", 0);
                e           = er;
            }
            else if (evType.Equals("SAN"))
            {
                GPEventSankranti es = new GPEventSankranti();
                es.nSankranti = GetSubelementIntValue(elem, "sankranti", 0);
                e             = es;
            }
            else if (evType.Equals("NAK"))
            {
                GPEventNaksatra en = new GPEventNaksatra();
                en.nNaksatra = GetSubelementIntValue(elem, "naksatra", 0);
                e            = en;
            }
            else if (evType.Equals("YOG"))
            {
                GPEventYoga en = new GPEventYoga();
                en.nYoga = GetSubelementIntValue(elem, "naksatra", 0);
                e        = en;
            }
            else if (evType.Equals("ASTRO"))
            {
                GPEventAstro ea = new GPEventAstro();
                ea.nAstroType = GetSubelementIntValue(elem, "astrotype", 1);
                ea.nData      = GetSubelementIntValue(elem, "data", 0);
                e             = ea;
            }

            e.nClass   = GetAttributeIntValue(elem, "class", 6);
            e.nVisible = GetAttributeIntValue(elem, "visible", 1);
            e.nUsed    = GetAttributeIntValue(elem, "used", 0);

            e.nStartYear = GetSubelementIntValue(elem, "startyear", -10000);
            e.nSpec      = GetSubelementIntValue(elem, "specid", -1);
            e.nOffset    = GetSubelementIntValue(elem, "offset", 0);
            e.nDeleted   = GetSubelementIntValue(elem, "deleted", 0);
            e.setRawFastType(GetSubelementIntValue(elem, "fasttype", 0));
            e.setRawFastSubject(GetSubelementValue(elem, "fastsubject", "").Trim());
            e.setRawText(GetSubelementValue(elem, "text", "").Trim());
            e.textStringId        = GetSubelementIntValue(elem, "textstringid", -1);
            e.fastSubjectStringId = GetSubelementIntValue(elem, "fastsubjectstringid", -1);
            e.eventId             = GetSubelementIntValue(elem, "eventid", 0);

            /*if (e.nClass < 6)
             * {
             *  if (e.strText.Length > 0 && e.textStringId < 0)
             *  {
             *      sidSb.AppendFormat("{0}\t{1}\n", currSid, e.strText);
             *      e.textStringId = currSid;
             *      currSid++;
             *  }
             *
             *  if (e.strFastSubject.Length > 0 && e.fastSubjectStringId < 0)
             *  {
             *      sidSb.AppendFormat("{0}\t{1}\n", currSid, e.strFastSubject);
             *      e.fastSubjectStringId = currSid;
             *      currSid++;
             *  }
             * }*/

            add(e);
        }