/************************************************************************* Block size for complex subroutines. -- ALGLIB routine -- 15.12.2009 Bochkanov Sergey *************************************************************************/ public static int ablascomplexblocksize(ref AP.Complex[,] a) { int result = 0; result = 24; return result; }
/************************************************************************* 1-dimensional complex cross-correlation. For given Pattern/Signal returns corr(Pattern,Signal) (non-circular). Correlation is calculated using reduction to convolution. Algorithm with max(N,N)*log(max(N,N)) complexity is used (see ConvC1D() for more info about performance). IMPORTANT: for historical reasons subroutine accepts its parameters in reversed order: CorrC1D(Signal, Pattern) = Pattern x Signal (using traditional definition of cross-correlation, denoting cross-correlation as "x"). INPUT PARAMETERS Signal - array[0..N-1] - complex function to be transformed, signal containing pattern N - problem size Pattern - array[0..M-1] - complex function to be transformed, pattern to search withing signal M - problem size OUTPUT PARAMETERS R - cross-correlation, array[0..N+M-2]: * positive lags are stored in R[0..N-1], R[i] = sum(conj(pattern[j])*signal[i+j] * negative lags are stored in R[N..N+M-2], R[N+M-1-i] = sum(conj(pattern[j])*signal[-i+j] NOTE: It is assumed that pattern domain is [0..M-1]. If Pattern is non-zero on [-K..M-1], you can still use this subroutine, just shift result by K. -- ALGLIB -- Copyright 21.07.2009 by Bochkanov Sergey *************************************************************************/ public static void corrc1d(ref AP.Complex[] signal, int n, ref AP.Complex[] pattern, int m, ref AP.Complex[] r) { AP.Complex[] p = new AP.Complex[0]; AP.Complex[] b = new AP.Complex[0]; int i = 0; int i_ = 0; int i1_ = 0; System.Diagnostics.Debug.Assert(n>0 & m>0, "CorrC1D: incorrect N or M!"); p = new AP.Complex[m]; for(i=0; i<=m-1; i++) { p[m-1-i] = AP.Math.Conj(pattern[i]); } conv.convc1d(ref p, m, ref signal, n, ref b); r = new AP.Complex[m+n-1]; i1_ = (m-1) - (0); for(i_=0; i_<=n-1;i_++) { r[i_] = b[i_+i1_]; } if( m+n-2>=n ) { i1_ = (0) - (n); for(i_=n; i_<=m+n-2;i_++) { r[i_] = b[i_+i1_]; } } }
internal CompletionResult(string name, string completion, string doc, PythonMemberType memberType, AP.CompletionValue[] values) { _name = name; _memberType = memberType; _completion = completion; _doc = doc; _values = values; }
public PythonParameter(ISignature signature, AP.Parameter param, Span locus, Span ppLocus, AnalysisVariable[] variables) { _signature = signature; _param = param; _locus = locus; _ppLocus = ppLocus; _documentation = _param.doc.LimitLines(15, stopAtFirstBlankLine: true); _variables = variables; }
/************************************************************************* Calculation of the determinant of a general matrix Input parameters: A - matrix, array[0..N-1, 0..N-1] N - size of matrix A. Result: determinant of matrix A. -- ALGLIB -- Copyright 2005 by Bochkanov Sergey *************************************************************************/ public static AP.Complex cmatrixdet(AP.Complex[,] a, int n) { AP.Complex result = 0; int[] pivots = new int[0]; a = (AP.Complex[,])a.Clone(); trfac.cmatrixlu(ref a, n, n, ref pivots); result = cmatrixludet(ref a, ref pivots, n); return result; }
/************************************************************************* Complex ABLASSplitLength -- ALGLIB routine -- 15.12.2009 Bochkanov Sergey *************************************************************************/ public static void ablascomplexsplitlength(ref AP.Complex[,] a, int n, ref int n1, ref int n2) { if( n>ablascomplexblocksize(ref a) ) { ablasinternalsplitlength(n, ablascomplexblocksize(ref a), ref n1, ref n2); } else { ablasinternalsplitlength(n, ablasmicroblocksize(), ref n1, ref n2); } }
public override void Excute() { get_par(); if (URL == "" || URL == null) { return; } AP.set_first_edit(false); AP.set_edited(false); AP.unselect(); AP.draw(); AP.save(URL); AP.logFile("save_as succeeded"); }
public void MarkOrderShipped(string clientOrderId, PartialShipmentContents partialShipmentContents) { try { AP.CreateSubmit(ExtensionsInternal.CreateMethodCallInfo(this.AdditionalLogInfo)).Do(() => { var result = this._client.SubmitOrderShipmentList(this._credentials, this.AccountId, CreatePartialShipmentByClientId(clientOrderId, partialShipmentContents)); this.CheckCaSuccess(result); }); } catch (Exception e) { throw new MarkOrderShippedException(clientOrderId, this.AccountId, partialShipmentContents.CarrierCode, partialShipmentContents.ClassCode, partialShipmentContents.TrackingNumber, e); } }
public async Task MarkOrderShippedAsync(string clientOrderId, PartialShipmentContents partialShipmentContents) { try { await AP.CreateSubmitAsync(ExtensionsInternal.CreateMethodCallInfo(this.AdditionalLogInfo)).Do(async() => { var result = await this._client.SubmitOrderShipmentListAsync(this._credentials, this.AccountId, CreatePartialShipmentByClientId(clientOrderId, partialShipmentContents)).ConfigureAwait(false); this.CheckCaSuccess(result.SubmitOrderShipmentListResult); }).ConfigureAwait(false); } catch (Exception e) { throw new MarkOrderShippedException(clientOrderId, this.AccountId, partialShipmentContents.CarrierCode, partialShipmentContents.ClassCode, partialShipmentContents.TrackingNumber, e); } }
public async Task MarkOrderShippedAsync(int orderId, string carrierCode, string classCode, string trackingNumber, DateTime dateShipped) { try { await AP.CreateSubmitAsync(ExtensionsInternal.CreateMethodCallInfo(this.AdditionalLogInfo)).Do(async() => { var result = await this._client.SubmitOrderShipmentListAsync(this._credentials, this.AccountId, CreateShipmentByOrderId(orderId, carrierCode, classCode, trackingNumber, dateShipped)).ConfigureAwait(false); this.CheckCaSuccess(result.SubmitOrderShipmentListResult); }).ConfigureAwait(false); } catch (Exception e) { throw new MarkOrderShippedException(orderId.ToString(CultureInfo.InvariantCulture), this.AccountId, carrierCode, classCode, trackingNumber, e); } }
/************************************************************************* Fast kernel -- ALGLIB routine -- 19.01.2010 Bochkanov Sergey *************************************************************************/ public static bool cmatrixrank1f(int m, int n, ref AP.Complex[,] a, int ia, int ja, ref AP.Complex[] u, int iu, ref AP.Complex[] v, int iv) { bool result = new bool(); result = false; return result; }
/************************************************************************* Application of an elementary reflection to a rectangular matrix of size MxN The algorithm pre-multiplies the matrix by an elementary reflection transformation which is given by column V and scalar Tau (see the description of the GenerateReflection). Not the whole matrix but only a part of it is transformed (rows from M1 to M2, columns from N1 to N2). Only the elements of this submatrix are changed. Note: the matrix is multiplied by H, not by H'. If it is required to multiply the matrix by H', it is necessary to pass Conj(Tau) instead of Tau. Input parameters: C - matrix to be transformed. Tau - scalar defining transformation. V - column defining transformation. Array whose index ranges within [1..M2-M1+1] M1, M2 - range of rows to be transformed. N1, N2 - range of columns to be transformed. WORK - working array whose index goes from N1 to N2. Output parameters: C - the result of multiplying the input matrix C by the transformation matrix which is given by Tau and V. If N1>N2 or M1>M2, C is not modified. -- LAPACK auxiliary routine (version 3.0) -- Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., Courant Institute, Argonne National Lab, and Rice University September 30, 1994 *************************************************************************/ public static void complexapplyreflectionfromtheleft(ref AP.Complex[,] c, AP.Complex tau, ref AP.Complex[] v, int m1, int m2, int n1, int n2, ref AP.Complex[] work) { AP.Complex t = 0; int i = 0; int vm = 0; int i_ = 0; if (tau == 0 | n1 > n2 | m1 > m2) { return; } // // w := C^T * conj(v) // vm = m2 - m1 + 1; for (i = n1; i <= n2; i++) { work[i] = 0; } for (i = m1; i <= m2; i++) { t = AP.Math.Conj(v[i + 1 - m1]); for (i_ = n1; i_ <= n2; i_++) { work[i_] = work[i_] + t * c[i, i_]; } } // // C := C - tau * v * w^T // for (i = m1; i <= m2; i++) { t = v[i - m1 + 1] * tau; for (i_ = n1; i_ <= n2; i_++) { c[i, i_] = c[i, i_] - t * work[i_]; } } }
/************************************************************************* Fast kernel -- ALGLIB routine -- 19.01.2010 Bochkanov Sergey *************************************************************************/ public static bool cmatrixmvf(int m, int n, ref AP.Complex[,] a, int ia, int ja, int opa, ref AP.Complex[] x, int ix, ref AP.Complex[] y, int iy) { bool result = new bool(); result = false; return result; }
/************************************************************************* 1-dimensional complex FFT. Array size N may be arbitrary number (composite or prime). Composite N's are handled with cache-oblivious variation of a Cooley-Tukey algorithm. Small prime-factors are transformed using hard coded codelets (similar to FFTW codelets, but without low-level optimization), large prime-factors are handled with Bluestein's algorithm. Fastests transforms are for smooth N's (prime factors are 2, 3, 5 only), most fast for powers of 2. When N have prime factors larger than these, but orders of magnitude smaller than N, computations will be about 4 times slower than for nearby highly composite N's. When N itself is prime, speed will be 6 times lower. Algorithm has O(N*logN) complexity for any N (composite or prime). INPUT PARAMETERS A - array[0..N-1] - complex function to be transformed N - problem size OUTPUT PARAMETERS A - DFT of a input array, array[0..N-1] A_out[j] = SUM(A_in[k]*exp(-2*pi*sqrt(-1)*j*k/N), k = 0..N-1) -- ALGLIB -- Copyright 29.05.2009 by Bochkanov Sergey *************************************************************************/ public static void fftc1d(ref AP.Complex[] a, int n) { ftbase.ftplan plan = new ftbase.ftplan(); int i = 0; double[] buf = new double[0]; System.Diagnostics.Debug.Assert(n>0, "FFTC1D: incorrect N!"); // // Special case: N=1, FFT is just identity transform. // After this block we assume that N is strictly greater than 1. // if( n==1 ) { return; } // // convert input array to the more convinient format // buf = new double[2*n]; for(i=0; i<=n-1; i++) { buf[2*i+0] = a[i].x; buf[2*i+1] = a[i].y; } // // Generate plan and execute it. // // Plan is a combination of a successive factorizations of N and // precomputed data. It is much like a FFTW plan, but is not stored // between subroutine calls and is much simpler. // ftbase.ftbasegeneratecomplexfftplan(n, ref plan); ftbase.ftbaseexecuteplan(ref buf, 0, n, ref plan); // // result // for(i=0; i<=n-1; i++) { a[i].x = buf[2*i+0]; a[i].y = buf[2*i+1]; } }
/************************************************************************* Fast kernel -- ALGLIB routine -- 19.01.2010 Bochkanov Sergey *************************************************************************/ public static bool cmatrixlefttrsmf(int m, int n, ref AP.Complex[,] a, int i1, int j1, bool isupper, bool isunit, int optype, ref AP.Complex[,] x, int i2, int j2) { bool result = new bool(); result = false; return result; }
private OrderResponseItem[] GetOrdersPage(OrderCriteria orderCriteria) { return(AP.CreateQuery(ExtensionsInternal.CreateMethodCallInfo(this.AdditionalLogInfo)).Get(() => { var results = this._client.GetOrderList(this._credentials, this.AccountId, orderCriteria); CheckCaSuccess(results); var resultData = results.ResultData ?? new OrderResponseItem[0]; // If you get message code = 1 (Unexpected) if (results.MessageCode == 1) { resultData = this.HandleErrorUnexpected(orderCriteria); } return resultData; })); }
private async Task <OrderResponseItem[]> GetOrdersPageAsync(OrderCriteria orderCriteria, Mark mark = null) { return(await AP.CreateQueryAsync(ExtensionsInternal.CreateMethodCallInfo(this.AdditionalLogInfo, mark: mark)).Get(async() => { var results = await this._client.GetOrderListAsync(this._credentials, this.AccountId, orderCriteria).ConfigureAwait(false); CheckCaSuccess(results.GetOrderListResult); var resultData = results.GetOrderListResult.ResultData ?? new OrderResponseItem[0]; // If you get message code = 1 (Unexpected) if (results.GetOrderListResult.MessageCode == 1) { resultData = await this.HandleErrorUnexpectedAsync(orderCriteria).ConfigureAwait(false); } return resultData; }).ConfigureAwait(false)); }
public override void get_par() { IT = AP.get_copied_item(); if (IT == null) { return; } if (IT is Item.ImageItem) { i = new Item.ImageItem((IT as Item.ImageItem), AP.get_item_count()); } else { i = new Item.TextItem((IT as Item.TextItem), AP.get_item_count()); } }
/************************************************************************* 1-dimensional complex convolution. For given A/B returns conv(A,B) (non-circular). Subroutine can automatically choose between three implementations: straightforward O(M*N) formula for very small N (or M), overlap-add algorithm for cases where max(M,N) is significantly larger than min(M,N), but O(M*N) algorithm is too slow, and general FFT-based formula for cases where two previois algorithms are too slow. Algorithm has max(M,N)*log(max(M,N)) complexity for any M/N. INPUT PARAMETERS A - array[0..M-1] - complex function to be transformed M - problem size B - array[0..N-1] - complex function to be transformed N - problem size OUTPUT PARAMETERS R - convolution: A*B. array[0..N+M-2]. NOTE: It is assumed that A is zero at T<0, B is zero too. If one or both functions have non-zero values at negative T's, you can still use this subroutine - just shift its result correspondingly. -- ALGLIB -- Copyright 21.07.2009 by Bochkanov Sergey *************************************************************************/ public static void convc1d(ref AP.Complex[] a, int m, ref AP.Complex[] b, int n, ref AP.Complex[] r) { System.Diagnostics.Debug.Assert(n>0 & m>0, "ConvC1D: incorrect N or M!"); // // normalize task: make M>=N, // so A will be longer that B. // if( m<n ) { convc1d(ref b, n, ref a, m, ref r); return; } convc1dx(ref a, m, ref b, n, false, -1, 0, ref r); }
/// <summary> /// Updates the code applying the changes to the existing text buffer and updates the version. /// </summary> public static string UpdateCode(this IProjectEntry entry, AP.VersionChanges[] versions, int buffer, int version) { lock (_currentCodeKey) { CurrentCode curCode = GetCurrentCode(entry, buffer); var strBuffer = curCode.Text; foreach (var versionChange in versions) { int delta = 0; foreach (var change in versionChange.changes) { strBuffer.Remove(change.start + delta, change.length); strBuffer.Insert(change.start + delta, change.newText); delta += change.newText.Length - change.length; } } curCode.Version = version; return strBuffer.ToString(); } }
/************************************************************************* Determinant calculation of the matrix given by its LU decomposition. Input parameters: A - LU decomposition of the matrix (output of RMatrixLU subroutine). Pivots - table of permutations which were made during the LU decomposition. Output of RMatrixLU subroutine. N - size of matrix A. Result: matrix determinant. -- ALGLIB -- Copyright 2005 by Bochkanov Sergey *************************************************************************/ public static AP.Complex cmatrixludet(ref AP.Complex[,] a, ref int[] pivots, int n) { AP.Complex result = 0; int i = 0; int s = 0; result = 1; s = 1; for (i = 0; i <= n - 1; i++) { result = result * a[i, i]; if (pivots[i] != i) { s = -s; } } result = result * s; return result; }
public ActionResult MostrarAP(List <int> idsRecibos, int numeroFinca, int meses) { AP ap = AP_Conexion.MostrarAP(numeroFinca, meses, idsRecibos); String markup = "<div>"; markup += String.Format(@" <p> <h5>Monto: <span class='badge badge-danger'> {0}</span> </h5> <h5>Intereses: <span class='badge-info'> {1}</span> </h5> <h5>Cuota: <span class='badge badge-info'> {2}</span> </h5> <h5>Plazo: <span class='badge badge-info'> {3}</span> </h5> </p>", ap.montoOriginal, ap.tasaInteres, ap.cuota, ap.plazoOriginal ); markup += "</div>"; return(Content(markup)); }
private void CheckFulfillmentStatus <T>(List <T> orders, Mark mark = null) where T : OrderResponseItem { var refundedOrderIds = GetRefundedOrderIds(orders); if (refundedOrderIds.Count == 0) { return; } int pageSize; if (!this._pageSizes.TryGetValue("High", out pageSize)) { pageSize = 50; } var cancelledOrderIds = new List <int>(); var ordersParts = ItemsService.ToChunks(refundedOrderIds, pageSize); ChannelAdvisorLogger.LogStarted(this.CreateMethodCallInfo(mark: mark, additionalInfo: this.AdditionalLogInfo(), methodParameters: refundedOrderIds.ToJson())); foreach (var part in ordersParts) { var ordersFulfillment = AP.CreateQuery(ExtensionsInternal.CreateMethodCallInfo(this.AdditionalLogInfo)).Get(() => { var results = this._fulfillmentServiceClient.GetOrderFulfillmentDetailList(this._fulfillmentServiceCredentials, this.AccountId, part.ToArray(), null); CheckCaSuccess(results); var resultData = results.ResultData ?? new FulfillmentService.OrderFulfillmentResponse[0]; return(resultData); }); ChannelAdvisorLogger.LogTrace(this.CreateMethodCallInfo(mark: mark, methodResult: ordersFulfillment.ToJson(), additionalInfo: this.AdditionalLogInfo(), methodParameters: part.ToJson())); var cancelledOrderIdsPart = ordersFulfillment.Where(o => o.FulfillmentList.All(fulfillment => fulfillment.FulfillmentStatus == "Canceled")).Select(o => o.OrderID); cancelledOrderIds.AddRange(cancelledOrderIdsPart); } ChannelAdvisorLogger.LogEnd(this.CreateMethodCallInfo(mark: mark, methodResult: cancelledOrderIds.ToJson(), additionalInfo: this.AdditionalLogInfo(), methodParameters: refundedOrderIds.ToJson())); CancelOrders(orders, cancelledOrderIds); }
/************************************************************************* Fast kernel -- ALGLIB routine -- 19.01.2010 Bochkanov Sergey *************************************************************************/ public static bool cmatrixgemmf(int m, int n, int k, AP.Complex alpha, ref AP.Complex[,] a, int ia, int ja, int optypea, ref AP.Complex[,] b, int ib, int jb, int optypeb, AP.Complex beta, ref AP.Complex[,] c, int ic, int jc) { bool result = new bool(); result = false; return result; }
private async Task CheckFulfillmentStatusAsync <T>(List <T> orders, Mark mark = null) where T : OrderResponseItem { var refundedOrderIds = GetRefundedOrderIds(orders); if (refundedOrderIds.Count == 0) { return; } int pageSize; if (!this._pageSizes.TryGetValue("High", out pageSize)) { pageSize = 50; } var ordersParts = ItemsService.ToChunks(refundedOrderIds, pageSize); ChannelAdvisorLogger.LogStarted(this.CreateMethodCallInfo(mark: mark, additionalInfo: this.AdditionalLogInfo(), methodParameters: refundedOrderIds.ToJson())); var cancelledOrderIds = (await ordersParts.ProcessInBatchAsync(3, async part => { var ordersFulfillment = await AP.CreateQueryAsync(ExtensionsInternal.CreateMethodCallInfo(this.AdditionalLogInfo)).Get(async() => { var results = await this._fulfillmentServiceClient.GetOrderFulfillmentDetailListAsync(this._fulfillmentServiceCredentials, this.AccountId, part.ToArray(), null).ConfigureAwait(false); CheckCaSuccess(results.GetOrderFulfillmentDetailListResult); var resultData = results.GetOrderFulfillmentDetailListResult.ResultData ?? new FulfillmentService.OrderFulfillmentResponse[0]; return(resultData); }).ConfigureAwait(false); ChannelAdvisorLogger.LogTrace(this.CreateMethodCallInfo(mark: mark, methodResult: ordersFulfillment.ToJson(), additionalInfo: this.AdditionalLogInfo(), methodParameters: part.ToJson())); return(ordersFulfillment.Where(o => o.FulfillmentList.All(fulfillment => fulfillment.FulfillmentStatus == "Canceled")).Select(o => o.OrderID)); }).ConfigureAwait(false)).SelectMany(x => x).ToArray(); ChannelAdvisorLogger.LogEnd(this.CreateMethodCallInfo(mark: mark, methodResult: cancelledOrderIds.ToJson(), additionalInfo: this.AdditionalLogInfo(), methodParameters: refundedOrderIds.ToJson())); CancelOrders(orders, cancelledOrderIds); }
void UpdateAPs() { try { av_nets = adapter.GetAvailableNetworkList(Wlan.WlanGetAvailableNetworkFlags.IncludeAllAdhocProfiles); } catch (Exception) { SetEnabled(false); return; } access_points = new AP[av_nets.Length]; for (int c = 0; c < av_nets.Length; c++) { access_points[c] = new AP(av_nets[c].flags.HasFlag(Wlan.WlanAvailableNetworkFlags.Connected), Encoding.Default.GetString(av_nets[c].dot11Ssid.SSID).Remove((int)av_nets[c].dot11Ssid.SSIDLength), av_nets[c].profileName, av_nets[c].wlanSignalQuality.ToString(), av_nets[c].numberOfBssids.ToString()); } dg_wifi.DataSource = access_points; SetEnabled(true); return; }
public void SynchItems(IEnumerable <InventoryItemSubmit> items, bool isCreateNew = false, Mark mark = null) { if (mark.IsBlank()) { mark = Mark.CreateNew(); } var parameters = new { items, isCreateNew }; try { ChannelAdvisorLogger.LogStarted(this.CreateMethodCallInfo(mark: mark, additionalInfo: this.AdditionalLogInfo(), methodParameters: parameters.ToJson())); if (!isCreateNew) { var existSkus = this.DoSkusExist(items.Select(x => x.Sku), mark).Select(x => x.Sku); items = items.Where(x => existSkus.Contains(x.Sku)); } var itemsByPages = ToChunks(items, 100); foreach (var i in itemsByPages) { AP.CreateSubmit(ExtensionsInternal.CreateMethodCallInfo(this.AdditionalLogInfo)).Do(() => { ChannelAdvisorLogger.LogTraceRetryStarted(this.CreateMethodCallInfo(mark: mark, additionalInfo: this.AdditionalLogInfo(), methodParameters: !this.LogDetailsEnum.HasFlag(LogDetailsEnum.LogParametersAndResultForRetry) ? null : i.ToJson())); var resultOfBoolean = this._client.SynchInventoryItemList(this._credentials, this.AccountId, i.ToArray()); CheckCaSuccess(resultOfBoolean); ChannelAdvisorLogger.LogTraceRetryEnd(this.CreateMethodCallInfo(mark: mark, methodResult: !this.LogDetailsEnum.HasFlag(LogDetailsEnum.LogParametersAndResultForRetry) ? null : resultOfBoolean.ToJson(), additionalInfo: this.AdditionalLogInfo(), methodParameters: !this.LogDetailsEnum.HasFlag(LogDetailsEnum.LogParametersAndResultForRetry) ? null : i.ToJson())); }); } ChannelAdvisorLogger.LogEnd(this.CreateMethodCallInfo(mark: mark, methodResult: "void", additionalInfo: this.AdditionalLogInfo(), methodParameters: parameters.ToJson())); } catch (Exception exception) { var channelAdvisorException = new ChannelAdvisorException(this.CreateMethodCallInfo(mark: mark, additionalInfo: this.AdditionalLogInfo()), exception); ChannelAdvisorLogger.LogTraceException(channelAdvisorException); throw channelAdvisorException; } }
public ActionPoint SpawnActionPoint(IO.Swagger.Model.ProjectActionPoint apData, IActionPointParent actionPointParent) { Debug.Assert(apData != null); GameObject AP; if (actionPointParent == null) { AP = Instantiate(ActionPointPrefab, ActionPointsOrigin.transform); } else { AP = Instantiate(ActionPointPrefab, actionPointParent.GetTransform()); } AP.transform.localScale = new Vector3(1f, 1f, 1f); ActionPoint actionPoint = AP.GetComponent <ActionPoint>(); actionPoint.InitAP(apData, APSize, actionPointParent); ActionPoints.Add(actionPoint.Data.Id, actionPoint); return(actionPoint); }
/// <summary> /// returns The build name. /// </summary> public static string BuildName() { var ChampionName = CleanUpChampionName(Player.Instance.ChampionName); if (ChampionName.Equals("MonkeyKing", StringComparison.CurrentCultureIgnoreCase)) { ChampionName = "Wukong"; } if (ADC.Any(s => s.Equals(ChampionName, StringComparison.CurrentCultureIgnoreCase))) { return("ADC"); } if (AD.Any(s => s.Equals(ChampionName, StringComparison.CurrentCultureIgnoreCase))) { return("AD"); } if (AP.Any(s => s.Equals(ChampionName, StringComparison.CurrentCultureIgnoreCase))) { return("AP"); } if (ManaAP.Any(s => s.Equals(ChampionName, StringComparison.CurrentCultureIgnoreCase))) { return("ManaAP"); } if (Tank.Any(s => s.Equals(ChampionName, StringComparison.CurrentCultureIgnoreCase))) { return("Tank"); } Logger.Send("Failed To Detect " + ChampionName, Logger.LogLevel.Warn); //Logger.Send("Using Default Build !"); return("Default"); }
public void RemoveLabelListFromItemList(string[] labels, IEnumerable <string> skus, string reason, Mark mark = null) { Condition.Requires(labels, "labels").IsShorterOrEqual(3, "Only up to 3 labels allowed.").IsNotNull(); if (mark.IsBlank()) { mark = Mark.CreateNew(); } var parameters = new { labels, skus, reason }; try { ChannelAdvisorLogger.LogStarted(this.CreateMethodCallInfo(mark: mark, additionalInfo: this.AdditionalLogInfo(), methodParameters: parameters.ToJson())); var skusByPages = ToChunks(skus, 500); foreach (var s in skusByPages) { AP.CreateSubmit(ExtensionsInternal.CreateMethodCallInfo(this.AdditionalLogInfo)).Do(() => { ChannelAdvisorLogger.LogTraceRetryStarted(this.CreateMethodCallInfo(mark: mark, additionalInfo: this.AdditionalLogInfo(), methodParameters: !this.LogDetailsEnum.HasFlag(LogDetailsEnum.LogParametersAndResultForRetry) ? null : s.ToJson())); var resultOfBoolean = this._client.RemoveLabelListFromInventoryItemList(this._credentials, this.AccountId, labels, s.ToArray(), reason); CheckCaSuccess(resultOfBoolean); ChannelAdvisorLogger.LogTraceRetryEnd(this.CreateMethodCallInfo(mark: mark, methodResult: !this.LogDetailsEnum.HasFlag(LogDetailsEnum.LogParametersAndResultForRetry) ? null : resultOfBoolean.ToJson(), additionalInfo: this.AdditionalLogInfo(), methodParameters: !this.LogDetailsEnum.HasFlag(LogDetailsEnum.LogParametersAndResultForRetry) ? null : s.ToJson())); }); } ChannelAdvisorLogger.LogEnd(this.CreateMethodCallInfo(mark: mark, additionalInfo: this.AdditionalLogInfo(), methodParameters: parameters.ToJson())); } catch (Exception exception) { var channelAdvisorException = new ChannelAdvisorException(this.CreateMethodCallInfo(mark: mark, additionalInfo: this.AdditionalLogInfo()), exception); ChannelAdvisorLogger.LogTraceException(channelAdvisorException); throw channelAdvisorException; } }
public ControllerComponent(Controller controller, AP ap) { Controller = controller; AP = ap; Controller.Holder = this; }
private void device_OnPacketArrival(object sender, CaptureEventArgs e) { packetsProcessed++; if (packetsProcessed == 38) { } if (e.Packet.LinkLayerType == PacketDotNet.LinkLayers.Ieee80211) { Packet packet = PacketDotNet.Packet.ParsePacket(e.Packet.LinkLayerType, e.Packet.Data); PacketDotNet.Ieee80211.BeaconFrame beacon = packet as PacketDotNet.Ieee80211.BeaconFrame; PacketDotNet.Ieee80211.ProbeRequestFrame probeRequest = packet as PacketDotNet.Ieee80211.ProbeRequestFrame; PacketDotNet.Ieee80211.QosDataFrame DataFrame = packet as PacketDotNet.Ieee80211.QosDataFrame; PacketDotNet.Ieee80211.DeauthenticationFrame DeAuthFrame = packet as PacketDotNet.Ieee80211.DeauthenticationFrame; PacketDotNet.Ieee80211.AssociationRequestFrame AuthFrame2 = packet as PacketDotNet.Ieee80211.AssociationRequestFrame; PacketDotNet.Ieee80211.DataDataFrame DataDataFrame = packet as PacketDotNet.Ieee80211.DataDataFrame; if (beacon != null) { BeaconFrame beaconFrame = new BeaconFrame(beacon, e.Packet.Timeval.Date); _beacons.Add(beaconFrame); long MacAddrNumber = MacToLong(beaconFrame.MacAddress); //check for APs with this Mac Address AccessPoint AP = null; if (!_accessPoints.TryGetValue(MacAddrNumber, out AP)) { AP = new AccessPoint(beaconFrame); _accessPoints.Add(MacAddrNumber, AP); } AP.AddBeaconFrame(beaconFrame); } else if (probeRequest != null) { ProbePacket probe = new ProbePacket(probeRequest, e.Packet.Timeval.Date); Station station = null; long MacAddrNumber = MacToLong(probe.SourceMacAddress); if (!_stations.TryGetValue(MacAddrNumber, out station)) { station = new Station(probe); _stations.Add(MacAddrNumber, station); } station.AddProbe(probe); } else if (DataFrame != null) { DataFrame _dataFrame = new Packets.DataFrame(DataFrame, e.Packet.Timeval.Date); //invalid packets are useless, probably encrypted if (_dataFrame.IsValidPacket) { _dataFrames.Add(_dataFrame); } } else if (DataDataFrame != null) { } } }
/************************************************************************* Recurrent complex LU subroutine. Never call it directly. -- ALGLIB routine -- 04.01.2010 Bochkanov Sergey *************************************************************************/ private static void cmatrixluprec(ref AP.Complex[,] a, int offs, int m, int n, ref int[] pivots, ref AP.Complex[] tmp) { int i = 0; int m1 = 0; int m2 = 0; int i_ = 0; int i1_ = 0; // // Kernel case // if( Math.Min(m, n)<=ablas.ablascomplexblocksize(ref a) ) { cmatrixlup2(ref a, offs, m, n, ref pivots, ref tmp); return; } // // Preliminary step, make N>=M // // ( A1 ) // A = ( ), where A1 is square // ( A2 ) // // Factorize A1, update A2 // if( m>n ) { cmatrixluprec(ref a, offs, n, n, ref pivots, ref tmp); for(i=0; i<=n-1; i++) { i1_ = (offs+n) - (0); for(i_=0; i_<=m-n-1;i_++) { tmp[i_] = a[i_+i1_,offs+i]; } for(i_=offs+n; i_<=offs+m-1;i_++) { a[i_,offs+i] = a[i_,pivots[offs+i]]; } i1_ = (0) - (offs+n); for(i_=offs+n; i_<=offs+m-1;i_++) { a[i_,pivots[offs+i]] = tmp[i_+i1_]; } } ablas.cmatrixrighttrsm(m-n, n, ref a, offs, offs, true, true, 0, ref a, offs+n, offs); return; } // // Non-kernel case // ablas.ablascomplexsplitlength(ref a, m, ref m1, ref m2); cmatrixluprec(ref a, offs, m1, n, ref pivots, ref tmp); if( m2>0 ) { for(i=0; i<=m1-1; i++) { if( offs+i!=pivots[offs+i] ) { i1_ = (offs+m1) - (0); for(i_=0; i_<=m2-1;i_++) { tmp[i_] = a[i_+i1_,offs+i]; } for(i_=offs+m1; i_<=offs+m-1;i_++) { a[i_,offs+i] = a[i_,pivots[offs+i]]; } i1_ = (0) - (offs+m1); for(i_=offs+m1; i_<=offs+m-1;i_++) { a[i_,pivots[offs+i]] = tmp[i_+i1_]; } } } ablas.cmatrixrighttrsm(m2, m1, ref a, offs, offs, true, true, 0, ref a, offs+m1, offs); ablas.cmatrixgemm(m-m1, n-m1, m1, -1.0, ref a, offs+m1, offs, 0, ref a, offs, offs+m1, 0, +1.0, ref a, offs+m1, offs+m1); cmatrixluprec(ref a, offs+m1, m-m1, n-m1, ref pivots, ref tmp); for(i=0; i<=m2-1; i++) { if( offs+m1+i!=pivots[offs+m1+i] ) { i1_ = (offs) - (0); for(i_=0; i_<=m1-1;i_++) { tmp[i_] = a[i_+i1_,offs+m1+i]; } for(i_=offs; i_<=offs+m1-1;i_++) { a[i_,offs+m1+i] = a[i_,pivots[offs+m1+i]]; } i1_ = (0) - (offs); for(i_=offs; i_<=offs+m1-1;i_++) { a[i_,pivots[offs+m1+i]] = tmp[i_+i1_]; } } } } }
/************************************************************************* Level-2 Hermitian Cholesky subroutine. -- LAPACK routine (version 3.0) -- Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., Courant Institute, Argonne National Lab, and Rice University February 29, 1992 *************************************************************************/ private static bool hpdmatrixcholesky2(ref AP.Complex[,] aaa, int offs, int n, bool isupper, ref AP.Complex[] tmp) { bool result = new bool(); int i = 0; int j = 0; int k = 0; int j1 = 0; int j2 = 0; double ajj = 0; AP.Complex v = 0; double r = 0; int i_ = 0; int i1_ = 0; result = true; if( n<0 ) { result = false; return result; } // // Quick return if possible // if( n==0 ) { return result; } if( isupper ) { // // Compute the Cholesky factorization A = U'*U. // for(j=0; j<=n-1; j++) { // // Compute U(J,J) and test for non-positive-definiteness. // v = 0.0; for(i_=offs; i_<=offs+j-1;i_++) { v += AP.Math.Conj(aaa[i_,offs+j])*aaa[i_,offs+j]; } ajj = (aaa[offs+j,offs+j]-v).x; if( (double)(ajj)<=(double)(0) ) { aaa[offs+j,offs+j] = ajj; result = false; return result; } ajj = Math.Sqrt(ajj); aaa[offs+j,offs+j] = ajj; // // Compute elements J+1:N-1 of row J. // if( j<n-1 ) { if( j>0 ) { i1_ = (offs) - (0); for(i_=0; i_<=j-1;i_++) { tmp[i_] = -AP.Math.Conj(aaa[i_+i1_,offs+j]); } ablas.cmatrixmv(n-j-1, j, ref aaa, offs, offs+j+1, 1, ref tmp, 0, ref tmp, n); i1_ = (n) - (offs+j+1); for(i_=offs+j+1; i_<=offs+n-1;i_++) { aaa[offs+j,i_] = aaa[offs+j,i_] + tmp[i_+i1_]; } } r = 1/ajj; for(i_=offs+j+1; i_<=offs+n-1;i_++) { aaa[offs+j,i_] = r*aaa[offs+j,i_]; } } } } else { // // Compute the Cholesky factorization A = L*L'. // for(j=0; j<=n-1; j++) { // // Compute L(J+1,J+1) and test for non-positive-definiteness. // v = 0.0; for(i_=offs; i_<=offs+j-1;i_++) { v += AP.Math.Conj(aaa[offs+j,i_])*aaa[offs+j,i_]; } ajj = (aaa[offs+j,offs+j]-v).x; if( (double)(ajj)<=(double)(0) ) { aaa[offs+j,offs+j] = ajj; result = false; return result; } ajj = Math.Sqrt(ajj); aaa[offs+j,offs+j] = ajj; // // Compute elements J+1:N of column J. // if( j<n-1 ) { if( j>0 ) { i1_ = (offs) - (0); for(i_=0; i_<=j-1;i_++) { tmp[i_] = AP.Math.Conj(aaa[offs+j,i_+i1_]); } ablas.cmatrixmv(n-j-1, j, ref aaa, offs+j+1, offs, 0, ref tmp, 0, ref tmp, n); for(i=0; i<=n-j-2; i++) { aaa[offs+j+1+i,offs+j] = (aaa[offs+j+1+i,offs+j]-tmp[n+i])/ajj; } } else { for(i=0; i<=n-j-2; i++) { aaa[offs+j+1+i,offs+j] = aaa[offs+j+1+i,offs+j]/ajj; } } } } } return result; }
/************************************************************************* Triangular matrix inversion, recursive subroutine -- ALGLIB -- 05.02.2010, Bochkanov Sergey. Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., Courant Institute, Argonne National Lab, and Rice University February 29, 1992. *************************************************************************/ private static void cmatrixtrinverserec(ref AP.Complex[,] a, int offs, int n, bool isupper, bool isunit, ref AP.Complex[] tmp, ref int info, ref matinvreport rep) { int n1 = 0; int n2 = 0; int i = 0; int j = 0; AP.Complex v = 0; AP.Complex ajj = 0; int i_ = 0; int i1_ = 0; if (n < 1) { info = -1; return; } // // Base case // if (n <= ablas.ablascomplexblocksize(ref a)) { if (isupper) { // // Compute inverse of upper triangular matrix. // for (j = 0; j <= n - 1; j++) { if (!isunit) { if (a[offs + j, offs + j] == 0) { info = -3; return; } a[offs + j, offs + j] = 1 / a[offs + j, offs + j]; ajj = -a[offs + j, offs + j]; } else { ajj = -1; } // // Compute elements 1:j-1 of j-th column. // if (j > 0) { i1_ = (offs + 0) - (0); for (i_ = 0; i_ <= j - 1; i_++) { tmp[i_] = a[i_ + i1_, offs + j]; } for (i = 0; i <= j - 1; i++) { if (i < j - 1) { i1_ = (i + 1) - (offs + i + 1); v = 0.0; for (i_ = offs + i + 1; i_ <= offs + j - 1; i_++) { v += a[offs + i, i_] * tmp[i_ + i1_]; } } else { v = 0; } if (!isunit) { a[offs + i, offs + j] = v + a[offs + i, offs + i] * tmp[i]; } else { a[offs + i, offs + j] = v + tmp[i]; } } for (i_ = offs + 0; i_ <= offs + j - 1; i_++) { a[i_, offs + j] = ajj * a[i_, offs + j]; } } } } else { // // Compute inverse of lower triangular matrix. // for (j = n - 1; j >= 0; j--) { if (!isunit) { if (a[offs + j, offs + j] == 0) { info = -3; return; } a[offs + j, offs + j] = 1 / a[offs + j, offs + j]; ajj = -a[offs + j, offs + j]; } else { ajj = -1; } if (j < n - 1) { // // Compute elements j+1:n of j-th column. // i1_ = (offs + j + 1) - (j + 1); for (i_ = j + 1; i_ <= n - 1; i_++) { tmp[i_] = a[i_ + i1_, offs + j]; } for (i = j + 1; i <= n - 1; i++) { if (i > j + 1) { i1_ = (j + 1) - (offs + j + 1); v = 0.0; for (i_ = offs + j + 1; i_ <= offs + i - 1; i_++) { v += a[offs + i, i_] * tmp[i_ + i1_]; } } else { v = 0; } if (!isunit) { a[offs + i, offs + j] = v + a[offs + i, offs + i] * tmp[i]; } else { a[offs + i, offs + j] = v + tmp[i]; } } for (i_ = offs + j + 1; i_ <= offs + n - 1; i_++) { a[i_, offs + j] = ajj * a[i_, offs + j]; } } } } return; } // // Recursive case // ablas.ablascomplexsplitlength(ref a, n, ref n1, ref n2); if (n2 > 0) { if (isupper) { for (i = 0; i <= n1 - 1; i++) { for (i_ = offs + n1; i_ <= offs + n - 1; i_++) { a[offs + i, i_] = -1 * a[offs + i, i_]; } } ablas.cmatrixlefttrsm(n1, n2, ref a, offs, offs, isupper, isunit, 0, ref a, offs, offs + n1); ablas.cmatrixrighttrsm(n1, n2, ref a, offs + n1, offs + n1, isupper, isunit, 0, ref a, offs, offs + n1); } else { for (i = 0; i <= n2 - 1; i++) { for (i_ = offs; i_ <= offs + n1 - 1; i_++) { a[offs + n1 + i, i_] = -1 * a[offs + n1 + i, i_]; } } ablas.cmatrixrighttrsm(n2, n1, ref a, offs, offs, isupper, isunit, 0, ref a, offs + n1, offs); ablas.cmatrixlefttrsm(n2, n1, ref a, offs + n1, offs + n1, isupper, isunit, 0, ref a, offs + n1, offs); } cmatrixtrinverserec(ref a, offs + n1, n2, isupper, isunit, ref tmp, ref info, ref rep); } cmatrixtrinverserec(ref a, offs, n1, isupper, isunit, ref tmp, ref info, ref rep); }
public CheckPayment(AP ap) : base(ap) { this.PaymentMethod = PaymentMethodCheck; this.PaymentAmount = ap.CheckAmt; this.ValueDate = DateTime.Parse(ap.CheckDate); }
/************************************************************************* Recursive subroutine for HPD inversion. -- ALGLIB routine -- 10.02.2010 Bochkanov Sergey *************************************************************************/ private static void hpdmatrixcholeskyinverserec(ref AP.Complex[,] a, int offs, int n, bool isupper, ref AP.Complex[] tmp) { int i = 0; int j = 0; AP.Complex v = 0; int n1 = 0; int n2 = 0; int info2 = 0; matinvreport rep2 = new matinvreport(); int i_ = 0; int i1_ = 0; if (n < 1) { return; } // // Base case // if (n <= ablas.ablascomplexblocksize(ref a)) { cmatrixtrinverserec(ref a, offs, n, isupper, false, ref tmp, ref info2, ref rep2); if (isupper) { // // Compute the product U * U'. // NOTE: we never assume that diagonal of U is real // for (i = 0; i <= n - 1; i++) { if (i == 0) { // // 1x1 matrix // a[offs + i, offs + i] = AP.Math.Sqr(a[offs + i, offs + i].x) + AP.Math.Sqr(a[offs + i, offs + i].y); } else { // // (I+1)x(I+1) matrix, // // ( A11 A12 ) ( A11^H ) ( A11*A11^H+A12*A12^H A12*A22^H ) // ( ) * ( ) = ( ) // ( A22 ) ( A12^H A22^H ) ( A22*A12^H A22*A22^H ) // // A11 is IxI, A22 is 1x1. // i1_ = (offs) - (0); for (i_ = 0; i_ <= i - 1; i_++) { tmp[i_] = AP.Math.Conj(a[i_ + i1_, offs + i]); } for (j = 0; j <= i - 1; j++) { v = a[offs + j, offs + i]; i1_ = (j) - (offs + j); for (i_ = offs + j; i_ <= offs + i - 1; i_++) { a[offs + j, i_] = a[offs + j, i_] + v * tmp[i_ + i1_]; } } v = AP.Math.Conj(a[offs + i, offs + i]); for (i_ = offs; i_ <= offs + i - 1; i_++) { a[i_, offs + i] = v * a[i_, offs + i]; } a[offs + i, offs + i] = AP.Math.Sqr(a[offs + i, offs + i].x) + AP.Math.Sqr(a[offs + i, offs + i].y); } } } else { // // Compute the product L' * L // NOTE: we never assume that diagonal of L is real // for (i = 0; i <= n - 1; i++) { if (i == 0) { // // 1x1 matrix // a[offs + i, offs + i] = AP.Math.Sqr(a[offs + i, offs + i].x) + AP.Math.Sqr(a[offs + i, offs + i].y); } else { // // (I+1)x(I+1) matrix, // // ( A11^H A21^H ) ( A11 ) ( A11^H*A11+A21^H*A21 A21^H*A22 ) // ( ) * ( ) = ( ) // ( A22^H ) ( A21 A22 ) ( A22^H*A21 A22^H*A22 ) // // A11 is IxI, A22 is 1x1. // i1_ = (offs) - (0); for (i_ = 0; i_ <= i - 1; i_++) { tmp[i_] = a[offs + i, i_ + i1_]; } for (j = 0; j <= i - 1; j++) { v = AP.Math.Conj(a[offs + i, offs + j]); i1_ = (0) - (offs); for (i_ = offs; i_ <= offs + j; i_++) { a[offs + j, i_] = a[offs + j, i_] + v * tmp[i_ + i1_]; } } v = AP.Math.Conj(a[offs + i, offs + i]); for (i_ = offs; i_ <= offs + i - 1; i_++) { a[offs + i, i_] = v * a[offs + i, i_]; } a[offs + i, offs + i] = AP.Math.Sqr(a[offs + i, offs + i].x) + AP.Math.Sqr(a[offs + i, offs + i].y); } } } return; } // // Recursive code: triangular factor inversion merged with // UU' or L'L multiplication // ablas.ablascomplexsplitlength(ref a, n, ref n1, ref n2); // // form off-diagonal block of trangular inverse // if (isupper) { for (i = 0; i <= n1 - 1; i++) { for (i_ = offs + n1; i_ <= offs + n - 1; i_++) { a[offs + i, i_] = -1 * a[offs + i, i_]; } } ablas.cmatrixlefttrsm(n1, n2, ref a, offs, offs, isupper, false, 0, ref a, offs, offs + n1); ablas.cmatrixrighttrsm(n1, n2, ref a, offs + n1, offs + n1, isupper, false, 0, ref a, offs, offs + n1); } else { for (i = 0; i <= n2 - 1; i++) { for (i_ = offs; i_ <= offs + n1 - 1; i_++) { a[offs + n1 + i, i_] = -1 * a[offs + n1 + i, i_]; } } ablas.cmatrixrighttrsm(n2, n1, ref a, offs, offs, isupper, false, 0, ref a, offs + n1, offs); ablas.cmatrixlefttrsm(n2, n1, ref a, offs + n1, offs + n1, isupper, false, 0, ref a, offs + n1, offs); } // // invert first diagonal block // hpdmatrixcholeskyinverserec(ref a, offs, n1, isupper, ref tmp); // // update first diagonal block with off-diagonal block, // update off-diagonal block // if (isupper) { ablas.cmatrixsyrk(n1, n2, 1.0, ref a, offs, offs + n1, 0, 1.0, ref a, offs, offs, isupper); ablas.cmatrixrighttrsm(n1, n2, ref a, offs + n1, offs + n1, isupper, false, 2, ref a, offs, offs + n1); } else { ablas.cmatrixsyrk(n1, n2, 1.0, ref a, offs + n1, offs, 2, 1.0, ref a, offs, offs, isupper); ablas.cmatrixlefttrsm(n2, n1, ref a, offs + n1, offs + n1, isupper, false, 2, ref a, offs + n1, offs); } // // invert second diagonal block // hpdmatrixcholeskyinverserec(ref a, offs + n1, n2, isupper, ref tmp); }
/************************************************************************* Complex LUP kernel -- ALGLIB routine -- 10.01.2010 Bochkanov Sergey *************************************************************************/ private static void cmatrixlup2(ref AP.Complex[,] a, int offs, int m, int n, ref int[] pivots, ref AP.Complex[] tmp) { int i = 0; int j = 0; int jp = 0; AP.Complex s = 0; int i_ = 0; int i1_ = 0; // // Quick return if possible // if( m==0 | n==0 ) { return; } // // main cycle // for(j=0; j<=Math.Min(m-1, n-1); j++) { // // Find pivot, swap columns // jp = j; for(i=j+1; i<=n-1; i++) { if( (double)(AP.Math.AbsComplex(a[offs+j,offs+i]))>(double)(AP.Math.AbsComplex(a[offs+j,offs+jp])) ) { jp = i; } } pivots[offs+j] = offs+jp; if( jp!=j ) { i1_ = (offs) - (0); for(i_=0; i_<=m-1;i_++) { tmp[i_] = a[i_+i1_,offs+j]; } for(i_=offs; i_<=offs+m-1;i_++) { a[i_,offs+j] = a[i_,offs+jp]; } i1_ = (0) - (offs); for(i_=offs; i_<=offs+m-1;i_++) { a[i_,offs+jp] = tmp[i_+i1_]; } } // // LU decomposition of 1x(N-J) matrix // if( a[offs+j,offs+j]!=0 & j+1<=n-1 ) { s = 1/a[offs+j,offs+j]; for(i_=offs+j+1; i_<=offs+n-1;i_++) { a[offs+j,i_] = s*a[offs+j,i_]; } } // // Update trailing (M-J-1)x(N-J-1) matrix // if( j<Math.Min(m-1, n-1) ) { i1_ = (offs+j+1) - (0); for(i_=0; i_<=m-j-2;i_++) { tmp[i_] = a[i_+i1_,offs+j]; } i1_ = (offs+j+1) - (m); for(i_=m; i_<=m+n-j-2;i_++) { tmp[i_] = -a[offs+j,i_+i1_]; } ablas.cmatrixrank1(m-j-1, n-j-1, ref a, offs+j+1, offs+j+1, ref tmp, 0, ref tmp, m); } } }
/************************************************************************* Inversion of a general matrix. Input parameters: A - matrix, array[0..N-1,0..N-1]. N - size of A. Output parameters: Info - return code, same as in RMatrixLUInverse Rep - solver report, same as in RMatrixLUInverse A - inverse of matrix A, same as in RMatrixLUInverse -- ALGLIB -- Copyright 2005 by Bochkanov Sergey *************************************************************************/ public static void cmatrixinverse(ref AP.Complex[,] a, int n, ref int info, ref matinvreport rep) { int[] pivots = new int[0]; trfac.cmatrixlu(ref a, n, n, ref pivots); cmatrixluinverse(ref a, ref pivots, n, ref info, ref rep); }
/************************************************************************* Recursive computational subroutine for HPDMatrixCholesky -- ALGLIB routine -- 15.12.2009 Bochkanov Sergey *************************************************************************/ private static bool hpdmatrixcholeskyrec(ref AP.Complex[,] a, int offs, int n, bool isupper, ref AP.Complex[] tmp) { bool result = new bool(); int n1 = 0; int n2 = 0; // // check N // if( n<1 ) { result = false; return result; } // // special cases // if( n==1 ) { if( (double)(a[offs,offs].x)>(double)(0) ) { a[offs,offs] = Math.Sqrt(a[offs,offs].x); result = true; } else { result = false; } return result; } if( n<=ablas.ablascomplexblocksize(ref a) ) { result = hpdmatrixcholesky2(ref a, offs, n, isupper, ref tmp); return result; } // // general case: split task in cache-oblivious manner // result = true; ablas.ablascomplexsplitlength(ref a, n, ref n1, ref n2); result = hpdmatrixcholeskyrec(ref a, offs, n1, isupper, ref tmp); if( !result ) { return result; } if( n2>0 ) { if( isupper ) { ablas.cmatrixlefttrsm(n1, n2, ref a, offs, offs, isupper, false, 2, ref a, offs, offs+n1); ablas.cmatrixsyrk(n2, n1, -1.0, ref a, offs, offs+n1, 2, +1.0, ref a, offs+n1, offs+n1, isupper); } else { ablas.cmatrixrighttrsm(n2, n1, ref a, offs, offs, isupper, false, 2, ref a, offs+n1, offs); ablas.cmatrixsyrk(n2, n1, -1.0, ref a, offs+n1, offs, 0, +1.0, ref a, offs+n1, offs+n1, isupper); } result = hpdmatrixcholeskyrec(ref a, offs+n1, n2, isupper, ref tmp); if( !result ) { return result; } } return result; }
protected override string SetRecvBankPrimaryIdType(AP ap) { return(string.Empty); }
/************************************************************************* Inversion of a Hermitian positive definite matrix. Given an upper or lower triangle of a Hermitian positive definite matrix, the algorithm generates matrix A^-1 and saves the upper or lower triangle depending on the input. Input parameters: A - matrix to be inverted (upper or lower triangle). Array with elements [0..N-1,0..N-1]. N - size of matrix A. IsUpper - storage format. If IsUpper = True, then the upper triangle of matrix A is given, otherwise the lower triangle is given. Output parameters: Info - return code, same as in RMatrixLUInverse Rep - solver report, same as in RMatrixLUInverse A - inverse of matrix A, same as in RMatrixLUInverse -- ALGLIB routine -- 10.02.2010 Bochkanov Sergey *************************************************************************/ public static void hpdmatrixinverse(ref AP.Complex[,] a, int n, bool isupper, ref int info, ref matinvreport rep) { if (n < 1) { info = -1; return; } info = 1; if (trfac.hpdmatrixcholesky(ref a, n, isupper)) { hpdmatrixcholeskyinverse(ref a, n, isupper, ref info, ref rep); } else { info = -3; } }
/************************************************************************* Cache-oblivious Cholesky decomposition The algorithm computes Cholesky decomposition of a Hermitian positive- definite matrix. The result of an algorithm is a representation of A as A=U'*U or A=L*L' (here X' detones conj(X^T)). INPUT PARAMETERS: A - upper or lower triangle of a factorized matrix. array with elements [0..N-1, 0..N-1]. N - size of matrix A. IsUpper - if IsUpper=True, then A contains an upper triangle of a symmetric matrix, otherwise A contains a lower one. OUTPUT PARAMETERS: A - the result of factorization. If IsUpper=True, then the upper triangle contains matrix U, so that A = U'*U, and the elements below the main diagonal are not modified. Similarly, if IsUpper = False. RESULT: If the matrix is positive-definite, the function returns True. Otherwise, the function returns False. Contents of A is not determined in such case. -- ALGLIB routine -- 15.12.2009 Bochkanov Sergey *************************************************************************/ public static bool hpdmatrixcholesky(ref AP.Complex[,] a, int n, bool isupper) { bool result = new bool(); AP.Complex[] tmp = new AP.Complex[0]; if( n<1 ) { result = false; return result; } tmp = new AP.Complex[2*n]; result = hpdmatrixcholeskyrec(ref a, 0, n, isupper, ref tmp); return result; }
public override void get_par() { IT = AP.get_selected_item(); color = AP.Inter.get_textcolor(); font = AP.Inter.get_font(); }
public static void cmatrixplu(ref AP.Complex[,] a, int m, int n, ref int[] pivots) { AP.Complex[] tmp = new AP.Complex[0]; int i = 0; int j = 0; double mx = 0; AP.Complex v = 0; int i_ = 0; // // Internal LU decomposition subroutine. // Never call it directly. // System.Diagnostics.Debug.Assert(m>0, "CMatrixPLU: incorrect M!"); System.Diagnostics.Debug.Assert(n>0, "CMatrixPLU: incorrect N!"); tmp = new AP.Complex[2*Math.Max(m, n)]; pivots = new int[Math.Min(m, n)]; // // Scale matrix to avoid overflows, // decompose it, then scale back. // mx = 0; for(i=0; i<=m-1; i++) { for(j=0; j<=n-1; j++) { mx = Math.Max(mx, AP.Math.AbsComplex(a[i,j])); } } if( (double)(mx)!=(double)(0) ) { v = 1/mx; for(i=0; i<=m-1; i++) { for(i_=0; i_<=n-1;i_++) { a[i,i_] = v*a[i,i_]; } } } cmatrixplurec(ref a, 0, m, n, ref pivots, ref tmp); if( (double)(mx)!=(double)(0) ) { v = mx; for(i=0; i<=Math.Min(m, n)-1; i++) { for(i_=i; i_<=n-1;i_++) { a[i,i_] = v*a[i,i_]; } } } }
public void ProcessPacket(Packet packet, DateTime ArrivalDate) { PacketDotNet.Ieee80211.BeaconFrame beacon = packet as PacketDotNet.Ieee80211.BeaconFrame; PacketDotNet.Ieee80211.ProbeRequestFrame probeRequest = packet as PacketDotNet.Ieee80211.ProbeRequestFrame; PacketDotNet.Ieee80211.QosDataFrame DataFrame = packet as PacketDotNet.Ieee80211.QosDataFrame; PacketDotNet.Ieee80211.DeauthenticationFrame DeAuthFrame = packet as PacketDotNet.Ieee80211.DeauthenticationFrame; PacketDotNet.Ieee80211.AssociationRequestFrame AuthRequestFrame = packet as PacketDotNet.Ieee80211.AssociationRequestFrame; PacketDotNet.Ieee80211.DataDataFrame DataDataFrame = packet as PacketDotNet.Ieee80211.DataDataFrame; if (beacon != null) { BeaconFrame beaconFrame = new BeaconFrame(beacon, ArrivalDate); _beacons.Add(beaconFrame); long MacAddrNumber = Utils.MacToLong(beaconFrame.MacAddress); //check for APs with this Mac Address AccessPoint AP = null; if (!_accessPoints.TryGetValue(MacAddrNumber, out AP)) { AP = new AccessPoint(beaconFrame); _accessPoints.Add(MacAddrNumber, AP); } AP.AddBeaconFrame(beaconFrame); if (onReadAccessPoint != null) { onReadAccessPoint(AP); } } else if (probeRequest != null) { ProbePacket probe = new ProbePacket(probeRequest, ArrivalDate); Station station = null; long MacAddrNumber = Utils.MacToLong(probe.SourceMacAddress); if (!_stations.TryGetValue(MacAddrNumber, out station)) { station = new Station(probe); _stations.Add(MacAddrNumber, station); } station.AddProbe(probe); if (onReadStation != null) { onReadStation(station); } } else if (DataFrame != null) { DataFrame _dataFrame = new Packets.DataFrame(DataFrame, ArrivalDate); _dataFrames.Add(_dataFrame); if (onReadDataFrame != null) { onReadDataFrame(_dataFrame); } } else if (DataDataFrame != null) { DataFrame _dataFrame = new Packets.DataFrame(DataDataFrame, ArrivalDate); _dataFrames.Add(_dataFrame); if (onReadDataFrame != null) { onReadDataFrame(_dataFrame); } } else if (AuthRequestFrame != null) { _authRequestFrames.Add(new AuthRequestFrame(AuthRequestFrame, ArrivalDate)); } }
/************************************************************************* Recurrent complex LU subroutine. Never call it directly. -- ALGLIB routine -- 04.01.2010 Bochkanov Sergey *************************************************************************/ private static void cmatrixplurec(ref AP.Complex[,] a, int offs, int m, int n, ref int[] pivots, ref AP.Complex[] tmp) { int i = 0; int n1 = 0; int n2 = 0; int i_ = 0; int i1_ = 0; // // Kernel case // if( Math.Min(m, n)<=ablas.ablascomplexblocksize(ref a) ) { cmatrixplu2(ref a, offs, m, n, ref pivots, ref tmp); return; } // // Preliminary step, make M>=N. // // A = (A1 A2), where A1 is square // Factorize A1, update A2 // if( n>m ) { cmatrixplurec(ref a, offs, m, m, ref pivots, ref tmp); for(i=0; i<=m-1; i++) { i1_ = (offs+m) - (0); for(i_=0; i_<=n-m-1;i_++) { tmp[i_] = a[offs+i,i_+i1_]; } for(i_=offs+m; i_<=offs+n-1;i_++) { a[offs+i,i_] = a[pivots[offs+i],i_]; } i1_ = (0) - (offs+m); for(i_=offs+m; i_<=offs+n-1;i_++) { a[pivots[offs+i],i_] = tmp[i_+i1_]; } } ablas.cmatrixlefttrsm(m, n-m, ref a, offs, offs, false, true, 0, ref a, offs, offs+m); return; } // // Non-kernel case // ablas.ablascomplexsplitlength(ref a, n, ref n1, ref n2); cmatrixplurec(ref a, offs, m, n1, ref pivots, ref tmp); if( n2>0 ) { for(i=0; i<=n1-1; i++) { if( offs+i!=pivots[offs+i] ) { i1_ = (offs+n1) - (0); for(i_=0; i_<=n2-1;i_++) { tmp[i_] = a[offs+i,i_+i1_]; } for(i_=offs+n1; i_<=offs+n-1;i_++) { a[offs+i,i_] = a[pivots[offs+i],i_]; } i1_ = (0) - (offs+n1); for(i_=offs+n1; i_<=offs+n-1;i_++) { a[pivots[offs+i],i_] = tmp[i_+i1_]; } } } ablas.cmatrixlefttrsm(n1, n2, ref a, offs, offs, false, true, 0, ref a, offs, offs+n1); ablas.cmatrixgemm(m-n1, n-n1, n1, -1.0, ref a, offs+n1, offs, 0, ref a, offs, offs+n1, 0, +1.0, ref a, offs+n1, offs+n1); cmatrixplurec(ref a, offs+n1, m-n1, n-n1, ref pivots, ref tmp); for(i=0; i<=n2-1; i++) { if( offs+n1+i!=pivots[offs+n1+i] ) { i1_ = (offs) - (0); for(i_=0; i_<=n1-1;i_++) { tmp[i_] = a[offs+n1+i,i_+i1_]; } for(i_=offs; i_<=offs+n1-1;i_++) { a[offs+n1+i,i_] = a[pivots[offs+n1+i],i_]; } i1_ = (0) - (offs); for(i_=offs; i_<=offs+n1-1;i_++) { a[pivots[offs+n1+i],i_] = tmp[i_+i1_]; } } } } }
public EftOrigPartyNameAddress(AP ap) : base(ap) { }
private static void cmatrixluinverserec(ref AP.Complex[,] a, int offs, int n, ref AP.Complex[] work, ref int info, ref matinvreport rep) { int i = 0; int iws = 0; int j = 0; int jb = 0; int jj = 0; int jp = 0; int k = 0; AP.Complex v = 0; int n1 = 0; int n2 = 0; int i_ = 0; int i1_ = 0; if (n < 1) { info = -1; return; } // // Base case // if (n <= ablas.ablascomplexblocksize(ref a)) { // // Form inv(U) // cmatrixtrinverserec(ref a, offs, n, true, false, ref work, ref info, ref rep); if (info <= 0) { return; } // // Solve the equation inv(A)*L = inv(U) for inv(A). // for (j = n - 1; j >= 0; j--) { // // Copy current column of L to WORK and replace with zeros. // for (i = j + 1; i <= n - 1; i++) { work[i] = a[offs + i, offs + j]; a[offs + i, offs + j] = 0; } // // Compute current column of inv(A). // if (j < n - 1) { for (i = 0; i <= n - 1; i++) { i1_ = (j + 1) - (offs + j + 1); v = 0.0; for (i_ = offs + j + 1; i_ <= offs + n - 1; i_++) { v += a[offs + i, i_] * work[i_ + i1_]; } a[offs + i, offs + j] = a[offs + i, offs + j] - v; } } } return; } // // Recursive code: // // ( L1 ) ( U1 U12 ) // A = ( ) * ( ) // ( L12 L2 ) ( U2 ) // // ( W X ) // A^-1 = ( ) // ( Y Z ) // ablas.ablascomplexsplitlength(ref a, n, ref n1, ref n2); System.Diagnostics.Debug.Assert(n2 > 0, "LUInverseRec: internal error!"); // // X := inv(U1)*U12*inv(U2) // ablas.cmatrixlefttrsm(n1, n2, ref a, offs, offs, true, false, 0, ref a, offs, offs + n1); ablas.cmatrixrighttrsm(n1, n2, ref a, offs + n1, offs + n1, true, false, 0, ref a, offs, offs + n1); // // Y := inv(L2)*L12*inv(L1) // ablas.cmatrixlefttrsm(n2, n1, ref a, offs + n1, offs + n1, false, true, 0, ref a, offs + n1, offs); ablas.cmatrixrighttrsm(n2, n1, ref a, offs, offs, false, true, 0, ref a, offs + n1, offs); // // W := inv(L1*U1)+X*Y // cmatrixluinverserec(ref a, offs, n1, ref work, ref info, ref rep); if (info <= 0) { return; } ablas.cmatrixgemm(n1, n1, n2, 1.0, ref a, offs, offs + n1, 0, ref a, offs + n1, offs, 0, 1.0, ref a, offs, offs); // // X := -X*inv(L2) // Y := -inv(U2)*Y // ablas.cmatrixrighttrsm(n1, n2, ref a, offs + n1, offs + n1, false, true, 0, ref a, offs, offs + n1); for (i = 0; i <= n1 - 1; i++) { for (i_ = offs + n1; i_ <= offs + n - 1; i_++) { a[offs + i, i_] = -1 * a[offs + i, i_]; } } ablas.cmatrixlefttrsm(n2, n1, ref a, offs + n1, offs + n1, true, false, 0, ref a, offs + n1, offs); for (i = 0; i <= n2 - 1; i++) { for (i_ = offs; i_ <= offs + n1 - 1; i_++) { a[offs + n1 + i, i_] = -1 * a[offs + n1 + i, i_]; } } // // Z := inv(L2*U2) // cmatrixluinverserec(ref a, offs + n1, n2, ref work, ref info, ref rep); }
// if you override Equals you must also override GetHashCode, otherwise if this is // used as a key in a hash table things wouldn't work correctly public override int GetHashCode() { return(ML.GetHashCode() ^ AP.GetHashCode() ^ SI.GetHashCode()); }
/************************************************************************* Inversion of a matrix given by its LU decomposition. INPUT PARAMETERS: A - LU decomposition of the matrix (output of CMatrixLU subroutine). Pivots - table of permutations which were made during the LU decomposition (the output of CMatrixLU subroutine). N - size of matrix A. OUTPUT PARAMETERS: Info - return code, same as in RMatrixLUInverse Rep - solver report, same as in RMatrixLUInverse A - inverse of matrix A, same as in RMatrixLUInverse -- ALGLIB routine -- 05.02.2010 Bochkanov Sergey *************************************************************************/ public static void cmatrixluinverse(ref AP.Complex[,] a, ref int[] pivots, int n, ref int info, ref matinvreport rep) { AP.Complex[] work = new AP.Complex[0]; int i = 0; int j = 0; int k = 0; AP.Complex v = 0; info = 1; // // Quick return if possible // if (n == 0) { info = -1; return; } for (i = 0; i <= n - 1; i++) { if (pivots[i] > n - 1 | pivots[i] < i) { info = -1; return; } } // // calculate condition numbers // rep.r1 = rcond.cmatrixlurcond1(ref a, n); rep.rinf = rcond.cmatrixlurcondinf(ref a, n); if ((double)(rep.r1) < (double)(rcond.rcondthreshold()) | (double)(rep.rinf) < (double)(rcond.rcondthreshold())) { for (i = 0; i <= n - 1; i++) { for (j = 0; j <= n - 1; j++) { a[i, j] = 0; } } rep.r1 = 0; rep.rinf = 0; info = -3; return; } // // Call cache-oblivious code // work = new AP.Complex[n]; cmatrixluinverserec(ref a, 0, n, ref work, ref info, ref rep); // // apply permutations // for (i = 0; i <= n - 1; i++) { for (j = n - 2; j >= 0; j--) { k = pivots[j]; v = a[i, j]; a[i, j] = a[i, k]; a[i, k] = v; } } }
public override void get_par() { IT = AP.get_selected_item(); opa = AP.Inter.get_opacity(); }
/************************************************************************* Inversion of a Hermitian positive definite matrix which is given by Cholesky decomposition. Input parameters: A - Cholesky decomposition of the matrix to be inverted: A=U�*U or A = L*L'. Output of HPDMatrixCholesky subroutine. N - size of matrix A. IsUpper � storage format. If IsUpper = True, then matrix A is given as A = U'*U (matrix contains upper triangle). Similarly, if IsUpper = False, then A = L*L'. Output parameters: Info - return code, same as in RMatrixLUInverse Rep - solver report, same as in RMatrixLUInverse A - inverse of matrix A, same as in RMatrixLUInverse -- ALGLIB routine -- 10.02.2010 Bochkanov Sergey *************************************************************************/ public static void hpdmatrixcholeskyinverse(ref AP.Complex[,] a, int n, bool isupper, ref int info, ref matinvreport rep) { int i = 0; int j = 0; int info2 = 0; matinvreport rep2 = new matinvreport(); AP.Complex[] tmp = new AP.Complex[0]; AP.Complex v = 0; if (n < 1) { info = -1; return; } info = 1; // // calculate condition numbers // rep.r1 = rcond.hpdmatrixcholeskyrcond(ref a, n, isupper); rep.rinf = rep.r1; if ((double)(rep.r1) < (double)(rcond.rcondthreshold()) | (double)(rep.rinf) < (double)(rcond.rcondthreshold())) { if (isupper) { for (i = 0; i <= n - 1; i++) { for (j = i; j <= n - 1; j++) { a[i, j] = 0; } } } else { for (i = 0; i <= n - 1; i++) { for (j = 0; j <= i; j++) { a[i, j] = 0; } } } rep.r1 = 0; rep.rinf = 0; info = -3; return; } // // Inverse // tmp = new AP.Complex[n]; hpdmatrixcholeskyinverserec(ref a, 0, n, isupper, ref tmp); }
public override void get_par() { IT = AP.get_selected_item(); size = AP.Inter.get_size(); }
/************************************************************************* Triangular matrix inverse (complex) The subroutine inverts the following types of matrices: * upper triangular * upper triangular with unit diagonal * lower triangular * lower triangular with unit diagonal In case of an upper (lower) triangular matrix, the inverse matrix will also be upper (lower) triangular, and after the end of the algorithm, the inverse matrix replaces the source matrix. The elements below (above) the main diagonal are not changed by the algorithm. If the matrix has a unit diagonal, the inverse matrix also has a unit diagonal, and the diagonal elements are not passed to the algorithm. Input parameters: A - matrix, array[0..N-1, 0..N-1]. N - size of A. IsUpper - True, if the matrix is upper triangular. IsUnit - True, if the matrix has a unit diagonal. Output parameters: Info - same as for RMatrixLUInverse Rep - same as for RMatrixLUInverse A - same as for RMatrixLUInverse. -- ALGLIB -- Copyright 05.02.2010 by Bochkanov Sergey *************************************************************************/ public static void cmatrixtrinverse(ref AP.Complex[,] a, int n, bool isupper, bool isunit, ref int info, ref matinvreport rep) { int i = 0; int j = 0; AP.Complex[] tmp = new AP.Complex[0]; if (n < 1) { info = -1; return; } info = 1; // // calculate condition numbers // rep.r1 = rcond.cmatrixtrrcond1(ref a, n, isupper, isunit); rep.rinf = rcond.cmatrixtrrcondinf(ref a, n, isupper, isunit); if ((double)(rep.r1) < (double)(rcond.rcondthreshold()) | (double)(rep.rinf) < (double)(rcond.rcondthreshold())) { for (i = 0; i <= n - 1; i++) { for (j = 0; j <= n - 1; j++) { a[i, j] = 0; } } rep.r1 = 0; rep.rinf = 0; info = -3; return; } // // Invert // tmp = new AP.Complex[n]; cmatrixtrinverserec(ref a, 0, n, isupper, isunit, ref tmp, ref info, ref rep); }
public EftRecvPartyNameAddress(AP ap) : base(ap) { }
public override void get_par() { IT = AP.get_selected_item(); pos = AP.Inter.get_postion(); }
public override void get_par() { IT = AP.get_selected_item(); }
public void ProcessPacket(Packet packet, DateTime ArrivalDate, int Channel) { PacketDotNet.Ieee80211.BeaconFrame beacon = packet as PacketDotNet.Ieee80211.BeaconFrame; PacketDotNet.Ieee80211.ProbeRequestFrame probeRequest = packet as PacketDotNet.Ieee80211.ProbeRequestFrame; PacketDotNet.Ieee80211.QosDataFrame DataFrame = packet as PacketDotNet.Ieee80211.QosDataFrame; PacketDotNet.Ieee80211.DeauthenticationFrame DeAuthFrame = packet as PacketDotNet.Ieee80211.DeauthenticationFrame; PacketDotNet.Ieee80211.AssociationRequestFrame AuthRequestFrame = packet as PacketDotNet.Ieee80211.AssociationRequestFrame; PacketDotNet.Ieee80211.DataDataFrame DataDataFrame = packet as PacketDotNet.Ieee80211.DataDataFrame; PacketDotNet.Ieee80211.RadioPacket radioFrame = packet as PacketDotNet.Ieee80211.RadioPacket; if (packet != null && false)//LiveCaptureMode) { _allFrames.Add(new AnyPacketFrame(ArrivalDate, packet, Channel)); } if (radioFrame != null) { PacketDotNet.Ieee80211.FrameControlField.FrameSubTypes type = ((PacketDotNet.Ieee80211.MacFrame)radioFrame.PayloadPacket).FrameControl.SubType; if (type == PacketDotNet.Ieee80211.FrameControlField.FrameSubTypes.ManagementBeacon) { beacon = new PacketDotNet.Ieee80211.BeaconFrame(new PacketDotNet.Utils.ByteArraySegment(packet.Bytes)); } else if (type == PacketDotNet.Ieee80211.FrameControlField.FrameSubTypes.Data) { DataFrame = new PacketDotNet.Ieee80211.QosDataFrame(new PacketDotNet.Utils.ByteArraySegment(packet.Bytes)); } } if (beacon != null) { BeaconFrame beaconFrame = new BeaconFrame(beacon, ArrivalDate, Channel); _beacons.Add(beaconFrame); long MacAddrNumber = Utils.MacToLong(beaconFrame.MacAddress); //check for APs with this Mac Address AccessPoint AP = null; if (!_accessPoints.TryGetValue(MacAddrNumber, out AP)) { AP = new AccessPoint(beaconFrame); _accessPoints.Add(MacAddrNumber, AP); } AP.AddBeaconFrame(beaconFrame); if (onReadAccessPoint != null) { onReadAccessPoint(AP); } } else if (probeRequest != null) { ProbePacket probe = new ProbePacket(probeRequest, ArrivalDate); Station station = null; long MacAddrNumber = Utils.MacToLong(probe.SourceMacAddress); if (!_stations.TryGetValue(MacAddrNumber, out station)) { station = new Station(probe); _stations.Add(MacAddrNumber, station); } station.AddProbe(probe); if (onReadStation != null) { onReadStation(station); } } /**/ else if (DataFrame != null) { DataFrame _dataFrame = new Packets.DataFrame(DataFrame, ArrivalDate, Channel); _dataFrames.Add(_dataFrame); if (onReadDataFrame != null) { onReadDataFrame(_dataFrame); } } else if (DataDataFrame != null) { DataFrame _dataFrame = new Packets.DataFrame(DataDataFrame, ArrivalDate, Channel); _dataFrames.Add(_dataFrame); if (onReadDataFrame != null) { onReadDataFrame(_dataFrame); } } else if (AuthRequestFrame != null) { _authRequestFrames.Add(new AuthRequestFrame(AuthRequestFrame, ArrivalDate)); } else if (radioFrame != null) { } }
private async void Window_PreviewKeyDown(object sender, KeyEventArgs e) { var key = e.Key == Key.System ? e.SystemKey : e.Key; ApplyKeyboardModifiers(); if (!tasklist.SearchBox.TextBox.IsFocused) { if (AP.IsMouseOver && !AP.IsKeyboardFocusWithin) { e.Handled = true; switch (key) { case Key.Space: if (Keyboard.Modifiers == ModifierKeys.Control) { tasklist.FILEList.ScrollIntoView(AP.CurrentPlaying); } else { if (AP.Player.State == MediaStates.Stopped || AP.Player.State == MediaStates.NothingSpecial) { await PlayFile(tasklist.FILEList.SelectedItem as Fichier, null); } else { await AP.PlayPause(); } } break; case Key.S: if (Keyboard.Modifiers == ModifierKeys.Shift) { await VGMStream.DeleteTempFilesIfNotUsed(); GC.Collect(); } else { await CancelAndStop(); } break; case Key.PageDown: await NextWithRandom(); break; case Key.PageUp: await PreviousWithRandom(); break; case Key.Insert: tasklist.OpenFileDialog((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control, (Keyboard.Modifiers & ModifierKeys.Alt) == ModifierKeys.Alt); break; case Key.Delete: switch (Keyboard.Modifiers) { case ModifierKeys.Control: tasklist.RemoveInvalidItems(); break; case ModifierKeys.Shift: tasklist.RemoveAll(); break; case ModifierKeys.Alt: tasklist.RemoveDFiles(); break; case ModifierKeys.Control | ModifierKeys.Alt: tasklist.RemoveSNFiles(); break; default: tasklist.RemoveSelectedItems(); break; } break; case Key.Left: await AP.PositionMinus(); break; case Key.Right: await AP.PositionPlus(); break; default: goto NoMouseOver; } } if (tasklist.IsMouseOver && !tasklist.IsKeyboardFocusWithin) { switch (key) { case Key.F: if (Keyboard.Modifiers == ModifierKeys.Control) { e.Handled = true; if (tasklist.SearchBox.Visibility == Visibility.Visible) { tasklist.SearchBox.TextBox.Focus(); } else { tasklist.SearchBox.Visibility = Visibility.Visible; } } break; case Key.C: if (Keyboard.Modifiers == ModifierKeys.Control) { tasklist.CopySelectedFiles(); } break; case Key.X: if (Keyboard.Modifiers == ModifierKeys.Control) { tasklist.CutSelectedFiles(); } break; case Key.V: if (Keyboard.Modifiers == ModifierKeys.Control) { tasklist.PasteFiles(); } break; } if (!tasklist.IsKeyboardFocusWithin) { tasklist.FILEList_PreviewKeyDown(sender, e); } } if (tasklist.IsMouseOver && !AP.IsKeyboardFocusWithin) { switch (key) { case Key.Space: e.Handled = true; if (Keyboard.Modifiers == ModifierKeys.Control) { tasklist.FILEList.ScrollIntoView(AP.CurrentPlaying); } else { if (AP.Player.State == MediaStates.Stopped || AP.Player.State == MediaStates.NothingSpecial) { await PlayFile(tasklist.FILEList.SelectedItem as Fichier, null); } else { await AP.PlayPause(); } } break; case Key.S: if (Keyboard.Modifiers == ModifierKeys.Shift) { await VGMStream.DeleteTempFilesIfNotUsed(); GC.Collect(); } else { await CancelAndStop(); } break; case Key.PageDown: e.Handled = true; await NextWithRandom(); break; case Key.PageUp: e.Handled = true; await PreviousWithRandom(); break; } } } NoMouseOver: switch (key) { case Key.Play: if (AP.Player.State == MediaStates.Stopped || AP.Player.State == MediaStates.NothingSpecial) { await PlayFile(tasklist.FILEList.SelectedItem as Fichier, null); } else { await AP.Play(); } break; case Key.Pause: await AP.Pause(); break; case Key.MediaPlayPause: if (AP.Player.State == MediaStates.Stopped || AP.Player.State == MediaStates.NothingSpecial) { await PlayFile(tasklist.FILEList.SelectedItem as Fichier, null); } else { await AP.PlayPause(); } break; case Key.MediaStop: await CancelAndStop(); break; case Key.MediaNextTrack: await NextWithRandom(); break; case Key.MediaPreviousTrack: await PreviousWithRandom(); break; case Key.B: if (Keyboard.Modifiers == (ModifierKeys.Control | ModifierKeys.Shift)) { e.Handled = true; StatusBar.Display = !StatusBar.Display; Settings.SettingsData["StatusBar"]["Display"] = StatusBar.Display.ToString(); } break; case Key.P: if (Keyboard.Modifiers == ModifierKeys.Control) { OpenSettingsWindow(); } break; case Key.O: switch (Keyboard.Modifiers) { case ModifierKeys.Control | ModifierKeys.Shift: tasklist.OpenFileDialog(true, false); break; case ModifierKeys.Control: tasklist.OpenFileDialog(false, false); break; case ModifierKeys.Control | ModifierKeys.Alt | ModifierKeys.Shift: tasklist.OpenFileDialog(true, true); break; case ModifierKeys.Control | ModifierKeys.Alt: tasklist.OpenFileDialog(false, true); break; } break; case Key.D: switch (Keyboard.Modifiers) { case ModifierKeys.Control | ModifierKeys.Alt: if (await VGMStream.DownloadVLC()) { MessageBox.Show(App.Str("WW_VLCDownloaded"), string.Empty, MessageBoxButton.OK, MessageBoxImage.Information); } break; case ModifierKeys.Control: await VGMStream.DownloadVGMStream(); break; } break; case Key.F5: StartButton_Click(StartButton, new RoutedEventArgs()); break; #if DEBUG case Key.X: if (Keyboard.Modifiers == (ModifierKeys.Control | ModifierKeys.Alt)) { /*switch (App.CurrentCulture.ToString()) * { * case "fr-FR": * App.SetLanguage("en-US"); * break; * case "en-US": * App.SetLanguage("fr-FR"); * break; * }*/ } break; #endif } }