public static bool DownLoadFileAsync(UpdateObjectVector _owner, string _appname, string _sourceurl, string _destination, bool _IsClear, Action <string, string> _finished, Action <long, long, float> _progress) { if (sDownLoadMap.ContainsKey(_sourceurl)) { DLog.LogError("有相同URL文件正在下载当中.URL = " + _sourceurl); return(false); } DownLoadTask ttaskdown = new DownLoadTask(_owner, _appname, _sourceurl, _destination, _IsClear, _finished, _progress); bool isstart = ttaskdown.StartDownloadAsync(); if (!isstart) { ttaskdown.Dispose(); } return(isstart); }
public static void DebugLightsModule(this ParticleSystem.LightsModule lightsModule) { DLog.Log("\n[LightsModule]"); DLog.Log($"alphaAffectsIntensity: {lightsModule.alphaAffectsIntensity}"); DLog.Log($"enabled: {lightsModule.enabled}"); lightsModule.intensity.DebugMinMaxCurve("intensity"); DLog.Log($"intensityMultiplier: {lightsModule.intensityMultiplier}"); lightsModule.light.DebugLight("light"); DLog.Log($"maxLights: {lightsModule.maxLights}"); lightsModule.range.DebugMinMaxCurve("range"); DLog.Log($"rangeMultiplier: {lightsModule.rangeMultiplier}"); DLog.Log($"ratio: {lightsModule.ratio}"); DLog.Log($"sizeAffectsRange: {lightsModule.sizeAffectsRange}"); DLog.Log($"useParticleColor: {lightsModule.useParticleColor}"); DLog.Log($"useRandomDistribution: {lightsModule.useRandomDistribution}"); }
override public void ConnectToServer() { if (IsCOrD()) { DLog.LogError(mNetTag + string.Format("[{0}]Closing或Connecting状态下不可执行.", mNetTag)); return; } if (isConnected) { AddMainThreadMsgReCall(GetMsgReCallData(MSG_RECALL.ConectError, mNetTag + "重复建立连接")); return; } mState = TcpState.Connecting; System.Threading.Tasks.Task.Run(ThreatConnect); }
public void BeginSend(byte[] buffer, int offset, int size) { try { SocketError errorCode = SocketError.Success; var ar = socket.BeginSend(buffer, offset, size, SocketFlags.None, out errorCode, sendCallback, buffer); if (errorCode != SocketError.Success) { DLog.LogErrorFormat("TCP Send Error.{0}", errorCode); } } catch (System.Exception erro) { DLog.LogFormat("TCP Send Error.{0}", erro); } }
public void ObtainAndReturn() { SimplePool sp = new SimplePool(); string path = "path"; GameObject prefab = new GameObject("Prefab"); sp.AddDefinition(new SimplePool.Definition(path, prefab)); SimplePoolItem item = sp.Obtain(path); sp.Return(item); if (item.gameObject.activeInHierarchy == false) { DLog.Log("ObtainAndReturn passed"); } }
/// <summary> /// The given breakpoint has been bound to the VM. /// </summary> internal void OnBound(IDebugBreakpoint breakpoint) { DLog.Debug(DContext.VSDebuggerComCall, "DebugBoundBreakpoint.OnBound"); // Check parameters if (this.breakpoint != breakpoint) { throw new ArgumentException("Unknown breakpoint"); } // Record in pending breakpoint pendingBreakpoint.AddBoundBreakpoint(this); // Notify VS breakpointManager.OnBound(pendingBreakpoint); }
public void Obtain2TimesShouldReturnDifferentItems() { SimplePool sp = new SimplePool(); string path = "path"; GameObject prefab = new GameObject("Prefab"); sp.AddDefinition(new SimplePool.Definition(path, prefab)); SimplePoolItem item1 = sp.Obtain(path); SimplePoolItem item2 = sp.Obtain(path); if (item1 != item2 && item1.gameObject != item2.gameObject) { DLog.Log("Obtain2TimesShouldReturnDifferentItems passed"); } }
private void RunUpdate(UpdateBase _runobj) { #if LITDEBUG try { #endif _runobj.RunDelgete(); #if LITDEBUG } catch (System.Exception _erro) { DLog.LogError(string.Format("[{0}] [{1}]{2}", mUpdateType.ToString(), _runobj.Key, _erro.ToString())); _runobj.UnRegToOwner(); } #endif }
public static Task doTask(int threadID, Action action, bool debugTask) { Task task = new Task(action, currentTaskID, threadID); task.debugTask = debugTask; activeThreads [threadID].tasks.Enqueue(task); if (debugTask) { DLog.Log("NEW TASK " + currentTaskID + " FOR:" + threadID, UnityEngine.Color.yellow); } currentTaskID += 1; return(task); }
override public IType GetObjectType(object _obj) { if (_obj == null) { throw new NullReferenceException("LS GetObjectType _obj = null"); } if (_obj is ILTypeInstance) { return(((ILTypeInstance)_obj).Type); } else { DLog.LogError("GetObjectType 只可用于ILTypeInstance"); } return(null); }
public void Call(object pObject) { #if LITDEBUG try { #endif EventDelgate(pObject); #if LITDEBUG } catch (System.Exception _e) { DLog.LogError(_e.ToString()); } #endif }
public static void AppChangeAsync(string _nowapp, string _nextapp, string _startscene) { if (IsChanging) { DLog.LogError("App is Changing."); return; } IsChanging = true; if (!string.IsNullOrEmpty(_nowapp)) { DestroyGameCore(_nowapp); } GameCore ret = CreatGameCore(_nextapp); ret.LManager.LoadAssetAsync(_startscene, _startscene, LoadedStartScene); }
public static void DebugRect(this Rect rect, string prefixString) { DLog.Log($"{prefixString}.center: {rect.center}"); DLog.Log($"{prefixString}.height: {rect.height}"); DLog.Log($"{prefixString}.max: {rect.max}"); DLog.Log($"{prefixString}.min: {rect.min}"); DLog.Log($"{prefixString}.position: {rect.position}"); DLog.Log($"{prefixString}.size: {rect.size}"); DLog.Log($"{prefixString}.width: {rect.width}"); DLog.Log($"{prefixString}.x: {rect.x}"); DLog.Log($"{prefixString}.xMax: {rect.xMax}"); DLog.Log($"{prefixString}.xMin: {rect.xMin}"); DLog.Log($"{prefixString}.y: {rect.y}"); DLog.Log($"{prefixString}.yMax: {rect.yMax}"); DLog.Log($"{prefixString}.yMin: {rect.yMin}"); }
public T TryGetAttribute <T>(string keyParameter, object _defaultValue = null) { try { object obj = Attribut[keyParameter]; checked { return(obj != null ? (T)obj : _defaultValue == null ? default(T) : (T)_defaultValue); } } catch (System.Exception erro) { DLog.LogError(erro.ToString()); } return(_defaultValue == null ? default(T) : (T)_defaultValue); }
public bool StartDownloadAsync() { if (mUpdateObject == null) { DLog.LogError("UpdateObject == null"); return(false); } if (mIsStart) { return(true); } mIsStart = true; mObject.StartDownLoadAsync(); mUpdateObject.RegToOwner(); return(true); }
public Vector3d GetProperPosi(Vector3d v1, Vector3d v2, out bool hitx, out bool hity) { var offset = v2 - v1; long x = v1.x, y = v1.y; hitx = hity = false; if (offset.x > 0) { var testPosi = v1 + new Vector3d(offset.x + FixedMath.Half, 0, 0); if (IsInObstacle(testPosi)) { hitx = true; x = FixedMath.Floor(testPosi.x) - FixedMath.One / 2 - 1; DLog.Log(x.ToFloat() + " " + v1.ToString() + " " + v2); } } else if (offset.x < 0) { var testPosi = v1 + new Vector3d(offset.x - FixedMath.Half, 0, 0); if (IsInObstacle(testPosi)) { hitx = true; x = FixedMath.Floor(testPosi.x) + FixedMath.One / 2 + 1; } } if (offset.y > 0) { var testPosi = v1 + new Vector3d(0, offset.y + FixedMath.One * 2, 0); if (IsInObstacle(testPosi)) { hity = true; y = FixedMath.Floor(testPosi.y) - FixedMath.One * 2 - 1; } } else if (offset.y < 0) { var testPosi = v1 + new Vector3d(0, offset.y, 0); if (IsInObstacle(testPosi)) { hity = true; y = FixedMath.Floor(testPosi.y) + FixedMath.One + 1; } } Vector3d v = new Vector3d(hitx? x : v2.x, hity?y:v2.y, 0); return(v); }
public void GetPrimitiveInfo(string tokenId, string id) { HttpContext.Current.Response.ContentType = "application/json;charset=utf-8"; var jsonCallBackFunName = HttpContext.Current.Request.Params["jsoncallback"]; //判断TokenId是否合法 if (Common.VerifyTokenId(tokenId)) { MySqlCommand sqlcom = new MySqlCommand { CommandText = "SELECT ep_detection.scene_name,ep_detection.equipment_name, ep_detection_detail.item_name,ep_detection.detection_date,DATE_ADD(ep_detection.detection_date, INTERVAL -3 MONTH) date2 " + "FROM environmental_protection.ep_detection INNER JOIN environmental_protection.ep_detection_detail " + "ON (ep_detection.detection_id = ep_detection_detail.detection_id) " + "where detection_detail_id=@id" }; MySqlParameter[] commandParameters = new MySqlParameter[] { new MySqlParameter("@id", id), }; try { var Info = MySqlHelper.GetDataSet(MySqlHelper.Conn, CommandType.Text, sqlcom.CommandText, commandParameters).Tables[0].DefaultView; if (Info != null && Info.Table.Rows.Count >= 1) //信息存在 { var json = Common.DataTableToJson(Info.Table); //信息的Json形式 HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(1, json)); return; } else //不存在或已删除 { HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(0, "检测信息不存在")); return; } } catch (Exception e) { HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(0, "系统异常")); DLog.w("系统异常:" + e.Message); return; } } else//TokenId过期 { HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(0, "TokenId过期")); return; } }
public void GetTaskDetail(string tokenId, string tid) { HttpContext.Current.Response.ContentType = "application/json;charset=utf-8"; var jsonCallBackFunName = HttpContext.Current.Request.Params["jsoncallback"]; Dugufeixue.Common.SystemConfig.ConnectionStringKey = System.Configuration.ConfigurationManager.ConnectionStrings["ConnStringDes"].ToString(); //判断TokenId是否合法 if (Common.VerifyTokenId(tokenId)) { //查询接班人 MySqlCommand sqlcom = new MySqlCommand { CommandText = "(SELECT * FROM ep_task,sys_employee WHERE task_id = @task_id and ep_task.emp_id = sys_employee.emp_id ) UNION (SELECT * FROM ep_task,sys_employee WHERE task_id = @task_id and ep_task.accept_emp_id = sys_employee.emp_id)" }; MySqlParameter[] commandParameters = new MySqlParameter[] { new MySqlParameter("@task_id", tid) }; try { var Info = MySqlHelper.GetDataSet(MySqlHelper.Conn, CommandType.Text, sqlcom.CommandText, commandParameters).Tables[0].DefaultView; if (Info != null && Info.Table.Rows.Count >= 1) //信息存在 { var json = Common.DataTableToJson(Info.Table); //信息的Json形式 HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(1, json)); return; } else //不存在或已删除 { HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(0, "信息不存在")); return; } } catch (Exception e) { HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(0, "系统异常")); DLog.w("系统异常:" + e.Message); return; } } else//TokenId过期 { HttpContext.Current.Response.Write(jsonCallBackFunName + Common.GetResultJson(0, "TokenId过期")); return; } }
/// <summary> /// Process the result of an AllThreads request. /// </summary> private void ProcessAllThreads(Task <List <ThreadId> > task) { if (!task.CompletedOk()) { DLog.Error(DContext.DebuggerLibModel, "LoadAllThreads failed", task.Exception); task.ForwardException(); return; } List <DalvikThread> created = null; List <DalvikThread> removed = null; lock (threadsLock) { // Create missing threads foreach (var id in task.Result.Where(x => !threads.ContainsKey(x))) { // Create and record var thread = CreateThread(id); threads[id] = thread; list.Add(thread); created = created ?? new List <DalvikThread>(); created.Add(thread); } // Remove obsolete threads var toRemove = threads.Keys.Where(x => !task.Result.Contains(x)).ToList(); foreach (var id in toRemove) { var thread = threads[id]; threads.Remove(id); list.Remove(thread); removed = removed ?? new List <DalvikThread>(); removed.Add(thread); } } if (created != null) { created.ForEach(OnThreadCreated); } if (removed != null) { removed.ForEach(OnThreadEnd); } }
public void Convert(ReachableContext reachableContext) { // Collect all names var reachableInterfaces = reachableContext.ReachableTypes.Where(i => i.IsInterface).ToList(); var interfaceToImplementingTypes = reachableContext.ReachableTypes .Except(reachableInterfaces) .SelectMany(t => GetInterfaces(t).Distinct(), Tuple.Create) .Where(e => e.Item2.IsReachable) .ToLookup(e => e.Item2, e => e.Item1); // TODO: I don't think the we cover all possible cases here yet. // What about methods overriding imported methods? foreach (var intf in reachableInterfaces) { foreach (var iMethod in intf.Methods) { // ignore DexImport Interface types. TODO: also cover the reverse: a method implementing // both a import-interface as well as a .NET interface. if (iMethod.GetDexOrJavaImportAttribute() != null || iMethod.GetDexNameAttribute() != null) { continue; } var nativeImpls = interfaceToImplementingTypes[intf].Select(t => Tuple.Create(t, iMethod.GetImplementation(t))) .Where(e => e.Item2 != null && (e.Item2.GetDexOrJavaImportAttribute() != null || e.Item2.GetDexNameAttribute() != null)); foreach (var typeAndImpl in nativeImpls) { var type = typeAndImpl.Item1; var impl = typeAndImpl.Item2; var finalName = GetFinalImplementationName(impl); if (finalName == iMethod.Name) { continue; } // TODO: automatically create a redirecting stub. DLog.Error(DContext.CompilerILConverter, "Type '{0}' implements interface method '{1}' using imported method '{2}'. This is not supported at the moment. As a workaround, create a 'new' or explicit implementation of the interface, that redirects to the imported.", type.FullName, iMethod.FullName, impl.FullName); } } } }
/// <summary> /// Gets the file statement range of the document context. /// A statement range is the range of the lines that contributed the code to which this document context refers. /// </summary> public int GetStatementRange(TEXT_POSITION[] pBegPosition, TEXT_POSITION[] pEndPosition) { DLog.Debug(DContext.VSDebuggerComCall, "DebugDocumentContext.GetStatementRange"); var position = DocumentLocation.Position; if (position == null) { return(VSConstants.E_FAIL); } // TEXT_POSITION starts counting at 0 pBegPosition[0].dwLine = (uint)(position.Start.Line - 1); pBegPosition[0].dwColumn = (uint)(position.Start.Column - 1); pEndPosition[0].dwLine = (uint)(position.End.Line - 1); pEndPosition[0].dwColumn = (uint)(position.End.Column - 1); DLog.Debug(DContext.VSDebuggerComCall, "Range: {0}-{1}", position.Start, position.End); return(VSConstants.S_OK); }
public static void DebugSubName(this SubName subName, string prefixString = null) { if (prefixString == null) { DLog.Log($"\n[SubName]"); prefixString = "this"; } DLog.Log($"{prefixString}.enabled: {subName.enabled}"); DLog.Log($"{prefixString}.gameObject: {subName.gameObject.name}"); DLog.Log($"{prefixString}.hideFlags: {subName.hideFlags}"); DLog.Log($"{prefixString}.hideFlags: {subName}"); DLog.Log($"{prefixString}.tag: {subName.tag}"); DLog.Log($"{prefixString}.tag: {subName.transform.name}"); }
public bool StartUnZipAsync() { if (mUpdateObject == null) { DLog.LogError("UpdateObject == null"); return(false); } if (mIsStart) { return(true); } mIsStart = true; sUnZipMap.Add(mKey, this); mUnZipObject.StartUnZipAsync(); PublicUpdateManager.AddUpdate(mUpdateObject); return(true); }
public void WithoutNlogConfig() { var nlogConfig = DLog.GetDefaultConfigString(); XmlDocument document = new XmlDocument(); document.Load(new StringReader(nlogConfig)); Assert.Equal("nlog", document.DocumentElement.Name); Assert.Equal(2, document.DocumentElement.ChildNodes.Count); Assert.Equal(2, document.DocumentElement.ChildNodes[0].ChildNodes.Count); Assert.Equal("target", document.DocumentElement.ChildNodes[0].ChildNodes[0].Name); Assert.Equal("console", document.DocumentElement.ChildNodes[0].ChildNodes[0].Attributes["name"].Value); Assert.Equal("file", document.DocumentElement.ChildNodes[0].ChildNodes[1].Attributes["name"].Value); Assert.Equal(2, document.DocumentElement.ChildNodes[1].ChildNodes.Count); Assert.Equal("logger", document.DocumentElement.ChildNodes[1].ChildNodes[0].Name); Assert.Equal("console", document.DocumentElement.ChildNodes[1].ChildNodes[0].Attributes["writeTo"].Value); Assert.Equal("file", document.DocumentElement.ChildNodes[1].ChildNodes[1].Attributes["writeTo"].Value); }
public void LoadScriptFormMemory(byte[] _dllbytes, byte[] _pdbbytes) { if (mCore.SManager.ProjectLoaded) { DLog.LogError("脚本不可重复加载."); return; } if (_dllbytes != null && _pdbbytes != null) { mCore.SManager.LoadProjectByBytes(_dllbytes, _pdbbytes); StartMain(StartClass, StartFun); } else { DLog.LogErrorFormat("LoadScriptFormMemory(byte[] _dllbytes = }|,byte[] _pdbbytes){}"); } }
/// <summary> /// we send our current positions (as we just did a resim) along with the frame we resimed to, to everyone so they can /// use it in their local sims as a best guess starting point /// </summary> /// <param name="frame"></param> public void BroadcastValidation(int frame) { //could probably do entity events //lazy if (entity.isAttached) { RigidbodyDataEvent e = RigidbodyDataEvent.Create(); e.entity = entity; e.position = this.transform.position; e.rotation = this.transform.rotation; e.velocity = GetRigidbody().velocity; e.angularVelocity = GetRigidbody().angularVelocity; e.frame = frame; e.Send(); DLog.Log("BroadcastValidation: " + this.gameObject.name); } }
override protected void Processingdata(int _len, byte[] _buffer) { try { base.Processingdata(_len, _buffer); if (_len < SocketDataBase.mPackageTopLen) { return; } ReceiveData tssdata = new ReceiveData(_buffer, 0); Call(tssdata.Cmd, tssdata); } catch (Exception e) { DLog.LogError(mNetTag + "-" + e.ToString()); } }
/// <summary> /// Load call stack /// </summary> public int EnumFrameInfo(enum_FRAMEINFO_FLAGS dwFieldSpec, uint nRadix, out IEnumDebugFrameInfo2 ppEnum) { DLog.Debug(DContext.VSDebuggerComCall, "IDebugThread2.EnumFrameInfo"); // Get frames var frameInfos = new List <FRAMEINFO>(); foreach (var stackFrame in GetCallStack()) { FRAMEINFO info; ((DebugStackFrame)stackFrame).SetFrameInfo(dwFieldSpec, out info); frameInfos.Add(info); } ppEnum = new FrameInfoEnum(frameInfos); return(VSConstants.S_OK); }
IEnumerator LoadHashFileFromServer() { UnityWebRequest www = UnityWebRequest.Get("http://47.94.204.158/AB/assetBundleHash.txt"); yield return(www.Send()); if (www.isError) { DLog.Log(www.error); } else { // Show results as text _needDownLoadList.Clear(); // System.Diagnostics.Stopwatch sw = new Stopwatch(); var remoteBundleHash = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, string> >(www.downloadHandler.text); var localBundleHash = AssetResources.LoadBundleHash(); foreach (var bh in remoteBundleHash) { string hash; if (localBundleHash.TryGetValue(bh.Key, out hash)) { if (!hash.Equals(bh.Value)) { _needDownLoadList.Add(bh.Key); } } else { _needDownLoadList.Add(bh.Key); } } for (int i = 0; i < _needDownLoadList.Count; i++) { DLog.Log("Start Download " + _needDownLoadList[i]); Main.SP.StartCoroutine(DownLoadAssetBundle(_needDownLoadList[i], (s, bytes) => { _needDownLoadList.Remove(s); DLog.Log(s + " Download Finish"); SaveToPersistentPath(s, bytes); })); } SaveToPersistentPath("assetBundleHash.txt", www.downloadHandler.data); www.Dispose(); } }
public void StoreLocalInput(PhysicsInputCommand e) { //here we store commands that get sent to the server for validation. These are our inputs, and can not be wrong. //We need these if we do a rewind, to re-apply them when we sim forward if (localInputs.ContainsKey(e.frame)) { //this key already exists DLog.Log("Key already exists: " + e.frame); } else { localInputs.Add(e.frame, new PhysicsInputState() { onlineIndex = e.onlineIndex, inputDir = e.inputDir, dash = e.dash, frame = e.frame }); } }