コード例 #1
1
ファイル: CultureHelpers.cs プロジェクト: tah91/eworkyWebSite
        /// <summary>
        /// Get Format for javascript date, depending on culture
        /// </summary>
        /// <param name="format">Format desired</param>
        /// <returns>Formatted datetime</returns>
        public static string GetFormat(TimeFormat format = TimeFormat.Date)
        {
            var isoName = System.Threading.Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName;

            switch (isoName)
            {
                case "en":
                    {
                        if (format == TimeFormat.Date)
                            return "MM/dd/yyyy";
                        if (format == TimeFormat.General)
                            return "MM/dd/yyyy hh:mm tt";
                    }
                    break;
                case "fr":
                case "es":
                case "de":
                case "nl":
                default:
                    {
                        if (format == TimeFormat.Date)
                            return "dd/MM/yyyy";
                        if (format == TimeFormat.General)
                            return "dd/MM/yyyy HH:mm";
                    }
                    break;
            }

            return "";
        }
コード例 #2
0
	/// <summary>
	/// Gets the sim time.
	/// </summary>
	/// <returns>The sim time.</returns>
	/// <param name="desiredFormat">Desired format. --- consult TimeFormat Enum</param>
	public string getSimTime(TimeFormat desiredFormat) {

		int seconds = timeTracker.getSimTimeInSeconds();

		string time="";


		switch(desiredFormat) {

		case TimeFormat.minSec:
			time = convertSecToMinSec(seconds);
			break;
		case TimeFormat.hoMinSec:
			time = convertSecToHoMinSec(seconds);
			break;
		case TimeFormat.dayHoMinSec:
			time = convertSecToDayHoMinSec(seconds);
			break;
		case TimeFormat.timeOfDay:
			time = convertSecToTimeOfDay(seconds);
			break;
		default:
			time = seconds.ToString();
			break;
		}

		return time;
	}
コード例 #3
0
        public string Format(TimeSpan? time, TimeFormat format)
        {
            //APRIL FOOLS
            /*if (DateTime.Now.Date.Month == 4 && DateTime.Now.Date.Day == 1 && time.HasValue)
            {
                time = time.Value + TimeSpan.FromSeconds(Math.Sin(DateTime.Now.TimeOfDay.TotalSeconds));
            }*/

            if (time.HasValue)
            {
                string minusString = "";
                if (time.Value < TimeSpan.Zero)
                {
                    minusString = "-";
                    time = TimeSpan.Zero - time;
                }
                if (time.Value.TotalDays >= 1)
                    return minusString + (int)(time.Value.TotalHours) + time.Value.ToString(@"\:mm\:ss\.ff", CultureInfo.InvariantCulture);
                else if (time.Value.TotalHours >= 1 || format == TimeFormat.Hours)
                    return minusString + time.Value.ToString(@"h\:mm\:ss\.ff", CultureInfo.InvariantCulture);
                else if (format == TimeFormat.Minutes)
                    return minusString + time.Value.ToString(@"mm\:ss\.ff", CultureInfo.InvariantCulture);
                else if (time.Value.Minutes >= 1)
                    return minusString + time.Value.ToString(@"m\:ss\.ff", CultureInfo.InvariantCulture);
                return minusString + time.Value.ToString(@"s\.ff", CultureInfo.InvariantCulture);
            }
            return "0.00";
        }
コード例 #4
0
 public string Format(TimeSpan? time, TimeFormat format)
 {
     if (time.HasValue)
     {
         string minusString = "";
         if (time.Value < TimeSpan.Zero)
         {
             minusString = "-";
             time = TimeSpan.Zero - time;
         }
         if (time.Value.TotalDays >= 1)
         {
             return minusString + (int)(time.Value.TotalHours) + time.Value.ToString(@"\:mm\:ss\.ff", CultureInfo.InvariantCulture);
         }
         else if (format == TimeFormat.TenHours)
         {
             return minusString + time.Value.ToString(@"hh\:mm\:ss\.ff", CultureInfo.InvariantCulture);
         }
         else if (time.Value.TotalHours >= 1 || format == TimeFormat.Hours)
         {
             return minusString + time.Value.ToString(@"h\:mm\:ss\.ff", CultureInfo.InvariantCulture);
         }
         else if (format == TimeFormat.Minutes)
         {
             return minusString + time.Value.ToString(@"mm\:ss\.ff", CultureInfo.InvariantCulture);
         }
         else if (time.Value.Minutes >= 1)
         {
             return minusString + time.Value.ToString(@"m\:ss\.ff", CultureInfo.InvariantCulture);
         }
         return minusString + time.Value.ToString(@"s\.ff", CultureInfo.InvariantCulture);
     }
     return "0.00";
 }
	void Start(){
		if (text_component == null)
			text_component = GetComponent<Text> ();
		if (timer == null)
			timer = GetComponent<GameTimer> ();
		if (GameTimer.start_hour == GameTimer.end_hour)
			format = TimeFormat.Real;
	}
コード例 #6
0
 public ClockSettings()
 {
     announce_format = TimeFormat.TwentyFourHourClock;
     announce_frequency = AnnounceFrequency.FiveMinutes;
     alarm_enabled = false;
     alarm_trigger_time = DateTime.Now;
     daily_alarm = true;
 }
コード例 #7
0
ファイル: ObjectExtensions.cs プロジェクト: john-t-white/Hex
        /// <summary>
        /// Will convert a <see cref="System.DateTime"/> using the format based on <see cref="Hex.TimeFormat"/>, otherwise it will return the object passed in.
        /// </summary>
        /// <param name="obj">The <see cref="System.Object"/> instance this method extends.</param>
        /// <param name="timeFormat">The time format.</param>
        /// <param name="timeOnly">Whether the result should only be time or date and time.</param>
        /// <returns>A formatted <see cref="System.DateTime"/>, otherwise it will return the object passed in.</returns>
        public static object ConvertIfDateTime( this object obj, TimeFormat timeFormat, bool timeOnly )
        {
            if( obj is DateTime )
            {
                return ( ( DateTime )obj ).ToString( timeFormat, timeOnly );
            }

            return obj;
        }
コード例 #8
0
ファイル: SdmxDateCore.cs プロジェクト: alcardac/SDMXRI_WS_OF
        /// <summary>
        /// Initializes a new instance of the <see cref="SdmxDateCore"/> class.
        /// </summary>
        /// <param name="date">
        /// The sdmxDate. 
        /// </param>
        /// <param name="timeFormat">
        /// The time format. 
        /// </param>
        /// ///
        /// <exception cref="ArgumentNullException">
        /// Throws ArgumentNullException.
        /// </exception>
        public SdmxDateCore(DateTime? date, TimeFormatEnumType timeFormat)
        {
            if (date == null)
            {
                throw new ArgumentNullException("date");
            }

            this._date = date.Value;
            this._timeFormat = TimeFormat.GetFromEnum(timeFormat);
            this._dateInSdmx = DateUtil.FormatDate(date.Value, timeFormat);
        }
コード例 #9
0
ファイル: TimePrint.cs プロジェクト: YuriyKokosha/ZombieSmash
    // ------------------------------------------------------------------------------------ //
    public static string timeToText(float time, TimeFormat type)
    {
        System.TimeSpan timeSpan = System.TimeSpan.FromSeconds(time);
        switch (type)
        {
            case TimeFormat.HMS: 	return string.Format("{0:D2}:{1:D2}:{2:D2}", timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds);
            case TimeFormat.MS: 	return string.Format("{0:D2}:{1:D2}", timeSpan.Minutes, timeSpan.Seconds);
        }

        SLog.logError("TimeBase getTimeText (float time, TimeFormat type): unknown type == " + type.ToString());
        return null;
    }
