Esempio n. 1
0
        void changelocation()
        {
            try
            {
                bool showw = bool.Parse(HelpClass.GETHtml("http://myspy.diodegames.eu/ShowWeather.txt"));
                if (showw)
                {
                    bool change = false;

                    if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/location.dat"))
                    {
                        File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/location.dat");
                    }

                    CityLocator city = new CityLocator();
                    city.GetGeoCoordByCityNameEmail(textBoxlocation.Text, "*****@*****.**");
                    SaveWriter Loc = new SaveWriter(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/location.dat");
                    Loc.AddItem("City", city.PlaceDisplayName);
                    Loc.AddItem("Latitude", city.Latitude);
                    Loc.AddItem("Longtitude", city.Longtitude);
                    Loc.Save();

                    textBoxlocation.Text = city.PlaceDisplayName;
                    change = true;


                    if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/weathersettings.dat"))
                    {
                        File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/weathersettings.dat");
                    }

                    SaveWriter wsave = new SaveWriter(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/weathersettings.dat");
                    wsave.AddItem("Unit", radioButton2.Checked);
                    wsave.Save();

                    if (change)
                    {
                        if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/weather.dat"))
                        {
                            File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/weather.dat");
                        }

                        if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/weathericon.dat"))
                        {
                            File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/weathericon.dat");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("" + ex);
            }
        }