Example #1
0
        private void SetupShaders()
        {
            VtxShaderHandle  = GL.CreateShader(ShaderType.VertexShader);
            FragShaderHandle = GL.CreateShader(ShaderType.FragmentShader);

            string VtxShaderSource  = EmbeddedResource.GetString("GlFbVtxShader");
            string FragShaderSource = EmbeddedResource.GetString("GlFbFragShader");

            GL.ShaderSource(VtxShaderHandle, VtxShaderSource);
            GL.ShaderSource(FragShaderHandle, FragShaderSource);
            GL.CompileShader(VtxShaderHandle);
            GL.CompileShader(FragShaderHandle);

            PrgShaderHandle = GL.CreateProgram();

            GL.AttachShader(PrgShaderHandle, VtxShaderHandle);
            GL.AttachShader(PrgShaderHandle, FragShaderHandle);
            GL.LinkProgram(PrgShaderHandle);
            GL.UseProgram(PrgShaderHandle);

            int TexUniformLocation = GL.GetUniformLocation(PrgShaderHandle, "tex");

            GL.Uniform1(TexUniformLocation, 0);

            int WindowSizeUniformLocation = GL.GetUniformLocation(PrgShaderHandle, "window_size");

            GL.Uniform2(WindowSizeUniformLocation, new Vector2(1280.0f, 720.0f));
        }
Example #2
0
        private void SetupShader()
        {
            Shader.VpHandle = GL.CreateShader(ShaderType.VertexShader);
            Shader.FpHandle = GL.CreateShader(ShaderType.FragmentShader);

            string VpSource = EmbeddedResource.GetString("GlFbVtxShader");
            string FpSource = EmbeddedResource.GetString("GlFbFragShader");

            GL.ShaderSource(Shader.VpHandle, VpSource);
            GL.ShaderSource(Shader.FpHandle, FpSource);
            GL.CompileShader(Shader.VpHandle);
            GL.CompileShader(Shader.FpHandle);

            Shader.Handle = GL.CreateProgram();

            GL.AttachShader(Shader.Handle, Shader.VpHandle);
            GL.AttachShader(Shader.Handle, Shader.FpHandle);
            GL.LinkProgram(Shader.Handle);
            GL.UseProgram(Shader.Handle);

            Matrix2 Transform = Matrix2.Identity;

            int TexUniformLocation = GL.GetUniformLocation(Shader.Handle, "tex");

            GL.Uniform1(TexUniformLocation, 0);

            int WindowSizeUniformLocation = GL.GetUniformLocation(Shader.Handle, "window_size");

            GL.Uniform2(WindowSizeUniformLocation, new Vector2(1280.0f, 720.0f));

            int TransformUniformLocation = GL.GetUniformLocation(Shader.Handle, "transform");

            GL.UniformMatrix2(TransformUniformLocation, false, ref Transform);
        }
Example #3
0
        public async Task <IEnumerable <MWLog> > SelectLogAsync(int seq)
        {
            List <MWLog> retList = new List <MWLog>();

            using (var conn = new MySqlConnection(connString))
            {
                await conn.OpenAsync();

                using (var cmd = new MySqlCommand())
                {
                    cmd.Connection  = conn;
                    cmd.CommandText = EmbeddedResource.GetString("SelectLogInfoWithLogPropertyBySeq.sql");
                    cmd.Parameters.AddWithValue("seq", seq);
                    cmd.Prepare();
                    using (var reader = await cmd.ExecuteReaderAsync())
                    {
                        while (await reader.ReadAsync())
                        {
                            retList.Add(ModelConverter.ToMWLog(reader));
                        }
                    }
                }
            }
            return(retList);
        }
