Example #1
0
        private List <Horoscope> ParseHoroscope(string pageAsText)
        {
            List <Horoscope> horoscopes = new List <Horoscope>();

            foreach (AstroSign sign in AstroManager.Instance.AllSigns)
            {
                Regex regex = new Regex(HOROSCOPE_PATTERN.Replace("__SIGN__", sign.Name.ToUpper()), RegexOptions.CultureInvariant | RegexOptions.Multiline);
                Match match = regex.Match(pageAsText);
                if (!match.Success)
                {
                    _logger.LogError($"Unable to find the sign {sign.Name}");
                    continue;
                }
                Horoscope horoscope = new Horoscope()
                {
                    Sign = sign, GlobalText = FormatText(match.Groups[1].Value)
                };
                horoscope.Topics.Add(new HoroscopeTopic()
                {
                    Title = "Amour", TotalStars = 4, Stars = match.Groups[2].Value.Count(c => c == '★')
                });
                horoscope.Topics.Add(new HoroscopeTopic()
                {
                    Title = "Job", TotalStars = 4, Stars = match.Groups[3].Value.Count(c => c == '★')
                });
                horoscope.Topics.Add(new HoroscopeTopic()
                {
                    Title = "Vitalité", TotalStars = 4, Stars = match.Groups[4].Value.Count(c => c == '★')
                });
                horoscopes.Add(horoscope);
            }
            return(horoscopes);
        }
Example #2
0
        private void openNewJhdFile()
        {
            DateTime tNow = DateTime.Now;
            Moment   mNow = new Moment(tNow.Year, tNow.Month, tNow.Day, tNow.Hour, tNow.Minute, tNow.Second);
            HoraInfo info = new HoraInfo(mNow,
                                         MhoraGlobalOptions.Instance.Latitude,
                                         MhoraGlobalOptions.Instance.Longitude,
                                         MhoraGlobalOptions.Instance.TimeZone);

            childCount++;
            Horoscope h = new Horoscope(info, (HoroscopeOptions)MhoraGlobalOptions.Instance.HOptions.Clone());
            //new HoroscopeOptions());
            MhoraChild child = new MhoraChild(h);

            child.Text      = childCount.ToString() + " - Prasna Chart";
            child.MdiParent = this;
            child.Name      = child.Text;
            //info.name = child.Text;
            try
            {
                child.Show();
            }
            catch (System.OutOfMemoryException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #3
0
        static public void Test(Horoscope h, Division dtype)
        {
            FindYogas fy = new FindYogas(h, dtype);
            //fy.evaluateYoga ("gr<sun> in hse <1st>");
            //fy.evaluateYoga ("  gr<sun> in hse <1st>  ");
            //fy.evaluateYoga ("( gr<sun> in   hse <1st> )");
            //fy.evaluateYoga ("(gr<sun> in hse <1st>)");
            //fy.evaluateYoga ("(gr<sun> in hse <1st> )  ");

            //fy.evaluateYoga ("<gr:sun,moon,mars,ketu> in <rasi:1st,2nd,3rd,4th,5th,6th,7th,8th>");
            //fy.evaluateYoga ("<gr:mer> with <gr:<lordof:ari>>");
            //fy.evaluateYoga ("&&(<gr:mer> with <gr:<lordof:ari>>)(birth in <time:day>)");
            //fy.evaluateYoga ("&&(<gr:mer> with <gr:<lordof:ari>>)(birth in <time:night>)");

            //fy.evaluateYoga ("<gr:mer> in <rasi:leo>");
            //fy.evaluateYoga ("rasi@(<gr:mer> in <rasi:leo>)");
            //fy.evaluateYoga ("navamsa@(<gr:mer> in <rasi:leo>)");
            //fy.evaluateYoga ("rasi@(<gr:mer> in <rasi:can>)");
            //fy.evaluateYoga ("navamsa@(<gr:mer> in <rasi:can>)");
            //fy.evaluateYoga ("&&(rasi@(<gr:mer> in <rasi:leo>))(d9@(<gr:mer> in <rasi:can>)))");


            //fy.evaluateYoga ("<gr:<dispof:mer>> is <gr:moon>");
            //fy.evaluateYoga ("d9@(<gr:<dispof:<dispof:mer>>> is <gr:moon>)");
            //fy.evaluateYoga ("<gr:<d9@dispof:merc>> with <gr:sun>");
            //fy.evaluateYoga ("&&(<gr:sun,moon,mars> in <rasi:1st,1st,ari> with <gr:moon> and <gr:jup,pis>)(<gr:moon> in <rasi:2nd>)");
            //fy.evaluateYoga ("(&& (gr<sun> in hse<1st>) (mid term) (gr<moon> in  hse<2nd> ) )");
        }
Example #4
0
        private void openJhdFileNow()
        {
            DateTime tNow = DateTime.Now;
            Moment   mNow = new Moment(tNow.Year, tNow.Month, tNow.Day, tNow.Hour, tNow.Minute, tNow.Second);

            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "JHD Files (*.jhd)|*.jhd";

            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return;
            }


            HoraInfo info = (new Jhd(ofd.FileName)).toHoraInfo();

            info.tob = mNow;

            string[]  _path_split = ofd.FileName.Split(new Char[] { '/', '\\' });
            ArrayList path_split  = new ArrayList(_path_split);

            childCount++;
            Horoscope h = new Horoscope(info, (HoroscopeOptions)MhoraGlobalOptions.Instance.HOptions.Clone());

            //Horoscope h = new Horoscope (info, new HoroscopeOptions());
            MhoraChild child = new MhoraChild(h);

            child.Text      = childCount.ToString() + " - Prasna Chart";
            child.MdiParent = this;
            child.Name      = child.Text;
            child.Show();
        }
Example #5
0
        public JhoraBasicsTab(Horoscope _h)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            h = _h;
            MhoraGlobalOptions.DisplayPrefsChanged += new EvtChanged(OnRedisplay);
            this.OnRedisplay(MhoraGlobalOptions.Instance);
            this.AddControlToTab(tabKeyInfo, new KeyInfoControl(h));
            //this.AddControlToTab (tabTest, new BalasControl(h));
            //this.AddControlToTab (tabTest, new Sarvatobhadra81Control(h));
            //this.AddControlToTab (tabTest, new KutaMatchingControl(h, h));
            //this.AddControlToTab (tabTest, new VaraChakra(h));

            this.tabControl1.TabPages[0] = tabKeyInfo;
            this.tabControl1.TabPages[1] = tabCalculations;
            this.tabControl1.TabPages[2] = tabNavamsaChakra;
            this.tabControl1.TabPages[3] = tabAshtakavarga;
            this.tabControl1.TabPages[4] = tabYogas;

            this.tabControl1.SelectedTab = tabKeyInfo;
            //this.tabControl1.SelectedTab = tabTest;
        }
