Ejemplo n.º 1
0
        protected virtual void OnTick(object o, TickArgs args)
        {
            long  currentTime     = args.CurrentTime;
            float currentposition = args.CurrentPosition;
            long  streamLength    = args.StreamLength;

            //Console.WriteLine ("Current Time:{0}\n Length:{1}\n",currentTime, streamLength);
            if (length != streamLength)
            {
                length  = streamLength;
                slength = TimeString.MSecondsToSecondsString(length);
            }

            if (InSegment())
            {
                currentTime    -= segmentStartTime;
                currentposition = (float)currentTime / (float)(segmentStopTime - segmentStartTime);
                slength         = TimeString.MSecondsToMSecondsString(segmentStopTime - segmentStartTime);
            }

            timelabel.Text  = TimeString.MSecondsToMSecondsString(currentTime) + "/" + slength;
            timescale.Value = currentposition;
            if (Tick != null)
            {
                Tick(o, args.CurrentTime, args.StreamLength, args.CurrentPosition, args.Seekable);
            }
        }
Ejemplo n.º 2
0
        public override void ProcessChatRoomMessage(object sender, MessageEventArgs e)
        {
            string[] SplitMessage = e.ReceivedMessage.Split(null);
            foreach (string Word in SplitMessage) //We do this to handle multiple videos
            {
                string VideoID = ExtractID(Word);

                if (string.IsNullOrEmpty(VideoID))
                {
                    //Do Nothing
                }
                else
                {
                    string VideoData = GetVideoData(VideoID);
                    if (string.IsNullOrEmpty(VideoData))
                    {
                        //Do Nothing
                    }
                    else
                    {
                        string item = VideoData;//.Replace("\n", string.Empty);
                        string TimeString;

                        Console.WriteLine(item);

                        dynamic    red  = JsonConvert.DeserializeObject(item);
                        RootObject data = JsonConvert.DeserializeObject <RootObject>(item);

                        string time = data.items[0].contentDetails.duration;

                        if (time.Contains("D"))
                        {
                            TimeString = "Over 24 Hours long";
                        }
                        else
                        {
                            TimeString = XmlConvert.ToTimeSpan(time).ToString();
                        }

                        string Hoursheader = "00:";
                        if (TimeString.StartsWith(Hoursheader))
                        {
                            TimeString = TimeString.Substring(Hoursheader.Length, TimeString.Length - Hoursheader.Length);
                        }
                        if (TimeString.Equals("00:00"))
                        {
                            TimeString = "Stream";
                        }
                        e.ReplyMessage = data.items[0].snippet.title + " [" + TimeString + "]";
                        e.InterfaceHandlerDestination.SendChatRoomMessage(this, e);
                    }
                    Console.WriteLine(GetVideoData(VideoID));
                }
            }
        }
Ejemplo n.º 3
0
 public void CloseActualSegment()
 {
     closebutton.Hide();
     segmentStartTime = 0;
     segmentStopTime  = 0;
     SetScaleValue(SCALE_FPS);
     //timescale.Sensitive = true;
     slength = TimeString.MSecondsToSecondsString(length);
     SegmentClosedEvent();
     player.CancelProgramedStop();
 }
        protected void PropChanged_Listener(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "Statistics")
            {
                Uptime          = TimeString.GenerateFromSeconds(Statistics.ServerUptime);
                AllSongDuration = TimeString.GenerateFromSeconds(Statistics.AllSongDuration);

                DateTime time = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Local)
                                .AddSeconds(Statistics.LastDBUpdate);

                LastDBUpdate = time.ToLongDateString() + " " + time.ToLongTimeString();
            }
        }
Ejemplo n.º 5
0
        private void SetTimeStrings()
        {
            List <TimeString> newRoomTimeStrings = new List <TimeString>();
            LevelHighscores   highscores         = PlayerData.Instance.GetLevelHighscores(GetCurrentLevel());

            for (int i = 0; i < highscores.NumberOfRooms; i++)
            {
                newRoomTimeStrings.Add(new TimeString("Room " + (i + 1), highscores.GetTime(i), false));
            }

            RoomTimeStrings = newRoomTimeStrings;
            TotalTimeString = new TimeString("Level", highscores.TotalTime, false);
        }
