当前位置: 首页>>代码示例>>C#>>正文


C# TimeCode.ToHHMMSSFF方法代码示例

本文整理汇总了C#中TimeCode.ToHHMMSSFF方法的典型用法代码示例。如果您正苦于以下问题:C# TimeCode.ToHHMMSSFF方法的具体用法?C# TimeCode.ToHHMMSSFF怎么用?C# TimeCode.ToHHMMSSFF使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TimeCode的用法示例。


在下文中一共展示了TimeCode.ToHHMMSSFF方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EncodeEndTimeCode

        private static string EncodeEndTimeCode(TimeCode time)
        {
            //00:50:39:13 (last is frame)

            //Bugfix for Avid - On 23.976 FPS and 24 FPS projects, when the End time of a subtitle ends in 02, 07, 12, 17, 22, 27 frames, the subtitle won't import.
            if (Math.Abs(Configuration.Settings.General.CurrentFrameRate - 23.976) < 0.01 ||
                Math.Abs(Configuration.Settings.General.CurrentFrameRate - 24) < 0.01)
            {
                var frames = SubtitleFormat.MillisecondsToFramesMaxFrameRate(time.Milliseconds);
                if (frames == 2 || frames == 7 || frames == 12 || frames == 17 || frames == 22 || frames == 27)
                    frames--;
                return string.Format("{0:00}:{1:00}:{2:00}:{3:00}", time.Hours, time.Minutes, time.Seconds, frames);
            }
            else
            {
                return time.ToHHMMSSFF();
            }
        }
开发者ID:ItsJustSean,项目名称:subtitleedit,代码行数:18,代码来源:AvidCaption.cs

示例2: EncodeTimeCode

 private static string EncodeTimeCode(TimeCode time)
 {
     //00:03:15:22 (last is frame)
     return time.ToHHMMSSFF();
 }
开发者ID:YangEunYong,项目名称:subtitleedit,代码行数:5,代码来源:AdobeEncoreLineTabs.cs

示例3: WriteTime

 private static void WriteTime(FileStream fs, TimeCode timeCode, bool addEndBytes)
 {
     var time = timeCode.ToHHMMSSFF();
     var buffer = Encoding.ASCII.GetBytes(time);
     fs.Write(buffer, 0, buffer.Length);
     if (addEndBytes)
     {
         fs.WriteByte(0xd);
         fs.WriteByte(0xa);
     }
 }
开发者ID:ARASHz4,项目名称:subtitleedit,代码行数:11,代码来源:CaptionsInc.cs

