public static float Average(this Color color, Channels channels) { float sum = 0f; int channelCount = 0; if ((channels & Channels.R) != 0) { sum += color.r; channelCount++; } if ((channels & Channels.G) != 0) { sum += color.g; channelCount++; } if ((channels & Channels.B) != 0) { sum += color.b; channelCount++; } if ((channels & Channels.A) != 0) { sum += color.a; channelCount++; } return sum / channelCount; }
private OpusDecoder(IntPtr decoder, SamplingRate.Template outputSamplingRateHz, Channels.Template outputChannels) { _decoder = decoder; OutputSamplingRate = outputSamplingRateHz; OutputChannels = outputChannels; MaxDataBytes = 4000; }
public Grabber(CheatEngineReader table, MemoryReader reader) { Config = new Configuration(this); //TEMPORARY configuration! Config.SamplesBeforeTrigger = 750; Config.SamplesAfterTrigger = 750; Config.SampleWaitTime = 10000;//ms, 1ms here Config.Trigger_Simple_Channel = 0; // gear Config.Trigger_Simple_Condition = TriggerCondition.IN_RANGE; // Rising up Config.Trigger_Simple_ValueType = MemoryChannelType.INT32; Config.Trigger_Simple_Value = new byte[4] { 3, 0, 0, 0 }; // INT32 (5) Config.Trigger_Simple_Value2 = new byte[4] { 5, 0, 0, 0 }; // INT32 (5) Config.Trigger_Simple = true; Channels = new Channels(this,table); Waveform = new Waveform(this); Trigger = new Triggering(this); this.Reader = reader; _mGrabberTiming = new MicroStopwatch(); TritonBase.PreExit += Stop; }
public Tv(string nameTv, bool stateTv, Channels channelCur, byte volumeCur, byte brightCur) : base(nameTv, stateTv) { channel = channelCur; volume = new Param(volumeCur, 1, 5); bright = new Param(brightCur, 1, 5); }
public static float Average(this Color color, Channels channels) { float average = 0; int axisCount = 0; if (channels.Contains(Channels.R)) { average += color.r; axisCount += 1; } if (channels.Contains(Channels.G)) { average += color.g; axisCount += 1; } if (channels.Contains(Channels.B)) { average += color.b; axisCount += 1; } if (channels.Contains(Channels.A)) { average += color.a; axisCount += 1; } return average / axisCount; }
public static void RegisterChannel(string prefix, Channels.Channel channel) { lock (m_channels) { m_channels.Add(prefix, channel); } }
public void can_read_after_select_on_queued_Channels() { var ch1 = new Channel<int>(1); var ch2 = new Channel<bool>(1); ThreadPool.QueueUserWorkItem(state => { ch1.Send(123); ch2.Send(true); ch2.Close(); ch1.Send(124); ch1.Close(); }); using (var select = new Channels(Op.Recv(ch1), Op.Recv(ch2))) { var got = select.Select(); Debug.Print("got.Index = " + got.Index); if (got.Index == 0) { Assert.AreEqual(123, got.Value, "got.Value"); Assert.AreEqual(Maybe<bool>.Some(true), ch2.Recv()); } else { Assert.AreEqual(1, got.Index, "got.Index"); Assert.AreEqual(true, got.Value, "got.Value"); Assert.AreEqual(Maybe<int>.Some(123), ch1.Recv()); } select.ClearAt(1); got = select.Select(); Assert.AreEqual(0, got.Index, "got.Index, value =" + got.Value); Assert.AreEqual(124, got.Value, "got.Value"); } }
/// <summary> /// /// </summary> /// <param name="channel"></param> /// <returns></returns> public int GetChannel(Channels channel) { //Odd high //Even low byte[] msb = new byte[] { (byte)((int)channel << 1) }; byte[] lsb = new byte[] { (byte)(((int)channel << 1) + 1) }; byte[] msbOut = new byte[1]; byte[] lsbOut = new byte[1]; I2CDevice.I2CTransaction[] transaction = new I2CDevice.I2CTransaction[] { I2CDevice.CreateWriteTransaction(msb), I2CDevice.CreateReadTransaction(msbOut), I2CDevice.CreateWriteTransaction(lsb), I2CDevice.CreateReadTransaction(lsbOut), }; int output = ((((int) msbOut[0]) << 8) | (lsbOut[0])); return output; }
/// <summary> /// Initialize the mixer API. /// This must be called before using other functions in this library. /// </summary> /// <param name="frequency">Output sampling frequency in samples per second (Hz). You might use DEFAULT_FREQUENCY(22050) since that is a good value for most games. </param> /// <param name="audioFormat">Output sample format.</param> /// <param name="channels">Number of sound channels in output. Set to Channels.STEREO(2) for stereo, Channels.MONO(1) for mono. This has nothing to do with mixing channels. </param> /// <param name="sampleSize">Bytes used per output sample.</param> public void Initialize(int frequency, ushort audioFormat, Channels channels, int sampleSize) { int iResult = SDL_mixer.Mix_OpenAudio(frequency, audioFormat, (int)channels, sampleSize); if (0 != iResult) { throw new Exception("Error while trying to initialize SDL_mixer: " + SDL.SDL_GetError()); } _bAudioInitialized = true; }
public static Color Div(this Color color, Color otherVector, Channels channels) { color.r = channels.Contains(Channels.R) ? color.r / otherVector.r : color.r; color.g = channels.Contains(Channels.G) ? color.g / otherVector.g : color.g; color.b = channels.Contains(Channels.B) ? color.b / otherVector.b : color.b; color.a = channels.Contains(Channels.A) ? color.a / otherVector.a : color.a; return color; }
public static Color Lerp(this Color color, Color target, float time, Channels channels) { color.r = channels.Contains(Channels.R) && Mathf.Abs(target.r - color.r) > epsilon ? Mathf.Lerp(color.r, target.r, time) : color.r; color.g = channels.Contains(Channels.G) && Mathf.Abs(target.g - color.g) > epsilon ? Mathf.Lerp(color.g, target.g, time) : color.g; color.b = channels.Contains(Channels.B) && Mathf.Abs(target.b - color.b) > epsilon ? Mathf.Lerp(color.b, target.b, time) : color.b; color.a = channels.Contains(Channels.A) && Mathf.Abs(target.a - color.a) > epsilon ? Mathf.Lerp(color.a, target.a, time) : color.a; return color; }
public TV(string name, Channels channel = Channels.Discovery, bool status = false, byte volume = 0, byte contrast = 0, byte abruptness = 0 ) : base(name, status) { this.Name = name; this.Status = status; this.channel = channel; this.Volume = volume; this.Abruptness = abruptness; this.Contrast = contrast; }
/// <summary> /// Creates a new Opus decoder. /// </summary> /// <param name="outputSamplingRateHz">Sample rate to decode at (Hz). This must be one of 8000, 12000, 16000, 24000, or 48000.</param> /// <param name="outputChannels">Number of channels to decode.</param> /// <returns>A new <c>OpusDecoder</c>.</returns> public static OpusDecoder Create(SamplingRate.Template outputSamplingRateHz, Channels.Template outputChannels) { IntPtr error; IntPtr decoder = Api.opus_decoder_create((int)outputSamplingRateHz, (int)outputChannels, out error); if ((ErrorCode)error != ErrorCode.OK) { throw new Exception("Exception occured while creating decoder"); } return new OpusDecoder(decoder, outputSamplingRateHz, outputChannels); }
public static void SetColor(this Renderer renderer, Color color, bool shared = false, Channels channels = Channels.RGBA) { var spriteRenderer = renderer as SpriteRenderer; if (spriteRenderer != null && spriteRenderer.sharedMaterial == null) spriteRenderer.color = spriteRenderer.color.SetValues(color, channels); else if (shared) renderer.sharedMaterial.SetColor(color, channels); else renderer.material.SetColor(color, channels); }
public static void FadeTowards(this Renderer renderer, Color targetColor, float speed, InterpolationModes interpolation, bool shared, Channels channels = Channels.RGBA) { switch (interpolation) { case InterpolationModes.Quadratic: renderer.SetColor(renderer.GetColor().Lerp(targetColor, Time.deltaTime * speed, channels), shared, channels); break; case InterpolationModes.Linear: renderer.SetColor(renderer.GetColor().LerpLinear(targetColor, Time.deltaTime * speed, channels), shared, channels); break; } }
private string GetChannelId(TunerHostInfo info, Channels i) { var id = ChannelIdPrefix + i.GuideNumber.ToString(CultureInfo.InvariantCulture); if (info.DataVersion >= 1) { id += '_' + (i.GuideName ?? string.Empty).GetMD5().ToString("N"); } return id; }
public void TestIntensity(Channels channel){ data = new byte[]{0xC3, 0xD0, 0x05, (byte)((channel == Channels.ChannelA)?0x01:0x02), 0x0, 0x1, 0x02, (byte)((channel == Channels.ChannelA)?0x01:0x02), (channel == Channels.ChannelA)?Settings.Instance.AmplitudeA.CurrentGlobalVal:Settings.Instance.AmplitudeB.CurrentGlobalVal, 0x42, 0x03, 0x02, 0xD2}; TransmitData (); }
public void can_select_on_all_closed_Channels() { var ch1 = new Channel<int>(); var ch2 = new Channel<bool>(); ch1.Close(); ch2.Close(); using (var select = new Channels(Op.Recv(ch1), Op.Recv(ch2))) { var got = select.Select(); Assert.AreNotEqual(-1, got.Index, "expected any channel to return"); Assert.AreEqual(null, got.Value); } }
public static Color Div(this Color color, Color values, Channels channels) { if ((channels & Channels.R) != 0) color.r /= values.r; if ((channels & Channels.G) != 0) color.g /= values.g; if ((channels & Channels.B) != 0) color.b /= values.b; if ((channels & Channels.A) != 0) color.a /= values.a; return color; }
public async Task<Channels> GetPersonalChannelList(InternalChannelItemQuery query, CancellationToken cancellationToken) { int? page = null; if (query.StartIndex.HasValue && query.Limit.HasValue) { page = 1 + (query.StartIndex.Value / query.Limit.Value) % query.Limit.Value; } var pChannels = Plugin.vc.vimeo_people_getSubscriptions(false, false, false, true, false); var channels = new Channels(); channels.AddRange(from pchan in pChannels where pchan.subject_id != "778" && pchan.subject_id != "927" select Plugin.vc.vimeo_channels_getInfo(pchan.subject_id)); return channels; }
public static Color LerpLinear(this Color color, Color target, float time, Channels channels) { Vector4 difference = target - color; Vector4 direction = Vector4.zero.SetValues(difference, channels); float distance = direction.magnitude; Vector4 adjustedDirection = direction.normalized * time; if (adjustedDirection.magnitude < distance) { color += Vector4.zero.SetValues(adjustedDirection, channels); } else { color = color.SetValues(target, channels); } return color; }
public void can_read_after_select() { var ch1 = new Channel<int>(); var ch2 = new Channel<bool>(); ThreadPool.QueueUserWorkItem(state => { ch1.Send(123); ch2.Send(true); ch1.Send(124); }); using (var select = new Channels(Op.Recv(ch1), Op.Recv(ch2))) { var got = select.Select(); Assert.AreEqual(0, got.Index, "select.Index"); Assert.AreEqual(123, got.Value, "select.Value"); Assert.AreEqual(Maybe<bool>.Some(true), ch2.Recv()); Assert.AreEqual(Maybe<int>.Some(124), ch1.Recv()); } }
// .... //https://api.twitch.tv/kraken/chat/mrgalski //GET /chat/:channel/badges //public typehere GetBages(string channel){body here} /// <summary> /// https://github.com/justintv/Twitch-API/blob/master/v3_resources/channels.md#put-channelschannel /// PUT /channels/:channel/ /// </summary> /// <param name="p1">channel name</param> /// <param name="p2">oauth2 token</param> /// <param name="p3">Channels.Channel object</param> /// <returns>TRUE if request succeded, FALSE otherwise</returns> public bool SetChannelDetails(string p1, string p2, Channels.Channel p3) { Debug.Write("from set channel"); string json = string.Format("channel[status]={0}&channel[game]={1}&channel[delay]={2}", p3.status, p3.game, p3.delay); string response = string.Empty; string url = string.Format("https://api.twitch.tv/kraken/channels/{0}", p1); try { HttpWebRequest req = WebRequest.CreateHttp(url); req.Method = "POST"; req.Headers.Set(HttpRequestHeader.Authorization, string.Format("OAuth {0}", p2)); using (Stream stream = req.GetRequestStream()) { byte[] buffer = Encoding.UTF8.GetBytes(json); stream.Write(buffer, 0, buffer.Length); } WebResponse resp = req.GetResponse(); using (StreamReader stream = new StreamReader(resp.GetResponseStream())) { StringBuilder sb = new StringBuilder(); while (!stream.EndOfStream) sb.AppendLine(stream.ReadLine()); response = sb.ToString(); } Debug.Write(response); } catch(Exception e) { Debug.WriteLine(e.Message); return false; } return true; }
public static Color SetValues(this Color color, Color values, Channels channels) { color.r = channels.Contains(Channels.R) ? values.r : color.r; color.g = channels.Contains(Channels.G) ? values.g : color.g; color.b = channels.Contains(Channels.B) ? values.b : color.b; color.a = channels.Contains(Channels.A) ? values.a : color.a; return color; }
private static extern int opus_decoder_get_size(Channels channels);
public DummyAffector(ApplicationContext context, Channels affectedChannels) : base(context, affectedChannels) { }
public void AddToChannelsSet(Channels channels) { base.AddObject("ChannelsSet", channels); }
public void AddChannel(string ChannelName) { Channels.Add(ChannelName); }
public GuildUnreadMessages() { OnClientUpdated += (s, args) => Channels.SetClientsInList(Client); }
public static void FadeTowards(this Renderer renderer, Color targetColor, float deltaTIme, bool shared = false, Channels channels = Channels.RGBA) { renderer.SetColor(renderer.GetColor().Lerp(targetColor, deltaTIme, channels), shared, channels); }
public static void Fade(this Renderer renderer, Color fade, bool shared = false, Channels channels = Channels.RGBA) { renderer.SetColor(renderer.GetColor(shared) + fade, shared, channels); }
public UglyPublishNotificationFirstDraft(string publicUrl, IValue <Subscriptions> subs, IValue <GroupOutlets> userUserOutlets, Channels channels) { _publicUrl = publicUrl; _subs = subs; _channels = channels; _userOutlets = userUserOutlets; }
private DiscordChannel findChannel(string name) { return(Channels.Find(cc => cc.Name == name) ?? null); }
/// <summary> /// Construsctor; reads the LAS file header to memory /// </summary> /// <param name="filename">File name</param> /// <param name="ParseData">Set to true is data parsing is needed</param> public LAS_File(string filename, bool ParseData) : base(filename) { FileStream fs = null; StreamReader sr = null; try { fs = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read); sr = new StreamReader(fs); bool version_info_block_on = false; bool well_info_block_on = false; bool curve_info_block_on = false; bool parameter_info_block_on = false; bool other_info_block_on = false; bool data_on = false; while (!sr.EndOfStream) { string s = sr.ReadLine(); string s2 = s.ToLower(); if (s2.StartsWith("~version")) { version_info_block_on = true; well_info_block_on = false; curve_info_block_on = false; parameter_info_block_on = false; other_info_block_on = false; data_on = false; continue; } if (s2.StartsWith("~well")) { version_info_block_on = false; well_info_block_on = true; curve_info_block_on = false; parameter_info_block_on = false; other_info_block_on = false; data_on = false; continue; } if (s2.StartsWith("~curv") || s2.StartsWith("~log_definition")) { version_info_block_on = false; well_info_block_on = false; curve_info_block_on = true; parameter_info_block_on = false; other_info_block_on = false; data_on = false; continue; } if (s2.StartsWith("~paramet") || s2.StartsWith("~log_parameter")) { version_info_block_on = false; well_info_block_on = false; curve_info_block_on = false; parameter_info_block_on = true; other_info_block_on = false; data_on = false; continue; } if (s2.ToLower().StartsWith("~other")) { version_info_block_on = false; well_info_block_on = false; curve_info_block_on = false; parameter_info_block_on = false; other_info_block_on = true; data_on = false; continue; } if (s2.ToUpper().StartsWith("~A") || s2.StartsWith("~log_data")) { version_info_block_on = false; well_info_block_on = false; curve_info_block_on = false; parameter_info_block_on = false; other_info_block_on = false; data_on = true; if (!ParseData) { break; } continue; } if (version_info_block_on) { if (s.StartsWith("#")) { continue; } if (s.Length <= 1) { continue; } LAS_Constant lc = new LAS_Constant(s); if (lc.Name.ToUpper() == "VERS" && !lc.Value.StartsWith("2.")) { throw new Exception("LAS version other than 2.x cannot be handled."); } if (lc.Name.ToUpper() == "WRAP" && !lc.Value.StartsWith("N")) { throw new Exception("Wrapped data cannot be handled by most clients. Do not use LAS wrap."); } Version.Add(lc); } if (well_info_block_on) { if (s.StartsWith("#")) { continue; } if (s.Length <= 1) { continue; } LAS_Constant lc = new LAS_Constant(s); if (lc.Name == "NULL") { MissingValue = Convert.ToDouble(lc.Value); } Constants.Add(lc); } if (curve_info_block_on) { if (s.StartsWith("#")) { continue; } if (s.Length <= 1) { continue; } LAS_Channel lc = new LAS_Channel(s); Channels.Add(lc); } if (parameter_info_block_on) { if (s.StartsWith("#")) { continue; } if (s.Length <= 1) { continue; } LAS_Constant lc = new LAS_Constant(s); Parameters.Add(lc); } if (other_info_block_on) { if (s.Length <= 1) { continue; } LAS_InfoLine lil = new LAS_InfoLine(s); InfoLines.Add(lil); } if (data_on) { if (s.StartsWith("#")) { continue; } if (s.Length <= 1) { continue; } if (s.StartsWith("~A")) { continue; } m_RawData.Add(s); } } } catch (Exception ex) { throw new Exception(ex.Message); } finally { if (sr != null) { sr.Close(); } if (fs != null) { fs.Close(); } } ConvertConstantsFromEarlierLAS(); // parse data to channels if (Channels.Count <= 0) { throw new Exception("No curves have been declared in the file."); } foreach (string s in m_RawData) { string[] ss = s.Split(_space_split, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < ss.Length; i++) { Channels[i].AddData(ss[i], MissingValue); } } m_RawData.Clear(); }
/// <exception cref="System.Exception"/> public ChannelPipeline GetPipeline() { return(Channels.Pipeline(RpcUtil.ConstructRpcFrameDecoder(), RpcUtil.StageRpcMessageParser , this.idleStateHandler, this._enclosing.handler, RpcUtil.StageRpcTcpResponse)); }
public void AddHook(Channels channel, AuthChannel subChannel, Action <NetIncomingMessage, object> hook, bool oneTime) { AddHook((int)channel, (int)subChannel, hook, oneTime); }
public async Task StartAsync(CancellationToken cancellationToken = default(CancellationToken)) { await ListenerSemaphore.WaitAsync(cancellationToken); await _transportListener.StartAsync(); ProducerConsumer.CreateAsync( c => _transportListener.AcceptTransportAsync(c), async transport => { await transport.OpenAsync(null, _cts.Token); var serverChannel = new ServerChannel( Guid.NewGuid().ToString(), new Node("postmaster", "msging.net", "instance"), transport, TimeSpan.FromSeconds(60), autoReplyPings: true); await serverChannel.EstablishSessionAsync( new[] { SessionCompression.None }, new[] { SessionEncryption.None }, new[] { AuthenticationScheme.Guest, AuthenticationScheme.Key, AuthenticationScheme.Plain, AuthenticationScheme.Transport, AuthenticationScheme.External }, (n, a) => { Authentications.Enqueue(a); return(new AuthenticationResult(null, n).AsCompletedTask()); }, _cts.Token); var channelListener = new ChannelListener( m => { Messages.Enqueue(m); return(TaskUtil.TrueCompletedTask); }, n => { Notifications.Enqueue(n); return(TaskUtil.TrueCompletedTask); }, async c => { Commands.Enqueue(c); if (c.Status == CommandStatus.Pending) { await serverChannel.SendCommandAsync( new Command(c.Id) { Status = CommandStatus.Success, Method = c.Method }, _cts.Token); } return(true); }); channelListener.Start(serverChannel); Channels.Enqueue(serverChannel); return(true); }, _cts.Token); }
public static Color Oscillate(this Color color, Color frequency, Color amplitude, Color center, Color offset, float time, Channels channels) { if ((channels & Channels.R) != 0) { color.r = center.r + amplitude.r * Mathf.Sin(frequency.r * time + offset.r); } if ((channels & Channels.G) != 0) { color.g = center.g + amplitude.g * Mathf.Sin(frequency.g * time + offset.g); } if ((channels & Channels.B) != 0) { color.b = center.b + amplitude.b * Mathf.Sin(frequency.b * time + offset.b); } if ((channels & Channels.A) != 0) { color.a = center.a + amplitude.a * Mathf.Sin(frequency.a * time + offset.a); } return(color); }
public static Color Div(this Color color, float value, Channels channels) { return(color.Div(new Color(value, value, value, value), channels)); }
public static Color LerpLinear(this Color color, Color target, float deltaTime, Channels channels) { Vector4 difference = target - color; Vector4 direction = Vector4.zero.SetValues(difference, (Axes)channels); float distance = direction.magnitude; Vector4 adjustedDirection = direction.normalized * deltaTime; if (adjustedDirection.magnitude < distance) { color += Color.clear.SetValues(adjustedDirection, channels); } else { color = color.SetValues(target, channels); } return(color); }
public void RemoveChannel(string ChannelName) { Channels.Remove(ChannelName); }
public static Color SetValues(this Color color, float value, Channels channels) { return(color.SetValues(new Color(value, value, value, value), channels)); }
public IEnumerator GetEnumerator() { string strError = ""; string strRange = "0-9999999999"; long lTotalCount = 0; // 总命中数 long lExportCount = 0; string strTimeMessage = ""; DigitalPlatform.Stop stop = this.Stop; StopStyle old_style = StopStyle.None; if (stop != null) { old_style = stop.Style; stop.Style = StopStyle.EnableHalfStop; // API的间隙才让中断。避免获取结果集的中途,因为中断而导致 Session 失效,结果集丢失,进而无法 Retry 获取 stop.OnStop += stop_OnStop; } ProgressEstimate estimate = new ProgressEstimate(); try { int i_path = 0; foreach (string path in this.Paths) { ResPath respath = new ResPath(path); string strQueryXml = "<target list='" + respath.Path + ":" + "__id'><item><word>" + strRange + "</word><match>exact</match><relation>range</relation><dataType>number</dataType><maxCount>-1</maxCount></item><lang>chi</lang></target>"; cur_channel = Channels.CreateTempChannel(respath.Url); Debug.Assert(cur_channel != null, "Channels.GetChannel() 异常"); try { long lRet = cur_channel.DoSearch(strQueryXml, "default", out strError); if (lRet == -1) { strError = "检索数据库 '" + respath.Path + "' 时出错: " + strError; throw new Exception(strError); } if (lRet == 0) { strError = "数据库 '" + respath.Path + "' 中没有任何数据记录"; continue; } lTotalCount += lRet; // 总命中数 estimate.SetRange(0, lTotalCount); if (i_path == 0) { estimate.StartEstimate(); } if (stop != null) { stop.SetProgressRange(0, lTotalCount); } SearchResultLoader loader = new SearchResultLoader(cur_channel, stop, this.ResultSetName, this.FormatList, this.Lang); loader.BatchSize = this.BatchSize; foreach (KernelRecord record in loader) { if (stop != null) { stop.SetProgressValue(lExportCount + 1); } lExportCount++; yield return(record); } strTimeMessage = "总共耗费时间: " + estimate.GetTotalTime().ToString(); } finally { cur_channel.Close(); cur_channel = null; } // MessageBox.Show(this, "位于服务器 '" + respath.Url + "' 上的数据库 '" + respath.Path + "' 内共有记录 " + lTotalCount.ToString() + " 条,本次导出 " + lExportCount.ToString() + " 条。" + strTimeMessage); i_path++; } } finally { if (stop != null) { stop.Style = old_style; stop.OnStop -= stop_OnStop; } } }
/// <summary> /// Returns true if EnrichedThingDTO instances are equal /// </summary> /// <param name="input">Instance of EnrichedThingDTO to be compared</param> /// <returns>Boolean</returns> public bool Equals(EnrichedThingDTO input) { if (input == null) { return(false); } return (( Label == input.Label || (Label != null && Label.Equals(input.Label)) ) && ( BridgeUID == input.BridgeUID || (BridgeUID != null && BridgeUID.Equals(input.BridgeUID)) ) && ( Configuration == input.Configuration || Configuration != null && Configuration.SequenceEqual(input.Configuration) ) && ( Properties == input.Properties || Properties != null && Properties.SequenceEqual(input.Properties) ) && ( UID == input.UID || (UID != null && UID.Equals(input.UID)) ) && ( ThingTypeUID == input.ThingTypeUID || (ThingTypeUID != null && ThingTypeUID.Equals(input.ThingTypeUID)) ) && ( Channels == input.Channels || Channels != null && Channels.SequenceEqual(input.Channels) ) && ( Location == input.Location || (Location != null && Location.Equals(input.Location)) ) && ( StatusInfo == input.StatusInfo || (StatusInfo != null && StatusInfo.Equals(input.StatusInfo)) ) && ( FirmwareStatus == input.FirmwareStatus || (FirmwareStatus != null && FirmwareStatus.Equals(input.FirmwareStatus)) ) && ( Editable == input.Editable || (Editable != null && Editable.Equals(input.Editable)) )); }
private static extern OpusStatusCode opus_encoder_init(IntPtr st, SamplingRate Fs, Channels channels, OpusApplicationType application);
public Layer(PsdBinaryReader reader, PsdFile psdFile) : this(psdFile) { Util.DebugMessage(reader.BaseStream, "Load, Begin, Layer"); Rect = reader.ReadRectangle(); //----------------------------------------------------------------------- // Read channel headers. Image data comes later, after the layer header. int numberOfChannels = reader.ReadUInt16(); for (int channel = 0; channel < numberOfChannels; channel++) { var ch = new Channel(reader, this); Channels.Add(ch); } //----------------------------------------------------------------------- // var signature = reader.ReadAsciiChars(4); if (signature != "8BIM") { throw (new PsdInvalidException("Invalid signature in layer header.")); } BlendModeKey = reader.ReadAsciiChars(4); Opacity = reader.ReadByte(); Clipping = reader.ReadBoolean(); var flagsByte = reader.ReadByte(); flags = new BitVector32(flagsByte); reader.ReadByte(); //padding //----------------------------------------------------------------------- // This is the total size of the MaskData, the BlendingRangesData, the // Name and the AdjustmentLayerInfo. var extraDataSize = reader.ReadUInt32(); var extraDataStartPosition = reader.BaseStream.Position; Masks = new MaskInfo(reader, this); BlendingRangesData = new BlendingRanges(reader, this); Name = reader.ReadPascalString(4); //----------------------------------------------------------------------- // Process Additional Layer Information long adjustmentLayerEndPos = extraDataStartPosition + extraDataSize; while (reader.BaseStream.Position < adjustmentLayerEndPos) { var layerInfo = LayerInfoFactory.Load(reader, this.PsdFile, false, adjustmentLayerEndPos); AdditionalInfo.Add(layerInfo); } foreach (var adjustmentInfo in AdditionalInfo) { switch (adjustmentInfo.Key) { case "luni": Name = ((LayerUnicodeName)adjustmentInfo).Name; break; case "lyid": LayerID = ((LayerId)adjustmentInfo).ID; break; } } Util.DebugMessage(reader.BaseStream, "Load, End, Layer, {0}", Name); PsdFile.LoadContext.OnLoadLayerHeader(this); }
private static extern OpusStatusCode opus_decoder_init(IntPtr st, SamplingRate Fs, Channels channels);
public async Task SaveChannel(Channels channel) { channel.CreatedAt = DateTime.Now; await channels.InsertOneAsync(channel); }
private void AddOutputChannels() { Channels.Add(DeviceWrapper.SmallRumble); Channels.Add(DeviceWrapper.BigRumble); Channels.Add(DeviceWrapper.ControlAccelerometer); }
public Channel GetChannel(string name) { return(Channels.FirstOrDefault(channel => channel.Name.Equals(name))); }
public static Color SetValues(this Color color, float value, Channels channels) { return color.SetValues(new Color(value, value, value, value), channels); }
protected override Task <ICommandResult> Handle(UpdateTransactionCommand command) { List <TransactionDetail> transactionDetailList = new List <TransactionDetail>(); var transaction = _transactionRepository.Get(command.TransactionId); if (transaction != null && transaction.CreatedBy != null && transaction.ChannelId != Channels.Feel) { var user = _userRepository.GetByAltId(transaction.CreatedBy); user.PhoneCode = command.DeliveryDetail[0].PhoneCode; user.PhoneNumber = command.DeliveryDetail[0].PhoneNumber; User upadateUserResult = _userRepository.Save(user); } var transactionDetails = AutoMapper.Mapper.Map <IEnumerable <FIL.Contracts.DataModels.TransactionDetail> >(_transactionDetailRepository.GetByTransactionId(command.TransactionId)); var eventTicketAttributeIds = transactionDetails.Select(s => s.EventTicketAttributeId).Distinct(); var eventTicketAttributes = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.EventTicketAttribute> >(_eventTicketAttributeRepository.GetByIds(eventTicketAttributeIds)); var ticketFeeDetails = AutoMapper.Mapper.Map <IEnumerable <Contracts.Models.TicketFeeDetail> >(_ticketFeeDetailRepository.GetByEventTicketAttributeIds(eventTicketAttributeIds)); var isItinerary = TransactionType.Regular; decimal totalConvenienceCharge = 0, smsCharges = 0, totalServiceCharge = 0, totalDeliveryCharge = 0, grossTicketAmount = 0, transactionFee = 0, transactionFeeValue = 0, transactionFeeValueTypeId = 0, creditCardSurcharge = 0, creditCardSurchargeValue = 0, creditCardSurchargeValueTypeId = 0; Channels ChannelID = transaction.ChannelId; foreach (var transactionDetail in transactionDetails) { TransactionDetail transactionDetailMapper = transactionDetail; var eventTicketAttribute = eventTicketAttributes.Where(w => w.Id == transactionDetail.EventTicketAttributeId).FirstOrDefault(); var ticketFeeDetailList = ticketFeeDetails.Where(w => w.EventTicketAttributeId == eventTicketAttribute.Id); var commandDeliveryDetail = command.DeliveryDetail.Where(w => w.EventTicketAttributeId == eventTicketAttribute.Id).FirstOrDefault(); grossTicketAmount += transactionDetail.PricePerTicket * transactionDetail.TotalTickets; } foreach (var transactionDetail in transactionDetails) { TransactionDetail transactionDetailMapper = transactionDetail; if (transactionDetail.TransactionType == TransactionType.Itinerary) { isItinerary = TransactionType.Itinerary; } var eventTicketAttribute = eventTicketAttributes.Where(w => w.Id == transactionDetail.EventTicketAttributeId).FirstOrDefault(); var ticketFeeDetailList = ticketFeeDetails.Where(w => w.EventTicketAttributeId == eventTicketAttribute.Id).OrderBy(o => o.FeeId); // Convert TicketFeeDetails into geo currency... if (ChannelID == Channels.Feel) { _geoCurrency.UpdateTicketFeeDetails(ticketFeeDetailList.ToList(), command.TargetCurrencyCode, eventTicketAttribute.CurrencyId); } var commandDeliveryDetail = command.DeliveryDetail.Where(w => w.EventTicketAttributeId == eventTicketAttribute.Id).FirstOrDefault(); decimal prevConvenienceCharges = 0; decimal DeliveryCharge = 0, ServiceCharge = 0, ConvenienceCharge = 0; decimal convenienceCharges = 0, serviceCharge = 0, pahCharge = 0, unitLevelSMSCharge = 0, unitLevelTransactionFee = 0; foreach (var ticketFeeDetail in ticketFeeDetailList) { if (ticketFeeDetail.FeeId == (int)FeeType.ConvenienceCharge) { if (ticketFeeDetail.ValueTypeId == (int)ValueTypes.Percentage) { convenienceCharges = ((ticketFeeDetail.Value * (transactionDetail.PricePerTicket * transactionDetail.TotalTickets)) / 100); prevConvenienceCharges = convenienceCharges; } else if (ticketFeeDetail.ValueTypeId == (int)ValueTypes.Flat) { convenienceCharges = ticketFeeDetail.Value * transactionDetail.TotalTickets; prevConvenienceCharges = convenienceCharges; } } if (ticketFeeDetail.FeeId == (int)FeeType.SMSCharge) { smsCharges = ticketFeeDetail.Value; } if (ticketFeeDetail.FeeId == (int)FeeType.TransactionFee) { transactionFeeValue = ticketFeeDetail.Value; transactionFeeValueTypeId = ticketFeeDetail.ValueTypeId; } if (ticketFeeDetail.FeeId == (int)FeeType.CreditCardSurcharge) { creditCardSurchargeValue = ticketFeeDetail.Value; creditCardSurchargeValueTypeId = ticketFeeDetail.ValueTypeId; } if (transactionFeeValueTypeId == (int)ValueTypes.Percentage) { transactionFee = ((transactionFeeValue * (totalConvenienceCharge + smsCharges)) / 100); } else if (transactionFeeValueTypeId == (int)ValueTypes.Flat) { transactionFee = transactionFeeValue; } if (creditCardSurchargeValueTypeId == (int)ValueTypes.Percentage) { creditCardSurcharge = ((creditCardSurchargeValue * (grossTicketAmount + transactionFee)) / 100); } else if (creditCardSurchargeValue == (int)ValueTypes.Flat) { creditCardSurcharge = creditCardSurchargeValue; } unitLevelSMSCharge = (smsCharges / transactionDetails.Count()); unitLevelTransactionFee = ((transactionFee + creditCardSurcharge) / transactionDetails.Count()); ConvenienceCharge = convenienceCharges + unitLevelSMSCharge + unitLevelTransactionFee; if (ticketFeeDetail.FeeId == (int)FeeType.ServiceCharge) { if (ticketFeeDetail.ValueTypeId == (int)ValueTypes.Percentage) { serviceCharge = ((ticketFeeDetail.Value * prevConvenienceCharges) / 100); prevConvenienceCharges = 0; } else if (ticketFeeDetail.ValueTypeId == (int)ValueTypes.Flat) { serviceCharge = ticketFeeDetail.Value * transactionDetail.TotalTickets; } } ServiceCharge = serviceCharge; if (commandDeliveryDetail.DeliveryTypeId == DeliveryTypes.PrintAtHome && ticketFeeDetail.FeeId == (int)FeeType.PrintAtHomeCharge) { pahCharge = ticketFeeDetail.Value; } DeliveryCharge = pahCharge; } transactionDetailMapper.ConvenienceCharges = ConvenienceCharge; transactionDetailMapper.ServiceCharge = ServiceCharge; transactionDetailMapper.DeliveryCharges = DeliveryCharge; totalDeliveryCharge += DeliveryCharge; totalServiceCharge += ServiceCharge; totalConvenienceCharge += ConvenienceCharge; transactionDetailList.Add(transactionDetailMapper); } if (transactionFeeValueTypeId == (int)ValueTypes.Percentage) { transactionFee = ((transactionFeeValue * (totalConvenienceCharge + smsCharges)) / 100); } else if (transactionFeeValueTypeId == (int)ValueTypes.Flat) { transactionFee = transactionFeeValue; } if (creditCardSurchargeValueTypeId == (int)ValueTypes.Percentage) { creditCardSurcharge = ((creditCardSurchargeValue * (grossTicketAmount + transactionFee)) / 100); } else if (creditCardSurchargeValue == (int)ValueTypes.Flat) { creditCardSurcharge = creditCardSurchargeValue; } if (transactionFee > 0) { transaction.ConvenienceCharges = transactionFee + creditCardSurcharge; transaction.ServiceCharge = totalServiceCharge; transaction.DeliveryCharges = totalDeliveryCharge; transaction.GrossTicketAmount = grossTicketAmount; transaction.NetTicketAmount = ((grossTicketAmount + transactionFee + creditCardSurcharge) - transaction.DiscountAmount); } else { transaction.ConvenienceCharges = totalConvenienceCharge + transactionFee + creditCardSurcharge; transaction.ServiceCharge = totalServiceCharge; transaction.DeliveryCharges = totalDeliveryCharge; transaction.GrossTicketAmount = grossTicketAmount; transaction.NetTicketAmount = ((grossTicketAmount + totalConvenienceCharge + totalServiceCharge + totalDeliveryCharge + transactionFee + creditCardSurcharge) - transaction.DiscountAmount); } if (ChannelID == Channels.Feel) { _geoCurrency.UpdateTransactionUpdates(transaction, command.TargetCurrencyCode); } FIL.Contracts.DataModels.Transaction transactionResult = _transactionRepository.Save(transaction); foreach (var transactionDetail in transactionDetailList) { TransactionDetail transactionDetailResult = _transactionDetailRepository.Save(transactionDetail); try { if (ChannelID == Channels.Feel) { var currentETA = command.EventTicketAttributeList.Where(s => s.Id == transactionDetail.EventTicketAttributeId && (transactionDetail.TicketTypeId != null ? (TicketType)transactionDetail.TicketTypeId : TicketType.Regular) == s.TicketType).FirstOrDefault(); if (currentETA != null && currentETA.GuestDetails != null) { foreach (FIL.Contracts.Commands.Transaction.GuestUserDetail currentGuestDetail in currentETA.GuestDetails) { _saveGuestUserProvider.SaveGuestUsers(currentGuestDetail, transactionDetail); } } } } catch (Exception e) { _logger.Log(Logging.Enums.LogCategory.Error, e); } } var transactionDeliveryDetails = _transactionDeliveryDetailRepository.GetByTransactionDetailIds(transactionDetails.Select(s => s.Id).Distinct()); foreach (var deliveryDetail in command.DeliveryDetail) { var transactionDeliveryDetail = transactionDeliveryDetails.Where(w => w.TransactionDetailId == transactionDetails.Where(c => c.EventTicketAttributeId == deliveryDetail.EventTicketAttributeId).Select(s => s.Id).FirstOrDefault()).FirstOrDefault(); if (transactionDeliveryDetail == null) { _transactionDeliveryDetailRepository.Save(new TransactionDeliveryDetail { TransactionDetailId = transactionDetails.Where(w => w.EventTicketAttributeId == deliveryDetail.EventTicketAttributeId).Select(s => s.Id).FirstOrDefault(), DeliveryTypeId = deliveryDetail.DeliveryTypeId, PickupBy = Convert.ToInt16(string.IsNullOrWhiteSpace(deliveryDetail.RepresentativeFirstName) ? 0 : 1), SecondaryName = $"{deliveryDetail.FirstName} {deliveryDetail.LastName}", SecondaryContact = $"{deliveryDetail.PhoneCode}-{deliveryDetail.PhoneNumber}", SecondaryEmail = deliveryDetail.DeliveryTypeId == DeliveryTypes.Courier ? deliveryDetail.Email : deliveryDetail.Email, PickUpAddress = command.PickUpAddress }); } else { transactionDeliveryDetail.SecondaryName = $"{deliveryDetail.FirstName} {deliveryDetail.LastName}"; transactionDeliveryDetail.SecondaryContact = $"{deliveryDetail.PhoneCode}-{deliveryDetail.PhoneNumber}"; transactionDeliveryDetail.SecondaryEmail = deliveryDetail.DeliveryTypeId == DeliveryTypes.Courier ? deliveryDetail.Email : deliveryDetail.Email; transactionDeliveryDetail.PickUpAddress = command.PickUpAddress; _transactionDeliveryDetailRepository.Save(transactionDeliveryDetail); } } var transactionresult = _transactionRepository.Get(command.TransactionId); UpdateTransactionCommandResult updateTransactionCommandResult = new UpdateTransactionCommandResult(); updateTransactionCommandResult.Id = transactionresult.Id; updateTransactionCommandResult.CurrencyId = transactionresult.CurrencyId; updateTransactionCommandResult.GrossTicketAmount = transactionresult.GrossTicketAmount; updateTransactionCommandResult.DeliveryCharges = transactionresult.DeliveryCharges; updateTransactionCommandResult.ConvenienceCharges = transactionresult.ConvenienceCharges; updateTransactionCommandResult.ServiceCharge = transactionresult.ServiceCharge; updateTransactionCommandResult.DiscountAmount = transactionresult.DiscountAmount; updateTransactionCommandResult.NetTicketAmount = transactionresult.NetTicketAmount; return(Task.FromResult <ICommandResult>(updateTransactionCommandResult)); }
private async Task GetChannel() { var ch = await _apiChannels.Get(); ch.ForEach(c => Channels.Add(c.Name)); }
public Channel?TryGetChannel(string id) => Channels.FirstOrDefault(c => c.Id == id);
public static void Fade(this Renderer renderer, float fade, bool shared = false, Channels channels = Channels.RGBA) { renderer.Fade(new Color(fade, fade, fade, fade), shared, channels); }
/// <summary> /// /// </summary> /// <returns></returns> public static bool BuildRecreate() { try { LOGs.WriteLine(LogMessageType.MSG_SQL, "SQL: 开始建构SQL领域..."); s_Domain = new Domain(s_ConnectionUrl, ""); //LOGs.WriteLine( LogMessageType.MSG_INFO, "SQL: 连接 {0}", s_Domain.ConnectionUrl ); LOGs.WriteLine(LogMessageType.MSG_SQL, "SQL: 信息 {0}", s_Domain.Driver.Info.Description); s_Domain.RegisterCulture(new Culture("US", "U.S. English", new CultureInfo("en-US", false))); s_Domain.RegisterCulture(new Culture("CN", "China. Chinese", new CultureInfo("zh-CN", false))); s_Domain.RegisterCulture(new Culture("TW", "Taiwan. Chinese", new CultureInfo("zh-TW", false))); s_Domain.Cultures["CN"].Default = true; s_Domain.RegisterTypes(s_RegisterTypes); LOGs.WriteLine(LogMessageType.MSG_SQL, "SQL: 注册 (NameSpace){0}", s_RegisterTypes); s_Domain.Build(DomainUpdateMode.Recreate); } catch (Exception exception) { LOGs.WriteLine(LogMessageType.MSG_FATALERROR, "SQL: 无法建构SQL领域 {0}", exception); return(false); } using (Session session = new Session(s_Domain)) { session.BeginTransaction(); Accounts accountsGM = (Accounts)session.CreateObject(typeof(Accounts)); accountsGM.AccountsGuid = accountsGM.ID; accountsGM.AccountsName = "DemoSoft"; accountsGM.Password = "******"; accountsGM.GMLevel = 300; // GM accountsGM.Locked = false; accountsGM.Banned = true; accountsGM.CreateDate = DateTime.Now; Accounts accountsTest = (Accounts)session.CreateObject(typeof(Accounts)); accountsTest.AccountsGuid = accountsTest.ID; accountsTest.AccountsName = "Test"; accountsTest.Password = "******"; accountsTest.GMLevel = 100; // Player accountsTest.Locked = false; accountsTest.Banned = false; accountsTest.CreateDate = DateTime.Now; Channels channelsCharacter1 = (Channels)session.CreateObject(typeof(Channels)); channelsCharacter1.ServerGuid = channelsCharacter1.ID; channelsCharacter1.ServerName = "Angel"; //channelsCharacter1.Host = "218.3.85.107"; channelsCharacter1.Host = "127.0.0.1"; channelsCharacter1.Port = 29100; channelsCharacter1.Status = 0; channelsCharacter1.OwnerGuid = Channels.CHARACTER_SERVER_ID; channelsCharacter1.Connected = 0; channelsCharacter1.MaxConnected = 0; Channels channelsCharacter2 = (Channels)session.CreateObject(typeof(Channels)); channelsCharacter2.ServerGuid = channelsCharacter2.ID; channelsCharacter2.ServerName = "Hell"; //channelsCharacter2.Host = "218.3.85.107"; channelsCharacter2.Host = "127.0.0.1"; channelsCharacter2.Port = 29100; channelsCharacter2.Status = 0; channelsCharacter2.OwnerGuid = Channels.CHARACTER_SERVER_ID; channelsCharacter2.Connected = 0; channelsCharacter2.MaxConnected = 0; Channels channelsWorld1 = (Channels)session.CreateObject(typeof(Channels)); channelsWorld1.ServerGuid = channelsWorld1.ID; channelsWorld1.ServerName = "Angel-1"; //channelsWorld1.Host = "218.3.85.107"; channelsWorld1.Host = "127.0.0.1"; channelsWorld1.Port = 29200; channelsWorld1.Status = 0; channelsWorld1.OwnerGuid = channelsCharacter1.ServerGuid; channelsWorld1.Connected = 0; channelsWorld1.MaxConnected = 300; Channels channelsWorld2 = (Channels)session.CreateObject(typeof(Channels)); channelsWorld2.ServerGuid = channelsWorld2.ID; channelsWorld2.ServerName = "Angel-2"; //channelsWorld2.Host = "218.3.85.107"; channelsWorld2.Host = "127.0.0.1"; channelsWorld2.Port = 29200; channelsWorld2.Status = 0; channelsWorld2.OwnerGuid = channelsCharacter1.ServerGuid; channelsWorld2.Connected = 0; channelsWorld2.MaxConnected = 300; Channels channelsWorld3 = (Channels)session.CreateObject(typeof(Channels)); channelsWorld3.ServerGuid = channelsWorld3.ID; channelsWorld3.ServerName = "Hell-1"; //channelsWorld3.Host = "218.3.85.107"; channelsWorld3.Host = "127.0.0.1"; channelsWorld3.Port = 29200; channelsWorld3.Status = 0; channelsWorld3.OwnerGuid = channelsCharacter2.ServerGuid; channelsWorld3.Connected = 0; channelsWorld3.MaxConnected = 300; Channels channelsWorld4 = (Channels)session.CreateObject(typeof(Channels)); channelsWorld4.ServerGuid = channelsWorld4.ID; channelsWorld4.ServerName = "Hell-2"; //channelsWorld4.Host = "218.3.85.107"; channelsWorld4.Host = "127.0.0.1"; channelsWorld4.Port = 29200; channelsWorld4.Status = 0; channelsWorld4.OwnerGuid = channelsCharacter2.ServerGuid; channelsWorld4.Connected = 0; channelsWorld4.MaxConnected = 300; session.Commit(); } LOGs.WriteLine(LogMessageType.MSG_SQL, "SQL: 完成建构SQL领域"); return(true); }
public static void FadeTowards(this Renderer renderer, float targetColor, float deltaTime, bool shared = false, Channels channels = Channels.RGBA) { renderer.FadeTowards(new Color(targetColor, targetColor, targetColor, targetColor), deltaTime, shared, channels); }
public void automatically_sticks_in_replies_queue() { Channels.HasChannel(TransportConstants.RetryUri) .ShouldBeTrue(); }
public static void SetColor(this Renderer renderer, float color, bool shared = false, Channels channels = Channels.RGBA) { renderer.SetColor(new Color(color, color, color, color), shared, channels); }
public ChannelInfo GetChannel(string channelName) { var fixedName = channelName[0] == '#' ? channelName.Substring(1) : channelName; return(Channels.FirstOrDefault(c => c.Name == fixedName)); }