Пример #1
0
        public static GPLocationProvider getMyLocation()
        {
            if (myLocation == null)
            {
                myLocation = new GPLocationProvider();
                bool   bSucc        = false;
                string possibleFile = GPFileHelper.getAppDataFile("mylocation.xml");
                if (File.Exists(possibleFile))
                {
                    try
                    {
                        myLocation.loadXml(possibleFile);
                        bSucc = true;
                    }
                    catch
                    {
                    }
                }

                if (bSucc == false)
                {
                    NumberFormatInfo fmt = new NumberFormatInfo();
                    GPLocation       loc = new GPLocation();
                    loc.setCity(GPUserDefaults.StringForKey("myloc.city", "Mayapur"));
                    loc.setCountryCode(GPUserDefaults.StringForKey("myloc.country", "IN"));
                    loc.setLatitudeNorthPositive(double.Parse(GPUserDefaults.StringForKey("myloc.lat", "23.423413"), fmt));
                    loc.setLongitudeEastPositive(double.Parse(GPUserDefaults.StringForKey("myloc.lon", "88.388079"), fmt));
                    loc.setTimeZoneName(GPUserDefaults.StringForKey("myloc.tzname", "Asia/Calcutta"));
                    myLocation.setDefaultLocation(loc);
                }
            }

            return(myLocation);
        }
Пример #2
0
        public string getFullPathForFile(string fileName)
        {
            string dir = GPFileHelper.getAppDataDirectory();

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            return(Path.Combine(dir, fileName));
        }
Пример #3
0
 public void refreshLanguageList()
 {
     languages = new List <GPLanguage>();
     string[] files = GPFileHelper.EnumerateLanguageFiles();
     foreach (string s in files)
     {
         GPLanguage nlang = new GPLanguage();
         if (nlang.LoadHeader(s))
         {
             languages.Add(nlang);
         }
     }
 }
Пример #4
0
        public static void saveMyLocation()
        {
            string possibleFile = GPFileHelper.getAppDataFile("mylocation.xml");

            try
            {
                if (myLocation != null)
                {
                    myLocation.saveXml(possibleFile);
                }
            }
            catch
            {
            }
        }
Пример #5
0
        public static string getFileName()
        {
            string dir = GPFileHelper.getAppDataDirectory();

            return(Path.Combine(dir, "UserDefaults.txt"));
        }
Пример #6
0
 public static string GetRecentFileName()
 {
     return(Path.Combine(GPFileHelper.getAppDataDirectory(), "recentloc.xml"));
 }