コード例 #10
0
ファイル: PrayerTime.cs プロジェクト: peekyou/Prayertimes
        public PrayerTimeCalculation(MethodBase method, AsrMethod asrMethod, MidnightMethod midnightMethod, int maghribAdjustment)
        {
            if (method == null)
                throw new ArgumentNullException("Method must be specified");
            else
                currentMethod = method;

            timeFormat = TimeFormat.Format24h;

            // Do not change anything here; use adjust method instead
            settings.Add(TimeNames.Imsak, "10 min");
            settings.Add(TimeNames.Dhuhr, "0 min");
            settings.Add(TimeNames.Asr, asrMethod);
            settings.Add("HighLats", HighLatitudeMethod.AngleBased);

            //timeSuffixes = ['am', 'pm'],
            //invalidTime =  '-----',

            numIterations = 1;

            // Default Parameters in Calculation Methods
            defaultParams.Add(TimeNames.Maghrib, maghribAdjustment + " min");
            defaultParams.Add(TimeNames.Midnight, midnightMethod);

            foreach (DictionaryEntry item in defaultParams)
            {
                if (!currentMethod.Parameters.Contains(item.Key))
                    currentMethod.Parameters.Add(item.Key, item.Value);
                else if (item.Key == TimeNames.Maghrib && maghribAdjustment > 0 && Utils.ContainsMin(currentMethod.Parameters[item.Key]))
                {
                    var maghribNewValue = Utils.Eval(currentMethod.Parameters[item.Key].ToString()) + maghribAdjustment;
                    currentMethod.Parameters[item.Key] = maghribNewValue + " min";
                }
            }

            // Initialize settings
            foreach (DictionaryEntry item in currentMethod.Parameters)
            {
                settings[item.Key] = item.Value;
            }

            foreach (string timeName in TimeNames.TimeName)
            {
                offsets.Add(timeName, 0);
            }
        }
コード例 #11
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            if (value is string)
            {
                FormatBase result    = null;
                string     className = (string)value;
                switch (className)
                {
                case "Boolean":
                    result = new BooleanFormat();
                    break;

                case "Currency":
                    result = new CurrencyFormat();
                    break;

                case "Custom":
                    result = new CustomFormat();
                    break;

                case "Date":
                    result = new DateFormat();
                    break;

                case "General":
                    result = new GeneralFormat();
                    break;

                case "Number":
                    result = new NumberFormat();
                    break;

                case "Percent":
                    result = new PercentFormat();
                    break;

                case "Time":
                    result = new TimeFormat();
                    break;
                }
                return(result);
            }
            return(base.ConvertFrom(context, culture, value));
        }
コード例 #12
0
        public ActionResult Index(ExportModel Expmodel, TopUpModel model, FormCollection frm)
        {
            model.ddlServiceProviderList = ser.ddlServiceProviderList();
            model.ddlTypeList            = ser.ddlTypeList();
            model.ddlStatusList          = ser.ddlStatusList();
            model.ListTopUp = ser.List(model);


            crtBKT.GetExportTypeClicked(Expmodel, frm);

            if (Expmodel != null && (Expmodel.ExportTypeExcel != null || Expmodel.ExportTypeWord != null || Expmodel.ExportTypeCSV != null || Expmodel.ExportTypePdf != null))
            {
                try
                {
                    if (Expmodel.ExportTypeExcel != null)
                    {
                        Expmodel.ExportTypeExcel = Expmodel.ExportTypeExcel;
                    }
                    else if (Expmodel.ExportTypeWord != null)
                    {
                        Expmodel.ExportTypeWord = Expmodel.ExportTypeWord;
                    }
                    else if (Expmodel.ExportTypePdf != null)
                    {
                        Expmodel.ExportTypePdf = Expmodel.ExportTypePdf;
                    }

                    var exportData = model.ListTopUp.Select(m => new
                    {
                        Tran_Id   = m.SalesTranId,
                        Date      = TimeFormat.DateFormat(m.SalesDate.ToString()),
                        Mobile_No = m.MobileNo,
                        Amount    = m.RechargeAmount,
                    });
                    App_Class.AppCollection.Export(Expmodel, exportData, "Mobile TopUp ");
                }
                catch
                {
                }
            }


            return(View(model));
        }
コード例 #13
0
 public ControlDict()
 {
     _application       = "simpleFoam";
     _startFrom         = StartFrom.latestTime;
     _startTime         = 0.0;
     _stopAt            = StopAtControl.endTime;
     _endTime           = 100.0;
     _deltaT            = 1.0;
     _writeControl      = WriteControl.timeStep;
     _writeInterval     = 20.0;
     _purgeWrite        = 0.0;
     _writeFormat       = Format.binary;
     _writePrecision    = 6;
     _writeCompression  = Compression.uncompressed;
     _timeFormat        = TimeFormat.general;
     _timePrecision     = 6;
     _runTimeModifiable = SwitchType.on;
     _libs = new List <string>();
 }
コード例 #14
0
ファイル: ShapeTime.cs プロジェクト: heng222/MyRepository
        public override void FromTo(ShapeBase shape)
        {
            if (shape == null)
            {
                return;
            }
            base.FromTo(shape);
            ShapeTime other = shape as ShapeTime;

            if (other != null)
            {
                _displayFormat = other._displayFormat;
                _Align         = other._Align;

                _Valign        = other._Valign;
                FrameSizeFixed = other.FrameSizeFixed;
                FontSizeFixed  = other.FontSizeFixed;
            }
        }
コード例 #15
0
    public bool Equals(TimeFormat other, bool useDayName)
    {
        if (useDayName)
        {
            if (other.dayName != dayName)
            {
                return(false);
            }
        }

        if (other.hours == hours && other.minutes == minutes)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
コード例 #16
0
 /// <summary>
 /// Resets all properties, because there is no real logging out from Todoist.com
 /// </summary>
 public void LogOff()
 {
     _id              = 0;
     _email           = string.Empty;
     _fullName        = string.Empty;
     _apiToken        = string.Empty;
     _startPage       = new StartPage();
     _timeZone        = null;
     _timeZoneOffset  = new TimeZoneOffset();
     _timeFormat      = new TimeFormat();
     _dateFormat      = 0;
     _sortOrder       = SortOrder.OldestDatesFirst;
     _notifoAccount   = string.Empty;
     _mobileNumber    = string.Empty;
     _mobileHost      = string.Empty;
     _premiumUntil    = string.Empty;
     _defaultReminder = new DefaultReminder();
     _jsonData        = string.Empty;
 }
コード例 #17
0
        public float TimeField(Rect rect, int id, float time, float frameRate, TimeFormat timeFormat)
        {
            bool flag;

            if (timeFormat == TimeFormat.None)
            {
                float num = EditorGUI.DoFloatField(EditorGUI.s_RecycledEditor, rect, new Rect(0f, 0f, 0f, 0f), id, time, EditorGUI.kFloatFieldFormatString, EditorStyles.numberField, false);
                return(this.SnapTimeToWholeFPS(num, frameRate));
            }
            if (timeFormat == TimeFormat.Frame)
            {
                int num3 = Mathf.RoundToInt(time * frameRate);
                return(((float)EditorGUI.DoIntField(EditorGUI.s_RecycledEditor, rect, new Rect(0f, 0f, 0f, 0f), id, num3, EditorGUI.kIntFieldFormatString, EditorStyles.numberField, false, 0f)) / frameRate);
            }
            string text           = this.FormatTime(time, frameRate, TimeFormat.TimeFrame);
            string allowedletters = "0123456789.,:";

            text = EditorGUI.DoTextField(EditorGUI.s_RecycledEditor, id, rect, text, EditorStyles.numberField, allowedletters, out flag, false, false, false);
            if (flag && (GUIUtility.keyboardControl == id))
            {
                float num9;
                GUI.changed = true;
                text        = text.Replace(',', '.');
                int index = text.IndexOf(':');
                if (index >= 0)
                {
                    int    num6;
                    int    num7;
                    string s    = text.Substring(0, index);
                    string str4 = text.Substring(index + 1);
                    if (int.TryParse(s, out num6) && int.TryParse(str4, out num7))
                    {
                        return(num6 + (((float)num7) / frameRate));
                    }
                    return(time);
                }
                if (float.TryParse(text, out num9))
                {
                    return(this.SnapTimeToWholeFPS(num9, frameRate));
                }
            }
            return(time);
        }
コード例 #18
0
ファイル: ConfigCtl.cs プロジェクト: xxxxst/desktopDate
        public void load()
        {
            List <TimerModel> lstTimer = md.lstTimer;

            for (int i = 0; i < lstTimer.Count; ++i)
            {
                TimerModel tm = lstTimer[i];
                TimeFormat.parseTime(lstTimer[i].time, out tm.hour, out tm.minute, out tm.second);
                //lstTimer[i].totalSecond = hour * 3600 + minute * 60 + second;
            }

            List <ClockModel> lstClock = md.lstClock;

            for (int i = 0; i < lstClock.Count; ++i)
            {
                ClockModel cm = lstClock[i];
                TimeFormat.parseTime(lstClock[i].time, out cm.hour, out cm.minute);
            }
        }
コード例 #19
0
 /// <summary>
 /// Returns the time in the specified time format
 /// </summary>
 /// <param name="format">Time Format</param>
 /// <returns>the time in the specified time format</returns>
 public static string GetTime(TimeFormat format)
 {
     if (format == TimeFormat.hh_mm)
     {
         return(HourString + ":" + MinuteString);
     }
     else if (format == TimeFormat.hh_mm_ss)
     {
         return(HourString + ":" + MinuteString + ":" + SecondString);
     }
     else if (format == TimeFormat.mm_ss)
     {
         return(MinuteString + ":" + SecondString);
     }
     else
     {
         return("ERROR");
     }
 }
コード例 #20
0
ファイル: Form1.cs プロジェクト: minduim89/screen-logger
 // very self explanitory.
 void SetTimerIntervalFromTextDependingOnTimeFormat(TimeFormat format)
 {
     if (format == TimeFormat.MilliSecond)
     {
         timer1.Interval = Convert.ToInt32(timeInterval_textBox.Text);
     }
     else if (format == TimeFormat.Second)
     {
         timer1.Interval = Convert.ToInt32(timeInterval_textBox.Text) * 1000;
     }
     else if (format == TimeFormat.Minute)
     {
         timer1.Interval = Convert.ToInt32(timeInterval_textBox.Text) * 1000 * 1000;
     }
     else
     {
         timer1.Interval = Convert.ToInt32(timeInterval_textBox.Text) * 1000 * 1000 * 1000;
     }
 }
コード例 #21
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            TimeFormat timeFormat = ( TimeFormat )value;

            switch (timeFormat)
            {
            case TimeFormat.Custom:
                return(DateTimeFormat.Custom);

            case TimeFormat.ShortTime:
                return(DateTimeFormat.ShortTime);

            case TimeFormat.LongTime:
                return(DateTimeFormat.LongTime);

            default:
                return(DateTimeFormat.ShortTime);
            }
        }
