private P2PData GetP2PDataToSend() { if (this.CfDataManagerContainer1.DataCount > 0) { Data dat = this.CfDataManagerContainer1.SelectedData; P2PData p2pDat = default(P2PData); if (!(dat == null)) { p2pDat = P2PData.GetP2PDataObject(dat.DataName, dat.data); if (!(p2pDat == null)) { this.AssingDataAttributesToP2PData(p2pDat); return(p2pDat); } else { throw new Exception("No valid p2p data to return"); } } else { throw (new Exception("No selected data to send")); } } else { throw (new Exception("No data available to send")); } }
public CommunicationsLibrary.Services.P2PCommunicationsScheme.Data.P2PData RetrieveData(CommunicationsLibrary.Services.P2PCommunicationsScheme.Data.P2PDataRequest request, int HandlerP2PPortNumber) { string dataName = request.RequestedDataName; if (this.chkSimulateHaltExecution.Checked) { while (true) { System.Threading.Thread.Sleep(10); if (!this.chkSimulateHaltExecution.Checked) { break; } } } if (this.chkSimulateFailure.Checked) { if (rbtnSimulateNull.Checked) { return(null); } else { throw (new Exception(this.txtExceptionText.Text)); } } if (this.chkRequestLog.Checked) { string msgStr = "Data Requested : " + dataName; this.SetListBoxItem(this.lstRequestReceived, msgStr); } this.SetDataGridDataSource(this.dgrGeneralStatistics, this._P2PPort.Statistics.GeneralStatisticsTable); this.SetDataGridDataSource(this.dgrRequestStatistics, this._P2PPort.Statistics.DataRequestsStatisticsTable); if (this.CfDataManagerContainer1.ContainsData(dataName)) { Data dat = this.CfDataManagerContainer1.DataItem(dataName); P2PData data = default(P2PData); data = P2PData.GetP2PDataObject(dataName, dat.data); return(data); } else { return(null); } }
public Services.P2PCommunicationsScheme.Data.P2PData RetrieveData(Services.P2PCommunicationsScheme.Data.P2PDataRequest request, int P2PPortNumber) { string adresseComponentName = System.Convert.ToString(request.GetRequestParameter("ADDRESSE_COMPONENT")); if (adresseComponentName == null) { throw (new Exception("Can\'t retrieve data because the parameter \'ADDRESSE_COMPONENT\' was missing in the request structure")); } string senderComponentName = System.Convert.ToString(request.GetRequestParameter("SENDER_COMPONENT")); if (senderComponentName == null) { throw (new Exception("Can\'t retrieve data because the parameter \'SENDER_COMPONENT\' was missing in the request structure")); } CNDCommunicationsEnvironment.Data.CommunicationsDataRequest commdDataRequest = new CNDCommunicationsEnvironment.Data.CommunicationsDataRequest(adresseComponentName, senderComponentName, System.Convert.ToString(request.RequestedDataName)); CommunicationsData dataResult = ((CNDCommunicationsEnvironment.Interfaces.IUseCNDCommunicationsScheme) this._componentOwner).RetrieveDataToRemoteComponent(commdDataRequest); P2PData resultData = P2PData.GetP2PDataObject(dataResult.P2PData.DataName, dataResult.P2PData.Value); return(resultData); }