示例4: ToText

        public override string ToText(Subtitle subtitle, string title)
        {
            const string xmpTemplate = @"<XIF version='1.0' filename='file:///filename.xif'>
              <FileHeader>
            <OriginatorSoftware Name='FileConverter' Version='1.01'/>
            <GlobalFileInfo ProgrammeName='NAME' Format='Open' Language='English' StartTime='00:00:00:00' StopTime='00:00:00:00' TotalLength='00:00:00:00' ProgrammeTitle='TITLE' NumberOfCaptions='405' RevisionNumber='0' CountryIndex='0' CharacterCodeTable='0' MaxColumns='0' EpisodeNumber='0' BlinkOption='yes' CaptionService='0' CurrentVideo='2' Videosize='0' BaseOffset='0' TopOffset='0' DefaultSave='0' DisplaySafwWidth='576' SafeAreaWidthPercent='80' DisplaySafeHoriz='0' SafeAreaHorizPos='0' CurrentStyle='None' StyleDate='None' StyleTime='None' SAOLeft='72' SAORight='0' VideoStartTC='00:00:00:00' SpellLanguage='English' CGConfig='0'/>
            <ReadingSpeeds>
              <ReadingSpeed ID='0' WordsPerMinute='180' CharsPerMinute='720' CharsPerSecond='12' PTS='WPM'/>
            </ReadingSpeeds>
            <Canvases>
              <Canvas ID='0' Width='720' Height='576' SAWidth='576' SAHeight='460' SATop='57' SALeft='72'/>
            </Canvases>
            <FormattingInfo TabWidth='3'/>
            <TimingStandards>
              <TimingStandard ID='0' Type='SMPTE25'/>
            </TimingStandards>
            <Fonts>
              <Font ID='0' Type='True Type' Typeface='Courier New' Height='0' AstonFountSize='185' Ascent='268' Descent='97' IntLead='43'/>
              <Font ID='1' Type='True Type' Typeface='Courier New' Height='0' AstonFountSize='185' Ascent='268' Descent='97' IntLead='43'/>
              <Font ID='2' Type='True Type' Typeface='Hairy Helix' Height='0' AstonFountSize='12' Ascent='15' Descent='3' IntLead='2'/>
              <Font ID='3' Type='True Type' Typeface='Hairy Helix Italics' Height='0' AstonFountSize='12' Ascent='15' Descent='3' IntLead='2'/>
              <Font ID='4' Type='True Type' Typeface='Arial' Height='35' AstonFountSize='22' Ascent='28' Descent='7' IntLead='5'/>
              <Font ID='5' Type='True Type' Typeface='Arial Narrow' Height='35' AstonFountSize='25' Ascent='30' Descent='5' IntLead='0'/>
              <Font/>
            </Fonts>
            <Colours>
              <Colour ID='0' value='0x000000'/>
              <Colour ID='1' value='0xFF0000'/>
              <Colour ID='2' value='0x00FF00'/>
              <Colour ID='3' value='0xFFFF00'/>
              <Colour ID='4' value='0x0000FF'/>
              <Colour ID='5' value='0xFF00FF'/>
              <Colour ID='6' value='0x00FFFF'/>
              <Colour ID='7' value='0xFFFFFF'/>
            </Colours>
            <Threads>
              <Thread ID='0' CanvasID='0' TimingStandardID='0' ReadingSpeedID='0' Medium='Open' Name='Default'/>
            </Threads>
            <WordLists/>
            <TxStreams>
              <TxStream ID='0' Active='yes'/>
            </TxStreams>
              </FileHeader>
              <FileBody>
            <ProgrammeBlock NoOfAssociatedIDs='0'>
              <SceneBaseBlock NewsID='0' Position='0' NewsRoomInternalID='0'/>
            </ProgrammeBlock>
            <StoryBlock TimingType='Manual'>
              <SceneBaseBlock NewsID='0' Position='0' NewsRoomInternalID='0'/>
            </StoryBlock>

              </FileBody>
            </XIF>";

            const string paragraphTemplate = @"
              <ContentBlock TXStreamID='0' uid='B4EB0AE5-B82F-48ea-9FD4-C4194D004041'>
              <ThreadedObject ID='0' Type='BasicSubtitle' VPos='448'>
            <Note/>
            <TimingObject>
              <TimeIn value='10:00:03:06'/>
              <TimeOut value='10:00:05:09'/>
            </TimingObject>
            <Content Override='0' RaisedRowUp='0' RaisedRowDown='0' DirectionState='0' PositionState='1' ConfidenceValue='0'>
              <SubtitleText>
            <Paragraph Type='Open' Justification='Centre' LineLimit='15' CharactersPerRow='99' Alignment='None' Language='ENG' VideoLanguage='ENG' Xpercent='0.0' Ypercent='0.0'>
              <StartState Foreground='7' Background='0' Flash='No' Underline='No' Italic='No' Bold='No' Indent='0' SBOnOff='Yes' FontID='4'/>
              <Boxing Colour='0' Transparency='0' Type='None'/>
              <AntiAliasing Style='Default'/>
            </Paragraph>
              </SubtitleText>
            </Content>
              </ThreadedObject>
            </ContentBlock>";

            var xml = new XmlDocument();
            var lastTimeCode = new TimeCode();
            if (subtitle.Paragraphs.Count > 0)
            {
                lastTimeCode = subtitle.Paragraphs[subtitle.Paragraphs.Count - 1].StartTime;
            }
            if (string.IsNullOrWhiteSpace(title))
                title = "Unknown";
            xml.LoadXml(xmpTemplate.Replace('\'', '"'));
            var globalFileInfoNode = xml.DocumentElement.SelectSingleNode("FileHeader/GlobalFileInfo");
            globalFileInfoNode.Attributes["ProgrammeName"].InnerText = title;
            globalFileInfoNode.Attributes["ProgrammeTitle"].InnerText = title;
            globalFileInfoNode.Attributes["StopTime"].InnerText = lastTimeCode.ToHHMMSSFF();
            globalFileInfoNode.Attributes["NumberOfCaptions"].InnerText = subtitle.Paragraphs.Count.ToString(CultureInfo.InvariantCulture);

            var fileBodyNode = xml.DocumentElement.SelectSingleNode("FileBody");
            foreach (Paragraph p in subtitle.Paragraphs)
            {
                XmlNode content = xml.CreateElement("ContentBlock");
                content.InnerXml = paragraphTemplate;
                content.SelectSingleNode("ContentBlock/ThreadedObject/TimingObject/TimeIn").InnerText = p.StartTime.ToHHMMSSFF();
                content.SelectSingleNode("ContentBlock/ThreadedObject/TimingObject/TimeOut").InnerText = p.EndTime.ToHHMMSSFF();

                var paragraphNode = content.SelectSingleNode("ContentBlock/ThreadedObject/Content/SubtitleText/Paragraph");
                var lines = HtmlUtil.RemoveHtmlTags(p.Text, true).SplitToLines();
                for (int i = 1; i < lines.Length + 1; i++)
//.........这里部分代码省略.........
开发者ID:LeonCheung,项目名称:subtitleedit,代码行数:101,代码来源:Xif.cs

示例5: ToTimeCode

 private static string ToTimeCode(TimeCode timeCode)
 {
     return timeCode.ToHHMMSSFF(); //10:00:07:27
 }
开发者ID:ARASHz4,项目名称:subtitleedit,代码行数:4,代码来源:OresmeDocXDocument.cs

示例6: EncodeTimeCode

 private static string EncodeTimeCode(TimeCode time)
 {
     var s = time.ToHHMMSSFF();
     return AddSpaces(s);
 }
开发者ID:ARASHz4,项目名称:subtitleedit,代码行数:5,代码来源:UnknownSubtitle71.cs

示例7: WriteTime

 private static void WriteTime(FileStream fs, TimeCode timeCode)
 {
     fs.WriteByte(0xb);
     byte[] buffer = Encoding.ASCII.GetBytes(timeCode.ToHHMMSSFF());
     fs.Write(buffer, 0, buffer.Length);
 }
开发者ID:ItsJustSean,项目名称:subtitleedit,代码行数:6,代码来源:CapMakerPlus.cs

示例8: ToText


//.........这里部分代码省略.........
          <TextColor R='229' G='229' B='229' A='255'/>
          <Side Width='3' Direction='8'/>
          <SideColor R='16' G='16' B='16' A='255'/>
          <Edge Angle='1' Width='0'/>
          <EdgeColor R='235' G='235' B='235' A='255'/>
          <Shadow OffsetX='0' OffsetY='0' Blur='0'/>
          <ShadowColor R='235' G='235' B='235' A='255'/>
          <Background Mode='0'/>
          <BackgroundColor R='0' G='0' B='0' A='0'/>
        </BlockParameters>
        <BlockParameters version='1.0'>
          <Language></Language>
          <UnicodeBitField></UnicodeBitField>
          <Position X='130' Y='974' Width='266' Height='47'/>
          <Bound X='130' Y='974' Width='266' Height='47'/>
          <Font Name='黑体' Width='54' Height='38' Bold='0' Italic='0' Underline='0'/>
          <FontLatin Name='Arial' Width='54' Height='38' Bold='0' Italic='0' Underline='0'/>
          <LineAlign Align='0'/>
          <Layout CharSpace='2' LineSpace='2' Alignment='0' Direction='0'/>
          <TextColor R='235' G='235' B='235' A='255'/>
          <Side Width='3' Direction='8'/>
          <SideColor R='16' G='16' B='16' A='255'/>
          <Edge Angle='0' Width='0'/>
          <EdgeColor R='235' G='235' B='235' A='255'/>
          <Shadow OffsetX='0' OffsetY='0' Blur='0'/>
          <ShadowColor R='235' G='235' B='235' A='255'/>
          <Background Mode='0'/>
          <BackgroundColor R='0' G='0' B='0' A='0'/>
        </BlockParameters>
      </DisplayParameters>
      <Private>
        <FreeCG>IsContinuousClip=FALSE</FreeCG>
      </Private>
      <ActionIn>
        <TCIn>0</TCIn>
        <TCOut>0</TCOut>
        <Type>0</Type>
      </ActionIn>
      <ActionStay>
        <TCIn>0</TCIn>
        <TCOut>52</TCOut>
        <Type>0</Type>
      </ActionStay>
      <ActionOut>
        <TCIn>52</TCIn>
        <TCOut>53</TCOut>
        <Type>0</Type>
      </ActionOut>
    </SectionInfo>
  </TextSection>
</Document>";

            const string paragraphTemplate = @"
      <TimeCodeIn>00:00:15:09</TimeCodeIn>
      <TimeCodeOut>00:00:16:14</TimeCodeOut>
      <TextBlock>
        <String></String>
      </TextBlock>
      <TextBlock>
        <String></String>
      </TextBlock>
      <ActionIn>
        <TCIn>0</TCIn>
        <TCOut>0</TCOut>
        <Type>0</Type>
      </ActionIn>
      <ActionStay>
        <TCIn>0</TCIn>
        <TCOut>29</TCOut>
        <Type>0</Type>
      </ActionStay>
      <ActionOut>
        <TCIn>29</TCIn>
        <TCOut>30</TCOut>
        <Type>0</Type>
      </ActionOut>";
            var xml = new XmlDocument();
            var firstTimeCode = new TimeCode(0);
            var lastTimeCode = new TimeCode(0);
            if (subtitle.Paragraphs.Count > 0)
            {
                firstTimeCode = subtitle.Paragraphs[0].StartTime;
                lastTimeCode = subtitle.Paragraphs[subtitle.Paragraphs.Count - 1].StartTime;
            }
            string today = DateTime.Now.ToString("YYYY-mm-DD");
            xml.LoadXml(xmpTemplate.Replace('\'', '"').Replace("[YYYY-MM-DD]", today).Replace("[TIME_CODE_FIRST]", firstTimeCode.ToHHMMSSFF()).Replace("[TIME_CODE_LAST]", lastTimeCode.ToHHMMSSFF()));

            var paragraphInsertNode = xml.DocumentElement.SelectSingleNode("TextSection");
            foreach (Paragraph p in subtitle.Paragraphs)
            {
                XmlNode paragraph = xml.CreateElement("TextScreen");
                paragraph.InnerXml = paragraphTemplate;
                paragraph.SelectSingleNode("TimeCodeIn").InnerText = p.StartTime.ToHHMMSSFF();
                paragraph.SelectSingleNode("TimeCodeOut").InnerText = p.EndTime.ToHHMMSSFF();
                var textBlockNodes = paragraph.SelectNodes("TextBlock");
                textBlockNodes[0].SelectSingleNode("String").InnerText = p.Text;
                paragraphInsertNode.AppendChild(paragraph);
            }
            return ToUtf8XmlString(xml).Replace(" xmlns=\"\"", string.Empty);
        }
开发者ID:ItsJustSean,项目名称:subtitleedit,代码行数:101,代码来源:UnknownSubtitle78.cs

示例9: EncodeTimeCode

 private static string EncodeTimeCode(TimeCode time)
 {
     return time.ToHHMMSSFF().Replace(":", string.Empty);
 }
开发者ID:YangEunYong,项目名称:subtitleedit,代码行数:4,代码来源:UnknownSubtitle80.cs

示例10: MakeTimeCode

 private static string MakeTimeCode(TimeCode tc)
 {
     return tc.ToHHMMSSFF();
 }
开发者ID:ARASHz4,项目名称:subtitleedit,代码行数:4,代码来源:AvidDvd.cs


注:本文中的TimeCode.ToHHMMSSFF方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。