/[AnywhereTS-MSSQL]/trunk/TSAdminTool/TimeZone.cs
ViewVC logotype

Contents of /trunk/TSAdminTool/TimeZone.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4 - (show annotations) (download)
Wed Jul 11 14:19:13 2012 UTC (7 years, 7 months ago) by william
File size: 1583 byte(s)
imported from https://anywherets.svn.sourceforge.net/svnroot/anywherets/trunk/
Revision: 1
Author: beartown
Date: 3:10:40 AM, Monday, June 21, 2010
Message:
First upload. Still todo in order to get a fully working product: Replace Thinstation images with vanilla Thinstation, modify ImageDesigntimeConfig.cs, ImageRuntimeConfig.cs in order to support the Thinstation image
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using System.Windows.Forms;
5
6 namespace AnywhereTS
7 {
8 static class ATSTimeZone
9 {
10 // The input cultures for rdesktop. Each culture is languagecode_countrycode or just languagecode
11 public static string[] timeZoneCode = new string[] { "UTC-12", "UTC-11", "UTC-10", "UTC-9", "UTC-8", "UTC-7", "UTC-6", "UTC-5", "UTC-4", "UTC-3", "UTC-2", "UTC-1", "UTC+0", "UTC+1", "UTC+2", "UTC+3", "UTC+4", "UTC+5", "UTC+6", "UTC+7", "UTC+8", "UTC+9", "UTC+10", "UTC+11", "UTC+12", "UTC+13", "UTC+14" };
12
13 // Returns the default timezone from the windows settings on the current computer.
14 public static string DefaultTimeZone()
15 {
16 int timeOffset = System.TimeZone.CurrentTimeZone.GetUtcOffset(System.DateTime.Now).Hours;
17 if (timeOffset >= -12 && timeOffset <= 14)
18 return timeZoneCode[timeOffset + 12];
19 else
20 return timeZoneCode[12]; // Time zone not valid, return UTC+0
21 }
22
23 // Returns the index for a time zone code.
24 public static int TimeZoneCodeToIndex(string searchTimeZoneCode)
25 {
26 for (int i = 0; i <= timeZoneCode.GetUpperBound(0); i++)
27 {
28 if (timeZoneCode[i] == searchTimeZoneCode)
29 {
30 return i;
31 }
32 }
33 // Not found
34 MessageBox.Show("Error illegal time zone (24553)");
35 return 12; // UTC+0
36 }
37 }
38 }

  ViewVC Help
Powered by ViewVC 1.1.22