Beispiel #1
0
 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;
 }
Beispiel #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;
 }
Beispiel #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;
     }
 }
Beispiel #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;
         }
     }
 }
Beispiel #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();
        }
        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);
        }
Beispiel #7
0
		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;
			}
		}
Beispiel #8
0
		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); };
			}
		}
Beispiel #9
0
 public EncoderUnit(string transcoder, string arguments, TransportMethod inputMethod, TransportMethod outputMethod, LogStream logStream, StreamContext context)
     : this(transcoder, arguments, inputMethod, outputMethod, logStream)
 {
     this.context = context;
 }