コード例 #1
0
        public static void SaveInstanceData()
        {
            SaveApplicationSettings(ApplicationSettingsFilePath);

            if (TLocationDatabase.Modified)
            {
                TLocationDatabase.SaveFile(LocationsFilePath);
            }

            if (TCountry.IsModified())
            {
                TCountry.SaveFile(CountriesFilePath);
            }

            if (GCStrings.gstr_Modified)
            {
                GCStrings.SaveStringsFile(StringsFilePath);
            }

            GCDisplaySettings.SaveDisplaySettingsFile(DisplaySettingsFilePath);

            GCFestivalBookCollection.SaveAllChangedFestivalBooks(ConfigurationFolderPath);

            if (TTimeZone.Modified)
            {
                TTimeZone.SaveFile(TimezonesFilePath);
            }
        }
コード例 #2
0
 public GCEarthData()
 {
     obs          = 0;
     longitudeDeg = 0.0;
     latitudeDeg  = 0.0;
     TimeZone     = TTimeZone.GetDefaultTimeZone();
 }
コード例 #3
0
 public override string ToString()
 {
     return(string.Format("{0}: {1}  {2}: {3}  {4}: {5}",
                          GCStrings.getString(10), GCEarthData.GetTextLatitude(latitudeDeg),
                          GCStrings.getString(11), GCEarthData.GetTextLongitude(longitudeDeg),
                          GCStrings.Localized("Timezone"), TTimeZone.GetTimeZoneOffsetText(OffsetUtcHours)));
 }
コード例 #4
0
ファイル: TTimeZone.cs プロジェクト: icfsoft/GCAL-NET-Core
 public static TTimeZone GetDefaultTimeZone()
 {
     if (p_defaultTimezone == null)
     {
         p_defaultTimezone      = new TTimeZone();
         p_defaultTimezone.Name = "Undefined";
     }
     return(p_defaultTimezone);
 }
コード例 #5
0
        public static void LoadInstanceData()
        {
            System.Threading.Thread.CurrentThread.CurrentCulture   = CultureInfo.InvariantCulture;
            System.Threading.Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;

            // initialization for AppDir
            initFolders();

            // initialization of global strings
            GCStrings.LoadStringsFile(StringsFilePath);

            // inicializacia timezones
            TTimeZone.LoadFile(TimezonesFilePath);

            // inicializacia countries
            TCountry.LoadFile(CountriesFilePath);

            // inicializacia miest a kontinentov
            // lazy loading of data
            TLocationDatabase.FileName = LocationsFilePath;
            //CLocationList.OpenFile();

            // inicializacia zobrazovanych nastaveni
            GCDisplaySettings.LoadDisplaySettingsFile(DisplaySettingsFilePath);

            // inicializacia custom events
            GCFestivalBookCollection.OpenFile(ConfigurationFolderPath);

            // looking for files *.recn
            GCConfigRatedManager.RefreshListFromDirectory(ConfigurationFolderPath);

            // initialization of global variables
            myLocation.EncodedString = GCLocation.DefaultEncodedString;

            recentLocations.Add(new GCLocation(myLocation));

            LoadApplicationSettings(ApplicationSettingsFilePath);
            // refresh fasting style after loading user settings
            //GCFestivalBook.SetOldStyleFasting(GCDisplaySettings.Current.getValue(42));

            // inicializacia tipov dna
            if (!File.Exists(TipsFilePath))
            {
                File.WriteAllText(TipsFilePath, Properties.Resources.tips);
            }
        }
コード例 #6
0
ファイル: TTimeZone.cs プロジェクト: icfsoft/GCAL-NET-Core
        public static int LoadFile(string filePath)
        {
            TTimeZone pce;

            if (!File.Exists(filePath))
            {
                File.WriteAllText(filePath, Properties.Resources.timezones2016);
            }

            XmlDocument doc = new XmlDocument();

            doc.Load(filePath);

            TimeZoneList.Clear();
            foreach (XmlElement e in doc.GetElementsByTagName("TimeZone"))
            {
                TTimeZone tz = new TTimeZone();
                tz.LoadFromNode(e);
                TimeZoneList.Add(tz);
            }

            return(TimeZoneList.Count);
        }
