コード例 #1
0
        private void TestScript()
        {
            short w1, w2, w3;

            m_head.GetScriptCount(out w1);

            m_head.AddScript("foo", "barism", 0);

            m_head.GetScriptCount(out w2);
            Debug.Assert(w2 == w1 + 1);

            long  l;
            short pLen = 0, pCLen = 0;

            m_head.GetScript(w1, null, ref pLen, null, ref pCLen, out l);

            StringBuilder sbType = new StringBuilder(pLen);
            StringBuilder sbCom  = new StringBuilder(pCLen);

            m_head.GetScript(w1, sbType, ref pLen, sbCom, ref pCLen, out l);

            m_head.RemoveScript(w1);

            m_head.GetScriptCount(out w3);
            Debug.Assert(w3 == w1);
        }
コード例 #2
0
ファイル: WMHeaderInfo.cs プロジェクト: 4dvn/yeti
        /// <summary>
        /// Get a script from the header info. Wraps IWMHeaderInfo.GetScript
        /// </summary>
        /// <param name="index">Index of desired script</param>
        /// <returns>Desired script. <see cref="Script"/></returns>
        public Script GetScript(int index)
        {
            ushort        commandlen = 0, typelen = 0;
            ulong         time;
            StringBuilder command, type;

            m_HeaderInfo.GetScript((ushort)index, null, ref typelen, null, ref commandlen, out time);
            command = new StringBuilder(commandlen);
            type    = new StringBuilder(typelen);
            m_HeaderInfo.GetScript((ushort)index, type, ref typelen, command, ref commandlen, out time);
            return(new Script(type.ToString(), command.ToString(), time));
        }
コード例 #3
0
ファイル: WMVCopy.cs プロジェクト: gchudov/WindowsMediaLib
        //------------------------------------------------------------------------------
        // Name: CWMVCopy::CopyScriptInHeader()
        // Desc: Copies the script in the header of the source file to the header
        //       of the destination file .
        //------------------------------------------------------------------------------
        protected void CopyScriptInHeader()
        {
            short         cScript       = 0;
            StringBuilder pwszType      = null;
            StringBuilder pwszCommand   = null;
            long          cnsScriptTime = 0;

            m_pReaderHeaderInfo.GetScriptCount(out cScript);

            for (short i = 0; i < cScript; i++)
            {
                short cchTypeLen    = 0;
                short cchCommandLen = 0;

                //
                // Get the memory size for this script
                //
                m_pReaderHeaderInfo.GetScript(i,
                                              null,
                                              ref cchTypeLen,
                                              null,
                                              ref cchCommandLen,
                                              out cnsScriptTime);

                pwszType    = new StringBuilder(cchTypeLen);
                pwszCommand = new StringBuilder(cchCommandLen);

                //
                // Get the script
                //
                m_pReaderHeaderInfo.GetScript(i,
                                              pwszType,
                                              ref cchTypeLen,
                                              pwszCommand,
                                              ref cchCommandLen,
                                              out cnsScriptTime);

                //
                // Add the script to the writer
                //
                m_pWriterHeaderInfo.AddScript(pwszType.ToString(),
                                              pwszCommand.ToString(),
                                              cnsScriptTime);
            }
        }