Example #6
0
        public async Task <HoroscopeSet> RetrieveHoroscope()
        {
            if (_cachedHoroscope != null)
            {
                return(_cachedHoroscope);
            }
            _cachedHoroscope = new HoroscopeSet {
                Time = DateTime.Today
            };
            using (HttpClient client = new HttpClient())
            {
                client.BaseAddress = new Uri("http://www.mon-horoscope-du-jour.com/horoscopes/quotidien/");
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("text/html"));
                client.DefaultRequestHeaders.UserAgent.Clear();
                client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident / 6.0)");
                client.Timeout = TimeSpan.FromSeconds(30);

                foreach (KeyValuePair <AstroSign, string> pageToParse in _urlToParse)
                {
                    Horoscope horoscope = await ParsePage(client, pageToParse.Key, pageToParse.Value);

                    _cachedHoroscope.Horoscopes.Add(horoscope);
                }
            }
            return(_cachedHoroscope);
        }
Example #7
0
        public JhoraMainTab(Horoscope _h)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.mTab.TabPages[0] = tabBasics;
            this.mTab.TabPages[1] = tabVargas;
            this.mTab.TabPages[2] = tabDasa;
            this.mTab.TabPages[3] = tabTransits;
            this.mTab.TabPages[4] = tabPanchanga;
            this.mTab.TabPages[5] = tabTithiPravesh;

            this.mTab.SelectedTab = tabBasics;

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            h = _h;
            MhoraGlobalOptions.DisplayPrefsChanged += new EvtChanged(OnRedisplay);
            this.OnRedisplay(MhoraGlobalOptions.Instance);

            this.AddControlToTab(tabBasics, new JhoraBasicsTab(h));
            //this.bTabBasicsLoaded = true;
        }