コード例 #22
0
ファイル: User.cs プロジェクト: sduck/Todoist.NET
 /// <summary>
 /// Resets all properties, because there is no real logging out from Todoist.com
 /// </summary>
 public void LogOff()
 {
     this.id              = 0;
     this.email           = string.Empty;
     this.fullName        = string.Empty;
     this.apiToken        = string.Empty;
     this.startPage       = new StartPage();
     this.timeZone        = null;
     this.timeZoneOffset  = new TimeZoneOffset();
     this.timeFormat      = new TimeFormat();
     this.dateFormat      = 0;
     this.sortOrder       = SortOrder.OldestDatesFirst;
     this.notifoAccount   = string.Empty;
     this.mobileNumber    = string.Empty;
     this.mobileHost      = string.Empty;
     this.premiumUntil    = string.Empty;
     this.defaultReminder = new DefaultReminder();
     this.jsonData        = string.Empty;
 }
コード例 #23
0
        /// <summary>
        /// Returns the appropriate full date/time format string based on the <see cref="Hex.TimeFormat"/>.  The date format will always be yyyy-MM-ddT.
        /// </summary>
        /// <param name="dateTime">The <see cref="System.DateTime"/> instance this method extends.</param>
        /// <param name="timeFormat">The time format.</param>
        /// <param name="timeOnly">Whether or not the returned format only contains the time or date and time.</param>
        /// <returns>The appropriate format string.</returns>
        public static string ToString( this DateTime dateTime, TimeFormat timeFormat, bool timeOnly )
        {
            string timeFormatString;
            switch( timeFormat )
            {
                case TimeFormat.Second:
                    timeFormatString = SECOND_TIME_FORMAT;
                    break;

                case TimeFormat.Millisecond:
                    timeFormatString = MILLISECOND_TIME_FORMAT;
                    break;

                default:
                    timeFormatString = MINUTE_TIME_FORMAT;
                    break;
            }

            return ( timeOnly ) ? dateTime.ToString( timeFormatString ) : dateTime.ToString( string.Format( "{0}{1}", DATE_FORMAT, timeFormatString ) );
        }
コード例 #24
0
        internal static object ToFormat(DateTimeOffset value, TimeFormat format)
        {
            switch (format)
            {
            case TimeFormat.Iso8601:
                return(Iso8601Utils.ToString(value));

            case TimeFormat.Rfc822:
                return(Rfc822Utils.ToString(value));

            case TimeFormat.Rfc2822:
                return(Rfc2822Utils.ToString(value));

            case TimeFormat.UnixTime:
                return((long)UnixTimeUtils.ToSeconds(value));

            default:
                throw new ArgumentException("Unsupported format " + format, nameof(format));
            }
        }
コード例 #25
0
ファイル: Program.cs プロジェクト: kbacob/LoggingTest
        /// <summary>
        /// <para>Переопределение формата строк с указанием времени события, если стандартные не устраивают.</para>
        /// По поводу формата смотри описания DateTime.Now.ToString(fmt) или DateTime.UtcNow.ToString(fmt) в документации от Microsoft
        /// </summary>
        /// <param name="timeFormat">Тип формата префикса времени сообщения</param>
        /// <param name="strTimeFormat">Строка, описывающая формат префикса времени сообщения</param>
        public void SetTimeFormat(TimeFormat timeFormat, string strTimeFormat)
        {
            if (boolDisposed)
            {
                throw new ObjectDisposedException(GetType().FullName);
            }
            if (strTimeFormat == null)
            {
                throw new ArgumentNullException("strTimeFormat");
            }

            if (LTimeFormat.ContainsKey(timeFormat))
            {
                LTimeFormat[timeFormat] = strTimeFormat;
            }
            else
            {
                throw new ArgumentOutOfRangeException("timeFormat");
            }
        }
コード例 #26
0
        public void timeFormatTest()
        {
            var t = new TimeFormat();

            Assert.AreEqual("1s 1ms", t.timeFormat(1001, "%s %ms"));
            Assert.AreEqual("1 1", t.timeFormat(1001, "s ms"));
            Assert.AreEqual("1 1ms", t.timeFormat(1001, "s %ms"));
            Assert.AreEqual("0y 0d 0h 0m 0s 0ms", t.timeFormat(0, ""));
            Assert.AreEqual("1y 1d 1h 1m 1s 1ms", t.timeFormat(31626061001, ""));
            Assert.AreEqual("1y 1d 1h 1m 1s 1ms", t.timeFormat(31626061001, "%y %d %h %m %s %ms"));
            Assert.AreEqual("366d 1h 1m 1s 1ms", t.timeFormat(31626061001, "%d %h %m %s %ms"));
            Assert.AreEqual("8785h 1m 1s 1ms", t.timeFormat(31626061001, "%h %m %s %ms"));
            Assert.AreEqual("527101m 1s 1ms", t.timeFormat(31626061001, "%m %s %ms"));
            Assert.AreEqual("31626061s 1ms", t.timeFormat(31626061001, "%s %ms"));
            Assert.AreEqual("31626061001ms", t.timeFormat(31626061001, "%ms"));
            Assert.AreEqual("1y 25h 1m 1s 1ms", t.timeFormat(31626061001, "%y %h %m %s %ms"));
            Assert.AreEqual("1y 1d 61m 1s 1ms", t.timeFormat(31626061001, "%y %d %m %s %ms"));
            Assert.AreEqual("1y 1d 1h 61s 1ms", t.timeFormat(31626061001, "%y %d %h %s %ms"));
            Assert.AreEqual("1y 1d 1h 1m 1001ms", t.timeFormat(31626061001, "%y %d %h %m %ms"));
        }
コード例 #27
0
        /// <summary>
        /// Resultado da captura de estado especifica
        /// </summary>
        /// <param name="tag">Nome da captura referente</param>
        /// <param name="format">Formato do resultado</param>
        /// <returns>Tempo decorrido entre o inicio e o fim da captura de estado</returns>
        public double result(string tag, TimeFormat format)
        {
            if (tag == null)
            {
                throw new InvalidParameterException("'tag' e null");
            }

            bool startTag = this.benchMap.ContainsKey(tag + START_MARK);
            bool endTag   = this.benchMap.ContainsKey(tag + END_MARK);

            if (!startTag || !endTag)
            {
                throw new BenchmarkException("Não encontrado par 'inicio-fim' de:" + tag);
            }

            double start = this.benchMap[tag + START_MARK];
            double end   = this.benchMap[tag + END_MARK];

            return((end - start) * Math.Pow(10, (int)format));
        }
