private void InstanceToJson(StringBuilder sb, IInstance inst) { // [id,[x,y],[scaleX, scaleY, rotation*, skew*], "name"] sb.Append("["); sb.Append(inst.DefinitionId + ","); sb.Append(inst.InstanceHash + ","); Vex.Matrix m = inst.GetTransformAtTime(0).Matrix; sb.Append("[" + m.Location.GetSVG() + "]"); if(m.HasScaleOrRotation()) { Vex.MatrixComponents mc = m.GetMatrixComponents(); sb.Append(",[" + mc.ScaleX + "," + mc.ScaleY ); if (mc.Rotation != 0) { sb.Append("," + mc.Rotation); if (mc.Shear != 0) { sb.Append("," + mc.Shear); } } sb.Append("]" ); } if(inst.Name != null && inst.Name != "") { sb.Append(",\"" + inst.Name + "\""); } sb.Append("]"); }
public CurrentElectricityConsumption(Event.IMediator eventMediator, IClock clock, IInstance entity) { _eventMediator = eventMediator; _clock = clock; _entity = entity; _identity = new Identity(ObservableIdentity); }
public Context(IKernel kernel, IBridge bridge, IInstance instance, Messaging.Client.IEndpoint clientEndpoint, Settings.IProvider settingsProvider) { Kernel = kernel; Bridge = bridge; Instance = instance; Endpoint = clientEndpoint; SettingsProvider = settingsProvider; }
public IResult[] Execute(IInstance[] instances, ITimes times) { return instances .AsParallel() .WithDegreeOfParallelism(this.degree) .Select(Parallelism.CreateCallback(times)) .ToArray(); }
private void Instance_OnProcessEventDone(IInstance in_Sender, ERuntimeErrorCode in_ErrorCode, DateTime in_SystemTime, uint in_HardwareIdentifier, uint in_Channel, EProcessEventType in_ProcessEventType, uint in_SequenceNumber) { }
void EventUniverseDisconnect(IInstance sender) { DisposeTimers(); DisconnectBots(); Instance.ReleaseEvents(); DisconnectBots(); Console.WriteLine("Universe connection lost, trying to reconnect."); Reconnect(ReconnectionType.Universe); }
void Instance_EventWorldList(IInstance sender, VpNet.Core.EventData.World eventData) { var client = _clients.Values.FirstOrDefault(p => p.Instance == sender); if (client != null) { client.Callback.WorldListCallback(eventData); } }
/***************************************************/ /**** Public methods ****/ /***************************************************/ public static bool SetLocation(this Element element, IInstance instance, RevitSettings settings) { if (instance.Location == null) { return(false); } return(SetLocation(element, instance.Location as dynamic, settings)); }
public UpdateDeviceState( IScriptInterpreter scriptInterpreter, ILogger logger, IInstance instance) { this.scriptInterpreter = scriptInterpreter; this.log = logger; this.instance = instance; }
/// <summary> /// Initialises a new instance of the <see cref="ValidateController"/> class /// </summary> public ValidateController( IInstance instanceService, IValidation validationService, IAppResources appResources) { _instanceService = instanceService; _validationService = validationService; _appResourceService = appResources; }
public SimulationContext( IDevices devices, IRateLimiting rateLimiting, IInstance instance) { this.instance = instance; this.Devices = devices; this.RateLimiting = rateLimiting; }
protected virtual void Dispose(bool aDisposing) { if (!mDisposed) { if (aDisposing) { SimulationRuntimeManager.OnRunTimemanagerLost -= onConnectionLost; mItemList.Clear(); mItemRWList.Clear(); mSDataValue = null; if (mTagBrowserForm != null) { mTagBrowserForm.Dispose(); mTagBrowserForm = null; } if (mItemListLock != null) { mItemListLock.Dispose(); mItemListLock = null; } if (mMainCycleTimer != null) { mMainCycleTimer.Dispose(); mMainCycleTimer = null; } if (mDisconnectEvent != null) { mDisconnectEvent.Dispose(); mDisconnectEvent = null; } if (mPLC != null) { mPLC.OnConfigurationChanged -= onConfigurationChanged; mPLC.OnConfigurationChanging -= onConfigurationChanging; mPLC.Dispose(); mPLC = null; } if (mRRManager != null) { mRRManager.OnConnectionLost -= onRemoteConnectionLost; mRRManager.Disconnect(); mRRManager.Dispose(); mRRManager = null; } } mDisposed = true; } }
public bool Checkout() { try { string[] tagname = new string[] { Name }; if (IsTemplate) { _log.Debug(string.Format("Querying galaxy for {0}", Name)); IgObjects queryResult = Galaxy.QueryObjectsByName(EgObjectIsTemplateOrInstance.gObjectIsTemplate, ref tagname); ICommandResult cmd = Galaxy.CommandResult; if (!cmd.Successful) { _log.Warn("QueryObjectsByName Failed:" + cmd.Text + " : " + cmd.CustomMessage); return(false); } ITemplate template = (ITemplate)queryResult[1];//can throw errors here if (template.CheckoutStatus != ECheckoutStatus.notCheckedOut) { _log.Warn(string.Format("Object [{0}] is already checked out by [{1}]", Name, template.checkedOutBy)); return(false); } _log.Debug(string.Format("Checking out {0}", Name)); template.CheckOut(); GRAccessObject = template; _log.Debug(string.Format("Checked out {0}", Name)); return(true); } else { _log.Debug(string.Format("Querying galaxy for {0}", Name)); IgObjects queryResult = Galaxy.QueryObjectsByName(EgObjectIsTemplateOrInstance.gObjectIsInstance, ref tagname); ICommandResult cmd = Galaxy.CommandResult; if (!cmd.Successful) { _log.Warn("QueryObjectsByName Failed:" + cmd.Text + " : " + cmd.CustomMessage); return(false); } IInstance instance = (IInstance)queryResult[1];//can throw errors here if (instance.CheckoutStatus != ECheckoutStatus.notCheckedOut) { _log.Warn(string.Format("Object [{0}] is already checked out by [{1}]", Name, instance.checkedOutBy)); return(false); } _log.Debug(string.Format("Checking out {0}", Name)); instance.CheckOut(); GRAccessObject = instance; _log.Debug(string.Format("Checked out {0}", Name)); return(true); } } catch (Exception ex) { _log.Error(ex); return(false); } }
protected override ExecResult ExecCommand(IInstance instance, long delta) { ExecResult ret = ExecResult.Blocked; while (ret == ExecResult.Blocked) { if (m_CommandQueue.Count == 0) { if (m_Condition.Value != 0) { Prepare(); foreach (ICommand cmd in m_CommandQueue) { cmd.Prepare(instance, m_CurCount, m_Arguments); } ++m_CurCount; ret = ExecResult.Blocked; } else { ret = ExecResult.Finished; } } else { while (m_CommandQueue.Count > 0) { ICommand cmd = m_CommandQueue.Peek(); ExecResult result = cmd.Execute(instance, delta); if (result == ExecResult.Blocked) { break; } else if (result == ExecResult.Finished) { cmd.Reset(); m_CommandQueue.Dequeue(); } else if (result == ExecResult.Parallel) { instance.ParallelCommands.Add(m_CommandQueue.Dequeue()); } else { LogUtil.Warn("Unknown skill exec result, skill {0}", instance.Id); } } ret = ExecResult.Blocked; if (m_CommandQueue.Count > 0) { break; } } } return(ret); }
public void AddInstanceResource(int id, IInstance instance) { lock (m_Lock) { if (!m_Instances.ContainsKey(id)) { m_Instances.Add(id, instance); } } }
protected override ExecResult ExecCommand(IInstance instance, long delta) { GameEntity target = instance.Target as GameEntity; if (null != target) { instance.DisableRotationInput = m_Value; } return(ExecResult.Finished); }
private static Vector3 Move(IInstance instance, GameEntity obj, float rotateDir, Vector3 speed_vect, Vector3 accel_vect, float time) { Vector3 speed = speed_vect + accel_vect * time / 2; Vector3 object_speed = Quaternion.Euler(0, Mathf.Rad2Deg * rotateDir, 0) * speed; instance.Velocity = object_speed; obj.ReplaceRotation(rotateDir); return(speed_vect + accel_vect * time); }
protected override ExecResult ExecCommand(IInstance instance, long delta) { string[] arglist = new string[m_MsgIds.Count]; for (int i = 0; i < m_MsgIds.Count; i++) { arglist[i] = m_MsgIds[i].Value; } instance.ClearMessage(arglist); return(ExecResult.Finished); }
public static void RegisterInstance <T>(IInstance instance) { if (instance.GetType() != typeof(T) && !instance.GetType().IsSubclassOf(typeof(T))) { DebugLog.LogErrorColor("Type mismatch in registering instance of type " + typeof(T).Name, LogColor.red); return; } _instances[typeof(T)] = instance; }
protected override ExecResult ExecCommand(IInstance instance, long delta) { GameEntity obj = instance.Target as GameEntity; if (obj != null) { Services.Instance.ViewService.SetAnimationSpeed(obj, m_AnimName, m_Speed); } return(ExecResult.Finished); }
public ExecResult Execute(IInstance instance, long delta) { if (m_LastExecResult != ExecResult.Finished || m_IscompositeCommand) { // 重复执行时不需要的每个tick都更新变量值,每个命令执行一次,变量值只读取一次。 UpdateVariables(instance); } m_LastExecResult = ExecCommand(instance, delta); return(m_LastExecResult); }
private IInstance GetInstanceResource(int id) { IInstance instance = null; lock (m_Lock) { m_Instances.TryGetValue(id, out instance); } return(instance); }
public ExecResult Execute(IInstance instance, long delta) { if (m_LastExecResult == ExecResult.Unknown) { //重复执行时不需要每个tick都更新变量值,每个命令每次执行,变量值只读取一次。 m_Params.Evaluate(instance); } m_LastExecResult = ExecCommand(instance, (ValueParamType)m_Params, delta); return(m_LastExecResult); }
public static object GetInstance(this IInstance instance) { var property = instance.TryGetConnectedProperty <object, InstanceTag>(); if (property != null) { return(property.GetOrCreate(instance.CreateInstance)); } return(instance.CreateInstance()); }
void EventQueryCellResult(IInstance sender, VpObject objectData) { if (Interpreter.Interpret(objectData).SelectMany(trigger => trigger.Commands).OfType <ACName>().Any(command => command.Name == _config.Config.Name)) { _billBoard = objectData; SetSign(_config.Config.TextItems[0]); _timer = AddTimer(new TimerT <TextRotatorBot>(RotationCallback, this, _config.Config.TextItems[0].Delay, 0)); _timer.Start(); } }
private void TryUpdateValue(IInstance instance) { if (m_Min.HaveValue && m_Max.HaveValue) { m_HaveValue = true; int min = m_Min.Value; int max = m_Max.Value; m_Value = Util.RandomUtil.Next(min, max); } }
/// <summary> /// Construct a <see cref="TestMergeManager"/> /// </summary> /// <param name="interfaceToUse">The <see cref="IInstance"/> to manage pull requests for</param> /// <param name="clientToUse">The <see cref="GitHubClient"/> to use for getting pull request information</param> public TestMergeManager(IInstance interfaceToUse, GitHubClient clientToUse) { InitializeComponent(); DialogResult = DialogResult.Cancel; UpdateToRemoteRadioButton.Checked = true; currentInterface = interfaceToUse; client = clientToUse; Load += PullRequestManager_Load; PullRequestListBox.ItemCheck += PullRequestListBox_ItemCheck; }
public AltinnApp( IAppResources appResourcesService, ILogger <AltinnApp> logger, IData dataService, IProcess processService, IPDF pdfService, IPrefill prefillService, IInstance instanceService) : base(appResourcesService, logger, dataService, processService, pdfService, prefillService, instanceService) { }
/// <summary> /// Регистрирует объект-сервер. /// </summary> public static void RegisterServer(string portName, string objectUri, IInstance instance) { var channel = new IpcChannel(portName); ChannelServices.RegisterChannel(channel, false); RemotingConfiguration.RegisterWellKnownServiceType( instance.GetType(), objectUri, WellKnownObjectMode.Singleton); }
public PreprovisionedIotHub( IServicesConfig config, ILogger logger, IInstance instance) { this.log = logger; this.connectionString = config.IoTHubConnString; this.instance = instance; this.registry = null; }
public void Analyze(IInstance instance) { if (m_ParamNum > 1) { m_Start.Analyze(instance); } if (m_ParamNum > 2) { m_Length.Analyze(instance); } }
//To be implemented for monsters private void SendBattleReportKnockBack(NecClient client, IInstance instance) { MonsterSpawn monster = (MonsterSpawn)instance; IBuffer res = BufferProvider.Provide(); res.WriteUInt32(monster.instanceId); res.WriteFloat(0); res.WriteFloat(2); // delay in seconds router.Send(client.map, (ushort)AreaPacketId.recv_battle_report_noact_notify_knockback, res, ServerType.Area); }
/***************************************************/ internal static void NullObjectPropertiesWarning(this IInstance instance) { string message = "The instance has no object properties."; if (instance != null) { message = string.Format("{0} BHoM Guid: {1}", message, instance.BHoM_Guid); } BH.Engine.Reflection.Compute.RecordError(message); }
public ActorsLogger( ILoggingConfig config, ILogger logger, IInstance instance) { this.enabled = false; this.enabledInConfig = config.ExtraDiagnostics; this.path = config.ExtraDiagnosticsPath.Trim(); this.log = logger; this.instance = instance; }
protected string GetInstanceName(IInstance inst) { string result = "rt"; if (timelineStack.Count > 0) { Instance[] tls = timelineStack.ToArray(); for (int i = 0; i < tls.Length; i++) { result += timelineSeparator + tls[i].InstanceID; } } result += timelineSeparator + inst.InstanceID; return result; }
private static Task<Result> CreateCallbackObjectReferenceCounterTask(IInstance instance, Func<Result> workUnit) { var objectReferenceCounter = _CallbackObjectReferenceCounters[instance]; var taskCompletionSource = new TaskCompletionSource<Result>(); var counter = unchecked(objectReferenceCounter.Counter++); objectReferenceCounter.TaskCompletionSources[counter] = taskCompletionSource; instance.Attributes.ObjectCallbackReference = counter; if(!TryExecuteWorkUnit(taskCompletionSource, workUnit)) { objectReferenceCounter.TaskCompletionSources.Remove(counter); } return taskCompletionSource.Task; }
public DictionaryInstance(IInstance instance) { NumericFeatureIndex = instance.NumericFeatures.ToDictionary( x => x.Name, x => x.Value); NominalFeatureIndex = instance.NominalFeatures.ToDictionary ( x => x.Name, x => x.Value); StringFeatureIndex = instance.StringFeatures.ToDictionary ( x => x.Name, x => x.Value); MissingFeatureIndex = instance.MissingFeatures.ToDictionary ( x => x.Name, x => x.Value); NumericTargetIndex = instance.NumericTargets.ToDictionary ( x => x.Name, x => x.Value); NominalTargetIndex = instance.NominalTargets.ToDictionary ( x => x.Name, x => x.Value); MissingTargetIndex = instance.MissingTargets.ToDictionary ( x => x.Name, x => x.Value); }
public MacheteInstance(IEmailServiceProvider p, IInstance cfg) { InstanceConfig = cfg; Provider = p; running = false; // // if (InstanceConfig.EmailQueue.TimerIntervalSeconds > 0) { interval = InstanceConfig.EmailQueue.TimerIntervalSeconds * 1000; } // // nlog = LogManager.GetCurrentClassLogger(); // // emailTimer = new Timer(interval); emailTimer.Elapsed += new ElapsedEventHandler(ProcessEvent_EmailQueue); }
private static Task<Result> CreateCallbackWorkItemQueueTask(IInstance instance, Callbacks callback, Func<Result> workUnit) { var callbackWorkItemQueue = _CallbackWorkItemQueues[instance][callback]; var taskCompletionSource = new TaskCompletionSource<Result>(); var callbackWorkItem = new CallbackWorkItem { TaskCompletionSource = taskCompletionSource, WorkUnit = workUnit }; callbackWorkItemQueue.Enqueue(callbackWorkItem); if (callbackWorkItemQueue.Count <= 1 && !TryExecuteWorkUnit(taskCompletionSource, workUnit)) { callbackWorkItemQueue.Dequeue(); } return taskCompletionSource.Task; }
private IEnumerable<IGatewayActionable> CreateActionable(IInstance entity, Command.Response.Device device) { return Enumerable.Empty<IGatewayActionable>(); }
public IGatewayObservable ForEntity(IInstance instance) { return new CurrentElectricityConsumption(_eventMediator, _clock, instance); }
private static void HandleInstanceDisposing(IInstance sender) { _CallbackWorkItemQueues.Remove(sender); _CallbackObjectReferenceCounters.Remove(sender); sender.Disposing -= HandleInstanceDisposing; }
public RtpCdotData() { versionModel = GenericAddOnFactory<IInstance, RtpVersionModel>.CreateInstance(); }
private IEnumerable<IGatewayObservable> CreateObservable(IInstance entity, Command.Response.Device device) { return _observableFactory.CreateForEntityDeviceType(entity, device.DeviceType); }
public void RemoveInstance(IInstance inst) { Instances.Remove(inst); inst.ParentDefinitionId = 0; HasSaveableChanges = true; }
public void AddInstance(IInstance inst) { Instances.Add(inst); inst.ParentDefinitionId = this.Id; HasSaveableChanges = true; }
/// <summary> /// 实例实体对象 /// </summary> /// <param name="key">实例唯一key</param> /// <param name="instance">实例对象</param> internal InstanceEntity(string key, IInstance instance) { Key = key; Instance = instance; IsRunning = false; }
public void Add(IInstance instance) { mocks.Add(instance); }
private void WriteInstance(IInstance inst) { // [defid,hasVals[7:bool], x?,y?,scaleX?, scaleY?, rotation?, skew?, "name"? //[9,[262.5,53.26]], //[5,[519.83,248.82],[5.042175,5.0422,54.15462]], //[3,[122.32,70.4],[0.9999654,0.9999616,-30.16027],"name"] WriteBits(inst.DefinitionId, idBitCount); WriteBits(inst.InstanceHash, idBitCount); Vex.Matrix m = inst.GetTransformAtTime(0).Matrix; Vex.MatrixComponents mc = m.GetMatrixComponents(); int[] vals = new int[] { (int)(mc.TranslateX * DrawObject.twips), (int)(mc.TranslateY * DrawObject.twips), (int)(mc.ScaleX * DrawObject.twips), (int)(mc.ScaleY * DrawObject.twips), (int)(mc.Rotation * DrawObject.twips), (int)(mc.Shear * DrawObject.twips) }; bool[] hasVals = new bool[] { vals[0] != 0, vals[1] != 0, vals[2] != DrawObject.twips, vals[3] != DrawObject.twips, vals[4] != 0, vals[5] != 0 }; bool hasName = !((inst.Name == null) || (inst.Name == "")); bool hasNumber = false; for (int i = 0; i < hasVals.Length; i++) { WriteBit(hasVals[i]); if (hasVals[i]) { hasNumber = true; } } WriteBit(hasName); if (hasNumber) { uint nBits = MinBits(vals); // always positive WriteNBitsCount(nBits); for (int i = 0; i < hasVals.Length; i++) { if (hasVals[i]) { WriteBits(vals[i], nBits); } } } if (hasName) { // todo: write name strings } }
public CaseGroup(ICaseInfo @case, IInstance[] instances) { this.@case = @case; this.instances = instances; }
public AttributeProvider(IInstance instance) { _instance = instance; }
public void InsertInstance(int depth, IInstance inst) { Instances.Insert(depth, inst); inst.ParentDefinitionId = this.Id; HasSaveableChanges = true; }
private Scanner() { _scanInstance = ScProxy.CreateInstance(); if (Valid) _scanInstance.ContextFile = "scapi.ini"; }
private static void AddCallbackObjectReferenceCounterHandler(IInstance instance, Action<InstanceCallbackHandler> addHandlerAction) { if(!_CallbackObjectReferenceCounters.ContainsKey(instance)) { _CallbackObjectReferenceCounters[instance] = new CallbackObjectReferenceCounter(); addHandlerAction(CreateObjectReferenceCounterCallbackHandler()); } }
private static void AddCallbackWorkItemQueueHandler(IInstance instance, Callbacks callback, Action<InstanceCallbackHandler> addHandlerAction) { if(!_CallbackWorkItemQueues.ContainsKey(instance)) { _CallbackWorkItemQueues[instance] = new Dictionary<Callbacks, Queue<CallbackWorkItem>>(); } if (_CallbackWorkItemQueues[instance].ContainsKey(callback)) { return; } _CallbackWorkItemQueues[instance].Add(callback, new Queue<CallbackWorkItem>()); addHandlerAction(CreateWorkItemQueueCallbackHandler(callback)); }
/// <summary> /// /// </summary> /// <param name="instance"> /// A <see cref="IInstance"/> /// </param> public void AddInstance(IInstance instance) { this.instances.Add (instance); }