protected void Start() { this.function = this.GetComponentInChildren <IFunctionProvider>()?.Function; LogTool.LogAssertIsTrue(this.function != null, "Cannot find function"); this.matrial = new DisposableMaterial(new Material(Shader.Find("Diffuse"))); this.matrial.Data.SetInt("_Cull", (int)UnityEngine.Rendering.CullMode.Off); var meshFiter = this.gameObject.FindOrAddTypeInComponentsAndChildren <MeshFilter>(); var meshRender = this.gameObject.FindOrAddTypeInComponentsAndChildren <MeshRenderer>(); meshRender.material = this.matrial; var mesh = FunctionTool.GenerateFunctionMesh(this.function); meshFiter.mesh = mesh; }
private void MeetingRoom_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { string SQL = @"Update NowLogin set MeetingID=@1,AllowIpRange='' "; int success = MSCE.ExecuteNonQuery(SQL, userMeeting.ID); if (success < 1) { LogTool.Debug(new Exception(@"DB失敗: " + SQL)); return; } //20141203 //Home_Change2MeetingDataCT_Event(userMeeting.ID); //20150422 Home_Change2MeetingDataCT_Event(userMeeting.ID, PreLoadMeetingData); }
void Awake() { //Don't destroy this important gameobject DontDestroyOnLoad(this.gameObject); _connectionString = "Server=" + host + ";Database=" + database + ";User="******";Password="******"MySql State: " + _msCon.State); } catch (Exception e) { Debug.Log(e); } LogTool.Print(RunQuery("SELECT * FROM test.user;")); }
public void SendMessage(IMessage protocol) { if (!this.IsActive()) { ServerSocket.Getinstance().DispatchProtocol(protocol, Const.LOCAL_CONNECT_ID); } else { byte[] msg_bytes = Protocol.Encode(protocol); ByteBuffer buffer = new ByteBuffer(); buffer.WriteInt(msg_bytes.Length); buffer.WriteBytes(msg_bytes); byte[] data = buffer.ToBytes(); LogTool.Tip("客户端发送消息类型:" + protocol.GetType() + " 长度为:" + data.Length); this.socket.Send(data); } }
/// <summary>取得系統設定參數</summary> /// <param name="pModel">參數類別</param> /// <param name="pGroup">參數群組</param> /// <param name="pLang">語系(預設:zh-tw)</param> /// <param name="pStatus">資料狀態:1=正常,9=刪除/停用</param> /// <param name="pManage">資料狀態:1=管理者才顯示,0=非管理者顯示</param> /// <returns></returns> public List <SysParams> getRCS_SYS_PARAMS(List <string> pModelList, string pGroup = "", string pLang = "zh-tw", string pStatus = "", string pManage = "") { List <SysParams> SelectListItem = new List <SysParams>(); try { DataTable dt = this.getRCS_SYS_PARAMS_DT("", "", pGroup, pLang, "", pStatus, pManage, pModelList); if (dt != null && dt.Rows.Count > 0) { SelectListItem = dt.ToList <SysParams>(); } } catch (Exception ex) { LogTool.SaveLogMessage(ex, "getRCS_SYS_PARAMS1", GetLogToolCS.BaseModel); } return(SelectListItem); }
public void Init() { string TextJsonStr = ResourcesManager.Instance.GetTableStr("Text", ResDefine.UnloadImmediatelyScenary); _tableTexts = Newtonsoft.Json.JsonConvert.DeserializeObject <Table_Text[]>(TextJsonStr); ResourcesManager.Instance.UnloadScenary(ResDefine.UnloadImmediatelyScenary); for (int i = 0; i < _tableTexts.Length; i++) { if (!Table_TextDic.ContainsKey(_tableTexts[i].Id)) { Table_TextDic.Add(_tableTexts[i].Id, _tableTexts[i]); } else { LogTool.Warning("_tableTexts table.Id {0} is duplicated!", _tableTexts[i].Id); } } }
private static void _003CCopyLog_003Eb__0() { try { string baseDirectory = AppDomain.CurrentDomain.BaseDirectory; string[] directories = Directory.GetDirectories(Path.Combine(baseDirectory, "Logs")); if (CS_0024_003C_003E9__CachedAnonymousMethodDelegate3 == null) { CS_0024_003C_003E9__CachedAnonymousMethodDelegate3 = new Func <string, string>(_003CCopyLog_003Eb__1); } string sourcePath = Enumerable.First(Enumerable.OrderByDescending(directories, CS_0024_003C_003E9__CachedAnonymousMethodDelegate3)); DirectoryTool.FullCopyDirectories(sourcePath, ClickOnceTool.GetFilePath()); } catch (Exception ex) { LogTool.Debug(ex); } }
public override void SetToGPU(string kernal = null) { if (this.IsShaderValid(kernal) && this.data != null) { this.Set(kernal); } else { if (this.data == null) { LogTool.Log(this.VariableName + " Data is null", LogLevel.Warning); } else { LogTool.LogFormat("Please bind {0} with compute shader first/or supply kernal name", LogLevel.Warning, LogChannel.Debug, this.VariableName); } } }
public string GetPurchasingOrderDetail() { try { var strSql = string.Format( "select spmc,sl,ddzt,to_char(cjsj, 'yyyy/mm/dd hh24:mi:ss') as cjsj from BO_WZCGMX_DDMX order by cjsj desc"); var dt = new Leo.Oracle.DataAccess(RegistryKey.KeyPathAwstest).ExecuteTable(strSql); var xml = new Leo.Xml.ToXml("").GetData(dt); return(new Leo.Xml.Message("获取成功!").TrueXml(xml)); } catch (Exception ex) { LogTool.WriteLog(typeof(ServiceECommerce), ex); return(new Leo.Xml.Message(string.Format("获取数据异常。{0}", ex.Message)).FalseXml()); } }
/// <summary> /// 第一次打开时,将文件拷贝至本机目录下 /// 之后读取本机目录即可 /// </summary> /// <param name="path"></param> /// <param name="fileName"></param> public static void Init(string path, string fileName) { savePath = path + "/" + fileName; flatBufferBuilder = new FlatBufferBuilder(1024); LogTool.Log(savePath); if (File.Exists(savePath)) { Load(); if (dataBase.ByteBuffer == null) { isFirstTime = true; } else { isFirstTime = false; } } }
public void _003CDoWithResponse_003Eb__2(IAsyncResult iar) { Action action = (Action)iar.AsyncState; try { action.EndInvoke(iar); } catch (Exception ex) { if (ErrorAction != null) { ErrorAction(); } LogTool.Debug(ex); AutoClosingMessageBox.Show(ex.Message); } }
public static void FullDeleteDirectories(DirectoryInfo baseDir) { try { if (baseDir.Exists) { foreach (DirectoryInfo item in baseDir.EnumerateDirectories()) { FullDeleteDirectories(item); } baseDir.Delete(true); } } catch (Exception ex) { LogTool.Debug(ex); } }
protected void Start() { this.source.InitBuffer(1024 * 512, true); foreach (var i in Enumerable.Range(0, this.source.Size)) { this.source.CPUData[i] = Random.Range(-this.source.Size, this.source.Size); // this.source.CPUData[i] = (uint)(this.source.Size - i); } this.source.SetToGPUBuffer(); this.Sort(ref this.source); this.source.GetToCPUData(); foreach (var i in Enumerable.Range(0, this.source.Size - 1)) { LogTool.AssertIsTrue(this.source.CPUData[i] <= this.source.CPUData[i + 1]); } }
/// <summary> /// 取得資訊 /// </summary> /// <param name="pSetIpdNo"></param> /// <param name="getLocation">0:批價序號,1:起始日期,2:結束日期,3:來源</param> /// <returns></returns> public string getHistoryList(string pSetIpdNo, int getLocation) { string tempVal = ""; try { if (!string.IsNullOrWhiteSpace(pSetIpdNo)) { if (getLocation == 1) { string data1 = pSetIpdNo.Split('|').ToArray <string>()[1]; string data2 = pSetIpdNo.Split('|').ToArray <string>()[2]; if (DateHelper.isDate(data1) && DateHelper.isDate(data2)) { if (DateHelper.Parse(data1) < DateHelper.Parse(data2)) { tempVal = DateHelper.Parse(data2).AddDays(-7).ToString("yyyy-MM-dd 00:00"); } else { tempVal = data1; } } else { tempVal = data1; } } else { tempVal = pSetIpdNo.Split('|').ToArray <string>()[getLocation]; } } } catch (Exception ex) { if (getLocation > 0) { tempVal = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } LogTool.SaveLogMessage(pSetIpdNo + "(" + getLocation + ")" + "轉換住院序號失敗,錯誤訊息如下所示:" + ex, "getSetIpdNo", GetLogToolCS.BaseModel); } return(tempVal); }
/// <summary> /// read model list /// </summary> /// <typeparam name="T">model type</typeparam> /// <param name="pms">query parameter</param> /// <returns>model list</returns> public List <T> GetAny <T>(Dictionary <string, object> pms = null) where T : class { try { using (HttpClient client = new HttpClient()) { //clear http request header client.DefaultRequestHeaders.Clear(); //add http request header media type client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); //add http request text type client.DefaultRequestHeaders.AcceptCharset.Add(new StringWithQualityHeaderValue("utf-8")); //create http request url string url = string.Empty; if (pms == null || pms.Count <= 0) { url = string.Format("http://{0}:{1}/api/{2}", WebApiHost, WebApiPort, typeof(T).Name.ToLower());//api/{controller} } else { string tmp = JsonConvert.SerializeObject(pms); url = string.Format("http://{0}:{1}/api/{2}/getlist?pmsStr={3}", WebApiHost, WebApiPort, typeof(T).Name.ToLower(), tmp);//api/{controller}/getlist/{pmsStr} } //send request HttpResponseMessage response = client.GetAsync(url).Result; //get response int statusCode = (int)response.StatusCode; //result analysis if (response.IsSuccessStatusCode) { return(response.Content.ReadAsAsync <List <T> >().Result); } else { return(null); } } } catch (Exception ex) { LogTool.Error(ex); return(null); } }
void init() { textBox2.Text = Program.config.DownloadPath; string DriveName = textBox2.Text.Substring(0, 1); DiskInfo_Lab.Text = DriveName + "盘剩余空间: " + (getSizeGB(GetFreeSpace(DriveName)) < 1 ? getSizeMB(GetFreeSpace(DriveName)) + "MB" : getSizeGB(GetFreeSpace(DriveName)) + "GB"); //从网盘下载 if (Info != null) { long Size = 0; foreach (var SubFile in Info.getFileList()) { textBox1.Text += $"https://pcs.baidu.com/rest/2.0/pcs/file?method=download&access_token={Program.config.Access_Token}&path=" + Uri.EscapeDataString(SubFile.path) + "\r\n"; Size += SubFile.size; } Name_Lab.Text = "文件名: " + Info.getName(); Size_Lab.Text = "文件大小: " + (getSizeGB(Size) < 1?getSizeMB(Size) + "MB":getSizeGB(Size) + "GB"); button2.Enabled = true; return; } textBox1.Text += Url + "\r\n这是由网页提取的链接,可能无法正常下载"; Name_Lab.Text = "文件名: " + FileName; try { HttpWebRequest Request = WebRequest.Create(Url) as HttpWebRequest; Request.Referer = "http://pan.baidu.com/disk/home"; Cookie ck = new Cookie("BDUSS", Cookies.BDUSS); ck.Domain = ".baidu.com"; Request.CookieContainer = new CookieContainer(); Request.CookieContainer.Add(ck); ck = new Cookie("pcsett", Cookies.PCSETT); ck.Domain = ".baidu.com"; Request.CookieContainer.Add(ck); using (HttpWebResponse Response = Request.GetResponse() as HttpWebResponse){ Size_Lab.Text = "文件大小: " + (getSizeGB(Response.ContentLength) < 1 ? getSizeMB(Response.ContentLength) + "MB" : getSizeGB(Response.ContentLength) + "GB"); } button2.Enabled = true; } catch (Exception ex) { LogTool.WriteLogError(typeof(Download), "获取文件信息时出现错误", ex); MessageBox.Show("获取文件信息时出现错误!", "错误"); } }
/// <summary> /// 產生Excel byte[] /// </summary> /// <typeparam name="T"></typeparam> /// <param name="pList"></param> /// <param name="em"></param> /// <returns></returns> public FileContentResult exportExcel <T>(List <T> pList, ExcelSetting em, bool exportFile = false) { byte[] buf = null; string actionName = "exportExcel"; setFileContentType(fileType.xls); try { DataTable dt = pList.ToDataTable(); buf = exportExcel(dt, em); } catch (Exception ex) { RESPONSE_MSG.message = "產生Excel發生錯誤,請洽資訊人員,錯誤訊息如下所示:" + ex.Message; RESPONSE_MSG.status = RESPONSE_STATUS.EXCEPTION; LogTool.SaveLogMessage(ex, actionName, csName); } return(retunFile(buf)); }
private void CopyLog() { if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed) { Task.Factory.StartNew(() => { try { string AppDir = AppDomain.CurrentDomain.BaseDirectory; string dir = Directory.GetDirectories(System.IO.Path.Combine(AppDir, "Logs")).OrderByDescending(f => f).First(); DirectoryTool.FullCopyDirectories(dir, ClickOnceTool.GetFilePath()); } catch (Exception ex) { LogTool.Debug(ex); } }); } }
public override void Execute() { LogTool.Log(CommenValue.AssetPath + downloadTex.name); if (!Directory.Exists(CommenValue.AssetPath + CommenValue.ThumbPath)) { Directory.CreateDirectory(CommenValue.AssetPath + CommenValue.ThumbPath); } if (!Directory.Exists(CommenValue.AssetPath + CommenValue.ImagePath)) { Directory.CreateDirectory(CommenValue.AssetPath + CommenValue.ImagePath); } if (!File.Exists(CommenValue.AssetPath + downloadTex.name)) { Texture2D texture2D = (Texture2D)downloadTex; File.WriteAllBytes(CommenValue.AssetPath + downloadTex.name, texture2D.EncodeToJPG()); } textureList.Add(downloadTex); panoramaSignal.Dispatch(); }
public override void SetToGPU(object container, ComputeShader cs, string kernel = null) { LogTool.AssertNotNull(cs); LogTool.AssertNotNull(kernel); // LogTool.AssertIsTrue(this.Size > 0); // if (cs == null || this.Size == 0) { LogTool.Log(this.displayName + " is not set to GPU", LogLevel.Warning); return; } if (cs == null || !this.Inited) { return; } LogTool.AssertNotNull(this.shaderName); this.SetToGPUBuffer(); var id = cs.FindKernel(kernel); cs.SetInt(this.shaderName + "Count", this.Size); cs.SetBuffer(id, this.shaderName, this.Data); }
// Start is called before the first frame update void Start() { graph = new HGraph(); var v1 = graph.Factory.CreateVertex(); var v2 = graph.Factory.CreateVertex(); var v3 = graph.Factory.CreateVertex(); v1 = graph.AddVertex(v1); v2 = graph.AddVertex(v2); v3 = graph.AddVertex(v3); var e1 = graph.AddEdge(v1, v2); var e2 = graph.AddEdge(v2, v3); var e3 = graph.AddEdge(v3, v1); var f = graph.GetFace(e1); LogTool.AssertIsTrue(f != NoneHalfEdgeObject.None); }
public void ChangeState(StateBase <ObjectStateMachine> newState) { lock (this) { if (this.currentState == newState) { LogTool.Log("Current state is same with new state, Restart", LogLevel.Warning); } if (this.currentState != null) { this.currentState.Leave(this); } this.currentState = newState; this.currentState.Enter(this); } }
public void Setup(SocketRole role, SocketData data = null) { if (this.roleState[role]) { return; } try { switch (role) { case SocketRole.Sender: { //connect is optional //socket.Connect(IPAddress.Parse(address), port); } break; case SocketRole.Receiver: { this.socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.ReuseAddress, true); //this.socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.PacketInformation, true); Assert.IsNotNull(data); this.socket.Bind(data.endPoint); if (DebugLog) { LogTool.Log("Start Receiver on " + data.endPoint); } } break; case SocketRole.Broadcast: { this.socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, true); this.socket.EnableBroadcast = true; //this.socket.Bind(this.socketConfigure.endPoint); } break; } } catch (SocketException e) { LogTool.Log(data.endPoint.ToString() + " " + e.ToString()); } this.roleState[role] = true; }
private void ResetFileItemDB(File_DownloadItemViewModel fileItem) { if (fileItem != null) { fileItem.DownloadBytes = 0L; fileItem.TotalBytes = 0L; fileItem.LastPercentage = 0.0; if (File.Exists(fileItem.StorageFilePath)) { File.Delete(fileItem.StorageFilePath); } string text = "update FileRow set Url=@1,StorageFileName=@2\r\n , DownloadBytes=@3,TotalBytes=@4 where ID=@6 and UserID=@7 and MeetingID=@8"; int num = MSCE.ExecuteNonQuery(text, fileItem.Url, fileItem.StorageFileName, fileItem.DownloadBytes.ToString(), fileItem.TotalBytes.ToString(), fileItem.ID, fileItem.UserID, fileItem.MeetingID); if (num < 1) { LogTool.Debug(new Exception("DB失敗:" + text)); } } }
/// <summary> /// IIS 停止時會記錄停止原因 /// </summary> protected void Application_End() { try { HttpRuntime runtime = (HttpRuntime)typeof(System.Web.HttpRuntime).InvokeMember("_theRuntime", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.GetField, null, null, null); if (runtime == null) { return; } string shutDownMessage = (string)runtime.GetType().InvokeMember("_shutDownMessage", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField, null, runtime, null); // 寫入log LogTool.SaveLogMessage(shutDownMessage, "Application_End"); } catch (Exception ex) { LogTool.SaveLogMessage(ex, "Application_End"); } }
private void LawListCT_Loaded(object sender, RoutedEventArgs e) { InitSelectDB(); // 只要是 CT 主要畫面,優先權設定為Send,因為設定Normal,按鈕的出現會感覺卡卡的。 //this.Dispatcher.BeginInvoke(DispatcherPriority.Send,new Action(() => this.Dispatcher.BeginInvoke(new Action(() => { try { InitUI(); InitEvent(); } catch (Exception ex) { LogTool.Debug(ex); } MouseTool.ShowArrow(); })); }
public static void FullDeleteDirectories(string dirPath) { try { DirectoryInfo directoryInfo = new DirectoryInfo(dirPath); if (directoryInfo.Exists) { foreach (DirectoryInfo item in directoryInfo.EnumerateDirectories()) { FullDeleteDirectories(item); } directoryInfo.Delete(true); } } catch (Exception ex) { LogTool.Debug(ex); } }
public override SortedList <ActionTag, ActionConfigUnit> Init() { var actionSort = new SortedList <ActionTag, ActionConfigUnit>(); allAction.ForEach((action) => { if (action.File != null) { action.File.Init(); actionSort.Add(action.commonTag, action.File.GetConfigUnit); } else { LogTool.Log($"File文件缺失"); } }); LogTool.Log($" --- {this.name} , Action数据已经加载完成 --->>> 共计${allAction.Count}个", LogEnum.AssetLog); return(actionSort); }
/// <summary> /// sync data /// </summary> /// <returns>sync result</returns> public bool SyncData() { try { List <Mes_ua_submit> listFromScada = GetSubmitSourceDataFromScada(); List <Mes_ua_submit> listFromMes = GetSubmitSourceDataFromMes(); List <Mes_ua_submit> listSame = ModelTool.GetJoin(listFromScada, listFromMes); List <Mes_ua_submit> listAdd = ModelTool.GetMinus(listFromScada, listSame); List <Mes_ua_submit> listDelete = ModelTool.GetMinus(listFromMes, listSame); AddDataIntoMes(listAdd); RemoveDataFromMes(listDelete); return(true); } catch (Exception ex) { LogTool.Error(ex); return(false); } }
/// <summary> /// 產生交班表Excel byte[] /// </summary> /// <param name="sch_data"></param> /// <returns></returns> public FileContentResult ExportShiftExcel(scheduling sch_data) { byte[] buf = null; string actionName = "ExportShiftExcel"; setFileContentType(fileType.xls); try { NPOITool NPOITool = new Models.NPOITool(); buf = NPOITool.ExportShiftExcel(sch_data); } catch (Exception ex) { RESPONSE_MSG.message = "產生Excel發生錯誤,請洽資訊人員,錯誤訊息如下所示:" + ex.Message; RESPONSE_MSG.status = RESPONSE_STATUS.EXCEPTION; LogTool.SaveLogMessage(ex, actionName, csName); } return(retunFile(buf)); }