public PhilosopherBehaviour(ChannelOutput service, ChannelInput deliver, ChannelOutput toConsole, int id) { this.service = service; this.deliver = deliver; this.toConsole = toConsole; this.id = id; }
public GConsole(ChannelInput toConsole, ChannelOutput fromConsole, ChannelInput clearInputArea, string frameLabel) { this.toConsole = toConsole; this.fromConsole = fromConsole; this.clearInputArea = clearInputArea; this.frameLabel = frameLabel; }
public SingleProcess(ChannelInput input, ChannelOutput output, int n) { this.input = input; this.output = output; this.n = n; //this.timeout = timeout; }
private NetAltingConnectionClient(AltingChannelInput input, ChannelOutput toLink, Link link, ConnectionData connData, NetConnectionLocation loc, NetworkMessageFilter.FilterTx filterTX, NetworkMessageFilter.FilterRx filterRX) : base(input) { this.toLinkTX = toLink; this.In = input; this.data = connData; this.serverLocation = loc; this.localLocation = new NetConnectionLocation(Node.getInstance().getNodeID(), connData.vconnn); this.outputFilter = filterTX; this.inputFilter = filterRX; if (link != null) { this.linkConnectedTo = link; // TODO: registration stuff this.isLocal = false; this.localConnection = null; } else { this.isLocal = true; this.localConnection = ConnectionManager.getInstance().getConnection(this.serverLocation.getVConnN()); this.linkConnectedTo = null; } }
public Variate(ChannelOutput Out, int start, int stop, int n) { this.Out = Out; this.start = start; this.stop = stop; this.n = n; }
/** * Receives some data from a client once a connection * has been established. This will block until the client * calls <code>request(Object)</code> but by establishing * a connection. * * @return the <code>Object</code> sent by the client. */ public Object request() //throws IllegalStateException { if (currentServerState == SERVER_STATE_RECEIVED) { throw new InvalidOperationException("Cannot call request() twice on ConnectionServer without replying to the client first."); } ConnectionClientMessage msg = (ConnectionClientMessage)currentInputChannel.read(); if (currentServerState == SERVER_STATE_CLOSED) { if (msg is ConnectionClientOpenMessage) { //channel to use to reply to client toClient = ((ConnectionClientOpenMessage)msg).replyChannel; setAltingChannel(furtherRequestIn); currentInputChannel = furtherRequestIn; //create a new msg for connection established //don't know if client implementation will have finished with //message after connection closed this.msg = new ConnectionServerMessage(); } else { throw new InvalidOperationException("Invalid message received from client"); } } currentServerState = SERVER_STATE_RECEIVED; return(msg.data); }
/** * Sends some data back to the client after a request * has been received. The closed parameter indicates whether or not * the connection should be closed. The connection will be closed * iff close is <code>true</code>. * * @param data the data to send to the client. * @param close <code>boolean</code> indicating whether or not the * connection should be closed. */ public void reply(Object data, Boolean close)// throws { try { if (currentServerState != SERVER_STATE_RECEIVED) { throw new InvalidOperationException("Cannot call reply(Object, boolean) on a ConnectionServer that has not received an unacknowledge request."); } //set open to true before replying msg.data = data; msg.open = !close; toClient.write(msg); if (close) { currentServerState = SERVER_STATE_CLOSED; toClient = null; setAltingChannel(openIn); currentInputChannel = openIn; } else { currentServerState = SERVER_STATE_OPEN; } } catch (InvalidOperationException) { throw; } }
public StressedWriterPerformance(ChannelOutput Out, int channel, int writer, int writerID) { this.Out = Out; this.channel = channel; this.writer = writer; this.writerID = writerID; }
public virtual void ChannelStep(int cycles) { if (!Active || _spu.Device.Cpu.SpeedFactor < 0.5) { return; } UpdateVolume(cycles); const float maxAmplitude = 0.05f; double realFrequency = 131072.0 / (2048.0 - Frequency) / 2; int sampleRate = ChannelOutput.SampleRate; double timeDelta = (cycles / GameBoyCpu.OfficialClockFrequency) / _spu.Device.Cpu.SpeedFactor * 2; int sampleCount = (int)(timeDelta * sampleRate); float[] buffer = new float[sampleCount]; if (!UseSoundLength || _length >= 0) { for (int i = 0; i < buffer.Length; i++) { buffer[i] = (float)(maxAmplitude * (_volume / 15.0) // Volume adjustments. * Math.Sign(Math.Sin(2 * Math.PI * realFrequency * _coordinate / sampleRate))); // Square wave formula _coordinate = (_coordinate + 1) % sampleRate; } if (UseSoundLength) { _length -= timeDelta; } } ChannelOutput.BufferSoundSamples(buffer, 0, buffer.Length); }
public async Task Reply(ICommandContext context, EmbedBuilder embed) { await Task.Run(async() => { ChannelOutput replyChannel; var guildInfo = context.Guild; if (guildInfo == null) { replyChannel = new ChannelOutput(); } else { replyChannel = GetGuildBotChannel(context.Guild.Id); } if (!string.IsNullOrEmpty(replyChannel.ChannelName)) { var messageChannel = await context.Client.GetChannelAsync((ulong)replyChannel.ChannelId) as ISocketMessageChannel; await messageChannel.SendMessageAsync("", false, embed.Build()); } else { await context.Channel.SendMessageAsync("", false, embed.Build()); } }); }
public StressedWriter(ChannelOutput Out, int channel, int writer) { this.Out = Out; this.channel = channel; this.writer = writer; this.id = "channel " + channel + " writer " + writer; }
public Regulate(AltingChannelInput In, AltingChannelInput reset, ChannelOutput Out, long initialInterval) { this.In = In; this.reset = reset; this.Out = Out; this.initialInterval = initialInterval; }
/** * Private constructor for creating a One2NetChannel. This is called by the create method. * * @param ackChannel * The channel used to receive acknowledgements from Links * @param toLink * The channel used to send messages to the input end * @param link * The Link that this channel is connected to * @param chanData * The structure used to store the state of the channel * @param loc * The location of the input end that this channel is connected to * @param immunity * The poison immunity level of the channel * @param filter * Filter used to encode outgoing messages */ private One2NetChannel(AltingChannelInput ackChannel, ChannelOutput toLink, Link link, ChannelData chanData, NetChannelLocation loc, int immunity, NetworkMessageFilter.FilterTx filter) { // Set all the object properties for the channel this.toLinkTx = toLink; this.theAckChannel = ackChannel; this.data = chanData; this.remoteLocation = loc; this.localLocation = new NetChannelLocation(Node.getInstance().getNodeID(), chanData.vcn); this.data.immunityLevel = immunity; this.messageFilter = filter; // We now must either register with the Link connecting us to the input end, or we connect directly to the // channel if it is local if (link != null) { // We are connected to a remote Node. Register with Link this.linkConnectedTo = link; this.linkConnectedTo.registerChannel(this.data); // Set the localised parameters accordingly this.isLocal = false; this.localChannel = null; } else { // We are connected to an input end on this Node. Set the localised parameters this.isLocal = true; // Get hold of the local channel data structure this.localChannel = ChannelManager.getInstance().getChannel(this.remoteLocation.getVCN()); // Set the Link connected to to null this.linkConnectedTo = null; } }
//if (Context.Channel is IDMChannel) //{ // await ReplyAsync("DM"); //} //else if (Context.Channel is IGuildChannel) //{ // await ReplyAsync("Channel"); //} public async Task SetGuildBotChannelAsync(ulong channelId, string channelName, ulong userId, string userName, string guildName, ulong guildId) { await Task.Run(async() => { using (var db = new NinjaBotEntities()) { var currentChannel = db.ChannelOutputs.FirstOrDefault(o => o.ServerId == (long)guildId); if (currentChannel == null) { var createChannel = new ChannelOutput { ChannelId = (long)channelId, ChannelName = channelName, ServerId = (long)guildId, ServerName = guildName, SetById = (long)userId, SetByName = userName, SetTime = DateTime.Now }; db.ChannelOutputs.Add(createChannel); } else { currentChannel.ChannelId = (long)channelId; currentChannel.ChannelName = channelName; currentChannel.ServerId = (long)guildId; currentChannel.ServerName = guildName; currentChannel.SetById = (long)userId; currentChannel.SetByName = userName; currentChannel.SetTime = DateTime.Now; } await db.SaveChangesAsync(); } }); }
public ChannelOutputList(Object[] channelListArray) { channelOutputs = new List <ChannelOutput>(); ChannelOutput[] outputEnds = new ChannelOutput[channelListArray.Length]; var name = channelListArray.GetType().Name; name = name.Substring(0, name.Length - 2); //removed array symbols [] to use the channel type name in Switch - Karo Pasierb switch (name) { case nameof(Any2AnyChannel): outputEnds = Channel.getOutputArray((Any2AnyChannel[])channelListArray); break; case nameof(Any2OneChannel): outputEnds = Channel.getOutputArray((Any2OneChannel[])channelListArray); break; case nameof(One2AnyChannel): outputEnds = Channel.getOutputArray((One2AnyChannel[])channelListArray); break; case nameof(One2OneChannel): outputEnds = Channel.getOutputArray((One2OneChannel[])channelListArray); break; } for (int i = 0; i < channelListArray.Length; i++) { channelOutputs.Add(outputEnds[i]); } }
public QueuingCanteen(ChannelInput service, ChannelOutput deliver, ChannelInput supply, ChannelOutput toConsole) { this.service = service; this.deliver = deliver; this.supply = supply; this.toConsole = toConsole; }
public AltingBarrierExampleProcess( AltingChannelInput click, AltingBarrier group, ChannelOutput configure ) { this.click = click; this.group = group; this.configure = configure; }
public ResetUser(ChannelOutput resetValue, ChannelOutput toConsole, AltingChannelInput fromConverter, ChannelOutput toClearOutput) { this.resetValue = resetValue; this.toConsole = toConsole; this.fromConverter = fromConverter; this.toClearOutput = toClearOutput; }
public ResetPrefix(int prefixValue, ChannelOutput outChannel, AltingChannelInput inChannel, ChannelInput resetChannel) { this.prefixValue = prefixValue; this.outChannel = outChannel; this.inChannel = inChannel; this.resetChannel = resetChannel; }
public AltingBarrierGadget0( AltingChannelInput click, AltingBarrier group, ChannelOutput configure ) { this.click = click; this.group = group; this.configure = configure; }
/** * Constructs and returns an array of output channel ends, each of which can only be used by a * s_ingle writer. The returned array, <code>r</code>, is constructed such that * <code>r[i] = c[i].out ()</code> for <code>0 <= i < c.Length</code>. * * @param c the array of channel to obta_in output ends from. * @return the array of output _input ends. */ public static ChannelOutput[] getOutputArray(One2OneChannel[] c) { ChannelOutput[] _in = new ChannelOutput[c.Length]; for (int i = 0; i < c.Length; i++) { _in[i] = c[i].Out(); } return(_in); }
public Vestibule(Bucket[] groups, ChannelInput needToConsult, ChannelOutput joinGroup, ChannelInput openForBusiness, ChannelInput consultationOver) { this.groups = groups; this.needToConsult = needToConsult; this.joinGroup = joinGroup; this.openForBusiness = openForBusiness; this.consultationOver = consultationOver; }
public AltingBarrierExampleProcess( AltingChannelInput input, AltingBarrier barrier, ChannelOutput output, int num ) { this.input = input; this.barrier = barrier; this.output = output; this.num = num; }
public ActionResult Add(string a) { //3. Create a channel //3.1 Create Channel Input var input = new ChannelInput { StreamingProtocol = StreamingProtocol.RTMP, AccessControl = new ChannelAccessControl { IPAllowList = new List <IPRange> { new IPRange { Name = "MyInput", Address = IPAddress.Parse("0.0.0.0"), SubnetPrefixLength = 0 } } } }; //3.2 Create Channel Preview var preview = new ChannelPreview { AccessControl = new ChannelAccessControl { IPAllowList = new List <IPRange>() { new IPRange { Name = "MyPreview", Address = IPAddress.Parse("0.0.0.0"), SubnetPrefixLength = 0 } } } }; //3.3 Create Channel Output var output = new ChannelOutput { Hls = new ChannelOutputHls { FragmentsPerSegment = 1 } }; var channel = _context.Channels.Create(new ChannelCreationOptions { Name = "Channel-Returngis-1", Input = input, Preview = preview, Output = output }); channel.Start(); return(View()); }
public void Channels_Verify() { var settingWrong1 = new ChannelOutput(0); var settingWrong2 = new ChannelOutput(-1); var setting = new ChannelOutput(1); Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong1); }); Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong2); }); Assert.Equal("-ac 1", SettingSerializer.Serialize(setting)); }
public Controller(long testInterval, long computeInterval, int addition, ChannelInput factor, ChannelOutput suspend, ChannelOutput injector) { this.testInterval = testInterval; this.computeInterval = computeInterval; this.addition = addition; this.factor = factor; this.suspend = suspend; this.injector = injector; }
protected internal SharedConnectionServerImpl(AltingChannelInput openIn, AltingChannelInput requestIn, ChannelInput synchIn, SharedChannelOutput synchOut, ConnectionWithSharedAltingServer parent) { connectionServerToUse = new AltingConnectionServerImpl(openIn, requestIn); this.synchOut = synchOut; this.synchIn = synchIn; this.parent = parent; }
public void Channels_Verify() { var settingWrong1 = new ChannelOutput(0); var settingWrong2 = new ChannelOutput(-1); var setting = new ChannelOutput(1); Assert.Throws <InvalidOperationException>(() => { var s = settingWrong1.GetAndValidateString(); }); Assert.Throws <InvalidOperationException>(() => { var s = settingWrong2.GetAndValidateString(); }); Assert.DoesNotThrow(() => { var s = setting.GetAndValidateString(); }); Assert.Equal(setting.GetAndValidateString(), "-ac 1"); }
public Scale(ChannelInput inChannel, ChannelOutput outChannel, ChannelOutput factor, ChannelInput suspend, ChannelInput injector, int multiplier, int scaling) { this.outChannel = outChannel; this.factor = factor; this.inChannel = inChannel; this.suspend = suspend; this.injector = injector; this.multiplier = multiplier; this.scaling = scaling; }
public Reindeer(int number, AltingBarrier stable, ChannelOutput harness, ChannelInput harnessed, ChannelInput returned, ChannelInput unharness, int holidayTime) { this.number = number; this.stable = stable; this.harness = harness; this.harnessed = harnessed; this.returned = returned; this.unharness = unharness; this.holidayTime = holidayTime; }