Example #8
0
 public Retrogression(Horoscope _h, Body.Name _b)
 {
     //Debug.Assert((int)_b >= (int)Body.Name.Moon &&
     //	(int)_b <= (int)Body.Name.Saturn,
     //	string.Format("Retrogression::Retrogression. Invalid Body {0}", _b));
     h = _h;
     b = _b;
 }
Example #9
0
        public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState)
        {
            Horoscope horoscope = e.Parameter as Horoscope;

            if (horoscope != null)
            {
                Horoscope = horoscope;
            }
        }
Example #10
0
 public GrahaStrengthsControl(Horoscope _h)
 {
     // This call is required by the Windows Form Designer.
     InitializeComponent();
     h            = _h;
     h.Changed   += new EvtChanged(this.OnRecalculate);
     this.options = new UserOptions();
     InitializeComboBoxes();
 }
        private void showHoroscope()
        {
            int    month         = Horoscope.dateConvert(LogicApp.m_LoggedInUser.Birthday, 0, 2);
            int    day           = Horoscope.dateConvert(LogicApp.m_LoggedInUser.Birthday, 3, 2);
            string horoscopeText = Horoscope.GetHoroscopeByDateOfBirth(day, month);

            FormHoroscope form = new FormHoroscope(horoscopeText);

            form.Show();
        }
Example #12
0
 public BalasControl(Horoscope _h)
 {
     // This call is required by the Windows Form Designer.
     InitializeComponent();
     h               = _h;
     h.Changed      += new EvtChanged(onRecalculate);
     mList.BackColor = Color.AliceBlue;
     this.Repopulate();
     this.AddViewsToContextMenu(this.contextMenu);
 }
Example #13
0
 public Ashtakavarga(Horoscope _h, Division _dtype)
 {
     h        = _h;
     dtype    = _dtype;
     avBodies = new Body.Name[]
     {
         Body.Name.Sun, Body.Name.Moon, Body.Name.Mars,
         Body.Name.Mercury, Body.Name.Jupiter, Body.Name.Venus,
         Body.Name.Saturn, Body.Name.Lagna
     };
 }
Example #14
0
        public void AddChild(Horoscope h, string name)
        {
            childCount++;
            MhoraChild child = new MhoraChild(h);

            h.OnChanged();
            child.Text      = childCount.ToString() + " - " + name;
            child.MdiParent = this;
            child.Name      = child.Text;
            child.Show();
        }
Example #15
0
 public KutaMatchingControl(Horoscope _h, Horoscope _h2)
 {
     // This call is required by the Windows Form Designer.
     InitializeComponent();
     h           = _h;
     h2          = _h2;
     h.Changed  += new EvtChanged(OnRecalculate);
     h2.Changed += new EvtChanged(OnRecalculate);
     this.AddViewsToContextMenu(this.mContext);
     this.populateTextBoxes();
     this.OnRecalculate(h);
 }
Example #16
0
        public MhoraChild(Horoscope _h)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            h = _h;
        }
Example #17
0
        public Dasa3Parts(Horoscope _h, DasaEntry _de, ToDate _td)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            td = _td;
            de = _de;
            h  = _h;
            this.repopulate();
        }
Example #18
0
        public KeyInfoControl(Horoscope _h)
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            // TODO: Add any initialization after the InitForm call
            h          = _h;
            h.Changed += new EvtChanged(OnRecalculate);
            MhoraGlobalOptions.DisplayPrefsChanged += new EvtChanged(OnRedisplay);
            Repopulate();
            this.AddViewsToContextMenu(this.mKeyInfoMenu);
        }
Example #19
0
        private bool checkJhd(string fileName)
        {
            HoraInfo  info = (new Jhd(fileName)).toHoraInfo();
            Horoscope h    = new Horoscope(info, new HoroscopeOptions());

            if (h.getPosition(Body.Name.Ketu).toDivisionPosition(new Division(Basics.DivisionType.Rasi)).zodiac_house.value ==
                h.getPosition(Body.Name.Lagna).toDivisionPosition(new Division(Basics.DivisionType.Rasi)).zodiac_house.value)
            {
                return(true);
            }

            return(false);
        }