コード例 #28
0
ファイル: FUtility.cs プロジェクト: atom-chen/luxa
        public static void PreferencesGUI()
        {
            if (!_preferencesLoaded)
            {
                LoadPreferences();
            }

            EditorGUI.BeginChangeCheck();

            _timeFormat            = (TimeFormat)EditorGUILayout.EnumPopup(new GUIContent("Time Format", "In what format is time represented? E.g. for 60fps:\n\tFrames: 127\n\tSeconds: 2.12\n\tSeconds Formatted: 2.7"), _timeFormat);
            _frameRate             = EditorGUILayout.IntSlider(new GUIContent("Frame Rate", "How many frames per second have the Sequences by default?"), _frameRate, 1, 120);
            _openSequenceOnSelect  = EditorGUILayout.Toggle(new GUIContent("Open Sequence On Select", "Should it open Sequences in Flux Editor window when they are selected?"), _openSequenceOnSelect);
            _renderOnEditorPlay    = EditorGUILayout.Toggle(new GUIContent("Render On Editor Play", "Render Flux Editor window when editor is in Play mode? Turn it off it you want to avoid the redraw costs of Flux when selected sequence is playing."), _renderOnEditorPlay);
            _collapseCommentTracks = EditorGUILayout.Toggle(new GUIContent("Collapse Comment Tracks", "Collapse the comment tracks so that they are slimmer and don't build preview textures."), _collapseCommentTracks);

            if (EditorGUI.EndChangeCheck())
            {
                SavePreferences();
            }
        }
コード例 #29
0
ファイル: TimeUtils.cs プロジェクト: bielu/Skybrud.Essentials
        internal static object ToFormat(DateTimeOffset value, TimeFormat format)
        {
            switch (format)
            {
            case TimeFormat.Iso8601:
                return(ToIso8601(value));

            case TimeFormat.Rfc822:
                return(ToRfc822(value));

            case TimeFormat.Rfc2822:
                return(ToRfc2822(value));

            case TimeFormat.UnixTime:
                return(GetUnixTimeFromDateTimeOffset(value));

            default:
                throw new ArgumentException("Unsupported format " + format, nameof(format));
            }
        }
コード例 #30
0
        private void btnStart_Click(object sender, RoutedEventArgs e)
        {
            TimerVM vm = (sender as MiniButton).Tag as TimerVM;

            //nowSecond = vm.md.totalSecond;

            TimerServer.ins.restart(vm.md);

            nowSecond = TimeFormat.getTotalSecond(vm.md.hour, vm.md.minute, vm.md.second);

            if (selectVM != null)
            {
                selectVM.IsSelect = false;
            }
            selectVM          = vm;
            selectVM.IsSelect = true;

            updateNowTime();
            updateTimerStatus();
        }
コード例 #31
0
        public ActionResult Index(ExportModel Expmodel, B2CUserManagementModel model, FormCollection frm)
        {
            model.ListB2CUsers = ser.GetAllB2CUserList().ToPagedList(1, int.MaxValue);
            //export
            bktctrl.GetExportTypeClicked(Expmodel, frm);
            if (Expmodel != null && (Expmodel.ExportTypeExcel != null || Expmodel.ExportTypeWord != null || Expmodel.ExportTypeCSV != null || Expmodel.ExportTypePdf != null))
            {
                try
                {
                    if (Expmodel.ExportTypeExcel != null)
                    {
                        Expmodel.ExportTypeExcel = Expmodel.ExportTypeExcel;
                    }
                    else if (Expmodel.ExportTypeWord != null)
                    {
                        Expmodel.ExportTypeWord = Expmodel.ExportTypeWord;
                    }
                    else if (Expmodel.ExportTypePdf != null)
                    {
                        Expmodel.ExportTypePdf = Expmodel.ExportTypePdf;
                    }

                    var exportData = model.ListB2CUsers.Select(m => new
                    {
                        Name         = m.FullName,
                        User_Name    = m.UserName,
                        Email        = m.Email,
                        Address      = m.Address,
                        Mobile       = m.Mobile,
                        Phone        = m.Phone,
                        Created_Date = TimeFormat.DateFormat(m.CreatedDate.ToString())
                    });
                    App_Class.AppCollection.Export(Expmodel, exportData, "User_List");
                }
                catch
                {
                }
            }

            return(View(model));
        }
コード例 #32
0
        /// <summary>
        /// Create an <see cref="TimeExpressionEntity"/> instance from the specified <paramref name="timeTranscoding"/>
        /// </summary>
        /// <param name="timeTranscoding">
        /// The Mapping store Time Transcoding
        /// </param>
        /// <returns>
        /// An <see cref="TimeExpressionEntity"/>
        /// </returns>
        public static TimeExpressionEntity CreateExpression(TimeTranscodingEntity timeTranscoding)
        {
            var   expr  = new TimeExpressionEntity();
            Match match = TimeExpressionRegex.Match(timeTranscoding.Expression);

            expr.Freq             = TimeFormat.GetTimeFormatFromCodeId(timeTranscoding.FrequencyValue).EnumType;
            expr.IsDateTime       = match.Groups["datetime"].Value.Equals("1");
            expr.TranscodingRules = timeTranscoding.TranscodingRules;

            if (!expr.IsDateTime)
            {
                expr.YearStart  = Convert.ToInt32(match.Groups["year_start"].Value, CultureInfo.InvariantCulture);
                expr.YearLength = Convert.ToInt32(match.Groups["year_len"].Value, CultureInfo.InvariantCulture);
                if (expr.YearLength == 0)
                {
                    expr.YearLength = 4;
                }

                expr.YearColumnSysId   = timeTranscoding.YearColumnId;
                expr.PeriodStart       = 0;
                expr.PeriodLength      = 0;
                expr.PeriodColumnSysId = 0;
                if (expr.Freq != TimeFormatEnumType.Year)
                {
                    expr.PeriodColumnSysId = timeTranscoding.PeriodColumnId;
                    expr.PeriodStart       = Convert.ToInt32(match.Groups["period_start"].Value, CultureInfo.InvariantCulture);
                    expr.PeriodLength      = Convert.ToInt32(match.Groups["period_len"].Value, CultureInfo.InvariantCulture);
                    expr.OneColumnMapping  = expr.YearColumnSysId == expr.PeriodColumnSysId;
                }
                else
                {
                    expr.OneColumnMapping = true;
                }
            }
            else
            {
                expr.DateColumnSysId = timeTranscoding.DateColumnId;
            }

            return(expr);
        }
コード例 #33
0
        /// <summary>
        /// 执行通道
        /// </summary>
        /// <param name="format">时间格式</param>
        /// <param name="data">待处理数据</param>
        /// <returns></returns>
        public override Tuple <bool, string, dynamic> ExcuteProccess(TimeFormat format, dynamic data)
        {
            Tuple <bool, string> tuple = null;

            switch (format)
            {
            case TimeFormat.Second:
                tuple = this.VerifySecond(data);
                break;

            case TimeFormat.Minute:
                tuple = this.VerifyMinute(data);
                break;

            case TimeFormat.Hour:
                tuple = this.VerifyHour(data);
                break;

            case TimeFormat.Day:
                tuple = this.VerifyDay(data);
                break;

            case TimeFormat.Month:
                tuple = this.VerifyMonth(data);
                break;

            case TimeFormat.DayOfWeek:
                tuple = this.VerifyDayOfWeek(data);
                break;

            case TimeFormat.Year:
                tuple = this.VerifyYear(data);
                break;
            }

            if (NextPipeline != null && tuple != null && tuple.Item1)
            {
                return(this.NextPipeline.ExcuteProccess(format, data));
            }
            return(new Tuple <bool, string, dynamic>(tuple.Item1, tuple.Item2, null));
        }
コード例 #34
0
ファイル: AidPacket.cs プロジェクト: martxelo94/GAM_SUM
    // Start is called before the first frame update
    void Start()
    {
        timeInterval = (TimeSpan)dateInterval;
        deckManager  = FindObjectOfType <DeckManager>();
        Assert.IsTrue(deckManager != null);
        initScale = transform.localScale;

        if (!LoadTimer())
        {
            lastDateUsed = DateTime.Now;
        }

        timeEnded = button.interactable = false;

        DateTime   now            = DateTime.Now;
        TimeSpan   dateDif        = now.Subtract(lastDateUsed);
        TimeSpan   timeLeft       = timeInterval.Subtract(dateDif);
        TimeFormat timeLeftFormat = new TimeFormat(timeLeft);

        timerText.text = timeLeftFormat.ToString();
    }
