Пример #1
0
        public static InternalOption CreateOption(string[] args, int revision)
        {
            var list = new List <string>(args);

            list.Add(revision.ToString());
            var new_args = list.ToArray();

            var option = new InternalOption();

            option.FileName = "log-r" + revision + ".txt";
            option.Args     = new_args;
            return(option);
        }
Пример #2
0
 internal TextureCube(int width, bool mipmap, PixelFormat format, PixelBufferOption option, InternalOption option2) : base(PixelBufferType.TextureCube, width, width, mipmap, format, option, option2)
 {
 }
Пример #3
0
        /// <summary>
        /// launch program and log to the output
        /// </summary>
        /// <param name="option"></param>
        /// <returns></returns>
        public static int Launch(InternalOption option)
        {
            string argument = string.Empty;

            if (option.Args.Length < 1)
            {
                return(1);
            }
            else if (option.Args.Length > 1)
            {
                // create new array excluding the first elelent.
                var new_length = option.Args.Length - 1;
                var arguments  = new string[new_length];
                Array.Copy(option.Args, 1, arguments, 0, new_length);

                // create string from the array
                argument = string.Join(" ", arguments);
            }

            try
            {
                using (var process = new Process())
                {
                    process.StartInfo.FileName               = option.Args[0];
                    process.StartInfo.UseShellExecute        = false;
                    process.StartInfo.RedirectStandardOutput = true;
                    process.StartInfo.RedirectStandardError  = true;
                    process.StartInfo.RedirectStandardInput  = false;
                    process.StartInfo.CreateNoWindow         = false;
                    process.StartInfo.Arguments              = argument;

                    var encoding = Console.OutputEncoding;
                    process.StartInfo.StandardOutputEncoding = encoding;
                    process.StartInfo.StandardErrorEncoding  = encoding;

                    var fileMode = FileMode.Create;

                    using (var fs = File.Open(option.FileName, fileMode, FileAccess.Write, FileShare.Read))
                    {
                        using (var streamWriter = new StreamWriter(fs))
                        {
                            process.OutputDataReceived += new DataReceivedEventHandler(delegate(object obj, DataReceivedEventArgs e)
                            {
                                if (e.Data == null)
                                {
                                    return;
                                }
                                streamWriter.WriteLine(e.Data);
                                Console.WriteLine(e.Data);
                            });
                            process.ErrorDataReceived += new DataReceivedEventHandler(delegate(object obj, DataReceivedEventArgs e)
                            {
                                if (e.Data == null)
                                {
                                    return;
                                }
                                streamWriter.WriteLine(e.Data);
                                Console.WriteLine(e.Data);
                            });
                            process.Start();
                            process.BeginOutputReadLine();
                            process.BeginErrorReadLine();
                            process.WaitForExit();
                        }
                    }
                    return(process.ExitCode);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(1);
            }
        }
Пример #4
0
 public static extern int Create(PixelBufferType type, int width, int height, bool mipmap, PixelFormat format, PixelBufferOption option, InternalOption option2, out int result);
Пример #5
0
 internal DepthBuffer(int width, int height, PixelFormat format, PixelBufferOption option, InternalOption option2) : base(PixelBufferType.DepthBuffer, width, height, false, format, option, option2)
 {
 }
Пример #6
0
 /// <summary>Creates a texture</summary>
 /// <param name="type">Texture type</param>
 /// <param name="width">Texture width</param>
 /// <param name="height">Texture height</param>
 /// <param name="mipmap">Existence/Lack of mipmap</param>
 /// <param name="format">Pixel format</param>
 /// <param name="option">Pixel buffer creation option</param>
 internal Texture(PixelBufferType type, int width, int height, bool mipmap, PixelFormat format, PixelBufferOption option, InternalOption option2) : base(type, width, height, mipmap, format, option, option2)
 {
     this.state = new TextureState();
 }
Пример #7
0
 internal Texture2D(int width, int height, bool mipmap, PixelFormat format, PixelBufferOption option, InternalOption option2) : base(PixelBufferType.Texture2D, width, height, mipmap, format, option, option2)
 {
 }
Пример #8
0
        internal PixelBuffer(PixelBufferType type, int width, int height, bool mipmap, PixelFormat format, PixelBufferOption option, InternalOption option2)
        {
            int errorCode = PsmPixelBuffer.Create(type, width, height, mipmap, format, option, option2, out this.handle);

            if (errorCode != 0)
            {
                Error.ThrowNativeException(errorCode);
            }
            PsmPixelBuffer.GetInfo(this.handle, out this.type, out this.width, out this.height, out this.level, out this.format, out this.option);
        }