public DynamicTimeSeriesCollection(int nSeries, int nMoments, RegularTimePeriod timeSample, TimeZone zone)
 {
   DynamicTimeSeriesCollection seriesCollection = this;
   this.maximumItemCount = 2000;
   this.timePeriodClass = DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Minute != null ? DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Minute : (DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Minute = DynamicTimeSeriesCollection.class\u0024("org.jfree.data.time.Minute"));
   this.minValue = new Float(0.0f);
   this.maxValue = (Float) null;
   this.maximumItemCount = nMoments;
   this.historyCount = nMoments;
   this.seriesKeys = new IComparable[nSeries];
   for (int index = 0; index < nSeries; ++index)
     this.seriesKeys[index] = (IComparable) "";
   this.newestAt = nMoments - 1;
   this.valueHistory = new DynamicTimeSeriesCollection.ValueSequence[nSeries];
   this.timePeriodClass = Object.instancehelper_getClass((object) timeSample);
   if (this.timePeriodClass == (DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Second != null ? DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Second : (DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Second = DynamicTimeSeriesCollection.class\u0024("org.jfree.data.time.Second"))))
     this.pointsInTime = (RegularTimePeriod[]) new Second[nMoments];
   else if (this.timePeriodClass == (DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Minute != null ? DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Minute : (DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Minute = DynamicTimeSeriesCollection.class\u0024("org.jfree.data.time.Minute"))))
     this.pointsInTime = (RegularTimePeriod[]) new Minute[nMoments];
   else if (this.timePeriodClass == (DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Hour != null ? DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Hour : (DynamicTimeSeriesCollection.class\u0024org\u0024jfree\u0024data\u0024time\u0024Hour = DynamicTimeSeriesCollection.class\u0024("org.jfree.data.time.Hour"))))
     this.pointsInTime = (RegularTimePeriod[]) new Hour[nMoments];
   this.workingCalendar = Calendar.getInstance(zone);
   this.position = 0;
   this.domainIsPointsInTime = true;
 }