コード例 #35
0
ファイル: CTimeSys.cs プロジェクト: yh821/Zombie
    /// <summary>
    /// 时间格式
    /// </summary>
    public static string TimeString(int time, TimeFormat format = TimeFormat.MMSS)
    {
        int hour   = time / 3600;
        int minute = time % 3600 / 60;
        int second = time % 60;

        switch (format)
        {
        case TimeFormat.HHMMSS:
            return(string.Format("{0}:{1}:{2}", hour.ToString("D2"), minute.ToString("D2"), second.ToString("D2")));

        case TimeFormat.HHMM:
            return(string.Format("{0}:{1}", hour.ToString("D2"), minute.ToString("D2")));

        case TimeFormat.MMSS:
            return(string.Format("{0}:{1}", minute.ToString("D2"), second.ToString("D2")));

        default:
            return(string.Empty);
        }
    }
コード例 #36
0
ファイル: TimeFormat.cs プロジェクト: Zyntex1/AeroSplit
        public static DigitsFormat ToDigitsFormat(this TimeFormat timeFormat)
        {
            if (timeFormat == TimeFormat.Seconds)
            {
                return(DigitsFormat.SingleDigitSeconds);
            }
            else if (timeFormat == TimeFormat.Minutes)
            {
                return(DigitsFormat.DoubleDigitMinutes);
            }
            else if (timeFormat == TimeFormat.Hours)
            {
                return(DigitsFormat.SingleDigitHours);
            }
            else if (timeFormat == TimeFormat.TenHours)
            {
                return(DigitsFormat.DoubleDigitHours);
            }

            return(DigitsFormat.SingleDigitSeconds);
        }
コード例 #37
0
ファイル: Time.cs プロジェクト: Costath/Enum_CS
        public static void SetTimeFormat(TimeFormat time_format)
        {
            switch (time_format)
            {
            case TimeFormat.Mil:
                TIME_FORMAT = TimeFormat.Mil;
                break;

            case TimeFormat.Hour12:
                TIME_FORMAT = TimeFormat.Hour12;
                break;

            case TimeFormat.Hour24:
                TIME_FORMAT = TimeFormat.Hour24;
                break;

            default:
                Console.WriteLine("ERROR");
                break;
            }
        }
コード例 #38
0
ファイル: CommonUtil.cs プロジェクト: zhangbo27/bbsmax
        public static string GetTimeFormatString(TimeFormat timeFormat)
        {
            switch (timeFormat)
            {
            case TimeFormat.hhmm:
                return("HH\\:mm");

            case TimeFormat.hhmmss:
                return("HH\\:mm\\:ss");

            case TimeFormat.hhmmtt:
                return("hh\\:mmtt");

            case TimeFormat.hhmmsstt:
                return("hh\\:mm\\:sstt");

            case TimeFormat.Default:
            default:
                return("HH\\:mm");
            }
        }
コード例 #39
0
 public static LocationModel ApplyTimeFormat(LocationModel location, TimeFormat timeFormat)
 {
     if (location != null)
     {
         if (location.NormalTradingHours != null)
         {
             foreach (var day in location.NormalTradingHours)
             {
                 if (timeFormat.Equals(TimeFormat.Hours12))
                 {
                     day.ClosingTime = AppHelper.GetTime12Hour(day.ClosingTime);
                     day.OpeningTime = AppHelper.GetTime12Hour(day.OpeningTime);
                 }
                 else
                 {
                     day.ClosingTime = AppHelper.GetTime24Hour(day.ClosingTime);
                     day.OpeningTime = AppHelper.GetTime24Hour(day.OpeningTime);
                 }
             }
         }
         if (location.ScheduledTradingHourChanges != null)
         {
             foreach (var day in location.ScheduledTradingHourChanges)
             {
                 if (timeFormat.Equals(TimeFormat.Hours12))
                 {
                     day.ClosingTime = AppHelper.GetTime12Hour(day.ClosingTime);
                     day.OpeningTime = AppHelper.GetTime12Hour(day.OpeningTime);
                 }
                 else
                 {
                     day.ClosingTime = AppHelper.GetTime24Hour(day.ClosingTime);
                     day.OpeningTime = AppHelper.GetTime24Hour(day.OpeningTime);
                 }
             }
         }
     }
     return(location);
 }
コード例 #40
0
ファイル: AnalysisObject.cs プロジェクト: imldresden/miria
        /// <summary>
        /// Initializes a new instance of the <see cref="AnalysisObject"/> class.
        /// </summary>
        /// <param name="title">The name or title of this object. This is used, e.g., for labels in the visualization.</param>
        /// <param name="id">The id of this object.</param>
        /// <param name="type">The <see cref="ObjectType"/> of this object.</param>
        /// <param name="parentId">The id of the parent object for this object. Should be -1 if the object has no parent.</param>
        /// <param name="dataSource">The data source for this object. This can be used to differentiate between different sensors or tracking systems.</param>
        /// <param name="unitfactor">The conversion factor between the samples' unit of length and 1m.</param>
        /// <param name="timeformat">The <see cref="TimeFormat"/> for this object</param>
        /// <param name="rotationformat">The <see cref="RotationFormat"/> for this object</param>
        /// <param name="conditions">An ordered <c>List</c> of <c>strings</c> representing the study conditions.</param>
        /// <param name="sessions">An ordered <c>List</c> of <see cref="Session"/> representing the study sessions.</param>
        /// <param name="color">The default <see cref="Color"/> for this object.</param>
        public AnalysisObject(
            string title,
            int id,
            ObjectType type,
            int parentId,
            string dataSource,
            float unitfactor,
            TimeFormat timeformat,
            RotationFormat rotationformat,
            List <string> conditions,
            List <Session> sessions,
            Color color)
        {
            Title                = title;
            Id                   = id;
            ObjectColor          = color;
            ParentObjectId       = parentId;
            ObjectDataSource     = dataSource;
            ObjectType           = type;
            UnitConversionFactor = unitfactor;
            RotationFormat       = rotationformat;
            TimeFormat           = timeformat;

            ConditionCount = conditions.Count;
            SessionCount   = sessions.Count;

            sampleArray = new List <Sample> [SessionCount, ConditionCount];
            maxSpeeds   = new float[SessionCount, ConditionCount];

            // create dictionaries for conditions
            ConditionToId = new Dictionary <string, int>(conditions.Count);
            IdToCondition = new Dictionary <int, string>(conditions.Count);

            for (int i = 0; i < conditions.Count; i++)
            {
                ConditionToId.Add(conditions[i], i);
                IdToCondition.Add(i, conditions[i]);
            }
        }
コード例 #41
0
        public static DateTime?TryGetDateTime(string jDate, TimeFormat timeFormat = TimeFormat.StartOfDay)
        {
            try
            {
                var now  = DateTime.Now;
                var date = GetDateTime(jDate.toEnglishNumber());
                switch (timeFormat)
                {
                case TimeFormat.EndOfDay:
                    date = date.AddDays(1).AddMilliseconds(-1);
                    break;

                case TimeFormat.Now:
                    date = date.AddHours(now.Hour).AddMinutes(now.Minute).AddSeconds(now.Second);
                    break;
                }
                return(date);
            }
            catch
            {
                return(null);
            }
        }
コード例 #42
0
ファイル: SdmxDateImpl.cs プロジェクト: alcardac/SDMXRI_WS_OF
		public SdmxDateImpl(DateTime date0, TimeFormat timeFormat1) {
			this.date = date0;
			this.timeFormat = timeFormat1;
			dateInSdmx = Org.Sdmxsource.Sdmx.Util.Date.DateUtil.FormatDate(date0, timeFormat1);
		}
