public void sendmaterial(string text, string openid) { string[] str = openid.Split('|'); Business.material material = new Business.material(); Business.materialData[] materialdata = material.Select(text); string imgfile = "../uploads/" + materialdata[0].materialfile; switch (materialdata[0].materialtype) { case ("1"): var voice = MaterialLib.Add(HttpContext.Current.Server.MapPath(imgfile), AccessTokenBox.GetTokenValue(), MaterialType.voice); var voiceret = GroupSend.SendVoiceByOpenID(voice.media_id, AccessTokenBox.GetTokenValue(), str); break; case ("2"): var image = MaterialLib.Add(HttpContext.Current.Server.MapPath(imgfile), AccessTokenBox.GetTokenValue(), MaterialType.image); var imageret = GroupSend.SendImgByOpenID(image.media_id, AccessTokenBox.GetTokenValue(), str); break; case ("3"): var video = MaterialLib.Add(HttpContext.Current.Server.MapPath(imgfile), AccessTokenBox.GetTokenValue(), MaterialType.video); var videoret = GroupSend.SendVideoByOpenID(video.media_id, AccessTokenBox.GetTokenValue(), str); break; default: break; } }
/// <summary> /// RAM pointer setup /// </summary> public SimpleMesh(MaterialLib materials, Vertex *vertices, int *indices, int vertexCount, int indexCount) { Materials = materials; Vertices = vertices; Indices = indices; VertexCount = vertexCount; IndexCount = indexCount; }
private void Awake() { if (instance != null) { MaterialLib other = FindObjectOfType <MaterialLib>(); Destroy(other); } else { instance = this.gameObject; } }
public void ProcessRequest(HttpContext context) { var accessToken = AccessTokenBox.GetTokenValue("wxf50808b364418ffb", "bfaf8363dc64787091b3bbb7740dcf44"); var res = MaterialLib.Add("D:/MyRepository/WeChatDevelopment/Material/voice/test.mp3", accessToken, MaterialType.voice, false, "voiceTitleDemo", "videoIntroDemo"); if (res.ErrCode == 0) { context.Response.Write("语音消息发送成功!media_id为:" + res.media_id); } else { context.Response.Write("语音消息发送失败!错误消息是:" + res.ErrDescription); } }
public void sendarticle(string text, string openid) { string[] str = openid.Split('|'); Business.article article = new Business.article(); Business.articleData[] articledata = article.Select(text); string imgfile = "../uploads/" + articledata[0].thumb_media_id; var img = MaterialLib.Add(HttpContext.Current.Server.MapPath(imgfile), AccessTokenBox.GetTokenValue(), MaterialType.image); var ret = GroupSend.UpLoadNew(new List <Article> { new Article { title = articledata[0].title, author = articledata[0].author, content = articledata[0].content, content_source_url = "https://www.baidu.com/", digest = articledata[0].digest, show_cover_pic = 1, thumb_media_id = img.media_id } }, AccessTokenBox.GetTokenValue()); var ss = WxApi.GroupSend.SendArticleByOpenID(ret.media_id, AccessTokenBox.GetTokenValue(), str); }
public static List <MaterialLib> ExtractMaterialData(IfcMaterialLayerSetUsage matusage) { List <MaterialLib> mats = new List <MaterialLib>(); var layers = matusage.ForLayerSet.MaterialLayers; for (int i = 0; i < layers.Count; i++) { var layer = layers[i]; var fmat = new MaterialLib(); fmat.Name = layer.Material.Name; fmat.Additional_Info.Add(new Data() { Name = "Thickness", Value = layer.LayerThickness.ToString() }); List <Data> datas = new List <Data>(); layer.Material.HasProperties.ForEach(p => { var dic = IfcConvert.ToIfcPropertyDic(p.Properties); datas.AddRange(IfcData.ExtractProps(dic, fmat)); }); } return(mats); }
public static MaterialLib ParseFromObj(string objPath, string relativeFilePath) { MaterialLib result = new MaterialLib(); string libPath = System.IO.Path.Combine(new System.IO.FileInfo(objPath).Directory.FullName, relativeFilePath); Debug.Log($"Loading mtllib at {libPath}"); result.Materials = new List <Material>(); Material tempMaterial = default; using (var file = new System.IO.FileStream(libPath, System.IO.FileMode.Open, System.IO.FileAccess.Read)) { using (var text = new System.IO.StreamReader(file)) { while (true) { if (text.EndOfStream) { break; } string line = text.ReadLine(); if (line == null || line.Length == 0) { continue; } if (line.StartsWith("#")) { continue; } if (line.StartsWith("newmtl ")) { tempMaterial = new Material(); tempMaterial.MaterialIndex = result.Materials.Count; tempMaterial.Name = line.Substring("newmtl ".Length); result.Materials.Add(tempMaterial); } else if (line.StartsWith("Ns ")) { // specular exponent } else if (line.StartsWith("Ka ")) { //int index = 2; //tempMaterial.Ambient = new Color(ParseFloat(line, ref index), ParseFloat(line, ref index), ParseFloat(line, ref index), 1f); } else if (line.StartsWith("Kd ")) { //int index = 2; //tempMaterial.Diffuse = new Color(ParseFloat(line, ref index), ParseFloat(line, ref index), ParseFloat(line, ref index), 1f); } else if (line.StartsWith("Ks ")) { // specular color } else if (line.StartsWith("Ke ")) { // emissive color } else if (line.StartsWith("Ni ")) { // index of refraction } else if (line.StartsWith("d ")) { // transparency } else if (line.StartsWith("illum ")) { // illumination mode (only support ambient & color) } else if (line.StartsWith("map_Kd ")) { int idx = "map_Kd ".Length; if (line[idx] == '-') { if (line[idx + 1] == 'b' && line[idx + 2] == 'm') { idx += 4; while (line[idx] != ' ') { idx++; // skip the -bm {x} } idx++; // set it to first of path } } string relativeMapPath = line.Substring(idx); string imagePath = System.IO.Path.Combine(new System.IO.FileInfo(libPath).Directory.FullName, relativeMapPath); Texture2D tex = new Texture2D(1, 1); byte[] imageBytes = System.IO.File.ReadAllBytes(imagePath); tex.LoadImage(imageBytes, false); tempMaterial.SetDiffuse(tex); UnityEngine.Object.Destroy(tex); Debug.Log($"Loaded img file {relativeMapPath} for material {tempMaterial.Name}"); } } } } return(result); }
/// <summary> /// 这个函数的作用就是打开文件时,将数据库中的所有记录填写到窗体上 /// </summary> /// <param name="pro_Id"></param> public bool SearchDatabaseFillEntity(int pro_Id) { ProjinfoHandle projinfoHandle = new ProjinfoHandle(); ScaffordParaHandle scaf = new ScaffordParaHandle(); DataTable dt = projinfoHandle.SearchInfo(pro_Id); DataTable dtPara = scaf.SearchPara(pro_Id); //判断dt的合理性 if (dt.Rows.Count == 1 && dtPara.Rows.Count == 1)//正确的dt会只查询出一行 { try { //工程信息 ProjectInfo.Clear(); ProjectInfo.Pro_Id = pro_Id; ProjectInfo.Pro_Name = dt.Rows[0]["pro_name"].ToString(); ProjectInfo.Pro_Type = dt.Rows[0]["pro_type"].ToString(); ProjectInfo.Con_Province = dt.Rows[0]["con_province"].ToString(); ProjectInfo.Con_City = dt.Rows[0]["con_city"].ToString(); ProjectInfo.Unit = dt.Rows[0]["unit"].ToString(); ProjectInfo.Con_Unit = dt.Rows[0]["con_unit"].ToString(); ProjectInfo.Sup_Unit = dt.Rows[0]["sup_unit"].ToString(); ProjectInfo.Con_Area = double.Parse(dt.Rows[0]["con_area"].ToString()); ProjectInfo.Con_Height = double.Parse(dt.Rows[0]["con_height"].ToString()); ProjectInfo.Des_Unit = dt.Rows[0]["des_unit"].ToString(); //脚手架参数 ScaffoldPara.Clear(); ScaffoldPara.Sca_Type = dtPara.Rows[0]["sca_type"].ToString(); ScaffoldPara.Con_Layers = (int)dtPara.Rows[0]["con_layers"]; ScaffoldPara.Act_Layers = (int)dtPara.Rows[0]["act_layers"]; ScaffoldPara.Soil_Types = dtPara.Rows[0]["soil_types"].ToString(); ScaffoldPara.Rough_Level = dtPara.Rows[0]["rough_level"].ToString(); ScaffoldPara.Cha_Value = (double)dtPara.Rows[0]["cha_value"]; ScaffoldPara.Pad_Area = (double)dtPara.Rows[0]["pad_area"]; ScaffoldPara.Anchor_Style = dtPara.Rows[0]["anchor_style"].ToString(); ScaffoldPara.Anchor_Type = dtPara.Rows[0]["anchor_type"].ToString(); ScaffoldPara.Anchor_Model = dtPara.Rows[0]["anchor_model"].ToString(); ScaffoldPara.Anchor_Connect = dtPara.Rows[0]["anchor_connect"].ToString(); ScaffoldPara.Sca_Situation = dtPara.Rows[0]["sca_situation"].ToString(); ScaffoldPara.Bui_Status = dtPara.Rows[0]["bui_status"].ToString(); ScaffoldPara.Bui_Distance = (double)dtPara.Rows[0]["bui_distance"]; ScaffoldPara.Per_Brace = (int)dtPara.Rows[0]["per_brace"]; ScaffoldPara.Per_Level = (int)dtPara.Rows[0]["per_level"]; ScaffoldPara.Per_Set = (int)dtPara.Rows[0]["per_set"]; ScaffoldPara.La = (double)dtPara.Rows[0]["la"]; ScaffoldPara.Lb = (double)dtPara.Rows[0]["lb"]; ScaffoldPara.H = (double)dtPara.Rows[0]["h"]; ScaffoldPara.Fast_Num = (int)dtPara.Rows[0]["fast_num"]; ScaffoldPara.Fitting_Model = dtPara.Rows[0]["fitting_model"].ToString(); ScaffoldPara.Step_Num = (int)dtPara.Rows[0]["step_num"]; //材料库 MaterialLib.clearMaterialLib(); MaterialLib.dtMaterial = new SQLOperations().GetMateriallib(ProjectInfo.Pro_Id); //为复现dgv中的内容,于数据库查询dt new SQLOperations().FillValidArray(MaterialLib.dtMaterial); //为解决不打开材料库时数据消失的问题,复现validArray return(true); } catch { ErrorService.Show("写入了不合法字符"); return(false); } } else { ErrorService.Show("本机数据库与工程文件不匹配"); return(false); } }
private async void InitializeMaterialLib() { MaterialLibs = await MaterialLib.CreateMaterialsCollection("MaterialLibraries.xml"); }