Example #4
0
        public async Task <IEnumerable <MWLog> > SelectLogAsync(LookupCondition lookupCondition)
        {
            List <MWLog> retList = new List <MWLog>();

            using (var conn = new MySqlConnection(connString))
            {
                await conn.OpenAsync();

                using (var cmd = new MySqlCommand())
                {
                    cmd.Connection = conn;
                    //string sql = "select info.*, prop.* from log_info info join log_property prop on info.property_seq = prop.seq order by info.seq desc limit 10;";
                    //cmd.CommandText = sql;
                    cmd.CommandText = EmbeddedResource.GetString("SelectLogInfoWithLogProperty.sql");
                    cmd.Parameters.AddWithValue("begin_date", lookupCondition.BeginDate.ToString("yyyy-MM-dd"));
                    cmd.Parameters.AddWithValue("end_date", lookupCondition.EndDate.ToString("yyyy-MM-dd"));
                    cmd.Parameters.AddWithValue("routing_key", "%" + lookupCondition.RoutingKey + "%");
                    cmd.Parameters.AddWithValue("limit", lookupCondition.Limit);
                    cmd.Prepare();
                    using (var reader = await cmd.ExecuteReaderAsync())
                    {
                        while (await reader.ReadAsync())
                        {
                            retList.Add(ModelConverter.ToMWLog(reader));
                        }
                    }
                }
            }
            return(retList);
        }
Example #5
0
 public static void ExecuteQueryFromFile(string file)
 {
     try
     {
         string sql = EmbeddedResource.GetString(file);
         Console.WriteLine(sql);
         ExecuteQuery.ExecuteQueryNoReturnValue(sql);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #6
0
        public void InsertLog(MessageReceivedInfo info, MessageProperties prop, string body)
        {
            DateTime sysNow = DateTime.Now;

            using (var conn = new MySqlConnection(connString))
            {
                conn.Open();

                using (var cmd = new MySqlCommand())
                {
                    cmd.Connection  = conn;
                    cmd.CommandText = EmbeddedResource.GetString("InsertLog.sql");
                    // MessageReceivedInfo
                    cmd.Parameters.AddWithValue("exchange", info.Exchange);
                    cmd.Parameters.AddWithValue("routing_key", info.RoutingKey);
                    cmd.Parameters.AddWithValue("queue", info.Queue);
                    cmd.Parameters.AddWithValue("deliver_tag", info.DeliverTag);
                    cmd.Parameters.AddWithValue("consumer_tag", info.ConsumerTag);
                    cmd.Parameters.AddWithValue("redelivered", info.Redelivered);
                    cmd.Parameters.AddWithValue("payload", body);
                    cmd.Parameters.AddWithValue("ins_date", DateTime.Now);
                    //MessageProperties
                    cmd.Parameters.AddWithValue("content_type", prop.ContentType);
                    cmd.Parameters.AddWithValue("content_encoding", prop.ContentEncoding);
                    cmd.Parameters.AddWithValue("delivery_mode", prop.DeliveryMode);
                    cmd.Parameters.AddWithValue("priority", prop.Priority);
                    cmd.Parameters.AddWithValue("correlation_id", prop.CorrelationId);
                    cmd.Parameters.AddWithValue("reply_to", prop.ReplyTo);
                    cmd.Parameters.AddWithValue("expiration", prop.Expiration);
                    cmd.Parameters.AddWithValue("app_id", prop.AppId);
                    cmd.Parameters.AddWithValue("message_id", prop.MessageId);
                    cmd.Parameters.AddWithValue("timestamp", prop.Timestamp);
                    cmd.Parameters.AddWithValue("type", prop.Type);
                    cmd.Parameters.AddWithValue("user_id", prop.UserId);
                    cmd.Parameters.AddWithValue("cluster_id", prop.ClusterId);
                    cmd.Parameters.AddWithValue("headers", JsonConvert.SerializeObject(prop.Headers));
                    cmd.Parameters.AddWithValue("ins_date", sysNow);
                    cmd.Parameters.AddWithValue("upd_date", sysNow);
                    cmd.Prepare();
                    cmd.ExecuteNonQuery();
                }
            }
        }
Example #7
0
 private static string _LoadSQLStmt(string filename)
 {
     return(EmbeddedResource.GetString(filename));
 }