Ejemplo n.º 1
0
        /// <summary>
        /// Create a new <see cref="Container"/> instance.
        /// </summary>
        /// <param name="ARef">The <see cref="Unsafe.AVFormatContext"/>.</param>
        /// <param name="AMode">The <see cref="StreamOpenMode"/>.</param>
        internal Container(Ref <Unsafe.AVFormatContext> ARef, StreamOpenMode AMode)
        {
            Debug.Assert(
                !ARef.IsNull,
                "Ref is null.",
                "This indicates a severe logic error in the code."
                );

            Ref  = ARef;
            Mode = AMode;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Simple version of the stream opening function
 /// </summary>
 /// <param name="ctx">Current runtime context.</param>
 /// <param name="path">URI or filename of the resource to be opened</param>
 /// <param name="mode">File access mode</param>
 /// <returns></returns>
 internal static PhpStream Open(Context ctx, string path, StreamOpenMode mode)
 {
     string modeStr = null;
     switch (mode)
     {
         case StreamOpenMode.ReadBinary: modeStr = "rb"; break;
         case StreamOpenMode.WriteBinary: modeStr = "wb"; break;
         case StreamOpenMode.ReadText: modeStr = "rt"; break;
         case StreamOpenMode.WriteText: modeStr = "wt"; break;
     }
     Debug.Assert(modeStr != null);
     return Open(ctx, path, modeStr, StreamOpenOptions.Empty, StreamContext.Default);
 }