Example #20
0
 public PanchangaControl(Horoscope _h)
 {
     // This call is required by the Windows Form Designer.
     InitializeComponent();
     h          = _h;
     h.Changed += new EvtChanged(OnRecalculate);
     MhoraGlobalOptions.DisplayPrefsChanged += new EvtChanged(OnRedisplay);
     opts = new UserOptions();
     this.AddViewsToContextMenu(this.contextMenu);
     this.mutexProgress = new Mutex(false);
     this.OnRedisplay(MhoraGlobalOptions.Instance.TableBackgroundColor);
     this.bCompute_Click(null, null);
 }
Example #21
0
 public static void releaseLock(Horoscope h)
 {
     if (mCurrentLockHolder == null)
     {
         throw new Exception("Sweph: releaseLock failed. Lock not held");
     }
     else if (mCurrentLockHolder != h)
     {
         throw new Exception("Sweph: releaseLock failed. Not lock owner");
     }
     //Debug.WriteLine("Sweph Lock released");
     mCurrentLockHolder = null;
 }
Example #22
0
 public VaraChakra(Horoscope _h)
 {
     // This call is required by the Windows Form Designer.
     InitializeComponent();
     h          = _h;
     h.Changed += new EvtChanged(OnRecalculate);
     MhoraGlobalOptions.DisplayPrefsChanged += new EvtChanged(OnResize);
     pn_black = new Pen(Color.Black, (float)0.1);
     pn_grey  = new Pen(Color.Gray, (float)0.1);
     b_black  = new SolidBrush(Color.Black);
     this.AddViewsToContextMenu(contextMenu);
     this.OnResize(MhoraGlobalOptions.Instance);
 }
Example #23
0
        public YogaControl(Horoscope _h)
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();
            h  = _h;
            fy = new FindYogas(h, new Division(Basics.DivisionType.Rasi));
            this.mList.BackColor = MhoraGlobalOptions.Instance.ChakraBackgroundColor;
            this.AddViewsToContextMenu(this.mContext);
            h.Changed += new EvtChanged(OnRecalculate);

            this.evaluateYogas();
            // TODO: Add any initialization after the InitializeComponent call
        }
Example #24
0
        public CalculationBase(AstroPlace locationData, bool IsWithDetails)
        {
            NakathEndDateTime = null;
            ThithiEndDateTime = null;
            KarnaEndDateTime  = null;
            YogaEndDateTime   = null;
            swissEph.swe_set_topo(locationData.Longitude, locationData.Latitude, 0.0);

            DateTime dateTime = locationData.BirthDateTime;

            LocationData    = locationData;
            CurrentDateTime = dateTime;
            Year            = dateTime.Year;
            Month           = dateTime.Month;
            Day             = dateTime.Day;
            Hour            = dateTime.Hour;
            Minute          = dateTime.Minute;
            Second          = dateTime.Second;
            List <AstroPlanet> pList = (IsWithDetails)? CalculatePlanetPositionWithDetailsOptmized():CalculatePlanetPosition();

            Sun     = pList.Find(x => x.Current == EnumPlanet.Sun);
            Moon    = pList.Find(x => x.Current == EnumPlanet.Moon);
            Mars    = pList.Find(x => x.Current == EnumPlanet.Mars);
            Mercury = pList.Find(x => x.Current == EnumPlanet.Mercury);
            Jupiter = pList.Find(x => x.Current == EnumPlanet.Jupiter);
            Venus   = pList.Find(x => x.Current == EnumPlanet.Venus);
            Saturn  = pList.Find(x => x.Current == EnumPlanet.Saturn);
            Uranus  = pList.Find(x => x.Current == EnumPlanet.Uranus);
            Neptune = pList.Find(x => x.Current == EnumPlanet.Neptune);
            Pluto   = pList.Find(x => x.Current == EnumPlanet.Pluto);
            Rahu    = pList.Find(x => x.Current == EnumPlanet.Rahu);
            Kethu   = pList.Find(x => x.Current == EnumPlanet.Kethu);

            Nakath         = new AstroNakath(this.Moon.Longitude);
            Nakath.EndTime = NakathEndDateTime;
            WeekDay        = new AstroWeekDay((EnumWeekDay)((int)dateTime.DayOfWeek + 1));
            Thithi         = new AstroThithi(new AstroThithi(EnumThithi.Amavasya).ofDeg(this.Sun.Longitude, this.Moon.Longitude));
            Thithi.EndTime = ThithiEndDateTime;
            Yoga           = new AstroYoga(new AstroYoga(EnumYoga.Shula).ofDeg(this.Sun.Longitude, this.Moon.Longitude));
            Yoga.EndTime   = YogaEndDateTime;
            Karna          = new AstroKarna(new AstroKarna(EnumKarana.Balava).ofDeg(this.Sun.Longitude, this.Moon.Longitude));
            Karna.EndTime  = KarnaEndDateTime;

            Horoscope = CalculateHoroscope(pList);
            Horoscope.ExtraDetails = new BirthRasiExtra(Horoscope);
            Horoscope.ExtraDetails.ThithiNumber = Thithi.Current;
            Horoscope.ExtraDetails.IsPura       = (Thithi.ThithiPaksha == EnumPaksha.Krishna);
            Horoscope.Nakath = Nakath;

            Init();
        }
