public void DebugLogger_LoggingTest() { string message = "Error Message"; Exception ex = new Exception(); string messageFormat = "Message Format: message: {0}, exception: {1}"; ILog log = new DebugLogger(GetType()); Assert.IsNotNull(log); log.Debug(message); log.Debug(message, ex); log.DebugFormat(messageFormat, messageFormat, ex.Message); log.Error(message); log.Error(message, ex); log.ErrorFormat(messageFormat, messageFormat, ex.Message); log.Fatal(message); log.Fatal(message, ex); log.FatalFormat(messageFormat, messageFormat, ex.Message); log.Info(message); log.Info(message, ex); log.InfoFormat(messageFormat, messageFormat, ex.Message); log.Warn(message); log.Warn(message, ex); log.WarnFormat(messageFormat, messageFormat, ex.Message); }
private static StatLightConfiguration CreateStatLightConfiguration(SilverlightTask silverlightTask, DebugLogger logger, MethodTask[] testMethods) { var configurationFactory = new StatLightConfigurationFactory(logger); return silverlightTask.HasXapPath() ? CreateStatLightConfigurationForXap(configurationFactory, testMethods, silverlightTask.GetXapPath()) : CreateStatLightConfigurationForDll(configurationFactory, testMethods, silverlightTask.GetDllPath()); }
public void Log4NetLoggerTest() { ILog log = new DebugLogger(GetType()); Assert.IsNotNull(log); log = new DebugLogger(GetType().Name); Assert.IsNotNull(log); }
public void CallingBeginScopeOnLogger_ReturnsNonNullableInstance() { // Arrange var logger = new DebugLogger("Test"); // Act var disposable = logger.BeginScopeImpl("Scope1"); // Assert Assert.NotNull(disposable); }
public void CallingBeginScopeOnLogger_AlwaysReturnsNewDisposableInstance() { // Arrange var logger = new DebugLogger("Test"); // Act var disposable1 = logger.BeginScopeImpl("Scope1"); var disposable2 = logger.BeginScopeImpl("Scope2"); // Assert Assert.NotNull(disposable1); Assert.NotNull(disposable2); Assert.NotSame(disposable1, disposable2); }
public void StartWithExistingSocket(StreamSocket socket) { try { this.Log("Starting with existing socket"); if (Running) { throw new Exception("Push client is already running"); } Socket = socket; _inboundReader = new DataReader(socket.InputStream); _outboundWriter = new DataWriter(socket.OutputStream); _inboundReader.ByteOrder = ByteOrder.BigEndian; _inboundReader.InputStreamOptions = InputStreamOptions.Partial; _outboundWriter.ByteOrder = ByteOrder.BigEndian; _runningTokenSource = new CancellationTokenSource(); StartPollingLoop(); } catch (Exception e) { DebugLogger.LogExceptionX(e); } }
private T Rent(T instance) { var key = instance.GetInstanceID(); if (!pooledObjects.TryGetValue(key, out var pool)) { DebugLogger.LogWarning("Pooled new object!"); pool = ForceRegisterInstance(key); } if (pool.Count > 0) { var obj = pool.Dequeue(); obj.gameObject.SetActive(true); return(obj); } else { DebugLogger.LogWarning("Created new object!"); var obj = CreateObject(instance, key); obj.gameObject.SetActive(true); return(obj); } }
/// <summary> /// Append a new event delegate to the list. /// </summary> static public void Add(List <EventDelegate> list, EventDelegate ev, bool oneShot) { if (ev.mRawDelegate || ev.target == null || string.IsNullOrEmpty(ev.methodName)) { Add(list, ev.mCachedCallback, oneShot); } else if (list != null) { for (int i = 0, imax = list.Count; i < imax; ++i) { EventDelegate del = list[i]; if (del != null && del.Equals(ev)) { return; } } EventDelegate copy = new EventDelegate(ev.target, ev.methodName); copy.oneShot = oneShot; if (ev.mParameters != null && ev.mParameters.Length > 0) { copy.mParameters = new Parameter[ev.mParameters.Length]; for (int i = 0; i < ev.mParameters.Length; ++i) { copy.mParameters[i] = ev.mParameters[i]; } } list.Add(copy); } else { DebugLogger.LogWarning("Attempting to add a callback to a list that's null"); } }
/// <summary> /// Retrieve the data items by some conditions. /// </summary> /// <typeparam name="T">The tyoe of data return.</typeparam> /// <param name="tableName">Name of the table.</param> /// <param name="conditions">The query conditions.</param> /// <param name="multiConditionOperators">The multi-condition operators.</param> /// <returns>The data items.</returns> public List <T> Select <T>(string tableName, List <BoxDBQueryCondition> conditions, List <BoxDBMultiConditionOperator> multiConditionOperators = null) where T : class, new() { try { if (database != null) { object[] values; string sql = GenerateMultiConditionQuerySQL(out values, tableName, conditions, multiConditionOperators); if (!string.IsNullOrEmpty(sql)) { IBEnumerable <T> items = database.Select <T>(sql, values); return(new List <T>(items)); } } } catch (Exception exception) { DebugLogger.LogException(exception, this); } return(null); }
private static int RealQuery( ReadOnlySpan <byte> payload, Span <byte> outData) { var dnsPacket = new DnsRequestPacket(payload); var n = dnsPacket.DomainName; if (!dnsPacket.IsARecordQuery) { return(dnsPacket.GenerateErrorResponse(0x8004, outData)); // AAAA query not implemented } else if (rlookupTable.TryGetValue(n, out var ipint)) { DebugLogger.Log("DNS request done: " + n); return(dnsPacket.GenerateAnswerResponse(ipint, outData)); } else { uint ip = (uint)((11 << 24) | (17 << 16) | lookupTable.Count); lookupTable[ip] = n; rlookupTable[n] = ip; DebugLogger.Log("DNS request done: " + n); return(dnsPacket.GenerateAnswerResponse(ip, outData)); } }
/// <summary> /// Executes the current console command on all remote machines. /// </summary> /// <param name="sender">Object that invoked this event.</param> /// <param name="e">Reason why this event was invoked.</param> private void consoleExecuteRemoteButton_Click(object sender, EventArgs e) { if (consoleClientIDCheckbox.Checked == true) { int clientID = 0; if (consoleClientIDTextBox.Text == "" || int.TryParse(consoleClientIDTextBox.Text, out clientID) == false) { return; } NetworkPacket packet = new NetworkPacket(); packet.ID = "CONSOLE_COMMAND".GetHashCode(); packet[0] = consoleTextBox.Text; foreach (NetworkClient client in NetworkManager.Connection.ClientList) { if (client.ID == clientID) { client.Connection.SendPacket(packet); } } DebugLogger.WriteLog("Executing remote console command '" + consoleTextBox.Text + "' on client " + clientID + "."); consoleTextBox.Text = ""; } else { NetworkPacket packet = new NetworkPacket(); packet.ID = "CONSOLE_COMMAND".GetHashCode(); packet[0] = consoleTextBox.Text; NetworkManager.Connection.BroadcastPacket(packet); DebugLogger.WriteLog("Executing remote console command '" + consoleTextBox.Text + "'."); consoleTextBox.Text = ""; } }
public static bool CanHaulAndInPrisonCell(Pawn p, Thing t, bool forced) { if (p.IsPrisonerOfColony) { DebugLogger.debug($"Prisoner {p.LabelShort} call: {t}"); } var unfinishedThing = t as UnfinishedThing; if (unfinishedThing != null && unfinishedThing.BoundBill != null) { return(false); } if (!p.CanReach(t, PathEndMode.ClosestTouch, p.NormalMaxDanger(), false, TraverseMode.ByPawn)) { return(false); } if (!p.CanReserve(t, 1, -1, null, forced)) { return(false); } if (t.def.IsNutritionGivingIngestible && t.def.ingestible.HumanEdible && !t.IsSociallyProper(p, false, true)) { if (PrisonerFoodReservation.IsReserved(t)) { JobFailReason.Is("ReservedForPrisoners".Translate()); return(false); } } if (t.IsBurning()) { JobFailReason.Is("BurningLower".Translate()); return(false); } return(true); }
// 蛙 : Position.Leftなら1、Rightなら0 // 兎 : Position.Leftなら0、Rightなら1 // 他 : 2 // Answer // 0 : 左タップ // 1 : 右タップ // 2 : スワイプ public int getAnswer() { Question q = questionList [counter]; Const.AnimalType at = q.questionImage.animalType; DebugLogger.Log("Position:" + q.position + " at:" + at); if (at == Const.AnimalType.OTHERS) { return(0); } if (at == Const.AnimalType.FROG) { if (q.position == Const.Position.LEFT) { return(1); } else { return(0); } } else if (at == Const.AnimalType.RABBIT) { if (q.position == Const.Position.LEFT) { return(0); } else { return(1); } } return(-1); }
// we might be able to do the slice add the same way as before, // trap for the slice events and add them public void RemoveExistingSlices(string scenefilename) { try { // open the zip file if (OpenSceneFile(scenefilename)) { //remove all *.png files //delete the slices node XmlNode slices = mManifest.FindSection(mManifest.m_toplevel, "Slices"); if (slices != null) { slices.RemoveAll(); // remove all child nodes for this manifest entry List <ZipEntry> etr = new List <ZipEntry>(); // entries to remove foreach (ZipEntry ze in mZip) // create a list of entries to remove { if (ze.FileName.Contains(".png")) { etr.Add(ze); } } //and remove them mZip.RemoveEntries(etr); } else { //slices does equal null, nothing to do... } CloseSceneFile(false); } } catch (Exception ex) { DebugLogger.Instance().LogError(ex); } }
private void ParseLine(string line, string[] headerElements) { var elements = line.Split(','); if (elements.Length == 1) { return; } if (elements.Length != headerElements.Length) // 何かがおかしい { DebugLogger.LogWarning(string.Format("can't load: {0}", line)); return; } var param = new Dictionary <string, string> (); for (int i = 0; i < elements.Length; i++) { var element = elements [i]; if (element.Contains("<comma>")) { element = element.Replace("<comma>", ","); } if (element.Contains("<br>")) { element = element.Replace("<br>", "\n"); } param.Add(headerElements [i], element); } var master = new T(); master.Load(param); masters.Add(master); }
private async void StartPollingLoop() { while (Running) { var reader = _inboundReader; try { await reader.LoadAsync(PacketDecoder.PACKET_HEADER_LENGTH); var packet = await PacketDecoder.DecodePacket(reader); await OnPacketReceived(packet); } catch (Exception e) { if (Running) { DebugLogger.LogExceptionX(e); OnDisconnect?.Invoke(this, true); Restart(); } return; } } }
/* * private PluginEntry Find(string fname) * { * foreach (PluginEntry pe in UVDLPApp.Instance().m_plugins) * { * if (pe.m_filename.Equals(fname)) * { * return pe; * } * } * return null; * } * */ public void Load(string fname) { try { if (File.Exists(fname)) { //string fname = UVDLPApp.Instance().m_apppath + UVDLPApp.m_pathsep + "pluginconfig.cfg"; using (StreamReader reader = new StreamReader(fname)) { string line; while ((line = reader.ReadLine()) != null) { PluginEntry pe = new PluginEntry(null, line.Trim());//Find(line.Trim()); m_entries.Add(pe); } reader.Close(); } } } catch (Exception ex) { DebugLogger.Instance().LogError(ex); } }
private void ReverseCommandHandler(string commandName, string commandBody) { try { switch (commandName) { case "emit": DoEmit(commandBody); break; default: DebugLogger.Log("Ignoring unknown reverse command: '{0}'", commandName); break; } } catch (Exception ex) { // report only the first exception occured in reverse command handler if (_reverseCommandHandlerException == null) { _reverseCommandHandlerException = ex; } } }
/// <summary> /// Sets the value of a given setting in this xml document. /// </summary> /// <param name="setting">Setting to get, namespaces can be split up with the : scoping character.</param> /// <param name="def">If no setting is found this value will be returned.</param> public string GetSetting(string setting, string def) { XmlNode node = FindNode(setting); if (node == null) { DebugLogger.WriteLog("Unable to find setting \"" + setting + "\" using default value \"" + def + "\""); return(def); } else { foreach (XmlNode attribute in node.Attributes) { if (attribute.Name.ToLower() == "value") { DebugLogger.WriteLog("Found setting \"" + setting + "\" with value \"" + attribute.Value + "\""); return(attribute.Value); } } } DebugLogger.WriteLog("Unable to find setting \"" + setting + "\" using default value \"" + def + "\""); return(def); }
/// <summary> /// ガチャ結果を反映させたデータをstringで受け取る /// </summary> /// <returns>The gacha result.</returns> /// <param name="pList">リスト</param> /// <param name="pId">ガチャ結果IDがあれば指定。基本は0。</param> public string getGachaResult(List <int> pList, int pId = 0) { int id = (pId != 0) ? pId : gachaalgorithm(); List <int> list = pList; // すでに持っているかチェック if (checkIfAlreadyHaveOne(id, list)) { DebugLogger.Log("SAME ONE..."); } else { // 持っていなければ、コレクションに追加する list.Add(id); list.Sort(); UpdateSprite(id, true); } string str = getStringFromList(list); return(str); }
internal bool TryAlterData(KeyIdentity key, string valueName, IKeyImpl keyImpl, IntPtr pdwType, Data dst, DataTransformer.Operation operation) { // TODO: this is a specific check that // rewrite is done only for values in sandboxie reghive which is BASE_HIVE // and if values are copied, DIFF_HIVE is also supported // It should be put outside this generalized class if (keyImpl.GetDisposition() == KeyDisposition.WINDOWS_REG) { return(Win32Exception.CheckIfFoundAndNoError(operation(pdwType, dst))); } return(DataTransformer.TryAlterData(pdwType, dst, operation, (result, type) => { DebugLogger.WriteLine(@"AlterData {0} {1}\{2} ({3}) Result: {4}", keyImpl.GetDisposition(), key.ToString(), valueName, type, (int)result); return result == Win32Api.Error.ERROR_SUCCESS && DataTransformer.IsStringType(type); }, (type, pSrcData, cbSrcData) => DataTransformer.TransformStringValue( type, pSrcData, cbSrcData, dst, str => CallStrAlterers(key, valueName, str), HookBarrier.IsLastInjectedFuncAnsi ? StringFormat.Ansi : StringFormat.Unicode))); }
void Export() { ieDialog = new ImportExportDialog(ExportData.DataFromDBs(), true); ieDialog.ImportExportComplete += (sss, e) => { OpenDialog ofd = new OpenDialog(false, new List <string>() { "*.cmx" }); ofd.FilesOpened += (sn, ee) => { try { XmlLoader <ExportData> .Save(e.Data, ee.Files[0]); } catch (Exception ex) { DebugLogger.WriteLine(ex.ToString()); } }; MainUI.MainView.AddSubview(ofd.View); }; MainUI.MainView.AddSubview(ieDialog.View); }
public DeviceManager(ITraceContext traceContext, DebugLogger logger) { _traceContext = traceContext; _spokes = Spokes.Instance; _spokes.SetLogger(logger); _spokes.Attached += OnDeviceAttached; _spokes.Detached += OnDeviceDetached; _spokes.Connected +=OnHeadsetConnected; _spokes.Disconnected += OnHeadsetDisconnected; _spokes.MuteChanged += OnMuteChanged; _spokes.ButtonPress += OnButtonPress; _spokes.CallAnswered += OnCallAnswered; _spokes.CallEnded += OnCallEnded; _spokes.OnCall += OnDeviceCall; _spokes.Connect("Interaction Client AddIn"); // _spokes. }
public void SpoolerStartUp(DebugLogger debugLogger) { try { print_spooler_client = new SpoolerClient(debugLogger) { IgnoreConnectingPrinters = false }; print_spooler_client.OnReceivedPrinterList += new OnReceivedPrinterListDel(OnReceivedPrinterList); print_spooler_client.OnReceivedMessage += new OnReceivedMessageDel(OnReceivedMessage); print_spooler_client.OnGotNewPrinter += new SpoolerClient.OnGotNewPrinterDel(OnGotNewPrinterInternal); print_spooler_client.OnPrinterDisconnected += new SpoolerClient.OnPrinterDisconnectedDel(OnPrinterDisconnectedInternal); print_spooler_client.OnProcessFromServer += new SpoolerClient.OnPrintProcessDel(OnPrintProcessChangedInternal); print_spooler_client.OnPrintStopped += new SpoolerClient.OnPrintStoppedDel(OnPrintStoppedInternal); var directorySeparatorChar = Path.DirectorySeparatorChar; Form1.debugLogger.Add("SpoolerConnection.SpoolerStartUp", "Setup", DebugLogger.LogType.Secondary); var num = (int)print_spooler_client.StartSession(Paths.ResourceFolder + directorySeparatorChar.ToString() + "Spooler" + directorySeparatorChar.ToString() + "M3DSpooler.exe", Paths.ResourceFolder + directorySeparatorChar.ToString() + "Spooler", "H B A D PSM", 2000); Form1.debugLogger.Add("SpoolerConnection.SpoolerStartUp", "Session Started", DebugLogger.LogType.Secondary); } catch (Exception ex) { ExceptionForm.ShowExceptionForm(ex); } }
public async Task <Result <UserPresenceResponse> > GetPresence() { ValidateLoggedIn(); try { var instaUri = UriCreator.GetDirectUserPresenceUri(); var response = await _httpClient.GetAsync(instaUri); var json = await response.Content.ReadAsStringAsync(); DebugLogger.LogResponse(response); if (response.StatusCode != HttpStatusCode.Ok) { return(Result <UserPresenceResponse> .Fail(json, response.ReasonPhrase)); } var obj = JsonConvert.DeserializeObject <UserPresenceResponse>(json); return(obj.IsOk() ? Result <UserPresenceResponse> .Success(obj, json) : Result <UserPresenceResponse> .Fail(json)); } catch (Exception exception) { DebugLogger.LogException(exception); return(Result <UserPresenceResponse> .Except(exception)); } }
/// <summary> /// Move this entity. /// </summary> /// <returns><c>true</c> if the movement was successfull, <c>false</c> otherwise.</returns> public virtual bool Move(Movement movement) { bool moved = (movement == Movement.WAIT); Pos old = CurrentPosition; Pos next = movement.Next(old); if (!moved) { if (World.IsWalkable(next)) { CurrentPosition = next; UpdatePositionOnVillage(old); if (CurrentPosition.Equals(Target)) { target = null; } moved = true; } } DebugLogger.Log(DebugChannel.Movement, " move " + movement + ": " + old + " -> " + next + " " + (moved ? "Success" : "Failed"), ToString()); return(moved); }
internal virtual IEnumerable <T> ApplyClientSideFilter(IEnumerable <T> objectList) { if (this.CmdletSessionInfo.CmdletParameters.Contains("Filter")) { string str = this.CmdletSessionInfo.CmdletParameters["Filter"].ToString(); if (str != "objectClass -like \"*\"") { List <T> ts = new List <T>(); ADFactoryBase <T> aDFactoryBase = this; ConvertSearchFilterDelegate convertSearchFilterDelegate = new ConvertSearchFilterDelegate(aDFactoryBase.BuildSearchFilter); VariableExpressionConverter variableExpressionConverter = new VariableExpressionConverter(new EvaluateVariableDelegate(this.CmdletSessionInfo.CmdletBase.GetVariableValue)); QueryParser queryParser = new QueryParser(str, variableExpressionConverter, convertSearchFilterDelegate); str = ADOPathUtil.ChangeNodeToWhereFilterSyntax(queryParser.FilterExpressionTree); StringBuilder stringBuilder = new StringBuilder("$args[0] | Where-Object -filterScript { "); stringBuilder.Append(str); stringBuilder.Append(" } "); object[] objArray = new object[1]; objArray[0] = objectList; Collection <PSObject> pSObjects = this.CmdletSessionInfo.CmdletBase.InvokeCommand.InvokeScript(stringBuilder.ToString(), false, PipelineResultTypes.None, null, objArray); foreach (PSObject pSObject in pSObjects) { ts.Add((T)pSObject.BaseObject); } return(ts); } else { DebugLogger.LogInfo("ADFactoryBase", string.Format("Filter: Found MatchAnyObject filter: {0}", str)); return(objectList); } } else { return(objectList); } }
public void SetLightmaps() { if (m_RendererInfo == null || m_RendererInfo.Length == 0) { return; } var lightmaps = LightmapSettings.lightmaps; var combinedLightmaps = new LightmapData[lightmaps.Length + m_Lightmaps.Length]; lightmaps.CopyTo(combinedLightmaps, 0); for (int i = 0; i < m_Lightmaps.Length; i++) { combinedLightmaps[i + lightmaps.Length] = new LightmapData { lightmapColor = m_Lightmaps[i], lightmapDir = m_Dirmaps[i] }; } ApplyRendererInfo(m_RendererInfo, lightmaps.Length); DebugLogger.Log("Applying Renderer Info for {0}", name); DebugLogger.Log("lm : {0} - dm : {1}", m_Lightmaps[0], m_Dirmaps[0]); DebugLogger.Log("{0}x{1}", m_Lightmaps[0].width, m_Lightmaps[0].height); foreach (List <RendererInfo> rendererInfos in lodRendererInfo) { ApplyRendererInfo(rendererInfos.ToArray(), lightmaps.Length); } LightmapSettings.lightmaps = combinedLightmaps; LightmapSettings.lightmapsMode = LightmapsMode.CombinedDirectional; Debug.Log(LightmapSettings.lightmaps); Debug.Log(LightmapSettings.lightmaps.Length); }
private void SetData() { m_settingData = true; try { numFB.FloatVal = (float)m_sc.fbrad; numFT.FloatVal = (float)m_sc.ftrad; numHB.FloatVal = (float)m_sc.hbrad; numHT.FloatVal = (float)m_sc.htrad; numFB1.FloatVal = (float)m_sc.fbrad2; numY.FloatVal = (float)m_sc.yspace; numX.FloatVal = (float)m_sc.xspace; numGap.FloatVal = (float)m_sc.mingap; chkOnlyDownward.Checked = m_sc.m_onlydownward; numDownAngle.FloatVal = (float)m_sc.downwardAngle; switch (m_sc.eSupType) { case SupportConfig.eAUTOSUPPORTTYPE.eBON: cmbSupType.SelectedIndex = 0; break; case SupportConfig.eAUTOSUPPORTTYPE.eADAPTIVE: cmbSupType.SelectedIndex = 1; break; // case SupportConfig.eAUTOSUPPORTTYPE.eADAPTIVE2: // cmbSupType.SelectedIndex = 2; // break; } UpdateForSupportType(); } catch (Exception ex) { DebugLogger.Instance().LogError(ex.Message); } m_settingData = false; }
public bool Load(XmlHelper xh, XmlNode thisnode) { XmlNode mdc = thisnode;// xh.FindSection(parent, "MonitorDriverConfig"); m_XDLPRes = xh.GetDouble(mdc, "DLP_X_Res", 1024.0); m_YDLPRes = xh.GetDouble(mdc, "DLP_Y_Res", 768.0); m_monitorid = xh.GetString(mdc, "MonitorID", ""); m_displayconnectionenabled = xh.GetBool(mdc, "DisplayCommEnabled", false); m_displayconnection.Load(xh, mdc); m_monitorrect.top = (float)xh.GetDouble(mdc, "MonitorTop", 0.0); m_monitorrect.left = (float)xh.GetDouble(mdc, "MonitorLeft", 0.0); m_monitorrect.right = (float)xh.GetDouble(mdc, "MonitorRight", 1.0); m_monitorrect.bottom = (float)xh.GetDouble(mdc, "MonitorBottom", 1.0); m_brightmask_filename = xh.GetString(mdc, "CorrectionMask", ""); m_usemask = xh.GetBool(mdc, "UseMask", false); if (m_usemask == true) { try { if (File.Exists(m_brightmask_filename)) { m_mask = new Bitmap(m_brightmask_filename); } else { DebugLogger.Instance().LogWarning("Mask Image " + m_brightmask_filename + " not found, disabling"); m_usemask = false; } } catch (Exception ex) { DebugLogger.Instance().LogError(ex); } } return(true); }
public void ApplyConfiguration(GuiConfigDB conf) { guiConf = conf; if (firstTime) { UVDLPApp.Instance() .m_callbackhandler.RegisterCallback("GMActivateTab", ActivateTab, UVDLPApp.Instance() .resman.GetString("GUITabActivationCtlTabItemCtlTabContent", UVDLPApp.Instance().cul)); firstTime = false; } try { // read and store all styles foreach (KeyValuePair <string, GuiControlStyle> pair in conf.GuiControlStylesDict) { GuiControlStylesDict[pair.Key] = pair.Value; } HandleDecals(conf); HandleLayouts(conf); HandleButtonCreation(conf); HandleControls(conf); HandleButtons(conf); HandleSequences(conf); if (GuiLayouts.ContainsKey("MainLayout")) { UVDLPApp.Instance().m_mainform.ReplaceGui(GuiLayouts["MainLayout"]); } } catch (Exception ex) { DebugLogger.Instance().LogError(ex); } }
public RemSyncTransactionFactory(DebugLogger logger) : base(new int[] { REMSYNC_PORT }, null, logger) { }
public MSNTransactionFactory(DebugLogger logger) : base(logger) { }
public RRACTransactionFactory(DebugLogger logger) : base(new int[] { RRAC_PORT }, null, logger) { }
/// <remarks/> public void DebugMessageAsync(DebugLogger log, object userState) { if ((this.DebugMessageOperationCompleted == null)) { this.DebugMessageOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDebugMessageOperationCompleted); } this.InvokeAsync("DebugMessage", new object[] { log}, this.DebugMessageOperationCompleted, userState); }
// Update is called once per frame void Update() { if (!isZombie) { //Behaviour when following a player if (humanScript.playerToFollow != null) { if (state != State.FollowingPlayer) { state = State.FollowingPlayer; } transform.position = Vector3.Slerp(transform.position, humanScript.playerToFollow.transform.position - (humanScript.playerToFollow.transform.forward * 5), Time.deltaTime * 2); navMeshAgent.SetDestination(humanScript.playerToFollow.transform.position - (humanScript.playerToFollow.transform.forward * 5)); //stick behind the player } //Behaviour when not following a player and not saved yet if (!humanScript.isPanicked && !humanScript.isSaved) { if (state == State.Idle) { currentIdleTimer += Time.deltaTime; var elapsedIdleSecs = currentIdleTimer % 60; //DebugLogger.Log("Idle current time = "+elapsedIdleSecs+"s", Enum.LoggerMessageType.Important); //DebugLogger.Log("I will move at " + nextIdleEndTime + "s", Enum.LoggerMessageType.Important); //choose a new destination when reaching the nextIdleEndTime if (elapsedIdleSecs >= nextIdleEndTime && canChooseWaypoint) { canChooseWaypoint = false; ChooseNextWaypoint(); } } else if (state == State.GoingToWayPoint) { //Debug.Log("remaining distance : " + Vector3.Distance(transform.position, targetWaypoint)); //If waypoint reached, trigger idle state if (Vector3.Distance(transform.position, navMeshAgent.destination) <= distanceMargin) { StartIdle(); } //Else continue moving else { } } //If the state is panicking here, that's because the humanScript had the isPanicked = true but now it's over and the human is going to a waypoint else if (state == State.Panicking) { DebugLogger.Log("Panicked is finished, going to waypoint", Enum.LoggerMessageType.Important); state = State.GoingToWayPoint; } } else if (humanScript.isPanicked) { if (state != State.Panicking) { state = State.Panicking; } if (currentIdleTimer > 0f) { currentIdleTimer = 0f; } } else if (humanScript.isSaved) { if (state != State.Saved) { state = State.Saved; } } } }
public void DebugMessage(DebugLogger log) { this.Invoke("DebugMessage", new object[] { log}); }
public TransactionFactory(DebugLogger logger) { this.logger = logger; }
public RemSyncSession(DebugLogger logger) : base(logger) { }
static Log() { Logger = new DebugLogger(); }
public OracleTransaction(DebugLogger logger) : base(logger) { redirPort = -1; }
//private bool m_ignorenextbattlevevent = false; /// <summary> /// If your application class implements the Spokes.DebugLogger interface you can pass a reference to your application class /// to the SetLogger method. This allows your class to be responsible for debug logging of Spokes related debug trace information. /// </summary> /// <param name="aLogger">For this parameter pass the "this" reference of your class that implements Spokes.DebugLogger interface.</param> public void SetLogger(DebugLogger aLogger) { m_debuglog = aLogger; }
public PacketParser(DebugLogger logger) { this.logger = logger; Initialize(); }
public bool Load(string scenefilename) { try { UVDLPApp.Instance().SceneFileName = scenefilename; ZipFile zip = ZipFile.Read(scenefilename); string xmlname = "manifest.xml"; ZipEntry manifestentry = zip[xmlname]; //create new manifest xml doc XmlHelper manifest = new XmlHelper(); //get memory stream MemoryStream manistream = new MemoryStream(); //extract the stream manifestentry.Extract(manistream); //read from stream manistream.Seek(0, SeekOrigin.Begin); // rewind the stream for reading manifest.LoadFromStream(manistream, "manifest"); //examine manifest //find the node with models XmlNode topnode = manifest.m_toplevel; XmlNode gcn = manifest.FindSection(topnode, "GCode"); string gcodename = manifest.GetString(gcn, "filename", "none"); if (!gcodename.Equals("none")) { try { ZipEntry gcodeentry = zip[gcodename]; MemoryStream gcstr = new MemoryStream(); gcodeentry.Extract(gcstr); //rewind to beginning gcstr.Seek(0, SeekOrigin.Begin); UVDLPApp.Instance().m_gcode = new GCodeFile(gcstr); UVDLPApp.Instance().RaiseAppEvent(eAppEvent.eGCodeLoaded, ""); //if we load the gcode, we can create the slice file here too if (UVDLPApp.Instance().m_gcode != null) { int xres, yres, numslices; xres = UVDLPApp.Instance().m_gcode.GetVar("X Resolution"); yres = UVDLPApp.Instance().m_gcode.GetVar("Y Resolution"); numslices = UVDLPApp.Instance().m_gcode.GetVar("Number of Slices"); UVDLPApp.Instance().m_slicefile = new SliceFile(xres, yres, numslices); if (UVDLPApp.Instance().SelectedObject != null) { UVDLPApp.Instance().m_slicefile.modelname = UVDLPApp.Instance().SelectedObject.m_fullname; } //UVDLPApp.Instance().m_slicefile.m_config = new SliceBuildConfig(); UVDLPApp.Instance().m_slicefile.m_config = null; //UVDLPApp.Instance().m_slicefile.m_config.ZThick = UVDLPApp.Instance().m_gcode.GetVar("Layer Thickness"); //UVDLPApp.Instance().m_slicefile.m_mode = SliceFile.SFMode.eImmediate; UVDLPApp.Instance().RaiseAppEvent(eAppEvent.eSlicedLoaded, "SliceFile Created"); } } catch (Exception ex) { DebugLogger.Instance().LogError(ex); } } XmlNode models = manifest.FindSection(topnode, "Models"); List <XmlNode> modelnodes = manifest.FindAllChildElement(models, "model"); bool supportLoaded = false; foreach (XmlNode nd in modelnodes) { string name = manifest.GetString(nd, "name", "noname"); string modstlname = name + ".stl"; int tag = manifest.GetInt(nd, "tag", 0); ZipEntry modelentry = zip[modstlname]; // the model name will have the _XXXX on the end with the stl extension MemoryStream modstr = new MemoryStream(); modelentry.Extract(modstr); //rewind to beginning modstr.Seek(0, SeekOrigin.Begin); //fix the name name = name.Substring(0, name.Length - 5);// get rid of the _XXXX at the end string parentName = manifest.GetString(nd, "parent", "noname"); Object3d obj, tmpObj; switch (tag) { case Object3d.OBJ_SUPPORT: case Object3d.OBJ_SUPPORT_BASE: if (tag == Object3d.OBJ_SUPPORT) { obj = (Object3d)(new Support()); } else { obj = (Object3d)(new SupportBase()); } //load the model obj.LoadSTL_Binary(modstr, name); //add to the 3d engine UVDLPApp.Instance().m_engine3d.AddObject(obj); //set the tag obj.tag = tag; obj.SetColor(System.Drawing.Color.Yellow); //find and set the parent tmpObj = UVDLPApp.Instance().m_engine3d.Find(parentName); if (tmpObj != null) { tmpObj.AddSupport(obj); } supportLoaded = true; break; default: //load as normal object obj = new Object3d(); //load the model obj.LoadSTL_Binary((MemoryStream)modstr, name); //add to the 3d engine UVDLPApp.Instance().m_engine3d.AddObject(obj); //set the tag obj.tag = tag; break; } } UVDLPApp.Instance().RaiseAppEvent(eAppEvent.eModelAdded, "Scene loaded"); return(true); } catch (Exception ex) { DebugLogger.Instance().LogError(ex); return(false); } }
bool m_voipIncoming = false; // mobile call direction flag #endregion Fields #region Constructors /// <summary> /// Default constructor, cannot be called directly. To obtain singleton call Spokes.Instance. /// </summary> private Spokes() { m_debuglog = null; PreLoadAllDeviceCapabilities(); }
public AddPackageViewModel( Func<string ,IObservable<string>> searchForPackages, Action<NugetResult> addPackageCallback, IObservable<Logging.Trace> paketTraceFunObservable) { var logger = new DebugLogger() {Level = LogLevel.Debug}; Splat.Locator.CurrentMutable.RegisterConstant(logger, typeof(ILogger)); _paketTraceFunObservable = paketTraceFunObservable; SearchNuget = ReactiveCommand.CreateAsyncObservable( this.ObservableForProperty(x => x.SearchText) .Select(x => !string.IsNullOrEmpty(SearchText)), _ => searchForPackages(SearchText) .Select(x => new NugetResult {PackageName = x})); //TODO: Localization var errorMessage = "NuGet packages couldn't be loaded."; var errorResolution = "You may not have internet or NuGet may be down."; SearchNuget.ThrownExceptions .Log(this, "Search NuGet exception:", e => e.ToString()) .Select(ex => new UserError(errorMessage, errorResolution)) .SelectMany(UserError.Throw) .Subscribe(); SearchNuget.IsExecuting .Where(isExecuting => isExecuting) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(_ => { NugetResults.Clear(); }); SearchNuget.Subscribe(NugetResults.Add); AddPackage = ReactiveCommand.CreateAsyncTask( this.WhenAnyValue(x => x.SelectedPackage).Select(x => x != null), _ => Task.Run(() => addPackageCallback(SelectedPackage))); _addPackageState = AddPackage .ThrownExceptions .Log(this, "Add Package exception:", e => e.ToString()) .Select(_ => LoadingState.Failure) .Merge( AddPackage .IsExecuting .Where(isExecuting => isExecuting) .Select(_ => LoadingState.Loading)) .Merge( AddPackage .Select(_ => LoadingState.Success)) .ToProperty(this, v => v.AddPackageState, out _addPackageState); _addPackageState .ThrownExceptions .Log(this, "Add package state exception:", e => e.ToString()) .Select(ex => new UserError("", errorResolution)) .SelectMany(UserError.Throw) .Subscribe(); this.ObservableForProperty(x => x.SearchText) .Where(x => !string.IsNullOrEmpty(SearchText)) .Throttle(TimeSpan.FromMilliseconds(250)) .InvokeCommand(SearchNuget); }
private void CreateSiteChildObjects(ADFactory <T> .DirectoryOperation operation, T instance, ADParameterSet parameters, ADObject directoryObj) { AttributeConverterEntry attributeConverterEntry = null; bool flag = ADFactory <T> .DirectoryOperation.Create == operation; MappingTable <AttributeConverterEntry> item = ADNtdsSiteSettingFactory <ADNtdsSiteSetting> .AttributeTable[base.ConnectedStore]; MappingTable <AttributeConverterEntry> mappingTable = ADReplicationSiteFactory <T> .AttributeTable[base.ConnectedStore]; IDictionary <string, ADPropertyValueCollection> strs = new Dictionary <string, ADPropertyValueCollection>(); if (instance != null) { foreach (string propertyName in instance.PropertyNames) { if (flag && instance[propertyName].Value == null || mappingTable.TryGetValue(propertyName, out attributeConverterEntry) || !item.TryGetValue(propertyName, out attributeConverterEntry)) { continue; } strs.Add(propertyName, instance[propertyName]); } } IDictionary <string, ADPropertyValueCollection> aDPVCDictionary = parameters.GetADPVCDictionary(); foreach (string key in aDPVCDictionary.Keys) { if (mappingTable.TryGetValue(key, out attributeConverterEntry) || !item.TryGetValue(key, out attributeConverterEntry)) { continue; } if (!strs.ContainsKey(key)) { strs.Add(key, aDPVCDictionary[key]); } else { strs[key] = aDPVCDictionary[key]; } } string str = ADPathModule.MakePath(directoryObj.DistinguishedName, "CN=NTDS Site Settings,", ADPathFormat.X500); ADNtdsSiteSettingFactory <ADNtdsSiteSetting> aDNtdsSiteSettingFactory = new ADNtdsSiteSettingFactory <ADNtdsSiteSetting>(); aDNtdsSiteSettingFactory.SetCmdletSessionInfo(base.CmdletSessionInfo); ADObject directoryObjectFromIdentity = null; if (!flag) { try { ADNtdsSiteSetting aDNtdsSiteSetting = new ADNtdsSiteSetting(str); directoryObjectFromIdentity = aDNtdsSiteSettingFactory.GetDirectoryObjectFromIdentity(aDNtdsSiteSetting, directoryObj.DistinguishedName); } catch (ADIdentityNotFoundException aDIdentityNotFoundException) { DebugLogger.LogInfo(this._debugCategory, string.Format("ADReplicationSiteFactory: Ntds-Site-Setting object not found for the site {0}, while updating the properties of the ntds-site-settings", directoryObj.DistinguishedName)); } } if (directoryObjectFromIdentity == null) { flag = true; directoryObjectFromIdentity = new ADObject(str, aDNtdsSiteSettingFactory.StructuralObjectClass); } foreach (string key1 in strs.Keys) { if (!item.TryGetValue(key1, out attributeConverterEntry) || !attributeConverterEntry.IsDirectoryConverterDefined) { continue; } attributeConverterEntry.InvokeToDirectoryConverter(strs[key1], directoryObjectFromIdentity, base.CmdletSessionInfo); } using (ADActiveObject aDActiveObject = new ADActiveObject(base.CmdletSessionInfo.ADSessionInfo, directoryObjectFromIdentity)) { if (!flag) { aDActiveObject.Update(); } else { aDActiveObject.Create(); } } if (operation == ADFactory <T> .DirectoryOperation.Create) { this.CreateServerContainer(directoryObj.DistinguishedName); } }
public RRACSession(DebugLogger logger, SubProtocol subProtocol) : base(logger) { this.subProtocol = subProtocol; this.pendingReplies = new Dictionary<RRACCommand, TransactionNode>(1); }
/// <summary> /// Save the entire scene into a zip file with a manifest /// This file will later be re-used to store png slicee, gcode & svg /// </summary> /// <param name="scenename"></param> /// <returns></returns> public bool Save(string scenefilename) { try { UVDLPApp.Instance().SceneFileName = scenefilename; // open a zip file with the scenename // iterate through all objects in engine string xmlname = "manifest.xml"; XmlHelper manifest = new XmlHelper(); //start the doc with no filename, becasue we're saving to a memory stream manifest.StartNew("", "manifest"); //start a new stream to store the manifest file MemoryStream manifeststream = new MemoryStream(); //create a new zip file ZipFile zip = new ZipFile(); //get the top-level node in the manifest //XmlNode mc = manifest.m_toplevel; // Add in a section for GCode if present XmlNode gcn = manifest.AddSection(manifest.m_toplevel, "GCode"); if (UVDLPApp.Instance().m_gcode != null) { //create the name of the gcode file String GCodeFileName = Path.GetFileNameWithoutExtension(scenefilename) + ".gcode"; manifest.SetParameter(gcn, "filename", GCodeFileName); Stream gcs = new MemoryStream(); //save to memory stream UVDLPApp.Instance().m_gcode.Save(gcs); //rewind gcs.Seek(0, SeekOrigin.Begin); //create new zip entry zip.AddEntry(GCodeFileName, gcs); } XmlNode mc = manifest.AddSection(manifest.m_toplevel, "Models"); //we need to make sure that only unique names are put in the zipentry // cloned objects yield the same name List <string> m_uniquenames = new List <string>(); // we can adda 4-5 digit code to the end here to make sure names are unique int id = 0; string idstr; foreach (Object3d obj in UVDLPApp.Instance().m_engine3d.m_objects) { //create a unique id to post-fix item names id++; idstr = string.Format("{0:0000}", id); idstr = "_" + idstr; //create a new memory stream MemoryStream ms = new MemoryStream(); //save the object to the memory stream obj.SaveSTL_Binary(ref ms); //rewind the stream to the beginning ms.Seek(0, SeekOrigin.Begin); //get the file name with no extension string objname = Path.GetFileNameWithoutExtension(obj.Name); //spaces cause this to blow up too objname = objname.Replace(' ', '_'); // add a value to the end of the string to make sure it's a unique name objname = objname + idstr; string objnameNE = objname; objname += ".stl"; // stl file zip.AddEntry(objname, ms); //create an entry for this object, using the object name with no extension //save anything special about it //XmlNode objnode = manifest.AddSection(mc, objnameNE); XmlNode objnode = manifest.AddSection(mc, "model"); manifest.SetParameter(objnode, "name", objnameNE); manifest.SetParameter(objnode, "tag", obj.tag); if (obj.tag != Object3d.OBJ_NORMAL && obj.m_parrent != null) { // note it's parent name in the entry manifest.SetParameter(objnode, "parent", Path.GetFileNameWithoutExtension(obj.m_parrent.Name)); } } //save the gcode //save the XML document to memorystream manifest.Save(1, ref manifeststream); manifeststream.Seek(0, SeekOrigin.Begin); //manifeststream. //save the memorystream for the xml metadata manifest into the zip file zip.AddEntry(xmlname, manifeststream); //save the zip file zip.Save(scenefilename); return(true); } catch (Exception ex) { DebugLogger.Instance().LogError(ex); } return(false); }
/// <remarks/> public void DebugMessageAsync(DebugLogger log) { this.DebugMessageAsync(log, null); }
private void Awake() { debug = new DebugLogger(this, () => false); }
/// <summary> /// First call to this object (constructor). /// </summary> private void Awake() { instance = this; }