コード例 #43
0
        /// <summary>
        /// Initializes a new instance of the <see cref="KeyableImpl" /> class.
        /// </summary>
        /// <param name="dataflowObject">The dataflow object.</param>
        /// <param name="dataStructureObject">The data structure object.</param>
        /// <param name="key">The key .</param>
        /// <param name="attributes">The attributes .</param>
        /// <param name="groupName">The group name .</param>
        /// <param name="timeFormat">The time format .</param>
        /// <param name="annotations">The annotations.</param>
        /// <exception cref="System.ArgumentException">Data Structure can not be null</exception>
        public KeyableImpl(IDataflowObject dataflowObject,
            IDataStructureObject dataStructureObject,
            IList<IKeyValue> key, IList<IKeyValue> attributes, string groupName, TimeFormat timeFormat
            ,params IAnnotation[] annotations)
        {
            this._dataStructure = dataStructureObject;
            this._dataflow = dataflowObject;
            this._attributes = new List<IKeyValue>();
            this._key = new List<IKeyValue>();
            this._attributeMap = new Dictionary<string, IKeyValue>();
            this._keyMap = new Dictionary<string, string>();
            this._annotations = new List<IAnnotation>();
            this._isTimeSeries = true;

            if (_dataStructure == null)
            {
                throw new ArgumentException("Data Structure can not be null");
            }

            this._series = string.IsNullOrWhiteSpace(groupName);

            if (attributes != null)
            {
                this._attributes = new List<IKeyValue>(attributes);

                foreach (IKeyValue currentKv in attributes)
                {
                    this._attributeMap.Add(currentKv.Concept, currentKv);
                }
            }

            if (key != null)
            {
                this._key = new List<IKeyValue>(key);
                foreach (IKeyValue currentKv4 in key)
                {
                    this._keyMap.Add(currentKv4.Concept, currentKv4.Code);
                }
            }

            if(annotations != null)
            {
			   foreach(IAnnotation currentAnnotation in annotations) 
               {
				  this._annotations.Add(currentAnnotation);
			   }
		    }

            this._groupName = groupName;
            this._timeFormat = timeFormat;
        }
コード例 #44
0
 /// <summary>
 /// Initializes a new instance of the <see cref="KeyableImpl"/> class.
 /// </summary>
 /// <param name="key">
 /// The key 0. 
 /// </param>
 /// <param name="attributes">
 /// The attributes 1. 
 /// </param>
 /// <param name="timeFormat">
 /// The time format 2. 
 /// </param>
 public KeyableImpl(IDataflowObject dataflowObject,
     IDataStructureObject dataStructureObject, IList<IKeyValue> key, IList<IKeyValue> attributes, TimeFormat timeFormat
     ,params IAnnotation[] annotations)
     : this(dataflowObject, dataStructureObject, key, attributes, null, timeFormat, annotations)
 {
 }
コード例 #45
0
        private string _uniqueId; // Generated on equals/hashcode

        #endregion

        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="KeyableImpl"/> class.
        /// </summary>
        /// <param name="key">
        /// The key 0. 
        /// </param>
        /// <param name="attributes">
        /// The attributes 1. 
        /// </param>
        /// <param name="timeFormat">
        /// The time format 2. 
        /// </param>
        /// <param name="crossSectionConcept">
        /// The cross section concept 3. 
        /// </param>
        /// <param name="obsTime">
        /// The obs time 4. 
        /// </param>
        /// <exception cref="SdmxSemmanticException">
        /// Throws Validate exception.
        /// </exception>
        public KeyableImpl(
            IDataflowObject dataflowObject,
            IDataStructureObject dataStructureObject,
            IList<IKeyValue> key, IList<IKeyValue> attributes,
            TimeFormat timeFormat,
            string crossSectionConcept,
            string obsTime, params IAnnotation[] annotations)
            : this(dataflowObject, dataStructureObject, key, attributes, null, timeFormat, annotations)
        {
            this._isTimeSeries = false;
            this._crossSectionConcept = crossSectionConcept;
            this._obsTime = obsTime;
            if (obsTime == null)
            {
                throw new SdmxSemmanticException("Cross sectional dataset missing time value for key : " + this);
            }
        }
コード例 #46
0
	/// <summary>
	/// Prints the sim time.
	/// </summary>
	/// <returns>The sim time.</returns>
	/// <param name="desiredFormat">Desired format. --- consult TimeFormat Enum</param>
	public void printSimTime(TimeFormat desiredFormat) {
		Debug.Log("Current simulation time = " + getSimTime(desiredFormat) );
		
	}
コード例 #47
0
ファイル: WSplit.cs プロジェクト: Joshimuz/WSplit
        private string timeFormatter(double secs, TimeFormat format)
        {
            TimeSpan span = TimeSpan.FromSeconds(Math.Abs(Math.Truncate(secs * 10) / 10));

            string str = "";
            if (((format == TimeFormat.Delta) || (format == TimeFormat.DeltaShort)) && (secs >= 0.0))
                str = str + "+";
            else if (secs < 0.0)
                str = str + "-";

            if (format == TimeFormat.Seconds)
                return (Math.Truncate(secs * 100) / 100).ToString();

            if (format == TimeFormat.Long)
            {
                if (span.TotalHours >= 1.0)
                    return (str + string.Format("{0}:{1:00}:{2:00.0}", Math.Floor(span.TotalHours), span.Minutes, span.Seconds + (((double)span.Milliseconds) / 1000.0)));
                return (str + string.Format("{0}:{1:00.0}", span.Minutes, span.Seconds + (((double)span.Milliseconds) / 1000.0)));
            }

            if ((span.TotalMinutes >= 1.0) || (format == TimeFormat.Short))
                span = TimeSpan.FromSeconds(Math.Abs(Math.Truncate(secs)));

            if ((span.TotalMinutes >= 100.0) && (format == TimeFormat.DeltaShort))
                span = new TimeSpan(0, 0x63, 0x3b);

            if (span.TotalHours >= 100.0)
                span = TimeSpan.FromMinutes(Math.Truncate(span.TotalMinutes));

            if ((span.TotalHours >= 100.0) && (format != TimeFormat.DeltaShort))
                return (str + string.Format("{0}h{1:00}", Math.Floor(span.TotalHours), span.Minutes));

            if ((span.TotalHours >= 1.0) && (format != TimeFormat.DeltaShort))
                return (str + string.Format("{0}:{1:00}:{2:00}", Math.Floor(span.TotalHours), span.Minutes, span.Seconds));

            if ((span.TotalMinutes >= 1.0) || (format == TimeFormat.Short))
                return (str + string.Format("{0}:{1:00}", Math.Floor(span.TotalMinutes), span.Seconds));

            return (str + string.Format("{0:0.0}", span.TotalSeconds));
        }
コード例 #48
0
        public static string FormatDateTime(FuzzyDateTime fuzzyDateTime, DateFormat dateFormat, TimeFormat timeFormat)
        {
            TimeSpan fromToday = fuzzyDateTime.DateTime.Subtract(DateTime.Today);

            string timeString = string.Empty;
            if (fuzzyDateTime.HasTime)
            {
                switch (timeFormat)
                {
                    case TimeFormat.TwelveHours:
                        timeString = fuzzyDateTime.DateTime.ToString("hh:mm tt");
                        break;
                    case TimeFormat.TwentyFourHours:
                    default:
                        timeString = fuzzyDateTime.DateTime.ToString("HH:mm");
                        break;
                }
            }

            if (fromToday.Days == 0)
            {
                if (fuzzyDateTime.HasTime)
                {
                    return timeString;
                }
                else
                {
                    return "Today";
                }
            }
            else if (fromToday.Days == 1)
            {
                string result = "Tomorrow";
                if (fuzzyDateTime.HasTime)
                    result += " " + timeString;
                return result;
            }
            else if (fromToday.Days == -1)
            {
                string result = "Yesterday";
                if (fuzzyDateTime.HasTime)
                    result += " " + timeString;
                return result;
            }
            else if (fromToday.Days > 0 && fromToday.Days <= 6)
            {
                string result = fuzzyDateTime.DateTime.DayOfWeek.ToString();
                if (fuzzyDateTime.HasTime)
                    result += " " + timeString;
                return result;
            }
            else if (fromToday.Days > 6 && fuzzyDateTime.DateTime.Year == DateTime.Today.Year)
            {
                string format = "MMM dd";
                switch (dateFormat)
                {
                    case DateFormat.European:
                        format = "dd MMM";
                        break;
                    case DateFormat.American:
                    default:
                        format = "MMM dd";
                        break;
                }
                string result = fuzzyDateTime.DateTime.ToString(format);
                if (fuzzyDateTime.HasTime)
                    result += " " + timeString;
                return result;
            }
            else
            {
                string format = "MM/dd/yy";
                switch (dateFormat)
                {
                    case DateFormat.European:
                        format = "dd/MM/yy";
                        break;
                    case DateFormat.American:
                    default:
                        format = "MM/dd/yy";
                        break;
                }
                string result = fuzzyDateTime.DateTime.ToString(format);
                if (fuzzyDateTime.HasTime)
                    result += " " + timeString;
                return result;
            }
        }
