コード例 #1
0
ファイル: EncoderUnit.cs プロジェクト: aredon/MPExtended
 public EncoderUnit(string transcoder, string arguments, TransportMethod inputMethod, TransportMethod outputMethod, LogStream logStream)
 {
     this.transcoderPath = transcoder;
     this.arguments = arguments;
     this.inputMethod = inputMethod;
     this.outputMethod = outputMethod;
     this.logStream = logStream;
 }
コード例 #2
0
 public static LogStream OpenStream( string filename = cclLogFileName )
 {
     var newStream = new LogStream();
     newStream.fileName = filename;
     newStream.indent = 0;
     newStream.stream = System.IO.File.Open( filename, System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.Read );
     if( filename == cclLogFileName )
     {
         cclStream = newStream;
     }
     return newStream;
 }
コード例 #3
0
 public static void CloseStream( LogStream stream = null )
 {
     if( stream == null )
     {
         stream = cclStream;
     }
     if( stream != null )
     {
         stream.stream.Close();
         stream.stream = null;
         stream = null;
     }
 }
コード例 #4
0
 public static void IndentStream( LogStream stream = null, int amount = 1 )
 {
     if( stream == null )
     {
         stream = cclStream;
     }
     if( stream != null )
     {
         stream.indent += amount;
         if( stream.indent < 0 )
         {
             stream.indent = 0;
         }
     }
 }
コード例 #5
0
        public static void Write( string s, LogStream stream = null )
        {
            if(
                ( s.NullOrEmpty() )||
                (
                    ( stream == null )&&
                    ( cclStream == null )
                )
            )
            {
                return;
            }

            if( stream == null )
            {
                stream = cclStream;
            }

            s += "\n";
            // Copy to a byte array with preceeding tabs for indentation
            byte[] b = new byte[ stream.indent + s.Length ];

            if( stream.indent > 0 )
            {
                for( int i = 0; i < stream.indent; ++i )
                {
                    b[ i ] = 9; // Tab
                }
            }

            for( int i = 0; i < s.Length; ++i )
            {
                b[ stream.indent + i ] = (byte) s[ i ];
            }

            stream.stream.Write( b, 0, stream.indent + s.Length );
            stream.stream.Flush();
        }
コード例 #6
0
        public void TestImportFromStream()
        {
            String path = Path.Combine(TestHelper.RootPath, "TestFiles\\duck.dae");

            FileStream fs = File.OpenRead(path);

            AssimpContext importer = new AssimpContext();
            LogStream.IsVerboseLoggingEnabled = true;

            LogStream logstream = new LogStream(delegate(String msg, String userData)
            {
                Console.WriteLine(msg);
            });

            logstream.Attach();

            Scene scene = importer.ImportFileFromStream(fs, ".dae");

            fs.Close();

            Assert.IsNotNull(scene);
            Assert.IsTrue((scene.SceneFlags & SceneFlags.Incomplete) != SceneFlags.Incomplete);
        }
コード例 #7
0
ファイル: LogConsole.cs プロジェクト: ddugovic/RASuite
		public static void HideConsole()
		{
			if (ConsoleVisible == false) return;
			Console.SetOut(TextWriter.Null);
			ConsoleVisible = false;
			if (NeedToRelease)
			{
				ReleaseConsole();
				NeedToRelease = false;
			}
			else
			{
				logStream.Close();
				logStream = null;
				Log.HACK_LOG_STREAM = null;
				window.Close();
				window = null;
			}
		}
コード例 #8
0
ファイル: LogConsole.cs プロジェクト: ddugovic/RASuite
		public static void ShowConsole()
		{
			if (ConsoleVisible) return;
			ConsoleVisible = true;

			if (Global.Config.WIN32_CONSOLE)
			{
				NeedToRelease = true;
				CreateConsole();
				//not sure whether we need to set a buffer size here
				//var sout = new StreamWriter(Console.OpenStandardOutput(),Encoding.ASCII,1) { AutoFlush = true };
				//var sout = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = true };
				//Console.SetOut(sout);
				//Console.Title = "BizHawk Message Log";
				//System.Runtime.InteropServices.SafeFi
				//new Microsoft.Win32.SafeHandles.SafeFileHandle(
			}
			else
			{
				logStream = new LogStream();
				Log.HACK_LOG_STREAM = logStream;
				var sout = new StreamWriter(logStream) { AutoFlush = true };
				new StringBuilder(); //not using this right now
				Console.SetOut(sout);
				window = new LogWindow();
				window.Show();
				logStream.Emit = (str) => { window.Append(str); };
			}
		}
コード例 #9
0
ファイル: EncoderUnit.cs プロジェクト: cpriebe/MPExtended
 public EncoderUnit(string transcoder, string arguments, TransportMethod inputMethod, TransportMethod outputMethod, LogStream logStream, StreamContext context)
     : this(transcoder, arguments, inputMethod, outputMethod, logStream)
 {
     this.context = context;
 }