Example #25
0
        private void bFemaleChange_Click(object sender, System.EventArgs e)
        {
            ChooseHoroscopeControl f = new ChooseHoroscopeControl();

            f.ShowDialog();
            if (f.GetHorsocope() != null)
            {
                this.h2.Changed      -= new EvtChanged(OnRecalculate);
                this.h2               = f.GetHorsocope();
                this.tbHorFemale.Text = f.GetHoroscopeName();
                this.h2.Changed      += new EvtChanged(OnRecalculate);
                this.OnRecalculate(h2);
            }
            f.Dispose();
        }
Example #26
0
        public PanchangaPrintDocument(
            PanchangaControl.UserOptions _opts,
            Horoscope _h, PanchangaGlobalMoments _globals, ArrayList _locals)
        {
            h       = _h;
            opts    = _opts;
            globals = _globals;
            locals  = _locals;

            if (locals.Count > 0 &&
                ((PanchangaLocalMoments)locals[0]).lagnas_ut.Count > 1)
            {
                bPrintLagna = true;
            }
        }
Example #27
0
        public RasiStrengthsControl(Horoscope _h)
        {
            // This call is required by the Windows Form Designer.

            InitializeComponent();

            if (false == MhoraGlobalOptions.Instance.RasiStrengthsFormSize.IsEmpty)
            {
                this.Size = MhoraGlobalOptions.Instance.RasiStrengthsFormSize;
            }

            h            = _h;
            h.Changed   += new EvtChanged(this.OnRecalculate);
            this.options = new UserOptions();
            InitializeComboBoxes();
        }
Example #28
0
        public void OnRecalculate(object _h)
        {
            if (bResultsInvalid == true)
            {
                return;
            }

            Horoscope h = (Horoscope)_h;

            ListViewItem li = new ListViewItem();

            li.Text = "Results may be out of date. Click the Compute Button to recalculate the panchanga";
            this.mList.Items.Insert(0, li);
            this.mList.Items.Insert(1, "");
            bResultsInvalid = true;
        }
Example #29
0
 public NavamsaControl(Horoscope _h)
 {
     // This call is required by the Windows Form Designer.
     InitializeComponent();
     h = _h;
     MhoraGlobalOptions.DisplayPrefsChanged += new EvtChanged(onRedisplay);
     h.Changed += new EvtChanged(onRecalculate);
     pn_black   = new Pen(Color.Black, (float)0.1);
     pn_grey    = new Pen(Color.Gray, (float)0.1);
     pn_lgrey   = new Pen(Color.LightGray, (float)0.1);
     nak_s      = new string[27]
     {
         "Asw", "Bha", "Kri", "Roh", "Mri", "Ard", "Pun", "Pus", "Asl",
         "Mag", "PPl", "UPh", "Has", "Chi", "Swa", "Vis", "Anu", "Jye",
         "Moo", "PAs", "UAs", "Sra", "Dha", "Sha", "PBh", "UBh", "Rev"
     };
     this.AddViewsToContextMenu(contextMenu);
     this.onRedisplay(MhoraGlobalOptions.Instance);
 }
Example #30
0
        public static void obtainLock(Horoscope h)
        {
            if (sweph.SwephLockObject == null)
            {
                sweph.SwephLockObject = new Object();
            }

            lock (sweph.SwephLockObject)
            {
                if (mCurrentLockHolder != null)
                {
                    throw new Exception("Sweph: obtainLock failed. Sweph Lock still held");
                }

                //Debug.WriteLine("Sweph Lock obtained");
                mCurrentLockHolder = h;
                sweph.swe_set_sid_mode((int)h.options.Ayanamsa, 0.0, 0.0);
            }
        }