コード例 #49
0
ファイル: User.cs プロジェクト: jbfp/Todoist.NET
 /// <summary>
 /// Resets all properties, because there is no real logging out from Todoist.com
 /// </summary>
 public void LogOff()
 {
     this.id = 0;
     this.email = string.Empty;
     this.fullName = string.Empty;
     this.apiToken = string.Empty;
     this.startPage = new StartPage();
     this.timeZone = null;
     this.timeZoneOffset = new TimeZoneOffset();
     this.timeFormat = new TimeFormat();
     this.dateFormat = 0;
     this.sortOrder = SortOrder.OldestDatesFirst;
     this.notifoAccount = string.Empty;
     this.mobileNumber = string.Empty;
     this.mobileHost = string.Empty;
     this.premiumUntil = string.Empty;
     this.defaultReminder = new DefaultReminder();
     this.jsonData = string.Empty;
 }
コード例 #50
0
        void _SetParameter(string[] args)
        {
            string[] values;
            values = base.GetParameter("W", 1);
            if (values != null)
            {
                try
                {
                    _timeOut = int.Parse(values[0]);
                }
                catch (Exception ex)
                {
                    throw new ApplicationException("パラメータ タイムアウト(/w)の指定が正しくありません。指定は数字である必要があります。", ex);
                }
            }

            values = base.GetParameter("S", 2);
            if (values != null)
            {
                try
                {
                    _maxThreads = int.Parse(values[0]);
                    _completionPortThreads = int.Parse(values[1]);
                }
                catch (Exception ex)
                {
                    throw new ApplicationException("パラメータ/sのMaxThreadsCount, CompletionPortThreadsが正しくありません。指定する内容は2つの数字である必要があります。", ex);
                }
            }

            values = base.GetParameter("E", 0);
            if (values != null)
            {
                _isErrorOnly = true;
            }

            values = base.GetParameter("D", 0);
            if (values != null)
            {
                _isDetailResult = true;
            }

            values = base.GetParameter("?", 0);
            if (values != null)
            {
                _isHelp = true;
            }

            values = base.GetParameter("help", 0);
            if (values != null)
            {
                _isHelp = true;
            }

            values = base.GetParameter("T", 0);
            if (values != null)
            {
                _timeFormat = TimeFormat.YYYYMMDDHHMMSS;
            }

            values = base.GetParameter("N", 1);
            if (values != null)
            {
                try
                {
                    _echoCount = int.Parse(values[0]);
                }
                catch (Exception ex)
                {
                    throw new ApplicationException("パラメータ タイムアウト(/w)の指定が正しくありません。指定は数字である必要があります。", ex);
                }
            }

            values = base.GetParameter("I", 1);
            if (values != null)
            {
                string parameterFile = values[0];
                string parameterData = File.ReadAllText(parameterFile);
                string[] parameters = parameterData.Split(new char[] { ' ', '\r', '\n', });
                //パラメータ解析
                _SetParameter(parameters);
                //残りは通常引数
                parameters.All(param =>
                {
                    if (param.Trim() != "")
                    {
                        ArgumentsExceptOptions.Add(param);
                    }
                    return true;
                });
            }
        }
コード例 #51
0
ファイル: CDDevice.cs プロジェクト: ugenlik/CdpLayer
        private int SetTimeFormat( TimeFormat TF )
        {
            ReturnCode = GetStringBuilder();
            CommandLine = "set cd time format ";

            switch(TF)
            {
                case(TimeFormat.MS):
                    ActionLine = "ms";
                    break;
                case(TimeFormat.MSF):
                    ActionLine = "msf wait";
                    break;
                case(TimeFormat.TMSF):
                    ActionLine = "tmsf wait";
                    break;
                default:
                    ActionLine = "tmsf wait";
                    break;
            }

            CommandLine = CommandLine + " " + ActionLine;

            return MciSendString( CommandLine, ReturnCode, ReturnCode.Length, new IntPtr(0) );
        }
コード例 #52
0
ファイル: User.cs プロジェクト: jbfp/Todoist.NET
        /// <summary>
        /// Update user
        /// </summary>
        /// <param name="newEmail">
        /// New email
        /// </param>
        /// <param name="newFullName">
        /// New name
        /// </param>
        /// <param name="newPassword">
        /// New password
        /// </param>
        /// <param name="newTimeZone">
        /// New timezone
        /// </param>
        /// <param name="newDateFormat">
        /// New dateformat
        /// </param>
        /// <param name="newTimeFormat">
        /// New timeformat
        /// </param>
        /// <param name="newStartPage">
        /// New startpage
        /// </param>
        public void UpdateUser(
            string newEmail, 
            string newFullName, 
            string newPassword, 
            string newTimeZone, 
            DateFormat? newDateFormat, 
            TimeFormat? newTimeFormat, 
            StartPage? newStartPage)
        {
            this.CheckLoginStatus();

            Uri uri = Core.ConstructUri(
                "updateUser?", 
                string.Format(
                    "token={0}&" + "email={1}&" + "full_name={2}&" + "password={3}&" + "timezone={4}&"
                    + "date_format={5}&" + "time_format={6}&" + "start_page={7}", 
                    this.ApiToken, 
                    newEmail, 
                    newFullName, 
                    newPassword, 
                    newTimeZone, 
                    newDateFormat, 
                    newTimeFormat, 
                    newStartPage), 
                true);

            string jsonResponse = Core.GetJsonData(uri);

            switch (jsonResponse)
            {
                case "\"ERROR_PASSWORD_TOO_SHORT\"":
                    throw new UpdateUserException(
                        "The password provided is too short. It must be at least 5 characters long.");
                case "\"ERROR_EMAIL_FOUND\"":
                    throw new UpdateUserException(
                        "The e-mail address provided has already been registered with Todoist with another account.");
            }

            this.jsonData = jsonResponse;
            this.AnalyseJson();
        }
コード例 #53
0
ファイル: User.cs プロジェクト: jbfp/Todoist.NET
        /// <summary>
        /// The analyse json.
        /// </summary>
        private void AnalyseJson()
        {
            JObject o = JObject.Parse(this.JsonData);
            this.notifoAccount = (string)o.SelectToken("notifo");
            this.apiToken = (string)o.SelectToken("api_token");
            switch ((int)o.SelectToken("time_format"))
            {
                case 0:
                    this.timeFormat = TimeFormat.TwentyFourHourClock;
                    break;
                case 1:
                    this.timeFormat = TimeFormat.TwelveHourClock;
                    break;
            }

            switch ((int)o.SelectToken("sort_order"))
            {
                case 0:
                    this.sortOrder = SortOrder.OldestDatesFirst;
                    break;
                case 1:
                    this.sortOrder = SortOrder.NewestDatesFirst;
                    break;
            }

            this.fullName = (string)o.SelectToken("full_name");
            this.mobileNumber = (string)o.SelectToken("mobile_number");
            this.mobileHost = (string)o.SelectToken("mobile_host");
            this.timeZone = (string)o.SelectToken("timezone");

            this.id = (int)o.SelectToken("id");

            switch ((int)o.SelectToken("date_format"))
            {
                case 0:
                    this.dateFormat = DateFormat.DdMmYyyy;
                    break;
                case 1:
                    this.dateFormat = DateFormat.MmDdYyyy;
                    break;
            }

            this.premiumUntil = (string)o.SelectToken("premium_until");

            JToken timeZoneString = o.SelectToken("tz_offset");
            this.timeZoneOffset = new TimeZoneOffset(
                timeZoneString.First.Value<string>(), 
                timeZoneString.First.Next.Value<int>(), 
                timeZoneString.First.Next.Next.Value<int>(), 
                timeZoneString.First.Next.Next.Next.Value<bool>());

            switch ((string)o.SelectToken("default_reminder"))
            {
                case "email":
                    this.defaultReminder = DefaultReminder.Email;
                    break;
                case "mobile":
                    this.defaultReminder = DefaultReminder.Mobile;
                    break;
                case "notifo":
                    this.defaultReminder = DefaultReminder.Notifo;
                    break;
                case "no_defalt":
                    this.defaultReminder = DefaultReminder.NoDefault;
                    break;
            }

            this.email = (string)o.SelectToken("email");
        }