Ejemplo n.º 6
0
        public string convertTime(string aTime)
        {
            ITime time = new TimeString(aTime);

            IBerlinClock berlinClock = new BerlinClock.Classes.BerlinClock(time);

            string result = berlinClock.getSeconds() + "\r\n"
                            + berlinClock.getHoursTimes5() + "\r\n"
                            + berlinClock.GetHoursTimes1() + "\r\n"
                            + berlinClock.getMinutesTimes5() + "\r\n"
                            + berlinClock.GetMinutsTimes1();

            return(result);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 保存一条房源需求(求租和求购)
 /// </summary>
 /// <param name="model"></param>
 public void SaveHouseDemand(HouseDemandModel model)
 {
     DAL.HouseDemandDAL dal = new DAL.HouseDemandDAL();
     model.CreateTime = DateTime.Now;
     if (model.HouseDemandId == "")
     {
         model.HouseDemandId = TimeString.GetNow_ff();
         dal.Add(model);
     }
     else
     {
         dal.Update(model);
     }
 }
Ejemplo n.º 8
0
 public void CloseActualSegment()
 {
     closebutton.Hide();
     segmentStartTime = 0;
     segmentStopTime  = 0;
     vscale1.Value    = 25;
     //timescale.Sensitive = true;
     slength = TimeString.MSecondsToSecondsString(length);
     if (SegmentClosedEvent != null)
     {
         SegmentClosedEvent();
     }
     player.CancelProgramedStop();
 }
Ejemplo n.º 9
0
    /// <summary>
    /// Converts the time (in seconds) to a TimeString.
    /// </summary>
    /// <returns>The TimeString representation</returns>
    /// <param name="time">Time.</param>
    public static TimeString ConvertTimeToTimeString(double time)
    {
        TimeString timestring = new TimeString();
        int        seconds    = (int)time;
        int        minutes    = seconds / 60;

        if (minutes < 10)
        {
            timestring.minutes = "0" + minutes;
        }
        else if (minutes >= 10 && minutes < 60)
        {
            timestring.minutes = minutes.ToString();
        }
        else
        {
            int hours = minutes / 60;
            if (hours < 10)
            {
                timestring.hours = "0" + hours;
            }
            else
            {
                timestring.hours = hours.ToString();
            }

            int sminutes = minutes % 60;
            if (sminutes < 10)
            {
                timestring.minutes = "0" + sminutes;
            }
            else
            {
                timestring.minutes = sminutes.ToString();
            }
        }

        seconds %= 60;
        if (seconds < 10)
        {
            timestring.seconds = "0" + seconds;
        }
        else
        {
            timestring.seconds = seconds.ToString();
        }

        return(timestring);
    }
Ejemplo n.º 10
0
 /// <summary>
 /// 保存一个房屋信息
 /// </summary>
 /// <param name="model">房屋信息类</param>
 public void SaveHouse(HouseModel model)
 {
     DAL.HouseDAL dal = new DAL.HouseDAL();
     model.CreateTime = DateTime.Now;
     if (model.HouseId == "")
     {
         //新增
         model.HouseId = TimeString.GetNowDifString();
         dal.Add(model);
     }
     else
     {   //修改
         dal.Update(model);
     }
 }
Ejemplo n.º 11
0
 private void SeekFromTimescale(double pos)
 {
     if (InSegment())
     {
         long seekPos = segmentStartTime + (long)(pos * (segmentStopTime - segmentStartTime));
         seeker.Seek(SeekType.Keyframe, GetRateFromScale(), true, seekPos);
         timelabel.Text = TimeString.MSecondsToMSecondsString(seekPos) + "/" +
                          TimeString.MSecondsToMSecondsString(segmentStopTime - segmentStartTime);
     }
     else
     {
         seeker.Seek(SeekType.Keyframe, GetRateFromScale(), true, (int)(pos * length));
         timelabel.Text = TimeString.MSecondsToMSecondsString(player.CurrentTime) + "/" + slength;
         Rate           = 1;
     }
 }
Ejemplo n.º 12
0
 private void SeekFromTimescale(double pos)
 {
     if (InSegment())
     {
         long seekPos = segmentStartTime + (long)(pos * (segmentStopTime - segmentStartTime));
         player.SeekInSegment(seekPos, GetRateFromScale());
         timelabel.Text = TimeString.MSecondsToSecondsString(seekPos) + "/" +
                          TimeString.MSecondsToSecondsString(segmentStopTime - segmentStartTime);
     }
     else
     {
         player.Position = pos;
         timelabel.Text  = TimeString.MSecondsToSecondsString(player.CurrentTime) + "/" + slength;
         Rate            = 1;
     }
 }
Ejemplo n.º 13
0
        private void DrawTimeString(TimeString timeString, float y)
        {
            float time = timeString.Time;

            string text = timeString.Context + ": " + (time < 0 ? "/" : Util.GetTimeString(time));

            if (timeString.IsNewRecord)
            {
                BasicGraphics.SetColor(BasicGraphics.Colors.SpecialText);
            }
            else
            {
                BasicGraphics.SetColor(BasicGraphics.Colors.DefaultText);
            }

            BasicGraphics.DrawText(text, new Vector2(-0.8f, y), 0.08f);
        }
Ejemplo n.º 14
0
        private void CaijiMove()
        {
            Model.MovInfoModel model = new Model.MovInfoModel();
            BLL.MovBLL         bll   = new BLL.MovBLL();


            model = bll.GetMovInfoModel(ReStr("MovId"));

            model.MovId         = ReStr("MovId"); //这是必须的
            model.CreateTime    = DateTime.Now;
            model.MovBiaoQian   = ReStr("MovBiaoQian", "");
            model.MovContent    = ReStr("MovContent", "");
            model.PianChang     = ReInt("PianChang", 0);
            model.MovImgUrl     = ImgHelper.downOneImg(ReStr("MovImgUrl"), "/upload/httpDown/Mov/");
            model.MovTitle      = ReStr("MovTitle");
            model.MovType       = ReStr("MovType");
            model.ShangYingTime = ReTime("ShangYingTime", DateTime.Now);
            model.ShiGuangId    = ReStr("MovId");
            model.MovClass      = ReStr("MovClass", "");
            DAL.MovInfoDAL dal = new DAL.MovInfoDAL();

            DataTable dtEv = ReTable("MovEventArrayStr");

            if (dtEv != null)
            {
                bll.DelMovEvent(" MovId='" + model.MovId + "' ");
                foreach (DataRow dr in dtEv.Rows)
                {
                    Model.MovEventModel EvModel        = new Model.MovEventModel();
                    DateTime            MovEventBgTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd " + dr["MovEventBgTime"] + ":00"));

                    EvModel.MovEventBgTime  = MovEventBgTime;
                    EvModel.MovEventId      = TimeString.GetNow_ff();
                    EvModel.MovEventMemo    = dr["MovEventMemo"].ToString();
                    EvModel.MovEventRePrice = Convert.ToDecimal(dr["MovEventRePrice"]);
                    EvModel.MovId           = model.MovId;
                    bll.AddMovEvent(EvModel);
                }
            }
            bll.SaveMovInfo(model);

            ReTrue();
        }
Ejemplo n.º 15
0
    public static string ToReadibleTime(float time, TimeString timeType)
    {
        string returnString = "";

        switch (timeType)
        {
        case TimeString.MinuteSecondsMilli:
            returnString  = getTimeSection(time / 60);
            returnString += ":";
            returnString += getTimeSection(time % 60);
            returnString += ":";
            returnString += getTimeSection((time % 1) * 100);
            break;

        case TimeString.MinuteSeconds:
            returnString  = getTimeSection(time / 60);
            returnString += ":";
            returnString += getTimeSection(time % 60);
            break;
        }
        return(returnString);
    }
Ejemplo n.º 16
0
        public LevelEndScreen(Level level)
        {
            Center = new Vector2(-0.8f, -0.85f);

            if (level.Name == "Level 1")
            {
                PlayerData.Instance.UnlockLevel("Level 2");
            }
            if (level.Name == "Level 2")
            {
                PlayerData.Instance.UnlockLevel("Level 3");
            }

            LevelHighscores highscores = PlayerData.Instance.GetLevelHighscores(level.Name, level.Rooms.Count);

            List <TimeString> roomTimeStrings = new List <TimeString>();

            for (int i = 0; i < level.Rooms.Count; i++)
            {
                float time        = level.Times[i];
                bool  isNewRecord = highscores.CheckSingleTime(i, time);

                roomTimeStrings.Add(new TimeString("Room " + (i + 1), time, isNewRecord));
            }

            RoomTimeStrings = roomTimeStrings;

            float totalTime        = level.GetTotalTime();
            bool  isNewTotalRecord = highscores.CheckTotalTime(totalTime);

            TotalTimeString = new TimeString("Level", totalTime, isNewTotalRecord);

            PlayerData.WriteXML();

            AddMainMenuButton("continue");
        }
        private void SetUpdatedValues()
        {
            if (Status != null)
            {
                string imageSource = (status.Repeat == 1) ? "repeat_blue.png" : "repeat_white.png";
                if (RepeatImageSource != imageSource)
                {
                    RepeatImageSource = imageSource;
                }

                imageSource = (status.Random == 1) ? "shuffle_blue.png" : "shuffle_white.png";
                if (ShuffleImageSource != imageSource)
                {
                    ShuffleImageSource = imageSource;
                }

                if (status.Volume >= 60)
                {
                    VolumeImageSource = "volume_up_white.png";
                }
                else if (status.Volume > 0)
                {
                    VolumeImageSource = "volume_down_white.png";
                }
                else
                {
                    VolumeImageSource = "volume_off_white.png";
                }

                PromilleElapsed   = (double)status.ElapsedTime / (1000.0 * Status.CurrentTrackLength);
                TracklengthString = (CurrentSong != null) ?
                                    TimeString.GenerateFromSeconds(CurrentSong.LengthInSeconds) : TimeString.GenerateFromSeconds(Status.CurrentTrackLength);

                ElapsedTimeString = TimeString.GenerateFromSeconds(Status.ElapsedTimeInSec);
            }
        }
Ejemplo n.º 18
0
        public void Parse_ShouldThrowFormatException_WhenHasUnknownFormat(string timeString)
        {
            void Act() => _ = TimeString.Parse(timeString);

            Assert.Throws <FormatException>(Act);
        }
Ejemplo n.º 19
0
        private void ShowDetail(int Line)
        {
            CurrentLine = Line;
            gntDetail.ClearChartBars();
            label2.Text        = "Resource # " + Line.ToString() + " Detail";
            gntDetail.FromDate = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 0, 0, 0);
            gntDetail.ToDate   = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 23, 59, 59);

            DataTable dt = _DS.Tables[0];
            int       i = 0;
            int       etHrs, etMins;
            string    ProductionLine, PrevProductionLine, TimeString, ProductName;
            int       stHrs = -1;
            int       stMins = -1;
            DateTime  StartTime, EndTime;
            Double    Setup, RunTime, RunLength;

            //     PrevProductionLine is used to iterate through the rows of the input dataset and
            //     determine when we have found the right production line to display
            PrevProductionLine = "";
            gntDetail.ClearSelection();

            int dbIndex = 0;

            foreach (DataRow dr in dt.Rows)
            {
                if (dr.RowState == DataRowState.Deleted)
                {
                    dbIndex++;
                    continue;
                }
                EndTime        = (DateTime)dr["End Time"];
                Setup          = (double)dr["Setup Time"];
                RunTime        = (double)dr["Run Time"];
                ProductionLine = dr["Resource Number"].ToString();
                ProductName    = (string)dr["Product Name"];
                if (Convert.ToInt32(ProductionLine) == Line)
                {
                    if (PrevProductionLine != ProductionLine)
                    {
                        RunLength = RunTime + Setup;
                        TimeSpan ts = new TimeSpan(0, (int)RunLength, 0);
                        StartTime  = EndTime - ts;
                        TimeString = StartTime.ToString("HH:mm");
                        stHrs      = Convert.ToInt32(TimeString.Substring(0, 2));
                        stMins     = Convert.ToInt32(TimeString.Substring(3, 2));
                    }
                    if (Setup != 0)
                    {
                        TimeSpan ts       = new TimeSpan(0, (int)RunTime, 0);
                        DateTime SetupEnd = EndTime - ts;
                        TimeString = SetupEnd.ToString("HH:mm");
                        etHrs      = Convert.ToInt32(TimeString.Substring(0, 2));
                        etMins     = Convert.ToInt32(TimeString.Substring(3, 2));
                        gntDetail.AddChartBar(ProductName, ProductionLine, new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, stHrs, stMins, 0),
                                              new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, etHrs, etMins, 0), SetupColor, Color.Khaki, i, dbIndex, true, false);

                        stHrs  = etHrs;
                        stMins = etMins;
                    }
                    TimeString = EndTime.ToString("HH:mm");
                    etHrs      = Convert.ToInt32(TimeString.Substring(0, 2));
                    etMins     = Convert.ToInt32(TimeString.Substring(3, 2));

                    gntDetail.AddChartBar(ProductName, ProductionLine, new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, stHrs, stMins, 0),
                                          new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, etHrs, etMins, 0), RunColor, Color.Khaki, i, dbIndex, false, false);
                    stHrs  = etHrs;
                    stMins = etMins;
                    i++;
                }
                dbIndex++;
            }
            gntDetail.PaintChart();
        }
Ejemplo n.º 20
0
        public void Parse_ShouldConvertTimeStringToTimeSpan(string timeString, double expected)
        {
            var timeSpan = TimeString.Parse(timeString);

            timeSpan.TotalMilliseconds.Should().Be(expected);
        }
Ejemplo n.º 21
0
 protected virtual void OnTick(int ellapsedTime)
 {
     timelabel.Text = "Time: " + TimeString.MSecondsToSecondsString(CurrentTime);
 }
Ejemplo n.º 22
0
        public void Parse_ShouldThrowArgumentException_WhenTimeStringIsNullOrWhiteSpace(string timeString)
        {
            void Act() => _ = TimeString.Parse(timeString);

            Assert.Throws <ArgumentException>(Act);
        }
Ejemplo n.º 23
0
        public void Ctor_ShouldAcceptValidTimeString(string value, double expected)
        {
            var timeString = new TimeString(value);

            timeString.TimeSpan.TotalMilliseconds.Should().Be(expected);
        }
Ejemplo n.º 24
0
 public override int GetHashCode()
 {
     return(Number ^ TimeString.GetHashCode() ^ Message.GetHashCode());
 }