コード例 #7
0
        public override GSCore ExecuteMessage(string token, GSCoreCollection args)
        {
            GSCore result = GSCore.Void;

            switch (token)
            {
            case "canDisplay":
                int  disp = (int)args.getSafe(0).getIntegerValue();
                bool b    = (disp != 0 && (disp == -1 || GCDisplaySettings.Current.getValue(disp) != 0));
                result = new GSBoolean(b);
                break;

            case "getDispValue":
                result = new GSNumber(GCDisplaySettings.Current.getValue((int)args.getSafe(0).getIntegerValue()));
                break;

            case "new":
                switch (args.getSafe(0).getStringValue())
                {
                case "GregorianDateTime":
                    result = new GregorianDateTime();
                    break;

                case "DateTime":
                    result = new GSDateTime();
                    break;

                default:
                    result = GSCore.Void;
                    break;
                }
                break;

            case "calendarHeaderType":
                result = new GSNumber(GCDisplaySettings.Current.CalHeaderType);
                break;

            case "centerText":
                string text    = args.getSafe(0).getStringValue();
                int    length  = (int)args.getSafe(1).getIntegerValue();
                string padStr  = args.getSafe(2).getStringValue();
                char   padChar = padStr.Length > 0 ? padStr[0] : ' ';
                int    half    = (length - text.Length) / 2;
                if (half > 0)
                {
                    result = new GSString(string.Format("{0} {1} {0}", "".PadLeft(half - 1, padChar), text));
                }
                else
                {
                    result = new GSString(text);
                }
                break;

            case "getTabPos":
                double d = args.getSafe(0).getDoubleValue();
                result = new GSNumber(d * GCLayoutData.textSizeText / 24.0);
                break;

            case "getWeekdayName":
                result = new GSString(GCCalendar.GetWeekdayName((int)args.getSafe(0).getIntegerValue()));
                break;

            case "getTimezoneOffset":
            {
                string    tzname   = args.getSafe(0).getStringValue();
                TTimeZone tzid     = TTimeZone.FindTimeZoneByName(tzname);
                int       tzoffset = tzid.OffsetMinutes;
                char      sign     = (tzoffset > 0) ? '+' : '-';
                tzoffset = Math.Abs(tzoffset);
                result   = new GSString(string.Format("{0}{1:00}{2:00}", sign, tzoffset / 60, Math.Abs(tzoffset) % 60));
            }
            break;

            case "getTimezoneOffsetBias":
            {
                string    tzname   = args.getSafe(0).getStringValue();
                TTimeZone tzid     = TTimeZone.FindTimeZoneByName(tzname);
                int       tzoffset = tzid.OffsetMinutes + tzid.BiasMinutes;
                char      sign     = (tzoffset > 0) ? '+' : '-';
                tzoffset = Math.Abs(tzoffset);
                result   = new GSString(string.Format("{0}{1:00}{2:00}", sign, tzoffset / 60, Math.Abs(tzoffset) % 60));
            }
            break;

            case "getDaylightTimeStartDate":
            {
                GregorianDateTime vc             = new GregorianDateTime();
                string            loc_timezoneId = args.getSafe(0).getStringValue();
                int       year = (int)args.getSafe(1).getIntegerValue();
                TTimeZone tzid = TTimeZone.FindTimeZoneByName(loc_timezoneId);
                tzid.GetDaylightTimeStartDate(year, ref vc);
                result = vc;
            }
            break;

            case "getNormalTimeStartDate":
            {
                GregorianDateTime vc             = new GregorianDateTime();
                string            loc_timezoneId = args.getSafe(0).getStringValue();
                int       year = (int)args.getSafe(1).getIntegerValue();
                TTimeZone tzid = TTimeZone.FindTimeZoneByName(loc_timezoneId);
                tzid.GetNormalTimeStartDate(year, ref vc);
                result = vc;
            }
            break;

            default:
                result = base.ExecuteMessage(token, args);
                break;
            }

            return(result);
        }
コード例 #8
0
        // !!!!!!!!
        // when adding new properties, dont forget to modify EncodedString and DefaultEncodedString properties


        public GCLocation()
        {
            Title    = string.Empty;
            Altitude = 6378.0;
            TimeZone = TTimeZone.GetDefaultTimeZone();
        }
コード例 #9
0
 public GCLocation(GCLocation cl)
 {
     Title    = string.Empty;
     TimeZone = TTimeZone.GetDefaultTimeZone();
     Set(cl);
 }