Пример #2
0
 public Minute(Date time, TimeZone zone, Locale locale)
 {
   Minute minute = this;
   if (time == null)
   {
     string str = "Null 'time' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else if (zone == null)
   {
     string str = "Null 'zone' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else if (locale == null)
   {
     string str = "Null 'locale' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else
   {
     Calendar instance = Calendar.getInstance(zone, locale);
     instance.setTime(time);
     this.minute = (byte) instance.get(12);
     this.hour = (byte) instance.get(11);
     this.day = new Day(time, zone, locale);
     this.peg(instance);
   }
 }
Пример #3
0
        public TimeZone Query(decimal latitude, decimal longitude)
        {
            var client = WebClientFactory.GetClient();
            var data = client.DownloadString(string.Format
                (BaseUrlTimeZone, latitude, longitude));

            XDocument doc = XDocument.Parse(data);

            var timeZoneElement = doc.Descendants("timezone").First();
            var ret = new TimeZone()
            {
                Version = Decimal.Parse(timeZoneElement.Elements("version").First().Value),
                DST = timeZoneElement.Elements("dst").First().Value,
                IsoTime = DateTimeOffset.Parse(timeZoneElement.Elements("isotime").First().Value),
                LocalTime = DateTime.Parse(timeZoneElement.Elements("localtime").First().Value),
                Location = new Location()
                {
                    Longitude = Decimal.Parse(timeZoneElement.Elements("location").First().Elements("longitude").First().Value),
                    Latitude = Decimal.Parse(timeZoneElement.Elements("location").First().Elements("latitude").First().Value),
                },
                Offset = Decimal.Parse(timeZoneElement.Elements("offset").First().Value),
                Suffix = timeZoneElement.Elements("suffix").First().Value,
                UtcTime = DateTime.Parse(timeZoneElement.Elements("utctime").First().Value)
            };
            return ret;
        }
Пример #4
0
 public Year(Date time, TimeZone zone, Locale locale)
 {
   Year year = this;
   Calendar instance = Calendar.getInstance(zone, locale);
   instance.setTime(time);
   this.year = (short) instance.get(1);
   this.peg(instance);
 }
Пример #5
0
 public Month(Date time, TimeZone zone, Locale locale)
 {
   Month month = this;
   Calendar instance = Calendar.getInstance(zone, locale);
   instance.setTime(time);
   this.month = instance.get(2) + 1;
   this.year = instance.get(1);
   this.peg(instance);
 }
Пример #6
0
 public static void AppendDetailViewFields(string sDETAIL_NAME, HtmlTable tbl, IDataReader rdr, L10N L10n, TimeZone T10n, CommandEventHandler Page_Command)
 {
     if ( tbl == null )
     {
         SplendidError.SystemWarning(new StackTrace(true).GetFrame(0), "HtmlTable is not defined for " + sDETAIL_NAME);
         return;
     }
     DataTable dtFields = SplendidCache.DetailViewFields(sDETAIL_NAME);
     AppendDetailViewFields(dtFields.DefaultView, tbl, rdr, L10n, T10n, Page_Command, false);
 }
Пример #7
0
        public void GeoNames_TimeZone_ShouldOverrideToString()
        {
            var model = new TimeZone
            {
                Id = "id",
            };

            model.ShouldNotBeNull();
            model.ToString().ShouldEqual(model.Id);
        }
Пример #8
0
 public Second(Date time, TimeZone zone, Locale locale)
 {
   Second second = this;
   Calendar instance = Calendar.getInstance(zone, locale);
   instance.setTime(time);
   this.second = (byte) instance.get(13);
   this.minute = (byte) instance.get(12);
   this.hour = (byte) instance.get(11);
   this.day = new Day(time, zone, locale);
   this.peg(instance);
 }
Пример #9
0
        private void FigureOutTimeZone()
        {
            string tzstr = this.ShowTimeZone;

            if (string.IsNullOrEmpty(tzstr))
                tzstr = TimeZone.DefaultTimeZone();

            this.SeriesTZ = TimeZone.TimeZoneFor(tzstr);

            this.LastFiguredTZ = tzstr;
        }
Пример #10
0
 static SegmentedTimeline()
 {
   int rawOffset = TimeZone.getDefault().getRawOffset();
   SimpleTimeZone.__\u003Cclinit\u003E();
   SegmentedTimeline.NO_DST_TIME_ZONE = (TimeZone) new SimpleTimeZone(rawOffset, new StringBuffer().append("UTC-").append(rawOffset).toString());
   GregorianCalendar.__\u003Cclinit\u003E();
   GregorianCalendar gregorianCalendar = new GregorianCalendar(SegmentedTimeline.NO_DST_TIME_ZONE);
   ((Calendar) gregorianCalendar).set(1900, 0, 1, 0, 0, 0);
   ((Calendar) gregorianCalendar).set(14, 0);
   while (((Calendar) gregorianCalendar).get(7) != 2)
     ((Calendar) gregorianCalendar).add(5, 1);
   SegmentedTimeline.FIRST_MONDAY_AFTER_1900 = ((Calendar) gregorianCalendar).getTime().getTime();
 }
Пример #11
0
 public MonthDateFormat(TimeZone zone, Locale locale, int chars, bool showYearForJan, bool showYearForDec)
 {
   int num1 = showYearForJan ? 1 : 0;
   int num2 = showYearForDec ? 1 : 0;
   TimeZone zone1 = zone;
   Locale locale1 = locale;
   int chars1 = chars;
   bool[] showYear = new bool[13];
   int index1 = 0;
   int num3 = num1;
   showYear[index1] = num3 != 0;
   int index2 = 1;
   int num4 = 0;
   showYear[index2] = num4 != 0;
   int index3 = 2;
   int num5 = 0;
   showYear[index3] = num5 != 0;
   int index4 = 3;
   int num6 = 0;
   showYear[index4] = num6 != 0;
   int index5 = 4;
   int num7 = 0;
   showYear[index5] = num7 != 0;
   int index6 = 5;
   int num8 = 0;
   showYear[index6] = num8 != 0;
   int index7 = 6;
   int num9 = 0;
   showYear[index7] = num9 != 0;
   int index8 = 7;
   int num10 = 0;
   showYear[index8] = num10 != 0;
   int index9 = 8;
   int num11 = 0;
   showYear[index9] = num11 != 0;
   int index10 = 9;
   int num12 = 0;
   showYear[index10] = num12 != 0;
   int index11 = 10;
   int num13 = 0;
   showYear[index11] = num13 != 0;
   int index12 = 11;
   int num14 = 0;
   showYear[index12] = num14 != 0;
   int index13 = 12;
   int num15 = num2;
   showYear[index13] = num15 != 0;
   SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yy");
   // ISSUE: explicit constructor call
   this.\u002Ector(zone1, locale1, chars1, showYear, (DateFormat) simpleDateFormat);
 }
Пример #12
0
        public void GeoNames_TimeZone_ShouldBePublic()
        {
            var model = new TimeZone
            {
                Id = "id",
                DstOffset = 1.0,
                GmtOffset = 2.0,
            };

            model.ShouldNotBeNull();
            model.Id.ShouldEqual("id");
            model.DstOffset.ShouldEqual(1.0);
            model.GmtOffset.ShouldEqual(2.0);
        }
Пример #13
0
 //////////////////////////////////////////////////////////////////////////
 // Constructors
 //////////////////////////////////////////////////////////////////////////
 internal DateTimeStr(string pattern, Locale locale, DateTime dt)
 {
     this.pattern  = pattern;
       this.m_locale = locale;
       this.year     = dt.getYear();
       this.mon      = dt.month();
       this.day      = dt.getDay();
       this.hour     = dt.getHour();
       this.min      = dt.getMin();
       this.sec      = dt.getSec();
       this.ns       = dt.getNanoSec();
       this.weekday  = dt.weekday();
       this.tz       = dt.tz();
       this.dst      = dt.dst();
 }
 public TimeSeriesCollection(TimeSeries series, TimeZone zone)
 {
   TimeSeriesCollection seriesCollection = this;
   if (zone == null)
     zone = TimeZone.getDefault();
   this.workingCalendar = Calendar.getInstance(zone);
   this.data = (List) new ArrayList();
   if (series != null)
   {
     this.data.add((object) series);
     series.addChangeListener((SeriesChangeListener) this);
   }
   this.xPosition = TimePeriodAnchor.__\u003C\u003ESTART;
   this.domainIsPointsInTime = true;
 }
Пример #15
0
        private static TimeZone ParseLine(string Line)
        {
            TimeZone n = new TimeZone();
            string[] parts = Line.Split('\t');
            double id = 0;

            n.CountryCode = parts[0];
            n.TimeZoneId = parts[1];

            if (double.TryParse(parts[2], out id)) n.GMTOffSet = id;
            if (double.TryParse(parts[3], out id)) n.DSTOffSet = id;
            if (double.TryParse(parts[4], out id)) n.RawOffSet = id;

            return n;
        }
Пример #16
0
 public PeriodAxis(string label, RegularTimePeriod first, RegularTimePeriod last, TimeZone timeZone, Locale locale)
   : base(label, (TickUnitSource) null)
 {
   PeriodAxis periodAxis = this;
   this.minorTickMarkInsideLength = 0.0f;
   this.minorTickMarkOutsideLength = 2f;
   this.minorTickMarkStroke = (Stroke) new BasicStroke(0.5f);
   this.minorTickMarkPaint = (Paint) Color.black;
   if (timeZone == null)
   {
     string str = "Null 'timeZone' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else if (locale == null)
   {
     string str = "Null 'locale' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else
   {
     this.first = first;
     this.last = last;
     this.timeZone = timeZone;
     this.locale = locale;
     this.calendar = Calendar.getInstance(timeZone, locale);
     this.first.peg(this.calendar);
     this.last.peg(this.calendar);
     this.autoRangeTimePeriodClass = Object.instancehelper_getClass((object) first);
     this.majorTickTimePeriodClass = Object.instancehelper_getClass((object) first);
     this.minorTickMarksVisible = false;
     this.minorTickTimePeriodClass = RegularTimePeriod.downsize(this.majorTickTimePeriodClass);
     this.setAutoRange(true);
     this.labelInfo = new PeriodAxisLabelInfo[2];
     PeriodAxisLabelInfo[] periodAxisLabelInfoArray1 = this.labelInfo;
     int index1 = 0;
     PeriodAxisLabelInfo.__\u003Cclinit\u003E();
     PeriodAxisLabelInfo periodAxisLabelInfo1 = new PeriodAxisLabelInfo(PeriodAxis.class\u0024org\u0024jfree\u0024data\u0024time\u0024Month != null ? PeriodAxis.class\u0024org\u0024jfree\u0024data\u0024time\u0024Month : (PeriodAxis.class\u0024org\u0024jfree\u0024data\u0024time\u0024Month = PeriodAxis.class\u0024("org.jfree.data.time.Month")), (DateFormat) new SimpleDateFormat("MMM", locale));
     periodAxisLabelInfoArray1[index1] = periodAxisLabelInfo1;
     PeriodAxisLabelInfo[] periodAxisLabelInfoArray2 = this.labelInfo;
     int index2 = 1;
     PeriodAxisLabelInfo.__\u003Cclinit\u003E();
     PeriodAxisLabelInfo periodAxisLabelInfo2 = new PeriodAxisLabelInfo(PeriodAxis.class\u0024org\u0024jfree\u0024data\u0024time\u0024Year != null ? PeriodAxis.class\u0024org\u0024jfree\u0024data\u0024time\u0024Year : (PeriodAxis.class\u0024org\u0024jfree\u0024data\u0024time\u0024Year = PeriodAxis.class\u0024("org.jfree.data.time.Year")), (DateFormat) new SimpleDateFormat("yyyy", locale));
     periodAxisLabelInfoArray2[index2] = periodAxisLabelInfo2;
   }
 }
Пример #17
0
 public Week(Date time, TimeZone zone, Locale locale)
 {
   Week week = this;
   if (time == null)
   {
     string str = "Null 'time' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else if (zone == null)
   {
     string str = "Null 'zone' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else if (locale == null)
   {
     string str = "Null 'locale' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else
   {
     Calendar instance = Calendar.getInstance(zone, locale);
     instance.setTime(time);
     int num1 = instance.get(3);
     if (num1 == 1 && instance.get(2) == 11)
     {
       this.week = (byte) 1;
       this.year = (short) (instance.get(1) + 1);
     }
     else
     {
       this.week = (byte) Math.min(num1, 53);
       int num2 = instance.get(1);
       if (instance.get(2) == 0 && (int) (sbyte) this.week >= 52)
         num2 += -1;
       this.year = (short) num2;
     }
     this.peg(instance);
   }
 }
Пример #18
0
 public TimeTableXYDataset(TimeZone zone, Locale locale)
 {
   TimeTableXYDataset timeTableXyDataset = this;
   if (zone == null)
   {
     string str = "Null 'zone' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else if (locale == null)
   {
     string str = "Null 'locale' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else
   {
     this.values = new DefaultKeyedValues2D(true);
     this.workingCalendar = Calendar.getInstance(zone, locale);
     this.xPosition = TimePeriodAnchor.__\u003C\u003ESTART;
   }
 }
Пример #19
0
        // set tz to 0 to not correct for timezone
        public static DateTime AdjustTZTimeToLocalTime(DateTime dt, TimeZone theirTimeZone)
        {
            if (theirTimeZone == null)
                return dt;

            if (Version.OnMono())
            {
                // need a mono version of this function
                return dt;
            }

            // take a DateTime in a foreign timezone (tz), and return it in ours
            // e.g. 3PM,NZST -> 1PM (if this computer's local time is in AEST)
            int thisYear = DateTime.Now.Year;

            // some timezones don't observe any DST.  the changeover dates seem to be all zeroes in that case.
            bool theyHaveDST = !((theirTimeZone.DaylightDate.wMonth == 0) && (theirTimeZone.DaylightDate.wDay == 0) && (theirTimeZone.DaylightDate.wHour == 0) && (theirTimeZone.DaylightDate.wMinute == 0) && (theirTimeZone.DaylightDate.wSecond == 0) && (theirTimeZone.DaylightDate.wMilliseconds == 0) && (theirTimeZone.StandardDate.wMonth == 0) && (theirTimeZone.StandardDate.wDay == 0) && (theirTimeZone.StandardDate.wHour == 0) && (theirTimeZone.StandardDate.wMinute == 0) && (theirTimeZone.StandardDate.wSecond == 0) && (theirTimeZone.StandardDate.wMilliseconds == 0));

            DateTime themNow = DateTime.UtcNow.AddMinutes(-theirTimeZone.Bias); // tz->bias in minutes. +300 = 5 hours _behind_ UTC

            if (theyHaveDST)
            {
                DateTime theirDSTStart = new DateTime(thisYear, theirTimeZone.DaylightDate.wMonth, theirTimeZone.DaylightDate.wDay, theirTimeZone.DaylightDate.wHour, theirTimeZone.DaylightDate.wMinute, theirTimeZone.DaylightDate.wSecond);
                DateTime theirDSTEnd = new DateTime(thisYear, theirTimeZone.StandardDate.wMonth, theirTimeZone.StandardDate.wDay, theirTimeZone.StandardDate.wHour, theirTimeZone.StandardDate.wMinute, theirTimeZone.StandardDate.wSecond);

                if (theirDSTEnd.CompareTo(theirDSTStart) < 0)
                    theirDSTStart -= new TimeSpan(365, 0, 0, 0, 0);

                if (themNow.CompareTo(theirDSTStart) > 0)
                    themNow = themNow.AddMinutes(-theirTimeZone.DaylightBias);
                if (themNow.CompareTo(theirDSTEnd) > 0)
                    themNow = themNow.AddMinutes(theirTimeZone.DaylightBias);
            }

            TimeSpan tweakTime = DateTime.Now.Subtract(themNow);

            return dt.Add(tweakTime);
        }
Пример #20
0
 /// <summary>
 /// Constructs a <b>Temporal</b> instance having either a UTC
 /// time or no timezone depending on the argument.
 /// </summary>
 /// <param name="timeZone">The <see cref="TimeZone"/> value or <b>null</b>.</param>
 protected Temporal(TimeZone timeZone)
 {
     this.timeZone = timeZone;
 }
Пример #21
0
 getTimestamp(TimeZone tz)
 {
     return((tz == null) ? SqlDates.parseTimestamp(value.Trim(), false)
                         : SqlDates.parseTimestamp(value.Trim(), tz));
 }
Пример #22
0
 public static string getID(this TimeZone timeZone)
 {
     return(timeZone.ID);
 }
        private void installButton_Click(object sender, RoutedEventArgs e)
        {
            var getKeyResponse       = apiControl.getKey();
            var getKeyResponseString = getKeyResponse.Result.Content.ReadAsStringAsync();

            var getKeyDict = JsonConvert.DeserializeObject <Dictionary <string, string> >(getKeyResponseString.Result);

            installButton.IsEnabled      = false;
            installHideButton.Visibility = Visibility.Hidden;

            new System.Threading.Thread(() =>
            {
                if (getKeyDict.ContainsKey("b64"))
                {
                    string tempFile = System.IO.Path.GetTempFileName();

                    File.WriteAllBytes(tempFile, Convert.FromBase64String(getKeyDict["b64"]));

                    VPNControl.addCertificate(tempFile);

                    if (VPNControl.checkCertificateInstalled())
                    {
                        string defaultRegion = Properties.Settings.Default.region;

                        if (defaultRegion == "")
                        {
                            defaultRegion = "United States - West";

                            string regionCode = RegionInfo.CurrentRegion.TwoLetterISORegionName.ToUpper();

                            if (regionCode == "US")
                            {
                                TimeZone theTZ = TimeZone.CurrentTimeZone;

                                if (theTZ.StandardName == "Eastern Standard Time" || theTZ.StandardName == "Central Standard Time")
                                {
                                    defaultRegion = "United States - East";
                                }
                            }
                            if (regionCode == "GB")
                            {
                                defaultRegion = "United Kingdom";
                            }
                            if (regionCode == "IE")
                            {
                                defaultRegion = "Ireland";
                            }
                            if (regionCode == "CA")
                            {
                                defaultRegion = "Canada";
                            }
                            if (regionCode == "KO")
                            {
                                defaultRegion = "South Korea";
                            }
                            if (regionCode == "SG")
                            {
                                defaultRegion = "Singapore";
                            }
                            if (regionCode == "DE" || regionCode == "FR" || regionCode == "IT" || regionCode == "PT" || regionCode == "ES" ||
                                regionCode == "AT" || regionCode == "PL" || regionCode == "RU" || regionCode == "UA")
                            {
                                defaultRegion = "Germany";
                            }
                            if (regionCode == "AU" || regionCode == "NZ")
                            {
                                defaultRegion = "Australia";
                            }
                            if (regionCode == "JP")
                            {
                                defaultRegion = "Japan";
                            }
                            if (regionCode == "IN" || regionCode == "PK" || regionCode == "BD")
                            {
                                defaultRegion = "India";
                            }
                            if (regionCode == "BR" || regionCode == "CO" || regionCode == "VE" || regionCode == "AR")
                            {
                                defaultRegion = "Brazil";
                            }
                        }

                        //VPNControl.addVPN(defaultRegion);

                        Properties.Settings.Default.region = defaultRegion;
                        Properties.Settings.Default.Save();

                        this.Dispatcher.Invoke(() =>
                        {
                            this.Close();
                        });
                    }
                    else
                    {
                        // No Certificate found by that subject name.
                    }
                }
                else
                {
                }

                this.Dispatcher.Invoke(() =>
                {
                    installButton.IsEnabled = true;
                });
            }).Start();
        }
Пример #24
0
        /**
         * Calculates the 1900 based numerical value based upon the utc value held
         * in the date object
         *
         * @param adjust TRUE if we want to incorporate timezone information
         * into the raw UTC date eg. when copying from a spreadsheet
         */
        private void calculateValue(bool adjust)
        {
            // Offsets for current time zone
            long zoneOffset = 0;
            long dstOffset  = 0;

            // Get the timezone and dst offsets if we want to take these into
            // account
            if (adjust)
            {
                // Get the current calender, replete with timezone information
                //Calendar cal = Calendar.CurrentEra();
                //cal.setTime(date);

                //zoneOffset = cal[Calendar.ZONE_OFFSET];
                //dstOffset = cal[Calendar.DST_OFFSET];

// TODO: fix this data handling....
                DateTime now  = DateTime.Now;
                TimeZone zone = TimeZone.CurrentTimeZone;
                zoneOffset = (long)zone.GetUtcOffset(now).TotalMilliseconds;

                DaylightTime daylight = zone.GetDaylightChanges(now.Year);
                if (daylight != null)
                {
                    dstOffset = (long)daylight.Delta.TotalMilliseconds;
                }
                else
                {
                    dstOffset = 0;
                }

                if (now.IsDaylightSavingTime())
                {
                    zoneOffset += dstOffset;
                }


                //zoneOffset = cal[Calendar.ZONE_OFFSET];
                //dstOffset = cal[Calendar.DST_OFFSET];
            }

            long utcValue = date.GetTime() + zoneOffset + dstOffset;

            // Convert this to the number of days, plus fractions of a day since
            // 01 Jan 1970
            double utcDays = (double)utcValue / (double)msInADay;

            // Add in the offset to get the number of days since 01 Jan 1900
            value = utcDays + utcOffsetDays;

            // Work round a bug in excel.  Excel seems to think there is a date
            // called the 29th Feb, 1900 - but this was not a leap year.
            // Therefore for values less than 61, we must subtract 1.  Only do
            // this for full dates, not times
            if (!time && value < nonLeapDay)
            {
                value -= 1;
            }

            // If this refers to a time, then get rid of the integer part
            if (time)
            {
                value = value - (int)value;
            }
        }
Пример #25
0
        public void ShouldFailToFindTimeZoneBasedOnWindowsTimeZoneNameWithTerritory()
        {
            TimeZone timeZone = _basicTimeZoneConverter.FindTimeZone("Fake Windows Zone", "000");

            Assert.AreEqual(null, timeZone);
        }
Пример #26
0
 /**
  *  Given an Excel date with either 1900 or 1904 date windowing,
  *  converts it to a java.util.Date.
  *
  *  Excel Dates and Times are stored without any timezone
  *  information. If you know (through other means) that your file
  *  uses a different TimeZone to the system default, you can use
  *  this version of the getJavaDate() method to handle it.
  *
  *  @param date  The Excel date.
  *  @param tz The TimeZone to evaluate the date in
  *  @param use1904windowing  true if date uses 1904 windowing,
  *   or false if using 1900 date windowing.
  *  @return Java representation of the date, or null if date is not a valid Excel date
  */
 public static DateTime getJavaDate(double date, bool use1904windowing, TimeZone tz)
 {
     return(GetJavaCalendar(date, use1904windowing, false));
 }
Пример #27
0
		public CalendarConverter(TimeZone timezone, string charset)
			: base(timezone, charset) {
		}
        //private static ThreadLocal<Locale> userLocale = new ThreadLocal<Locale>();

        /**
         * As time zone information is not stored in any format, it can be
         * set before any date calculations take place.
         * This setting is specific to the current thread.
         *
         * @param timezone the timezone under which date calculations take place
         */
        public static void SetUserTimeZone(TimeZone timezone)
        {
            userTimeZone.Value = (timezone);
        }
 /**
  * @return a calendar for the user locale and time zone
  */
 public static DateTime GetLocaleCalendar(TimeZone timeZone)
 {
     return(timeZone.ToLocalTime(DateTime.Now));
     //return Calendar.GetInstance(timeZone, GetUserLocale());
 }
Пример #30
0
        protected override void WriteProxy(IndentedTextWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            writer.WriteLine("# This PowerShell script was automatically generated by");
            writer.Write("# ");
            writer.WriteLine(GetType().AssemblyQualifiedName);
            writer.Write("# on ");
            DateTime now      = DateTime.Now;
            TimeZone timeZone = TimeZone.CurrentTimeZone;

            writer.Write(now.ToLongDateString());
            writer.Write(" at ");
            writer.Write(now.ToLongTimeString());
            writer.Write(" (");
            writer.Write(timeZone.IsDaylightSavingTime(now) ?
                         timeZone.DaylightName : timeZone.StandardName);
            writer.WriteLine(")");
            writer.WriteLine();

            Uri          url     = new Uri(Request.Url.GetLeftPart(UriPartial.Path));
            ServiceClass service = Service.GetClass();

            writer.Write("function ");
            writer.Write(service.Name);
            writer.WriteLine(" {");
            writer.Indent++;
            writer.Write("param($url = '");
            writer.Write(url.ToString());
            writer.WriteLine("')");
            writer.WriteLine();
            writer.WriteLine("$self = New-Object PSObject");
            writer.WriteLine("$self | Add-Member NoteProperty url $url");
            writer.WriteLine("$self | Add-Member NoteProperty id 0");
            writer.WriteLine();

            Method[] methods     = service.GetMethods();
            string[] methodNames = new string[methods.Length];

            for (int i = 0; i < methods.Length; i++)
            {
                Method method = methods[i];
                methodNames[i] = method.Name;

                if (method.Description.Length > 0)
                {
                    writer.Write("# ");
                    writer.WriteLine(Regex.Replace(method.Description, "(\r\n)|\r|\n", "$0 #", RegexOptions.None));
                    writer.WriteLine();
                }

                writer.Write("$self | Add-Member ScriptMethod ");
                writer.Write(method.Name.Replace(".", "_"));
                writer.WriteLine(" {");
                writer.Indent++;
                writer.Write("$this.jayrock_rpc('");
                writer.Write(method.Name);
                writer.Write("', @{");

                Parameter[] parameters = method.GetParameters();

                foreach (Parameter parameter in parameters)
                {
                    if (parameter.Position > 0)
                    {
                        writer.Write(';');
                    }
                    writer.Write(' ');
                    writer.Write(parameter.Name);
                    writer.Write(" = $args[");
                    writer.Write(parameter.Position.ToString(CultureInfo.InvariantCulture));
                    writer.Write(']');
                }

                writer.WriteLine(" })");
                writer.Indent--;
                writer.WriteLine("}");
                writer.WriteLine();
            }

            writer.WriteLine();
            writer.WriteLine(@"$self | Add-Member ScriptMethod jayrock_rpc {
        $this.id++
        $req = [Jayrock.Json.Conversion.JsonConvert]::ExportToString(@{ 
            'id' = $this.id; 'method' = $args[0]; 'params' = $args[1]})
        $form = New-Object Collections.Specialized.NameValueCollection
        $form.Add('JSON-RPC', $req)
        $wc = New-Object Net.WebClient
        $bytes = $wc.UploadValues($this.url, $form)
        if ($bytes) {
            # TODO: Get the encoding from the charset in the Content-Type response header
            $rsp = [Jayrock.Json.Conversion.JsonConvert]::Import([Text.Encoding]::UTF8.GetString($bytes))
            if ($rsp.error) {
                throw $rsp.error.message
            }
            else {
                $rsp.result
            }
        }
    }

    $self");

            writer.Indent--;
            writer.WriteLine("}");
        }
Пример #31
0
 public void AddServer(string name, int fullPercent, TimeZone tz, IPEndPoint address)
 {
     m_Servers.Add(new ServerInfo(name, fullPercent, tz, address));
 }
        // log notes:
        // Editing codebase to allow calls passing and receiving structures
        // miktek 8.15.2011

        public static void Main(string[] args)
        {
            int iRet = 999;

            // ErrorMEssage will be used to access error message
            // from the mt4 wrapper.
            String ErrorMessage = "none received";

            Console.WriteLine("testing 8.28.12");

            iRet = myManager.ManagerFactory();

            // hardwire the server name for short term.
            // put into a config.xml file for longer term sanity

            String ServerName = "mtdem01.primexm.com:443";

            // connect to the server
            iRet = myManager.Connect(ServerName);

            // get errorMessage from the CMTManager
            ErrorMessage = myManager.ErrorDescription(iRet);
            Console.WriteLine("Connect ErrMsg: {0}", ErrorMessage);

            // login in credentials. Don't dawdle here.
            // you have aprox. 15 seconds between connecting to the server
            // to enter your creds. Otherwise, say after 15 seconds, the server
            // drops your connection

            iRet         = myManager.Login(900, "!FQS123!!");
            ErrorMessage = myManager.ErrorDescription(iRet);
            Console.WriteLine("Login ErrMsg: {0}", ErrorMessage);

            if (iRet != 0)
            {
                return;
            }

            int choice = 0;

            do
            {
                Console.WriteLine("\nEnter your choice(1,2,3,4,5) to:\n1. Add the User.\n2. Update the User." +
                                  "\n3. History of closed trades.\n4. TradesRequest.\n5. Delete User.\n6. Exit.\n");
                string sChoice = Console.ReadLine();
                choice = int.Parse(sChoice);
                switch (choice)
                {
                case 1:
                    UserRecordNET user = new UserRecordNET();
                    user.group = "FQ-IB-One";
                    Console.WriteLine("\nEnter Name:");
                    user.name     = Console.ReadLine();
                    user.password = "******";
                    iRet          = myManager.UserRecordNew(user);
                    if (iRet == 0)
                    {
                        Console.WriteLine("\nUser Added Successfully.");
                        Console.WriteLine("User Login value: " + user.login);
                    }
                    else
                    {
                        Console.WriteLine("\nUser cannot added successfully.");
                        ErrorMessage = myManager.ErrorDescription(iRet);
                        Console.WriteLine("Login ErrMsg: {0}", ErrorMessage);
                    }

                    break;

                case 2:
                    UserRecordNET existingUser = new UserRecordNET();
                    existingUser.group = "FQ-IB-One";
                    Console.WriteLine("\nEnter Login to update:");
                    string tempLogin = Console.ReadLine();
                    existingUser.login = int.Parse(tempLogin);
                    Console.WriteLine("\nEnter Name:");
                    existingUser.name     = Console.ReadLine();
                    existingUser.password = "******";
                    iRet = myManager.UserRecordUpdate(existingUser);

                    if (iRet == 0)
                    {
                        Console.WriteLine("\nUser Modified Successfully.\n");
                    }
                    else
                    {
                        Console.WriteLine("\nUser cannot Modified successfully.\n");
                        ErrorMessage = myManager.ErrorDescription(iRet);
                        Console.WriteLine("ErrMsg: {0}", ErrorMessage);
                    }
                    break;

                case 3:

                    TimeZone tZone     = TimeZone.CurrentTimeZone;
                    DateTime baseTime  = new DateTime(1970, 1, 1, 0, 0, 0, 0);
                    DateTime startTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);
                    TimeSpan fromSpan  = baseTime - startTime + tZone.GetUtcOffset(baseTime);
                    DateTime endTime   = new DateTime(2012, 12, 28, 0, 0, 0, 0);
                    TimeSpan toSpan    = baseTime - endTime + tZone.GetUtcOffset(baseTime);
                    Int64    from      = Convert.ToInt64(Math.Abs(fromSpan.TotalSeconds));
                    Int64    to        = Convert.ToInt64(Math.Abs(toSpan.TotalSeconds));
                    Console.WriteLine("\nEnter Login:"******"Deals: " + TradeInfo[0].order + " Login: "******" Type: " + TradeInfo[0].cmd + "\nSymbol: " + TradeInfo[0].symbol +
                                          " TradeInfo[0].conv_rates[1]: " + TradeInfo[0].conv_rates[1] +
                                          "Closed Price: " + TradeInfo[0].close_price);
                    }
                    else
                    {
                        Console.WriteLine("No trade Info.\n");
                    }

                    break;

                case 4:
                    int val = 0;
                    TradeInfo = myManager.TradesRequest(ref val);
                    if (TradeInfo != null)
                    {
                        Console.WriteLine("Deals: " + TradeInfo[0].order + " Login: "******" Type: " + TradeInfo[0].cmd + "\nSymbol: " + TradeInfo[0].symbol +
                                          " TradeInfo[0].conv_rates[1]: " + TradeInfo[0].conv_rates[1] +
                                          "\nTotal No. of Trades: " + val);
                    }

                    break;

                case 5:

                    GroupCommandInfoNET info = new GroupCommandInfoNET();
                    info.command = (int)GroupOperation.GROUP_DELETE;

                    //set the leverage accordingly..
                    info.leverage = 0;
                    Console.WriteLine("Enter the number of login values to be entered:");
                    string strUserAccountsLength = Console.ReadLine();
                    int    nUserAcctLength       = int.Parse(strUserAccountsLength);

                    //info.len consist the number of user accounts..
                    info.len = nUserAcctLength;

                    int[] logins = new int[nUserAcctLength];
                    Console.WriteLine();

                    for (int i = 0; i < nUserAcctLength; i++)
                    {
                        Console.Write(" " + (i + 1) + ". Enter Login value: ");
                        logins[i] = int.Parse(Console.ReadLine());
                        Console.WriteLine();
                    }

                    iRet         = myManager.UsersGroupOp(info, ref logins[0]);
                    ErrorMessage = myManager.ErrorDescription(iRet);
                    Console.WriteLine("User Delete ErrMsg: {0}", ErrorMessage);
                    break;

                default:
                    break;
                }
            } while (choice > 0 && choice < 6);

            // declare a PumpFuncDelegate and then create an instance
            // of it. This will be used to start up the pumping asnycn
            // call back mechanism from the mtmanapi.dll, up through
            // the c++/cli wrapper to the C# client code here.

            MT4ManLibraryNETv03.PumpFuncDelegate myPumpFunc =
                new MT4ManLibraryNETv03.PumpFuncDelegate(miktekCSConAppTestHarness.CallBackMethod);

            // now we pass the delegate named myPumpFunc which acutally
            // is a function pointer the CallBackMethod declared
            iRet = myManager.PassMeADelegate(myPumpFunc);


            // enable the pumping switch
            myManager.PumpingSwitch();


            ExposureValueNET ExposureInfo = new ExposureValueNET();
            SymbolSummaryNET SummaryInfo  = new SymbolSummaryNET();

            int iCnt;

            // SummaryGet is passed a ref to a SymbolSummaryNET record
            // which will be populated by the SummaryGet call
            // and returned. miktek 9.10.12

            string symbol = "AUDCAD"; // FROM MTSampleAPI exec'ing.

            iCnt = myManager.SummaryGet(symbol, ref SummaryInfo);

            SymbolSummaryNET[] SymbolSummaryArray;

            // pass in and return a array Symbol Summary records
            SymbolSummaryArray = myManager.SummaryGetAll(ref iCnt); // risk mgmt call #4

            int       iResult  = 0;
            String    cur      = "AUD ";
            const int maxchars = 256;

            iResult = myManager.SummaryCurrency(cur, maxchars);

            // for testing what value should this be?
            const int sectype = 10;

            iResult = myManager.SummaryGetByType(sectype, ref SummaryInfo);

            const int symbolType = 10;

            iResult = myManager.SummaryGetByCount(symbolType, ref SummaryInfo);

            iResult = myManager.ExposureValueGet(cur, ref ExposureInfo);

            ExposureValueNET[] ExposedArray; // miktek 9.9.12

            int iRecCount = 0;
            int iLoopCtr  = 0;

            while (iLoopCtr < 4)
            {
                ExposedArray = myManager.ExposureGet(ref iRecCount);
                Console.WriteLine("ExposureGet attempt: {0} Recs Gotten: ", iLoopCtr, iRecCount);
                iLoopCtr++;
            }

            int iKey = 0;

            iKey = Console.Read();
            myManager.Disconnect();

            Console.WriteLine("End of test run 9.10.12");

            iKey = Console.Read();
        }
 public bool Equals(FbZonedDateTime other) => DateTime.Equals(other.DateTime) && TimeZone.Equals(other.TimeZone, StringComparison.OrdinalIgnoreCase);
Пример #34
0
 private static TimeZone loadFallback(string fullName, string name)
 {
     TimeZone tz = new TimeZone();
       tz.m_name = name;
       tz.m_fullName = fullName;
       tz.rules = new Rule[] { new Rule() };
       return tz;
 }
Пример #35
0
        public string TovCardString(TimeZone timeZone, string charset)
        {
            ContactConverter convert = new ContactConverter(timeZone, charset);

            return(convert.Convert(this));
        }
Пример #36
0
 /// <summary>
 /// Returns the result of comparing this instance to another <b>TimeZone</b>.
 /// </summary>
 /// <param name="other">The <b>TimeZone</b> instance to compare with.</param>
 /// <returns>An integer value indicating the relative ordering.</returns>
 public int CompareTo(TimeZone other)
 {
     return (offset - other.offset);
 }
Пример #37
0
        public void ShouldFailToFindTimeZoneBasedOnWindowsTimeZoneName()
        {
            TimeZone timeZone = _basicTimeZoneConverter.FindTimeZone("Non existent");

            Assert.AreEqual(null, timeZone);
        }
Пример #38
0
 public MonthDateFormat(TimeZone zone, int chars)
   : this(zone, Locale.getDefault(), chars, true, false)
 {
 }
Пример #39
0
 public void InitializeTimeZone(Switch device)
 {
     TimeZone.Initialize(this, device);
 }
Пример #40
0
        private string ConvertObjectToXMLString(List <WAZE.WAZEClass> feed)
        {
            string xmlString = string.Empty;

            /*
             * XmlSerializer ser = new XmlSerializer(waze.GetType());
             * using (MemoryStream ms = new MemoryStream()) {
             *  ser.Serialize(ms, waze);
             *  ms.Position = 0;
             *  xmlString = new StreamReader(ms).ReadToEnd();
             * }
             * */
            TimeZone zone     = TimeZone.CurrentTimeZone;
            TimeSpan offset   = zone.GetUtcOffset(DateTime.Now);
            int      osAmount = offset.Hours;
            bool     isNeg    = false;

            if (osAmount < 0)
            {
                isNeg = true;
            }
            string osString = Math.Abs(osAmount).ToString();

            while (osString.Length < 2)
            {
                osString = "0" + osString;
            }
            if (isNeg)
            {
                osString = "-" + osString;
            }
            else
            {
                osString = "+" + osString;
            }
            //DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + osString
            osString   = osString + ".00";
            xmlString  = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
            xmlString += "<incidents timestamp=\"" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:sszzz") + "\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://gstatic.com/road-incidents/incidents_feed.xsd\">";
            foreach (WAZE.WAZEClass w in feed)
            {
                xmlString += "<incident id=\"" + w.incidentID.ToString() + "\">";
                xmlString += "<creationtime>" + w.creationtime.ToString("yyyy-MM-ddTHH:mm:sszzz") + "</creationtime>";
                xmlString += "<updatetime>" + w.updatetime.ToString("yyyy-MM-ddTHH:mm:sszzz") + "</updatetime>";
                xmlString += "<type>" + w.type + "</type>";
                xmlString += "<subtype>" + w.subType + "</subtype>";
                if (!string.IsNullOrEmpty(w.description))
                {
                    xmlString += "<description>" + w.description + "</description>";
                }
                else
                {
                    xmlString += "<description>No Data</description>";
                }
                xmlString += "<location>";
                if (!string.IsNullOrEmpty(w.location.street))
                {
                    xmlString += "<street>" + w.location.street + "</street>";
                }
                xmlString += "<polyline>" + w.location.polyline + "</polyline>";
                xmlString += "</location>";
                xmlString += "<starttime>" + w.starttime.ToString("yyyy-MM-ddTHH:mm:sszzz") + "</starttime>";
                xmlString += "<endtime>" + w.endtime.ToString("yyyy-MM-ddTHH:mm:sszzz") + "</endtime>";
                xmlString += "</incident>";
            }
            xmlString += "</incidents>";
            return(xmlString);
        }
Пример #41
0
        public ActionResult StudentAssignmentSubmission(int LessonID)
        {
            var IsSubmitted = "";
            var UserId1     = User.Identity.GetUserId();

            AspNetStudent Student = db.AspNetStudents.Where(x => x.StudentID == UserId1).FirstOrDefault();

            AspnetStudentAssignmentSubmission StudentAssignmentSubmission = db.AspnetStudentAssignmentSubmissions.Where(x => x.LessonId == LessonID && x.StudentId == Student.Id).FirstOrDefault();

            if (StudentAssignmentSubmission == null)
            {
                IsSubmitted = "Submit Assignment Successfully";

                var File = Request.Files["file"];

                var fileName = "";
                if (File.ContentLength > 0)
                {
                    fileName = Path.GetFileName(File.FileName);
                    File.SaveAs(Server.MapPath("~/Content/StudentAssignments/") + fileName);
                }

                AspnetStudentAssignmentSubmission AssignmentSubmission = new AspnetStudentAssignmentSubmission();

                int?TopicId   = db.AspnetLessons.Where(x => x.Id == LessonID).FirstOrDefault().TopicId;
                int?SubjectId = db.AspnetSubjectTopics.Where(x => x.Id == TopicId).FirstOrDefault().SubjectId;

                //  db.AspnetSubjectTopics.Where(x => x.Id == LessonID);

                var Subject = db.GenericSubjects.Where(x => x.Id == SubjectId).FirstOrDefault();

                var id     = User.Identity.GetUserId();
                var UserId = db.AspNetUsers.Where(x => x.Id == id).FirstOrDefault().Id;

                int StudentId = db.AspNetStudents.Where(x => x.StudentID == UserId).FirstOrDefault().Id;
                int?ClassId   = db.AspNetStudents.Where(x => x.StudentID == UserId).FirstOrDefault().ClassID;

                var AssignmentDueDate = db.AspnetStudentAssignments.Where(x => x.LessonId == LessonID).FirstOrDefault().DueDate;


                TimeZone time2    = TimeZone.CurrentTimeZone;
                DateTime test     = time2.ToUniversalTime(DateTime.Now);
                var      pakistan = TimeZoneInfo.FindSystemTimeZoneById("Pakistan Standard Time");


                DateTime pakistantime = TimeZoneInfo.ConvertTimeFromUtc(test, pakistan);
                AssignmentSubmission.LessonId   = LessonID;
                AssignmentSubmission.TopicId    = TopicId;
                AssignmentSubmission.SubjectId  = SubjectId;
                AssignmentSubmission.ClassId    = ClassId;
                AssignmentSubmission.CourseType = Subject.SubjectType;
                AssignmentSubmission.StudentId  = StudentId;
                AssignmentSubmission.AssignmentSubmittedDate = pakistantime;
                AssignmentSubmission.AssignmentDueDate       = AssignmentDueDate;
                AssignmentSubmission.AssignmentFileName      = fileName;

                db.AspnetStudentAssignmentSubmissions.Add(AssignmentSubmission);
                db.SaveChanges();
            }
            else
            {
                IsSubmitted = "Submit Assignment failed, you have already Submited Assignment";
            }


            StudentLessonTracking LessonTracking = db.StudentLessonTrackings.Where(x => x.LessonId == LessonID && x.StudentId == UserId1).FirstOrDefault();

            if (LessonTracking != null)
            {
                LessonTracking.Assignment_Status = "Submitted";
                db.SaveChanges();
            }


            return(Json(IsSubmitted, JsonRequestBehavior.AllowGet));
        }// Student Assignment Submission
Пример #42
0
 public string TovCardString(TimeZone timeZone)
 {
     return(TovCardString(timeZone, Encoding.Default.EncodingName));
 }
Пример #43
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DataSubscription"/> class.
 /// </summary>
 /// <param name="fundid">The fundid.</param>
 /// <param name="request">The request.</param>
 /// <param name="security">The security.</param>
 /// <param name="timezone">The timezone.</param>
 /// <param name="aggregator">Initial aggregator</param>
 public DataSubscription(string fundid, DataSubscriptionRequest request, Security security, TimeZone timezone, DataAggregator aggregator)
 {
     //Set values
     Resolution  = new Resolution(request.Aggregation);
     Request     = request;
     Aggregators = new HashSet <DataAggregator>();
     if (aggregator != null)
     {
         Aggregators.Add(aggregator);
     }
     ExchangeTimeZone = security.Exchange.TimeZone;
     DateTimeZone     = timezone;
     FundId           = fundid;
 }
Пример #44
0
 void IOnVifDevice.SetSystemDateAndTime(SetDateTimeType DateTimeType, bool DaylightSavings, TimeZone TimeZone, DateTime UTCDateTime)
 {
     throw new NotImplementedException();
 }
Пример #45
0
 public XMPCalendar(DateTime dateTime, TimeZone timeZone)
 {
     this.dateTime = dateTime;
     this.timeZone = timeZone;
 }
Пример #46
0
        public void LogSettings()
        {
            log.Info(Program.MaskFilePath(ConfigFile));
            log.Info("OUTLOOK SETTINGS:-");
            log.Info("  Service: " + OutlookService.ToString());
            if (OutlookService == OutlookOgcs.Calendar.Service.SharedCalendar)
            {
                log.Info("  Shared Calendar: " + SharedCalendar);
            }
            else
            {
                log.Info("  Mailbox/FolderStore Name: " + MailboxName);
            }
            log.Info("  Calendar: " + (UseOutlookCalendar.Name == "Calendar"?"Default ":"") + UseOutlookCalendar.ToString());
            log.Info("  Category Filter: " + CategoriesRestrictBy.ToString());
            log.Info("  Categories: " + String.Join(",", Categories.ToArray()));
            log.Info("  Only Responded Invites: " + OnlyRespondedInvites);
            log.Info("  Filter String: " + OutlookDateFormat);
            log.Info("  GAL Blocked: " + OutlookGalBlocked);
            log.Info("  Disconnect Between Sync: " + DisconnectOutlookBetweenSync);
            if (TimezoneMaps.Count > 0)
            {
                log.Info("  Custom Timezone Mapping:-");
                TimezoneMaps.ToList().ForEach(tz => log.Info("    " + tz.Key + " => " + tz.Value));
            }

            log.Info("GOOGLE SETTINGS:-");
            log.Info("  Calendar: " + (UseGoogleCalendar == null ? "" : UseGoogleCalendar.ToString(true)));
            log.Info("  Exclude Declined Invites: " + ExcludeDeclinedInvites);
            log.Info("  Exclude Goals: " + ExcludeGoals);
            log.Info("  Personal API Keys: " + UsingPersonalAPIkeys());
            log.Info("    Client Identifier: " + PersonalClientIdentifier);
            log.Info("    Client Secret: " + (PersonalClientSecret.Length < 5
                ? "".PadLeft(PersonalClientSecret.Length, '*')
                : PersonalClientSecret.Substring(0, PersonalClientSecret.Length - 5).PadRight(5, '*')));
            log.Info("  API attendee limit in effect: " + APIlimit_inEffect);
            log.Info("  API attendee limit last reached: " + APIlimit_lastHit);
            log.Info("  Assigned API key: " + AssignedClientIdentifier);
            log.Info("  Cloak Email: " + CloakEmail);

            log.Info("SYNC OPTIONS:-");
            log.Info(" How");
            log.Info("  SyncDirection: " + SyncDirection.Name);
            log.Info("  MergeItems: " + MergeItems);
            log.Info("  DisableDelete: " + DisableDelete);
            log.Info("  ConfirmOnDelete: " + ConfirmOnDelete);
            log.Info("  SetEntriesPrivate: " + SetEntriesPrivate);
            log.Info("  SetEntriesAvailable: " + SetEntriesAvailable + (SetEntriesAvailable ? "; " + AvailabilityStatus : ""));
            log.Info("  SetEntriesColour: " + SetEntriesColour + (SetEntriesColour ? "; " + SetEntriesColourValue + "; \"" + SetEntriesColourName + "\"" : ""));
            if ((SetEntriesPrivate || SetEntriesAvailable || SetEntriesColour) && SyncDirection == Sync.Direction.Bidirectional)
            {
                log.Info("    TargetCalendar: " + TargetCalendar.Name);
                log.Info("    CreatedItemsOnly: " + CreatedItemsOnly);
            }
            if (ColourMaps.Count > 0)
            {
                log.Info("  Custom Colour/Category Mapping:-");
                if (OutlookOgcs.Factory.OutlookVersionName == OutlookOgcs.Factory.OutlookVersionNames.Outlook2003)
                {
                    log.Fail("    Using Outlook2003 - categories not supported, although mapping exists");
                }
                else
                {
                    ColourMaps.ToList().ForEach(c => log.Info("    " + OutlookOgcs.Calendar.Categories.OutlookColour(c.Key) + ":" + c.Key + " <=> " +
                                                              c.Value + ":" + GoogleOgcs.EventColour.Palette.GetColourName(c.Value)));
                }
            }
            log.Info("  SingleCategoryOnly: " + SingleCategoryOnly);
            log.Info("  Obfuscate Words: " + Obfuscation.Enabled);
            if (Obfuscation.Enabled)
            {
                if (Settings.Instance.Obfuscation.FindReplace.Count == 0)
                {
                    log.Info("    No regex defined.");
                }
                else
                {
                    foreach (FindReplace findReplace in Settings.Instance.Obfuscation.FindReplace)
                    {
                        log.Info("    '" + findReplace.find + "' -> '" + findReplace.replace + "'");
                    }
                }
            }
            log.Info(" When");
            log.Info("  DaysInThePast: " + DaysInThePast);
            log.Info("  DaysInTheFuture:" + DaysInTheFuture);
            log.Info("  SyncInterval: " + SyncInterval);
            log.Info("  SyncIntervalUnit: " + SyncIntervalUnit);
            log.Info("  Push Changes: " + OutlookPush);
            log.Info(" What");
            log.Info("  AddLocation: " + AddLocation);
            log.Info("  AddDescription: " + AddDescription + "; OnlyToGoogle: " + AddDescription_OnlyToGoogle);
            log.Info("  AddAttendees: " + AddAttendees + " <" + MaxAttendees);
            log.Info("  AddColours: " + AddColours);
            log.Info("  AddReminders: " + AddReminders);
            log.Info("    UseGoogleDefaultReminder: " + UseGoogleDefaultReminder);
            log.Info("    UseOutlookDefaultReminder: " + UseOutlookDefaultReminder);
            log.Info("    ReminderDND: " + ReminderDND + " (" + ReminderDNDstart.ToString("HH:mm") + "-" + ReminderDNDend.ToString("HH:mm") + ")");

            log.Info("PROXY:-");
            log.Info("  Type: " + Proxy.Type);
            if (Proxy.BrowserUserAgent != Proxy.DefaultBrowserAgent)
            {
                log.Info("  Browser Agent: " + Proxy.BrowserUserAgent);
            }
            if (Proxy.Type == "Custom")
            {
                log.Info("  Server Name: " + Proxy.ServerName);
                log.Info("  Port: " + Proxy.Port.ToString());
                log.Info("  Authentication Required: " + Proxy.AuthenticationRequired);
                log.Info("  UserName: "******"  Password: "******"" : "*********"));
            }

            log.Info("APPLICATION BEHAVIOUR:-");
            log.Info("  ShowBubbleTooltipWhenSyncing: " + ShowBubbleTooltipWhenSyncing);
            log.Info("  StartOnStartup: " + StartOnStartup + "; DelayedStartup: " + StartupDelay.ToString());
            log.Info("  HideSplashScreen: " + (UserIsBenefactor() ? HideSplashScreen.ToString() : "N/A"));
            log.Info("  SuppressSocialPopup: " + (UserIsBenefactor() ? SuppressSocialPopup.ToString() : "N/A"));
            log.Info("  StartInTray: " + StartInTray);
            log.Info("  MinimiseToTray: " + MinimiseToTray);
            log.Info("  MinimiseNotClose: " + MinimiseNotClose);
            log.Info("  ShowBubbleWhenMinimising: " + ShowBubbleWhenMinimising);
            log.Info("  Portable: " + Portable);
            log.Info("  CreateCSVFiles: " + CreateCSVFiles);

            log.Info("  VerboseOutput: " + VerboseOutput);
            log.Info("  MuteClickSounds: " + MuteClickSounds);
            //To pick up from settings.xml file:
            //((log4net.Repository.Hierarchy.Hierarchy)log.Logger.Repository).Root.Level.Name);
            log.Info("  Logging Level: " + LoggingLevel);
            log.Info("  Error Reporting: " + CloudLogging ?? "Undefined");

            log.Info("ABOUT:-");
            log.Info("  Alpha Releases: " + alphaReleases);
            log.Info("  Skip Version: " + SkipVersion);
            log.Info("  Subscribed: " + Subscribed.ToString("dd-MMM-yyyy"));
            log.Info("  Timezone Database: " + TimezoneDB.Instance.Version);

            log.Info("ENVIRONMENT:-");
            log.Info("  Current Locale: " + System.Globalization.CultureInfo.CurrentCulture.Name);
            log.Info("  Short Date Format: " + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern);
            log.Info("  Short Time Format: " + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern);
            TimeZone curTimeZone = TimeZone.CurrentTimeZone;

            log.Info("  System Time Zone: " + curTimeZone.StandardName + "; DST=" + curTimeZone.IsDaylightSavingTime(DateTime.Now));
            log.Info("  Completed Syncs: " + CompletedSyncs);
        }
Пример #47
0
 // 02/16/2006 Paul.  The query string is expected to be in a very specific format.
 // string sDateQuery = "date_start > '" + dtStartDate.ToUniversalTime().ToString("yyyy/MM/dd HH:mm:ss") + "' AND date_start < '" + dtEndDate.ToUniversalTime().ToString("yyyy/MM/dd HH:mm:ss") + "'";
 private static void ParseDateRange(string sQuery, string sField, TimeZone T10n, ref DateTime dtBeginDate, ref DateTime dtEndDate)
 {
     dtBeginDate = DateTime.MinValue;
     dtEndDate   = DateTime.MinValue;
     sQuery = sQuery.ToUpper();
     // 02/16/ 2006 Paul.  Remove excess whitespace.
     Regex r = new Regex(@"[^\w]+");
     sQuery = r.Replace(sQuery, " ");
     // 03/19/2006 Paul.  Use VB split as the C# split will split on each character.
     string[] aQuery = Strings.Split(sQuery, " AND ", -1, CompareMethod.Text);
     foreach ( string s in aQuery )
     {
         if ( s.StartsWith("DATE_START > ") )
         {
             string sDate = s.Substring("DATE_START > ".Length);
             sDate = sDate.Replace("\'", "");
             dtBeginDate = DateTime.Parse(sDate);
             // 04/04/2006 Paul.  Make sure to convert to server time.
             dtBeginDate = T10n.ToServerTimeFromUniversalTime(dtBeginDate);
         }
         else if ( s.StartsWith("DATE_START < ") )
         {
             string sDate = s.Substring("DATE_START < ".Length);
             sDate = sDate.Replace("\'", "");
             dtEndDate = DateTime.Parse(sDate);
             // 04/04/2006 Paul.  Make sure to convert to server time.
             dtEndDate = T10n.ToServerTimeFromUniversalTime(dtEndDate);
         }
     }
 }
Пример #48
0
 public XMPCalendar(TimeZone timeZone)
     : this(DateTime.Now, timeZone)
 {
 }
Пример #49
0
        private Rule[] rules; // reverse sorted by year

        #endregion Fields

        #region Constructors

        static TimeZone()
        {
            try
              {
            loadIndex();
              }
              catch (Exception e)
              {
            System.Console.WriteLine("ERROR: Cannot load timezone database");
            Err.dumpStack(e);
              }

              try
              {
            m_utc = fromStr("Etc/UTC");
              }
              catch (Exception e)
              {
            System.Console.WriteLine("ERROR: Cannot init UTC timezone");
            Err.dumpStack(e);

            m_utc = loadFallback("Etc/UTC", "UTC");
              }

              try
              {
            m_rel = fromStr("Etc/Rel");
              }
              catch (Exception e)
              {
            System.Console.WriteLine("ERROR: Cannot init Rel timezone");
            Err.dumpStack(e);

            m_rel = loadFallback("Etc/Rel", "Rel");
              }

              try
              {
            // first check system property
            string sysProp = (string)Env.cur().vars().get("fan.timezone");
            if (sysProp != null)
            {
              m_cur = fromStr(sysProp);
            }

            // we assume Java default uses Olson name
            else
            {
              // TODO - no clue how to auto map this yet
              //cur = fromStr(java.util.TimeZone.getDefault().getID());
              m_cur = fromStr("America/New_York");
            }
              }
              catch (Exception e)
              {
            System.Console.WriteLine("ERROR: Cannot init current timezone");
            Err.dumpStack(e);

            m_cur = m_utc;
              }
        }
Пример #50
0
 public virtual void SetTimeZone(TimeZone timeZone)
 {
     this.timeZone = timeZone;
 }
Пример #51
0
        /// <summary>
        /// Find the specified name in the index and load a time zone
        /// definition.  If the name is not found then return null.
        /// </summary>
        static TimeZone loadTimeZone(string x)
        {
            string name = x;
              int slash = x.LastIndexOf('/');
              if (slash > 0) name = name.Substring(slash+1);

              // find index, which maps the file offset
              // TODO: why doesn't BinarySearch work?
              // int ix = Array.BinarySearch(indexNames, name);
              int ix = -1;
              for (int i=0; i<indexNames.Length; ++i)
            if (name == indexNames[i]) { ix = i; break; }
              if (ix < 0) return null;

              // map full name
              string fullName = name;
              string prefix = prefixes[indexPrefixes[ix] & 0xff];
              if (prefix.Length != 0) fullName = prefix + "/" + name;
              if (slash > 0 && x != fullName) return null;

              // create time zone instance
              TimeZone tz = new TimeZone();
              tz.m_name      = name;
              tz.m_fullName  = fullName;

              // read time zone definition from database file
              FileStream f = dbFile.OpenRead();
              DataReader d = new DataReader(f);
              try
              {
            f.Seek(indexOffsets[ix], SeekOrigin.Begin);
            int numRules  = d.ReadUnsignedShort();
            tz.rules = new Rule[numRules];
            for (int i=0; i<numRules; ++i)
            {
              Rule r = tz.rules[i] = new Rule();
              r.startYear = d.ReadUnsignedShort();
              r.offset    = d.ReadInt();
              r.stdAbbr   = d.ReadUTF();
              r.dstOffset = d.ReadInt();
              if (r.dstOffset == 0) continue;
              r.dstAbbr   = d.ReadUTF();
              r.dstStart  = loadDstTime(d);
              r.dstEnd    = loadDstTime(d);
              if (i != 0 && tz.rules[i-1].startYear <= r.startYear)
            throw new IOException("TimeZone rules not sorted: " + name);
            }
              }
              finally
              {
            f.Close();
              }
              return tz;
        }
 partial void TimeZone_SetCondition(ref ITfsConnection instance, ref TimeZone setValue);
Пример #53
0
 /// <summary>
 /// Determines if this instance and another <b>TimeZone</b> hold
 /// the same value.
 /// </summary>
 /// <param name="other">The other <b>TimeZone</b>.</param>
 /// <returns><b>true</b> if both instances represent the same value,
 ///	<b>false</b> otherwise.</returns>
 public bool Equals(TimeZone other)
 {
     return (offset == other.offset);
 }
Пример #54
0
        public void AddRegion(IScene scene)
        {
            m_scene = scene;

            // This one enables the ability to type just "sun" without any parameters
            if (MainConsole.Instance != null)
            {
                foreach (KeyValuePair <string, string> kvp in GetParamList())
                {
                    MainConsole.Instance.Commands.AddCommand(
                        String.Format("sun {0}", kvp.Key),
                        String.Format("sun {0}", kvp.Key),
                        String.Format("{0} - {1}", kvp.Key, kvp.Value),
                        HandleSunConsoleCommand, true, false);
                }
            }

            TimeZone local = TimeZone.CurrentTimeZone;

            TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.UtcNow)).Ticks;
            //MainConsole.Instance.Debug("[Sun]: localtime offset is " + TicksUTCOffset);

            // July 21, 2017 - NoahStarfinder
            // We don't actually use the Pacific Standard Time zone at all.
            // It should really be based upon the local time zone of the serverr hardware.
            // Use a fixed offset from UTC for Pacific time with no DST changes. Must be a specific unchanging offset, could be 0.
            //TicksUTCOffset = -288000000000; // -8 * 60 * 60 * TICKS_PER_SECOND

            // Align ticks with Second Life
            TicksToEpoch = new DateTime(1970, 1, 1).Ticks;

            // Just in case they don't have the stanzas
            try
            {
                if (m_config.Configs["Sun"] != null)
                {
                    // Mode: determines how the sun is handled
                    m_RegionMode = m_config.Configs["Sun"].GetString("mode", d_mode);
                    // Year length in days
                    m_YearLengthDays = m_config.Configs["Sun"].GetInt("year_length", d_year_length);
                    // Day length in decimal hours
                    m_DayLengthHours = m_config.Configs["Sun"].GetDouble("day_length", d_day_length);

                    // Horizon shift, this is used to shift the sun's orbit, this affects the day / night ratio
                    // must hard code to ~.5 to match sun position in LL based viewers
                    m_HorizonShift = m_config.Configs["Sun"].GetDouble("day_night_offset", d_day_night);

                    // Scales the sun hours 0...12 vs 12...24, essentially makes daylight hours longer/shorter vs nighttime hours
                    m_DayTimeSunHourScale = m_config.Configs["Sun"].GetDouble("day_time_sun_hour_scale",
                                                                              d_DayTimeSunHourScale);
                    // Update frequency in frames
                    m_UpdateInterval = m_config.Configs["Sun"].GetInt("update_interval", d_frame_mod);
                }
                else
                {
                    m_RegionMode          = d_mode;
                    m_YearLengthDays      = d_year_length;
                    m_DayLengthHours      = d_day_length;
                    m_HorizonShift        = d_day_night;
                    m_UpdateInterval      = d_frame_mod;
                    m_DayTimeSunHourScale = d_DayTimeSunHourScale;
                }
            }
            catch (Exception e)
            {
                MainConsole.Instance.Debug("[Sun]: Configuration access failed, using defaults. Reason: " + e.Message);
                m_RegionMode          = d_mode;
                m_YearLengthDays      = d_year_length;
                m_DayLengthHours      = d_day_length;
                m_HorizonShift        = d_day_night;
                m_UpdateInterval      = d_frame_mod;
                m_DayTimeSunHourScale = d_DayTimeSunHourScale;
            }
            switch (m_RegionMode)
            {
            case "T1":
            default:
            case "SL":
                // Time taken to complete a cycle (day and season)
                SecondsPerSunCycle = (uint)(m_DayLengthHours * 60 * 60);
                SecondsPerYear     = (uint)(SecondsPerSunCycle * m_YearLengthDays);

                // Speed of rotation needed to complete a cycle in the
                // designated period (day and season)
                SunSpeed    = m_SunCycle / SecondsPerSunCycle;
                SeasonSpeed = m_SeasonalCycle / SecondsPerYear;

                // Horizon translation
                HorizonShift = m_HorizonShift;     // Z axis translation

                //  Insert our event handling hooks
                scene.EventManager.OnFrame                   += SunUpdate;
                m_scene.EventManager.OnStartupComplete       += EventManager_OnStartupComplete;
                scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
                scene.EventManager.OnEstateToolsSunUpdate    += EstateToolsSunUpdate;

                ready = true;
                break;
            }

            scene.RegisterModuleInterface <ISunModule>(this);
        }
Пример #55
0
 public TimeTableXYDataset(TimeZone zone)
   : this(zone, Locale.getDefault())
 {
 }
Пример #56
0
        /// <summary>
        /// Parses the time portion of the formal string
        /// </summary>
        /// <param name="date">The formal date string, excluding the date.</param>
        /// <exception cref="Gedcomx.Date.GedcomxDateException">
        /// Thrown if the formal date string does not meet the expected format. The specific reason will be given at runtime.
        /// </exception>
        private void ParseTime(String date)
        {
            int    offset = 0;
            int    end    = date.Length;
            String num;
            bool   flag24 = false;

            // Always initialize the Timezone to the local offset.
            // It may be overridden if set
            TimeZone tz             = TimeZone.CurrentTimeZone;
            double   offsetInMillis = tz.GetUtcOffset(DateTime.Now).TotalMilliseconds;

            tzHours   = Convert.ToInt32(offsetInMillis / 3600000);
            tzMinutes = Convert.ToInt32((offsetInMillis / 60000) % 60);

            // You must at least have hours
            if (end < 2)
            {
                throw new GedcomxDateException("Invalid Date: Hours must be 2 digits");
            }

            num = "";
            for (int i = 0; i < 2; i++)
            {
                if (!Char.IsDigit(date[offset]))
                {
                    throw new GedcomxDateException("Invalid Date: Malformed Hours");
                }
                num += date[offset++];
            }

            hours = Int32.Parse(num);

            if (hours > 24)
            {
                throw new GedcomxDateException("Invalid Date: Hours must be between 0 and 24");
            }

            if (hours == 24)
            {
                flag24 = true;
            }

            if (offset == end)
            {
                return;
            }

            // If there is a timezone offset
            if (date[offset] == '+' || date[offset] == '-' || date[offset] == 'Z')
            {
                ParseTimezone(date.Substring(offset)); // Don't remove the character when calling
                return;
            }

            if (date[offset] != ':')
            {
                throw new GedcomxDateException("Invalid Date: Invalid Hour-Minute Separator");
            }

            if (end - offset < 3)
            {
                throw new GedcomxDateException("Invalid Date: Minutes must be 2 digits");
            }

            offset++;
            num = "";
            for (int i = 0; i < 2; i++)
            {
                if (!Char.IsDigit(date[offset]))
                {
                    throw new GedcomxDateException("Invalid Date: Malformed Minutes");
                }
                num += date[offset++];
            }

            minutes = Int32.Parse(num);

            if (minutes > 59)
            {
                throw new GedcomxDateException("Invalid Date: Minutes must be between 0 and 59");
            }

            if (flag24 && minutes != 0)
            {
                throw new GedcomxDateException("Invalid Date: Hours of 24 requires 00 Minutes");
            }

            if (offset == end)
            {
                return;
            }

            // If there is a timezone offset
            if (date[offset] == '+' || date[offset] == '-' || date[offset] == 'Z')
            {
                ParseTimezone(date.Substring(offset)); // Don't remove the character when calling
                return;
            }

            if (date[offset] != ':')
            {
                throw new GedcomxDateException("Invalid Date: Invalid Minute-Second Separator");
            }

            if (end - offset < 3)
            {
                throw new GedcomxDateException("Invalid Date: Seconds must be 2 digits");
            }

            offset++;
            num = "";
            for (int i = 0; i < 2; i++)
            {
                if (!Char.IsDigit(date[offset]))
                {
                    throw new GedcomxDateException("Invalid Date: Malformed Seconds");
                }
                num += date[offset++];
            }

            seconds = Int32.Parse(num);

            if (seconds > 59)
            {
                throw new GedcomxDateException("Invalid Date: Seconds must be between 0 and 59");
            }

            if (flag24 && seconds != 0)
            {
                throw new GedcomxDateException("Invalid Date: Hours of 24 requires 00 Seconds");
            }

            if (offset == end)
            {
                return;
            }
            else
            {
                ParseTimezone(date.Substring(offset)); // Don't remove the character when calling
            }
        }
Пример #57
0
 public MonthDateFormat(TimeZone zone)
   : this(zone, Locale.getDefault(), 1, true, false)
 {
 }
Пример #58
0
        // Called immediately after the module is loaded for a given region
        // i.e. Immediately after instance creation.
        public void Initialize(Scene scene, IConfigSource config)
        {
            m_scene = scene;
            m_frame = 0;

            // This one puts an entry in the main help screen
            m_scene.AddCommand(this, String.Empty, "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null);

            // This one enables the ability to type just "sun" without any parameters
            m_scene.AddCommand(this, "sun", String.Empty, String.Empty, HandleSunConsoleCommand);
            foreach (KeyValuePair <string, string> kvp in GetParamList())
            {
                m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), String.Empty, HandleSunConsoleCommand);
            }



            TimeZone local = TimeZone.CurrentTimeZone;

            TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks;
            m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset);

            // Align ticks with Second Life

            TicksToEpoch = new DateTime(1970, 1, 1).Ticks;

            // Just in case they don't have the stanzas
            try
            {
                IConfig sunConfig = config.Configs["Sun"];
                if (sunConfig == null)
                {
                    m_log.Debug("[SUN]: Configuration access missing, using defaults.");
                    m_RegionMode          = d_mode;
                    m_YearLengthDays      = d_year_length;
                    m_DayLengthHours      = d_day_length;
                    m_HorizonShift        = d_day_night;
                    m_UpdateInterval      = d_frame_mod;
                    m_DayTimeSunHourScale = d_DayTimeSunHourScale;

                    // m_latitude    = d_latitude;
                    // m_longitude   = d_longitude;
                }
                else
                {
                    // Mode: determines how the sun is handled
                    m_RegionMode = config.Configs["Sun"].GetString("mode", d_mode);
                    // Mode: determines how the sun is handled
                    // m_latitude = config.Configs["Sun"].GetDouble("latitude", d_latitude);
                    // Mode: determines how the sun is handled
                    // m_longitude = config.Configs["Sun"].GetDouble("longitude", d_longitude);
                    // Year length in days
                    m_YearLengthDays = config.Configs["Sun"].GetInt("year_length", d_year_length);
                    // Day length in decimal hours
                    m_DayLengthHours = config.Configs["Sun"].GetDouble("day_length", d_day_length);

                    // Horizon shift, this is used to shift the sun's orbit, this affects the day / night ratio
                    // must hard code to ~.5 to match sun position in LL based viewers
                    m_HorizonShift = config.Configs["Sun"].GetDouble("day_night_offset", d_day_night);


                    // Scales the sun hours 0...12 vs 12...24, essentially makes daylight hours longer/shorter vs nighttime hours
                    m_DayTimeSunHourScale = config.Configs["Sun"].GetDouble("day_time_sun_hour_scale", d_DayTimeSunHourScale);

                    // Update frequency in frames
                    m_UpdateInterval = config.Configs["Sun"].GetInt("update_interval", d_frame_mod);
                }
            }
            catch (Exception e)
            {
                m_log.Debug("[SUN]: Configuration access failed, using defaults. Reason: " + e.Message);
                m_RegionMode          = d_mode;
                m_YearLengthDays      = d_year_length;
                m_DayLengthHours      = d_day_length;
                m_HorizonShift        = d_day_night;
                m_UpdateInterval      = d_frame_mod;
                m_DayTimeSunHourScale = d_DayTimeSunHourScale;

                // m_latitude    = d_latitude;
                // m_longitude   = d_longitude;
            }

            switch (m_RegionMode)
            {
            case "T1":
            default:
            case "SL":
                // Time taken to complete a cycle (day and season)

                SecondsPerSunCycle = (uint)(m_DayLengthHours * 60 * 60);
                SecondsPerYear     = (uint)(SecondsPerSunCycle * m_YearLengthDays);

                // Ration of real-to-virtual time

                // VWTimeRatio        = 24/m_day_length;

                // Speed of rotation needed to complete a cycle in the
                // designated period (day and season)

                SunSpeed    = m_SunCycle / SecondsPerSunCycle;
                SeasonSpeed = m_SeasonalCycle / SecondsPerYear;

                // Horizon translation

                HorizonShift = m_HorizonShift;          // Z axis translation
                // HoursToRadians    = (SunCycle/24)*VWTimeRatio;

                //  Insert our event handling hooks

                scene.EventManager.OnFrame += SunUpdate;
                scene.EventManager.OnAvatarEnteringNewParcel       += AvatarEnteringParcel;
                scene.EventManager.OnEstateToolsSunUpdate          += EstateToolsSunUpdate;
                scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour;

                ready = true;

                m_log.Debug("[SUN]: Mode is " + m_RegionMode);
                m_log.Debug("[SUN]: Initialization completed. Day is " + SecondsPerSunCycle + " seconds, and year is " + m_YearLengthDays + " days");
                m_log.Debug("[SUN]: Axis offset is " + m_HorizonShift);
                m_log.Debug("[SUN]: Percentage of time for daylight " + m_DayTimeSunHourScale);
                m_log.Debug("[SUN]: Positional data updated every " + m_UpdateInterval + " frames");

                break;
            }

            scene.RegisterModuleInterface <ISunModule>(this);
        }
Пример #59
0
 public MonthDateFormat(TimeZone zone, Locale locale, int chars, bool[] showYear, DateFormat yearFormatter)
 {
   base.\u002Ector();
   MonthDateFormat monthDateFormat = this;
   if (locale == null)
   {
     string str = "Null 'locale' argument.";
     Throwable.__\u003CsuppressFillInStackTrace\u003E();
     throw new IllegalArgumentException(str);
   }
   else
   {
     string[] months = new DateFormatSymbols(locale).getMonths();
     this.months = new string[12];
     for (int index = 0; index < 12; ++index)
       this.months[index] = chars <= 0 ? months[index] : String.instancehelper_substring(months[index], 0, Math.min(chars, String.instancehelper_length(months[index])));
     this.calendar = (__Null) new GregorianCalendar(zone);
     this.showYear = showYear;
     this.yearFormatter = yearFormatter;
     this.numberFormat = (__Null) NumberFormat.getNumberInstance();
   }
 }
Пример #60
0
        public virtual string ToiCalFormat()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("BEGIN:VEVENT");
            sb.AppendLine(String.Format("UID:{0}", this.Id));
            sb.AppendLine(String.Format("SUMMARY:{0}", this.Name));

            if (!string.IsNullOrEmpty(this.Description))
            {
                sb.AppendLine(String.Format("DESCRIPTION:{0}", this.Description.Replace("\n", "\\n")));
            }

            if (this.AllDayLong)
            {
                DateTime startDate = this.UtcStartDate, endDate = this.UtcEndDate;
                if (this.TimeZone != null)
                {
                    if (this.UtcStartDate != DateTime.MinValue)
                    {
                        startDate = startDate + TimeZone.GetUtcOffset(DateTime.UtcNow);
                    }

                    if (this.UtcEndDate != DateTime.MinValue)
                    {
                        endDate = endDate + TimeZone.GetUtcOffset(DateTime.UtcNow);
                    }
                }

                if (this.UtcStartDate != DateTime.MinValue)
                {
                    sb.AppendLine(String.Format("DTSTART;VALUE=DATE:{0}", startDate.ToString("yyyyMMdd")));
                }

                if (this.UtcEndDate != DateTime.MinValue)
                {
                    sb.AppendLine(String.Format("DTEND;VALUE=DATE:{0}", endDate.AddDays(1).ToString("yyyyMMdd")));
                }
            }
            else
            {
                if (this.UtcStartDate != DateTime.MinValue)
                {
                    sb.AppendLine(String.Format("DTSTART:{0}", this.UtcStartDate.ToString("yyyyMMdd'T'HHmmss'Z'")));
                }

                if (this.UtcEndDate != DateTime.MinValue)
                {
                    sb.AppendLine(String.Format("DTEND:{0}", this.UtcEndDate.ToString("yyyyMMdd'T'HHmmss'Z'")));
                }
            }


            if (this.RecurrenceRule != null)
            {
                sb.AppendLine(this.RecurrenceRule.ToiCalFormat());
            }

            sb.Append("END:VEVENT");
            return(sb.ToString());
        }