コード例 #54
0
 /// <summary>
 /// Writes an Observation value against the current series
 /// <p />
 /// The date is formatted as a string, the format rules are determined by the TIME_FORMAT argument
 /// <p />
 /// Validates the following:
 /// <ul><li>The obsTime does not replicate a previously reported obsTime for the current series</li></ul>
 /// </summary>
 /// <param name="obsTime">the time of the observation</param>
 /// <param name="obsValue">the observation value - can be numerical</param>
 /// <param name="sdmxSwTimeFormat">the time format to format the obsTime in when converting to a string</param>
 /// <param name="annotations">Any additional annotations that are attached to the observation, can be null if no annotations exist </param>
 public void WriteObservation(DateTime obsTime, string obsValue, TimeFormat sdmxSwTimeFormat, params IAnnotation[] annotations)
 {
     this.RunQueue();
     this._dataWriterEngine.WriteObservation(obsTime, obsValue, sdmxSwTimeFormat, annotations);
 }
コード例 #55
0
        /// <summary>
        /// 播放快进(每次快进 FramesStep)
        /// </summary>
        public void Forward()
        {
            int err = 0;
            StringBuilder buf = new StringBuilder(1000);
            TimeFormat tf = timeFormat;

            if (deviceID > 0)
            {
                if ((devCaps & DevCaps.CanShowVideo) == DevCaps.CanShowVideo)
                {
                    if (GetLength() - GetPosition() <= framesStep)
                    {
                        MCI_GENERIC_PARMS gen = new MCI_GENERIC_PARMS();

                        Pause();

                        err = mciSendCommandA(deviceID, MCI_SEEK, MCI_SEEK_TO_END | MCI_WAIT, ref gen);
                        if (err != 0)
                        {
                            mciGetErrorStringA(err, buf, 1000);
                            //throw new ApplicationException(buf.ToString());
                        }

                        Play();
                    }
                    else
                    {
                        MCI_DGV_STEP_PARMS step = new MCI_DGV_STEP_PARMS();

                        Pause();

                        if (timeFormat != TimeFormat.Frames)
                        {
                            timeFormat = TimeFormat.Frames;
                            MciSet(0, MCI_FORMAT_FRAMES, MCI_SET_TIME_FORMAT);
                        }

                        step.dwFrames = framesStep;
                        err = mciSendCommandA(deviceID, MCI_STEP, MCI_WAIT | MCI_DGV_STEP_FRAMES, ref step);
                        if (err != 0)
                        {
                            mciGetErrorStringA(err, buf, 1000);
                            //throw new ApplicationException(buf.ToString());
                        }

                        if (tf != TimeFormat.Frames)
                        {
                            timeFormat = tf;
                            MciSet(0, (int)tf, MCI_SET_TIME_FORMAT);
                        }
                        Play();
                    }
                }
                else
                {
                    if (timeFormat != TimeFormat.MilliSeconds)
                    {
                        timeFormat = TimeFormat.MilliSeconds;
                        MciSet(0, MCI_FORMAT_MILLISECONDS, MCI_SET_TIME_FORMAT);
                    }

                    SeekToAny(GetPosition() + framesStep);

                    if (tf != TimeFormat.MilliSeconds)
                    {
                        timeFormat = tf;
                        MciSet(0, (int)tf, MCI_SET_TIME_FORMAT);
                    }
                }
            }
        }
コード例 #56
0
        /// <summary>
        /// 打开多媒体文件。
        /// </summary>
        public void Open()
        {
            int err;
            int paras = 0;
            StringBuilder buf = new StringBuilder(1000);

            MCI_OPEN_PARMS op = new MCI_OPEN_PARMS();

            if (deviceID > 0)
                Close();

            if ((int)timer.Tag == 1)
            {
                timer.Tag = 0;
                timer.Stop();
            }

            if (fileName.ToString() == "" && deviceType != DeviceType.CDAudio && deviceType != DeviceType.VideoDisc
                && deviceType != DeviceType.WaveAudio && deviceType != DeviceType.Overlay)
            {
                //throw new ApplicationException("要打开的文件名为空!");
            }

            paras = MCI_WAIT;
            if (deviceType != DeviceType.CDAudio && deviceType != DeviceType.VideoDisc)
                paras |= MCI_OPEN_ELEMENT;

            if (deviceType != DeviceType.AutoSelect)
            {
                if (deviceType == DeviceType.OwnerSelect)
                    op.lpstrDeviceType = GetDriverType(fileName);
                else
                    op.lpstrDeviceType = deviceType.ToString();

                paras = paras | MCI_OPEN_TYPE;
            }

            if (shareAble)
            {
                if (fileName != string.Empty && deviceType != DeviceType.WaveAudio && deviceType != DeviceType.Overlay)
                    paras = paras | MCI_OPEN_SHAREABLE;
            }

            op.dwCallback = 0;
            op.wDeviceID = 0;
            op.lpstrElementName = fileName;

            err = mciSendCommandA(0, MCI_OPEN, paras, ref op);

            if (err != 0)
            {
                deviceID = 0;
                mciGetErrorStringA(err, buf, 1000);
                throw new ApplicationException("打开文件出错," + buf.ToString());
            }
            else
            {
                deviceID = op.wDeviceID;
                try
                {
                    GetDevcaps();

                    //以帧快进有问题,去掉
                    /*
                    if ((devCaps & DevCaps.CanShowVideo) != DevCaps.CanShowVideo)
                    {
                        if (framesStep == 0)
                            framesStep = 3000;
                    }
                     */

                    if (framesStep == 0)
                        framesStep = Length / 200;

                    if (deviceType == DeviceType.CDAudio || deviceType == DeviceType.VideoDisc)
                    {
                        timeFormat = TimeFormat.TMSF; //set timeformat to use tracks
                        MciSet(0, (int)timeFormat, MCI_WAIT | MCI_SET_TIME_FORMAT);
                    }
                    else
                    {
                        if (timeFormat != TimeFormat.Default)
                            MciSet(0, (int)timeFormat, MCI_WAIT | MCI_SET_TIME_FORMAT);
                    }

                    try
                    {
                        size = GetVideoSize();
                        SetVolume(volume);
                        SetAudio(audioSource);
                        SetMute(mute);
                    }
                    catch { }
                }
                catch (Exception ex)
                {
                    //throw new ApplicationException("打开文件出错," + ex.ToString());
                }
            }
        }
コード例 #57
0
ファイル: SdmxDateImpl.cs プロジェクト: alcardac/SDMXRI_WS_OF
		public SdmxDateImpl(String dateInSdmx0) {
			this.date = Org.Sdmxsource.Sdmx.Util.Date.DateUtil.FormatDate(dateInSdmx0);
			this.timeFormat = Org.Sdmxsource.Sdmx.Util.Date.DateUtil.GetTimeFormatOfDate(dateInSdmx0);
			this.dateInSdmx = dateInSdmx0;
		}
コード例 #58
0
ファイル: TimePicker.cs プロジェクト: Torion/WpfExToolkit
 protected virtual void OnFormatChanged( TimeFormat oldValue, TimeFormat newValue )
 {
   UpdateListBoxItems();
 }
コード例 #59
0
    protected virtual void OnFormatChanged( TimeFormat oldValue, TimeFormat newValue )
    {

    }
コード例 #60
-4
ファイル: TimeFormatter.cs プロジェクト: kantorn/toacs
        /// <summary>
        /// Formats an hour number for 12/24 hours clock.
        /// </summary>
        /// <param name="hour"></param>
        /// <param name="clock"></param>
        /// <param name="format"></param>
        /// <returns></returns>
        public static string GetHour(int hour, TimeFormat clock, string format)
        {
            bool am = (hour / 12) == 0;
            if (clock == TimeFormat.Clock12Hours)
            {
                hour = hour % 12;
                if (hour == 0)
                    hour = 12;
            }

            string suffix = String.Empty;
            if (clock == TimeFormat.Clock12Hours)
            {
                if (am)
                {
                    suffix = "AM";
                }
                else
                {
                    suffix = "PM";
                }
            }

            if (String.IsNullOrEmpty(format))
            {
                format = "{0} {1}";
            }

            return String.Format(format, hour, suffix);
        }