コード例 #1
0
ファイル: WebWorldSaveTime.cs プロジェクト: caleb-dp/Phoenix
        //---------------------------------------------------------------------------------------------

        public static WebWorldSaveInfo GetInfo(DateTime lastTime, int timeCorrection)
        {
            WebWorldSaveInfo info = new WebWorldSaveInfo();

            info.LastTime     = lastTime;
            info.NextTime     = info.LastTime.AddMinutes(WsPeriodMinutes - timeCorrection);
            info.LastTimeSpan = DateTime.Now - info.LastTime;
            info.NextTimeSpan = DateTime.Now - info.NextTime;

            try
            {
                string tsStr = info.LastTimeSpan.ToString();
                info.LastTimeStr = tsStr.Remove(tsStr.IndexOf('.'), tsStr.Length - tsStr.IndexOf('.'));

                string ts2Str = info.NextTimeSpan.ToString();
                info.NextTimeStr = ts2Str.Remove(ts2Str.IndexOf('.'), ts2Str.Length - ts2Str.IndexOf('.'));
            }
            catch
            {
                info.LastTimeStr = "Error";
                info.NextTimeStr = "Error";
            }

            return(info);
        }
コード例 #2
0
ファイル: WebWorldSaveTime.cs プロジェクト: caleb-dp/Phoenix
        public static void PrintLastWorldSaveInfoFromWeb(int timeCorrection)
        {
            WebWorldSaveInfo info = GetInfo(GetTimeFromUrl(), timeCorrection);

            UO.Print(0x0053, "WS pred: {0}", info.LastTimeStr);
            UO.Print(0x0053, "WS   za: {0}", info.NextTimeStr);
        }