//[string message] public Layout(RawData data) { Message = data.ReadString(); }
public void WriteTo(RawData data) { if (string.IsNullOrEmpty(Message)) return; data.WriteByte((byte)Type); data.WriteString(Message); }
/* SmallCsvFile has the values: A: B: C: 1 6 11 2 7 12 3 8 13 4 9 14 5 10 15 --------- Averages: 3 8 13 Grand Mean = 8 SST = 280 SSW = 30 SSB = 250 dft = 14 dfw = 12 dfb = 2 msb = 125 msw = 2.5 F = 50 */ public AnovaTestsExcel() { rData = new RawData(); //CsvParser parser = new CsvParser(); ExcelParser parser = new ExcelParser(); bool parsed = parser.TryParseData(@"TestFiles/SmallExcelFile.xlsx", out rData); data = new AnovaOneway(rData); }
private RawData ParseData(SLDocument doc) { RawData data = new RawData(); for (int i = 1; i <= numCols; i++) { data.Add(GetDataGroup(doc, i)); } return data; }
/// <summary> /// Takes in a filepath, and parses it according to type /// </summary> /// <param name="filepath">Path to the file to be parsed</param> /// <returns>Success flag</returns> public bool ParseInput(string filepath) { rawData = new RawData(); IDataParser parser = GetParser(filepath); //Throw failure flag if a parser can't be instantiated //Todo:Implement logging return parser != null && parser.TryParseData(filepath, out rawData); //Attempt parse, and return flag }
/* SmallCsvFile has the values: A: B: C: 1 6 11 2 7 12 3 8 13 4 9 14 5 10 15 --------- Averages: 3 8 13 Grand Mean = 8 SST = 280 SSE = 30 SSB = 250 dft = 14 dfe = 12 dfb = 2 msb = 125 msw = 2.5 F = 50 P = 0.0000015127924217375413 */ public AnovaTestsSmallCsv() { rData = new RawData(); CsvParser parser = new CsvParser(); bool parsed = parser.TryParseData(@"TestFiles/SmallCsvFile.csv", out rData); data = new AnovaOneway(rData); //AnovaResult res = data.GenerateAnovaResult(); //Debug.WriteLine(res); }
//[short configType][string message] public ConfigString(ConfigStringType configType, int subCode, RawData data) { ConfigType = configType; SubCode = subCode; Message = data.ReadString(); if(Message == string.Empty) ConfigType = ConfigStringType.Bad; }
public NGeoClientTest() { nGeoRequest = new Request() { Format = Format.Json, IP = HelperTest.GetLocalIP() }; nGeoClient = new NGeoClient(nGeoRequest); rawData = nGeoClient.Execute(); }
private RawData ParseData(string filepath) { RawData data = new RawData(); XDocument doc = XDocument.Load(filepath); XNamespace ns = "AnovaXMLSchema.xsd"; XElement root = doc.Descendants(ns + "DataSet").First(); foreach (XElement group in root.Descendants(ns + "Group")) { data.Add(ReadXmlGroup(group, ns)); } return data; }
public bool TryParseData(string filepath, out RawData output) { try { output = ParseData(filepath); return true; } catch (Exception) { output = null; return false; } }
public bool TryParseData(string filepath, out RawData output) { try { SLDocument doc = Open(filepath); CacheStats(doc); output = ParseData(doc); return true; } catch (Exception) { //todo: implement logging code here output = null; return false; } }
public void toAdmin(Message message, SessionID sessionID) { // This is only for the TT dev environment. The production FIX Adapter does not require a password MsgType msgType = new MsgType(); message.getHeader().getField(msgType); TargetCompID targetCompID = new TargetCompID(); message.getHeader().getField(targetCompID); if (msgType.ToString() == MsgType.Logon && (targetCompID.ToString() == "TTDEV9P" || targetCompID.ToString() == "TTDEV9O")) { const string password = "******"; RawData rawData = new RawData(password); message.getHeader().setField(rawData); } // End TT Dev environment case }
public bool TryParseData(string filepath, out RawData output) { try { output = new RawData(); IEnumerable<string[]> fieldArrays = ExtractFields(filepath); foreach (string[] array in fieldArrays) { IEnumerable<string> fields = RemoveEmptyFields(array); DataGroup group = ParseDataGroup(fields); output.Add(group); } return true; } catch (Exception) { //todo: implement logging code here output = null; return false; } }
public override string ToString() { return(RawData.Replace('\t', ' ')); }
public void StartDownload() { try { IEnumerable <Device> devices; string strDeviceModel = ""; //get valid devices using (var db = new iTimeServiceContext()) { devices = db.Set <Device>() .Where(x => (x.isdeleted == false || x.isdeleted == null)) .Where(x => x.isactive == true) .ToList(); } if (devices.Count() > 0) { foreach (var dev in devices) { string ipAdd = tripIpAdd(dev.ip); if (dev.model == enDeviceModel.Black_White) { strDeviceModel = "Black n White"; } else { strDeviceModel = "MultiMedia"; } Ping ping = new Ping(); PingReply reply; try { reply = ping.Send(ipAdd); if (reply.Status == IPStatus.Success) { if (dev.sdkname == enSDK_Name.ZKemKeeper) { string idwEnrollNumber; int enrollNo, idwVerifyMode; int idwInOutMode, idwYear, idwMonth, idwDay, idwHour, idwMinute, idwErrorCode; int idwSecond, idwWorkCode, idwReserved; DateTime punchTime; var glCount = 0; idwWorkCode = 0; idwErrorCode = 0; idwReserved = 0; bool isConnected; //ipAdd = "192.168.1.206"; isConnected = czKEM.Connect_Net(ipAdd, dev.port); if (isConnected) { if (czKEM.ReadGeneralLogData(dev.devno)) { if (dev.model == enDeviceModel.MultiMedia) { while (this.czKEM.SSR_GetGeneralLogData(dev.devno, out idwEnrollNumber, out idwVerifyMode, out idwInOutMode, out idwYear, out idwMonth, out idwDay, out idwHour, out idwMinute, out idwSecond, idwWorkCode) == true) { punchTime = instance.ToDateTime(idwYear, idwMonth, idwDay, idwHour, idwMinute, idwSecond, 0); bool rawDataExists = false; using (var db = new iTimeServiceContext()) { enrollNo = Int32.Parse(idwEnrollNumber.ToString()); rawDataExists = db.Set <RawData>() .Where(x => x.ENROLL_NO == enrollNo && x.DT_YR == idwYear) .Where(x => x.DT_MNTH == idwMonth && x.DT_DAY == idwDay) .Where(x => x.DT_HR == idwHour && x.DT_MIN == idwMinute && x.DT_SEC == idwSecond) .Where(x => x.DEV_ID == dev.devno) .Count() > 0; } if (!rawDataExists) { RawData rData = new RawData { ENROLL_NO = enrollNo, DT_YR = idwYear, DT_MNTH = idwMonth, DT_DAY = idwDay, DT_HR = idwHour, DT_MIN = idwMinute, DT_SEC = idwSecond, VER = idwVerifyMode, R_IO = idwInOutMode, R_WORK = idwWorkCode, DEV_ID = dev.devno, R_LOG = idwReserved, DATE_LOG = DateTime.Now, PUNCH_TIME = punchTime }; using (var db = new iTimeServiceContext()) { db.RawData.Add(rData); db.SaveChanges(); } Common.Common._insertedOk = true; } } czKEM.ClearGLog(dev.devno); } } } else { czKEM.GetLastError(idwErrorCode); if (idwErrorCode != 0) { _log.Info("Device data download failed. Error Code:" + idwErrorCode); } else { _log.Info("Device returns no data"); } Common.Common._insertedOk = false; } } else if (dev.sdkname == enSDK_Name.BioBridgeSDK) { //DownLoadBioBridge(dev, ipAdd); frmAxBioBridge bioBrdgeContainer = new frmAxBioBridge(); string strDevModel = "Black n White"; int icomKey = Int32.Parse(dev.comkey.ToString()); int EnrollNo = 0; int yr = 0; int mth = 0; int day_Renamed = 0; int hr = 0; int min = 0; int sec = 0; int ver = 0; int io = 0; int work = 0; int rlog = 0; DateTime punchTime; if (bioBrdgeContainer.axBioBridgeSDK1.Connect_TCPIP(strDevModel, dev.devno, ipAdd, dev.port, icomKey) == 0) { if (dev.model == enDeviceModel.Black_White) { if (bioBrdgeContainer.axBioBridgeSDK1.ReadGeneralLog(ref rlog) == 0) { //while (bioBrdgeContainer.axBioBridgeSDK1.GetGeneralLogData(dev.devno, EnrollNo, ver, io, yr, mth, day_Renamed, hr, min, sec, work) == 0) while (bioBrdgeContainer.axBioBridgeSDK1.GetGeneralLog(ref EnrollNo, ref yr, ref mth, ref day_Renamed, ref hr, ref min, ref sec, ref ver, ref io, ref work) == 0) { punchTime = instance.ToDateTime(yr, mth, day_Renamed, hr, min, sec, 0); bool rawDataExists = false; using (var db = new iTimeServiceContext()) { rawDataExists = db.Set <RawData>() .Where(x => x.ENROLL_NO == EnrollNo && x.DT_YR == yr) .Where(x => x.DT_MNTH == mth && x.DT_DAY == day_Renamed) .Where(x => x.DT_HR == hr && x.DT_MIN == min && x.DT_SEC == sec) .Where(x => x.DEV_ID == dev.devno) .Count() > 0; } if (!rawDataExists) { RawData rData = new RawData { ENROLL_NO = EnrollNo, DT_YR = yr, DT_MNTH = mth, DT_DAY = day_Renamed, DT_HR = hr, DT_MIN = min, DT_SEC = sec, VER = ver, R_IO = io, R_WORK = work, DEV_ID = dev.devno, R_LOG = rlog, DATE_LOG = DateTime.Now, PUNCH_TIME = punchTime }; using (var db = new iTimeServiceContext()) { db.RawData.Add(rData); db.SaveChanges(); Common.Common._insertedOk = true; } } } } bioBrdgeContainer.axBioBridgeSDK1.DeleteGeneralLog(); } } else { Common.Common._insertedOk = false; _log.Info("Connection to device IP : " + ipAdd + " Failed."); } bioBrdgeContainer.Dispose(); } } else if (reply.Status == IPStatus.DestinationHostUnreachable) { Common.Common._insertedOk = false; _log.Info("Device name " + dev.name + " with IP address: " + ipAdd + " was not reachable at " + DateTime.Now); } } catch (Exception ex) { Common.Common._insertedOk = false; Common.Common._exception = ex; //_log.Debug("Network connection to device :" + dev.name + " [IP: " + ipAdd + "] Failed", ex.InnerException); } } } } catch (Exception ex) { Common.Common._insertedOk = false; Common.Common._exception = ex; } }
/// <summary> /// Converts the <see cref="RawData.Data"/> array into a <see cref="double"/> and returns it. /// </summary> /// <param name="rawData">The <see cref="RawData"/> packet whose data to deserialise.</param> /// <returns>The deserialised value.</returns> public static double ToDouble(RawData rawData) { return(BitConverter.ToDouble(rawData.Data, 0)); }
public static void Main() { var raw = new RawData(); raw.P.X = 1; // フィールドは直接書き換え可能 raw.Items[0].X = 1; // 配列の要素の直接書き換え可能 }
/// <summary> /// Converts the <see cref="RawData.Data"/> array into a <see cref="string"/> using the <see cref="Encoding.UTF7"/> encoding, and returns it. /// </summary> /// <param name="rawData">The <see cref="RawData"/> packet whose data to deserialise.</param> /// <returns>The deserialised value.</returns> public static string ToUTF7String(RawData rawData) { return(Encoding.UTF7.GetString(rawData.Data)); }
/// <summary> /// Converts the <see cref="RawData.Data"/> array into a <see cref="char"/> and returns it. /// </summary> /// <param name="rawData">The <see cref="RawData"/> packet whose data to deserialise.</param> /// <returns>The deserialised value.</returns> public static char ToChar(RawData rawData) { return(BitConverter.ToChar(rawData.Data, 0)); }
/// <summary> /// Extracts an integer from the data stream. /// </summary> /// <param name="data">Raw data stream.</param> /// <param name="offset">Start offset.</param> /// <param name="width">Word width, which may be 1-4 bytes.</param> /// <param name="isBigEndian">True if word is in big-endian order.</param> /// <returns>Value found.</returns> public static int GetWord(byte[] data, int offset, int width, bool isBigEndian) { return(RawData.GetWord(data, offset, width, isBigEndian)); }
public CONSTRAINT_TABLE_USAGE(string connectionString) { RawData rd = new RawData(connectionString); rd.GetDataTable(out _constraint_tbl_use_dt, CONSTRAINT_TABLE_USAGE.Query); }
private CheckDefinition() { RawData.AddRange(new byte[0x10]); }
public void WriteTo(RawData data) { if (_configType == ConfigStringType.Bad) return; data.WriteByte((byte)Type); data.WriteShort((short) ((short)ConfigType + SubCode)); data.WriteString(Message); }
}//Codabar /// <summary> /// Encode the raw data using the Codabar algorithm. /// </summary> private string Encode_Codabar() { if (Raw_Data.Length < 2) { Error("ECODABAR-1: Data format invalid. (Invalid length)"); } //check first char to make sure its a start/stop char switch (Raw_Data[0].ToString().ToUpper().Trim()) { case "A": break; case "B": break; case "C": break; case "D": break; default: Error("ECODABAR-2: Data format invalid. (Invalid START character)"); break; }//switch //check the ending char to make sure its a start/stop char switch (Raw_Data[Raw_Data.Trim().Length - 1].ToString().ToUpper().Trim()) { case "A": break; case "B": break; case "C": break; case "D": break; default: Error("ECODABAR-3: Data format invalid. (Invalid STOP character)"); break; }//switch string temp = Raw_Data.Trim().Substring(1, RawData.Trim().Length - 2); if (!IsNumeric(temp)) { Error("ECODABAR-4: Data contains non-numeric characters."); } string result = ""; //populate the hashtable to begin the process this.init_Codabar(); foreach (char c in Raw_Data) { result += Codabar_Code[c].ToString(); result += "0"; //inter-character space }//foreach //remove the extra 0 at the end of the result result = result.Remove(result.Length - 1); //clears the hashtable so it no longer takes up memory this.Codabar_Code.Clear(); //change the Raw_Data to strip out the start stop chars for label purposes Raw_Data = Raw_Data.Trim().Substring(1, RawData.Trim().Length - 2); return(result); }//Encode_Codabar
private string Encode_Codabar() { if (Raw_Data.Length < 2) { Error("ECODABAR-1: Data format invalid. (Invalid length)"); } switch (Raw_Data[0].ToString().ToUpper().Trim()) { case "A": break; case "B": break; case "C": break; case "D": break; default: Error("ECODABAR-2: Data format invalid. (Invalid START character)"); break; } switch (Raw_Data[Raw_Data.Trim().Length - 1].ToString().ToUpper().Trim()) { case "A": break; case "B": break; case "C": break; case "D": break; default: Error("ECODABAR-3: Data format invalid. (Invalid STOP character)"); break; } this.init_Codabar(); string temp = Raw_Data; foreach (char c in Codabar_Code.Keys) { if (!CheckNumericOnly(c.ToString())) { temp = temp.Replace(c, '1'); } } if (!CheckNumericOnly(temp)) { Error("ECODABAR-4: Data contains invalid characters."); } string result = ""; foreach (char c in Raw_Data) { result += Codabar_Code[c].ToString(); result += "0"; } result = result.Remove(result.Length - 1); this.Codabar_Code.Clear(); Raw_Data = Raw_Data.Trim().Substring(1, RawData.Trim().Length - 2); return(result); }
public void FinalizeReport() { AnalyseData(); this.RawData = new List <Item>(); this.AllItems.ForEach(i => RawData.Add(i.GetCopy(true))); }
private static async Task <RawData> CreateRawDataAsync(IMongoCollection <RawData> mongoCollection, RawData rawDatas) { try { await mongoCollection.InsertOneAsync(rawDatas); MyConsole.Info("#### ### Create Raw Data Async Successfully!"); return(rawDatas); } catch (Exception ex) { MyConsole.Error("#### ###Create Raw Data failed" + ex.Message); throw; } }
// IGenerator public void OutputDataOp(int offset) { Formatter formatter = SourceFormatter; byte[] data = Project.FileData; Anattrib attr = Project.GetAnattrib(offset); string labelStr = string.Empty; if (attr.Symbol != null) { labelStr = mLocalizer.ConvLabel(attr.Symbol.Label); } string commentStr = SourceFormatter.FormatEolComment(Project.Comments[offset]); string opcodeStr, operandStr; FormatDescriptor dfd = attr.DataDescriptor; Debug.Assert(dfd != null); int length = dfd.Length; Debug.Assert(length > 0); bool multiLine = false; switch (dfd.FormatType) { case FormatDescriptor.Type.Default: if (length != 1) { Debug.Assert(false); length = 1; } opcodeStr = sDataOpNames.DefineData1; int operand = RawData.GetWord(data, offset, length, false); operandStr = formatter.FormatHexValue(operand, length * 2); break; case FormatDescriptor.Type.NumericLE: opcodeStr = sDataOpNames.GetDefineData(length); operand = RawData.GetWord(data, offset, length, false); operandStr = PseudoOp.FormatNumericOperand(formatter, Project.SymbolTable, mLocalizer.LabelMap, dfd, operand, length, PseudoOp.FormatNumericOpFlags.None); break; case FormatDescriptor.Type.NumericBE: opcodeStr = sDataOpNames.GetDefineBigData(length); if (string.IsNullOrEmpty(opcodeStr)) { // Nothing defined, output as comma-separated single-byte values. GenerateShortSequence(offset, length, out opcodeStr, out operandStr); } else { operand = RawData.GetWord(data, offset, length, true); operandStr = PseudoOp.FormatNumericOperand(formatter, Project.SymbolTable, mLocalizer.LabelMap, dfd, operand, length, PseudoOp.FormatNumericOpFlags.None); } break; case FormatDescriptor.Type.Fill: opcodeStr = sDataOpNames.Fill; operandStr = length + "," + formatter.FormatHexValue(data[offset], 2); break; case FormatDescriptor.Type.Dense: multiLine = true; opcodeStr = operandStr = null; OutputDenseHex(offset, length, labelStr, commentStr); break; case FormatDescriptor.Type.Junk: int fillVal = Helper.CheckRangeHoldsSingleValue(data, offset, length); if (fillVal >= 0 && GenCommon.CheckJunkAlign(offset, dfd, Project.AddrMap)) { // !align ANDVALUE, EQUALVALUE [, FILLVALUE] opcodeStr = sDataOpNames.Align; int alignVal = 1 << FormatDescriptor.AlignmentToPower(dfd.FormatSubType); operandStr = (alignVal - 1).ToString() + ",0," + formatter.FormatHexValue(fillVal, 2); } else if (fillVal >= 0) { // treat same as Fill opcodeStr = sDataOpNames.Fill; operandStr = length + "," + formatter.FormatHexValue(fillVal, 2); } else { // treat same as Dense multiLine = true; opcodeStr = operandStr = null; OutputDenseHex(offset, length, labelStr, commentStr); } break; case FormatDescriptor.Type.StringGeneric: case FormatDescriptor.Type.StringReverse: case FormatDescriptor.Type.StringNullTerm: case FormatDescriptor.Type.StringL8: case FormatDescriptor.Type.StringL16: case FormatDescriptor.Type.StringDci: multiLine = true; opcodeStr = operandStr = null; OutputString(offset, labelStr, commentStr); break; default: opcodeStr = "???"; operandStr = "***"; break; } if (!multiLine) { opcodeStr = formatter.FormatPseudoOp(opcodeStr); OutputLine(labelStr, opcodeStr, operandStr, commentStr); } }
public TABLES(string connectionString) { RawData rd = new RawData(connectionString); rd.GetDataTable(out _tables_dt, TABLES.Query); }
/// <summary> /// Returns a collection of strings /// </summary> /// <returns></returns> public SomeStrings GetChunkAsStringList() { return(new SomeStrings(RawData.ToList(), 0, DataLength)); }
///<summary> ///Update the run. This does the loop calculation over the year and calculate universe state. ///</summary> ///<param name="variety">The genotypeDef used in the run.</param> ///<param name="soil">The soilDef used in the run.</param> ///<param name="site">The siteDef used in the run.</param> ///<param name="management">The managementDef used in the run.</param> ///<param name="Inparameters">The parameter set used in the run.</param> ///<param name="runOptions">The run option set used in the run.</param> public void Start( CropParameterItem variety, SoilItem soil, SiteItem site, ManagementItem management, CropParameterItem Inparameters, RunOptionItem runOptions) { this.DoStop(); // Initialisation //Ph=new Phenology.Phenology(new Universe(this)); createParameters(variety, Inparameters); this.varietyDef = variety; this.soilDef = soil; this.siteDef = site; this.managementDef = management; this.parametersDef = Inparameters; this.runOptionsDef = runOptions; if (variety != null && management != null && Inparameters != null && runOptions != null && site != null && soil != null) { } else { throw new InvalidOperationException("Some input are null."); } savedUniverses = new RawData <Universe>(400); //weather = new Weather(this); currentUniverse = new Universe(this); ///<Behnam> ///<Comment>Estimating sowing date or using a fixed sowing date</Comment> IsSowDateEstimate = management.IsSowDateEstimate; SowingWindowType = site.SowingWindowType; management.FinalSowingDate = management.SowingDate; currentUniverse.Init(site, management); currentUniverse.Weather_.EstimateSowingWindows(site, management); currentUniverse.IsSowDateEstimate = IsSowDateEstimate; double SkipDays = Math.Max(1, management.SkipDays); SowingDate = management.SowingDate; // UseActualBase = runOptionsDef.UseActualBase; DoInteractions = runOptionsDef.DoInteractions; InteractionsW = runOptionsDef.InteractionsW; InteractionsN = runOptionsDef.InteractionsN; InteractionsT = runOptionsDef.InteractionsT; InteractionsWN = runOptionsDef.InteractionsWN; InteractionsWT = runOptionsDef.InteractionsWT; InteractionsNT = runOptionsDef.InteractionsNT; InteractionsWNT = runOptionsDef.InteractionsWNT; if (IsSowDateEstimate) { var year1 = SowingDate.Year; if (SowingWindowType == 0) // Fixed sowing window { site.FinalMinSowingDate = currentUniverse.Weather_.ESD_Fixed(year1, site); site.FinalMaxSowingDate = currentUniverse.Weather_.LSD_Fixed(year1, site); } else if (SowingWindowType == 1) // JRC winter sowing window { site.FinalMinSowingDate = currentUniverse.Weather_.ESD_Winter(year1); site.FinalMaxSowingDate = currentUniverse.Weather_.LSD_Winter(year1); } else if (SowingWindowType == 2) // JRC spring sowing window { site.FinalMinSowingDate = currentUniverse.Weather_.ESD_Spring(year1, site); site.FinalMaxSowingDate = currentUniverse.Weather_.LSD_Spring(year1, site); } else if (SowingWindowType == 3) // SiriusQuality method (based on nominal sowing date) { site.FinalMinSowingDate = currentUniverse.Weather_.ESD_Sirius(year1, site); site.FinalMaxSowingDate = currentUniverse.Weather_.LSD_Sirius(year1, site); } flagReSow = true; MinSowDate = site.FinalMinSowingDate.AddDays(-SkipDays); MaxSowDate = site.FinalMaxSowingDate; SowingDate = MinSowDate; management.FinalSowingDate = MinSowDate; } else { flagReSow = false; management.FinalSowingDate = SowingDate; site.FinalMinSowingDate = site.MinSowingDate; site.FinalMaxSowingDate = site.MaxSowingDate; } currentUniverse.Init(site, management); SaveCurrentUniverse(); currentUniverse.CurrentDate = currentUniverse.CurrentDate.AddDays(1); //currentUniverse.Crop_.Sow(currentUniverse.calculateDailyThermalTime_.CumulTT, currentUniverse.CurrentDate); int numdSkipDays = 0; int numdFreezing = 0; int numdSoilTemp = 0; int numdSoilMois = 0; double numdPcp = 0; ///<Behnam (2015.11.27)> ///<Comment>To enable using soil depth without any limitations</Comment> checkLay = Convert.ToInt16(Math.Ceiling(management.CheckDepth / 5)); // Soil layer to be ckecked checkLay = Math.Min(checkLay, currentUniverse.Soil_.Layers.Count) - 1; ///</Behnam> double CheckDaysTemp = management.CheckDaysTemp; double CheckDaysPcp = management.CheckDaysPcp; double TAveThr = management.TAveThr; double TMinThr = management.TMinThr; double SoilMoistThr = management.SoilMoistThr; double CumPcpThr = management.CumPcpThr; double SoilWorkabThr = management.SoilWorkabThr; ///<Relaxation variables> double origTAveThr = management.TAveThr; double origTMinThr = management.TMinThr; double origSoilMoistThr = management.SoilMoistThr; double origCumPcpThr = management.CumPcpThr; double origSoilWorkabThr = management.SoilWorkabThr; double poTAveThr = 1.0; double poTMinThr = 1.0; double poSoilMoistThr = 1.0; double poCumPcpThr = 1.0; double poSoilWorkabThr = 1.0; double length = (int)(site.FinalMaxSowingDate - site.FinalMinSowingDate).TotalDays; double TAveThrRelax = 0; double TMinThrRelax = -4; double SoilMoistThrRelax = 0; double CumPcpThrRelax = 3; double SoilWorkabThrRelax = 1.5; ///</Relaxation variables> ///<Relaxation curves> poTAveThr = DecreasePower(TAveThr, TAveThrRelax, length); poTMinThr = DecreasePower(TMinThr, TMinThrRelax, length); poSoilMoistThr = DecreasePower(SoilMoistThr, SoilMoistThrRelax, length); poCumPcpThr = DecreasePower(CumPcpThr, CumPcpThrRelax, length); poSoilWorkabThr = IncreasePower(SoilWorkabThr, SoilWorkabThrRelax, length); ///</Relaxation curves> bool oldLimitedWater = runOptionsDef.UnlimitedWater; bool oldLimitedNitrogen = runOptionsDef.UnlimitedNitrogen; bool oldLimitedTemperature = runOptionsDef.UnlimitedTemperature; bool initSoilAfterSowing = false; double minTempInitSoilAfterSowing = 0.0; double maxTempInitSoilAfterSowing = 0.0; double meanTempInitSoilAfterSowing = 0.0; while (!currentUniverse.Crop_.IsEnd) { if (!IsSowDateEstimate && !flagReSow) ///<Comment>Non-stressed conditions are only applied after sowing</Comment> { if (DoInteractions) { ///<Parallel runs> double OutputTotalDM_W = 0; double OutputTotalDM_N = 0; double OutputTotalDM_T = 0; double OutputTotalDM_WN = 0; double OutputTotalDM_WT = 0; double OutputTotalDM_NT = 0; double OutputTotalDM_WNT = 0; /// Behnam (2016.07.13): The runOld.RunOptionDef.UseActualBase was previously used. Pierre wanted it to be deleted. /// At one stage, we decided to use Potential conditions as the base run. Now it is not working anymore. if (true) { ///<Use actual conditions as the base run> if (InteractionsW) { OutputTotalDM_W = RunUnlimited(currentUniverse, true, false, false); } if (InteractionsN) { OutputTotalDM_N = RunUnlimited(currentUniverse, false, true, false); } if (InteractionsT) { OutputTotalDM_T = RunUnlimited(currentUniverse, false, false, true); } if (InteractionsWN) { OutputTotalDM_WN = RunUnlimited(currentUniverse, true, true, false); } if (InteractionsWT) { OutputTotalDM_WT = RunUnlimited(currentUniverse, true, false, true); } if (InteractionsNT) { OutputTotalDM_NT = RunUnlimited(currentUniverse, false, true, true); } if (InteractionsWNT) { OutputTotalDM_WNT = RunUnlimited(currentUniverse, true, true, true); } currentUniverse.isUnlimitedWater = false; currentUniverse.isUnlimitedNitrogen = false; currentUniverse.isUnlimitedTemperature = false; currentUniverse.Crop_.areRootsToBeGrown = true; if (initSoilAfterSowing) { currentUniverse.Soil_.Init(minTempInitSoilAfterSowing, maxTempInitSoilAfterSowing, meanTempInitSoilAfterSowing, false); currentUniverse.ShootTemperature_.MinShootTemperature = 0; currentUniverse.ShootTemperature_.MaxShootTemperature = 0; currentUniverse.ShootTemperature_.MeanShootTemperature = 0; currentUniverse.CumAirTempFromSowing = 0.0; currentUniverse.CumMaxCanopyTempFromSowing = 0.0; currentUniverse.CumMaxAirTempFromSowing = 0.0; currentUniverse.PrevAppliedStagesN = 1; currentUniverse.PrevAppliedStagesIrr = 1; //currentUniverse.NFertChange = 1; currentUniverse.CalcChangeinNFertilisation(); initSoilAfterSowing = false; } currentUniverse.RunDayStep(); } else { ///<Use non-stressed conditions as the base run> if (InteractionsW) { OutputTotalDM_W = RunUnlimited(currentUniverse, false, true, true); } if (InteractionsN) { OutputTotalDM_N = RunUnlimited(currentUniverse, true, false, true); } if (InteractionsT) { OutputTotalDM_T = RunUnlimited(currentUniverse, true, true, false); } if (InteractionsWN) { OutputTotalDM_WN = RunUnlimited(currentUniverse, false, false, true); } if (InteractionsWT) { OutputTotalDM_WT = RunUnlimited(currentUniverse, false, true, false); } if (InteractionsNT) { OutputTotalDM_NT = RunUnlimited(currentUniverse, true, false, false); } if (InteractionsWNT) { OutputTotalDM_WNT = RunUnlimited(currentUniverse, false, false, false); } currentUniverse.isUnlimitedWater = true; currentUniverse.isUnlimitedNitrogen = true; currentUniverse.isUnlimitedTemperature = true; currentUniverse.Crop_.areRootsToBeGrown = true; if (initSoilAfterSowing) { currentUniverse.Soil_.Init(minTempInitSoilAfterSowing, maxTempInitSoilAfterSowing, meanTempInitSoilAfterSowing, false); currentUniverse.ShootTemperature_.MinShootTemperature = 0; currentUniverse.ShootTemperature_.MaxShootTemperature = 0; currentUniverse.ShootTemperature_.MeanShootTemperature = 0; currentUniverse.CumAirTempFromSowing = 0.0; currentUniverse.CumMaxCanopyTempFromSowing = 0.0; currentUniverse.CumMaxAirTempFromSowing = 0.0; currentUniverse.PrevAppliedStagesN = 1; currentUniverse.PrevAppliedStagesIrr = 1; //currentUniverse.NFertChange = 1; currentUniverse.CalcChangeinNFertilisation(); } currentUniverse.RunDayStep(); } currentUniverse.Crop_.OutputTotalDM_W = OutputTotalDM_W; currentUniverse.Crop_.OutputTotalDM_N = OutputTotalDM_N; currentUniverse.Crop_.OutputTotalDM_T = OutputTotalDM_T; currentUniverse.Crop_.OutputTotalDM_WN = OutputTotalDM_WN; currentUniverse.Crop_.OutputTotalDM_WT = OutputTotalDM_WT; currentUniverse.Crop_.OutputTotalDM_NT = OutputTotalDM_NT; currentUniverse.Crop_.OutputTotalDM_WNT = OutputTotalDM_WNT; ///</Parallel runs> } else { ///<Normal run> currentUniverse.isUnlimitedWater = oldLimitedWater; currentUniverse.isUnlimitedNitrogen = oldLimitedNitrogen; currentUniverse.isUnlimitedTemperature = oldLimitedTemperature; currentUniverse.Crop_.areRootsToBeGrown = true; if (initSoilAfterSowing) { currentUniverse.Soil_.Init(minTempInitSoilAfterSowing, maxTempInitSoilAfterSowing, meanTempInitSoilAfterSowing, false); currentUniverse.ShootTemperature_.MinShootTemperature = 0; currentUniverse.ShootTemperature_.MaxShootTemperature = 0; currentUniverse.ShootTemperature_.MeanShootTemperature = 0; currentUniverse.CumAirTempFromSowing = 0.0; currentUniverse.CumMaxCanopyTempFromSowing = 0.0; currentUniverse.CumMaxAirTempFromSowing = 0.0; currentUniverse.PrevAppliedStagesN = 1; currentUniverse.PrevAppliedStagesIrr = 1; //currentUniverse.NFertChange = 1; currentUniverse.CalcChangeinNFertilisation(); initSoilAfterSowing = false; } currentUniverse.RunDayStep(); ///</Normal run> } } else { ///<Comment>Non-stressed conditions are only applied after sowing</Comment> currentUniverse.isUnlimitedWater = false; currentUniverse.isUnlimitedNitrogen = false; currentUniverse.isUnlimitedTemperature = false; currentUniverse.Crop_.areRootsToBeGrown = false; currentUniverse.RunDayStep(); } if (IsSowDateEstimate) { // Checking sowing conditions: ///<Skip days> numdSkipDays += 1; flagSkipDays = (numdSkipDays <= SkipDays); ///</Skip days> flagMaxDate = true; flagSoilMois = true; flagCumPcp = true; flagSoilTemp = true; flagFreezing = true; flagWorkabil = true; if (!flagSkipDays) { if (management.DoRelax) { ///<Relaxation> ///<Comment>The criteria are relaxed here using four exponential curves, if DoRelax=TRUE</Comment> var n = numdSkipDays - SkipDays - 1; TAveThr = ExpoDecrease(TAveThr, TAveThrRelax, origTAveThr, n, poTAveThr); TMinThr = ExpoDecrease(TMinThr, TMinThrRelax, origTMinThr, n, poTMinThr); SoilMoistThr = ExpoDecrease(SoilMoistThr, SoilMoistThrRelax, origSoilMoistThr, n, poSoilMoistThr); CumPcpThr = ExpoDecrease(CumPcpThr, CumPcpThrRelax, origCumPcpThr, n, poCumPcpThr); SoilWorkabThr = ExpoIncrease(SoilWorkabThr, SoilWorkabThrRelax, origSoilWorkabThr, n, poSoilWorkabThr); ///</Relaxation> } ///<Average daily air temperature temperature> numdSoilTemp = 0; for (var i = 1; i <= CheckDaysTemp; ++i) { if (currentUniverse.Weather_.MeanTemp(currentUniverse.CurrentDate.AddDays(i)) >= TAveThr) { numdSoilTemp += 1; } } flagSoilTemp = (numdSoilTemp < CheckDaysTemp); ///</Average daily air temperature temperature> ///<Minimum daily air temperature (frost risk)> numdFreezing = 0; for (var i = 1; i <= CheckDaysTemp; ++i) { if (currentUniverse.Weather_.MinTemp(currentUniverse.CurrentDate.AddDays(i)) >= TMinThr) { numdFreezing += 1; } } flagFreezing = (numdFreezing < CheckDaysTemp); ///</Minimum daily air temperature (frost risk)> ///<Cumulative precipitation> numdPcp = 0; for (var i = 1; i <= CheckDaysPcp; ++i) { numdPcp += currentUniverse.Weather_.Rain(currentUniverse.CurrentDate.AddDays(i)) / MMwaterToGwater; } flagCumPcp = (numdPcp < CumPcpThr); ///</Cumulative precipitation> ///<Soil moisture> if (currentUniverse.Soil_.Layers[checkLay].AvWater < SoilMoistThr * currentUniverse.Soil_.Layers[checkLay].MaxAvWater) { numdSoilMois = 0; } if (currentUniverse.Soil_.Layers[checkLay].AvWater >= SoilMoistThr * currentUniverse.Soil_.Layers[checkLay].MaxAvWater) { numdSoilMois += 1; } flagSoilMois = (numdSoilMois == 0); ///</Soil moisture> ///<Soil compaction (workability)> flagWorkabil = ((currentUniverse.Soil_.Layers[checkLay].AvWater + currentUniverse.Soil_.Layers[checkLay].ExWater) / currentUniverse.Soil_.Layers[checkLay].FcWater > SoilWorkabThr); ///</Soil compaction (workability)> } ///<Sowing window> flagMaxDate = (currentUniverse.CurrentDate < MaxSowDate.AddDays(-1)); ///</Sowing window> flagReSow = flagMaxDate & (flagSkipDays || flagSoilMois || flagCumPcp || flagSoilTemp || flagFreezing || flagWorkabil); } if (IsSowDateEstimate) // If sowing date search is ON, at least one day before sowing must be simulated. { SowingDate = currentUniverse.CurrentDate.AddDays(1); currentUniverse.Crop_.Dispose(); currentUniverse.Crop_ = new CropModel.Crop(currentUniverse); //Debug //currentUniverse.CumMaxCanopyTempFromSowing = 0.0; //??currentUniverse.Crop_.RootLength = 0.0; //??currentUniverse.Crop_.Tau = 1.0; //??currentUniverse.Crop_.SumInternodesLength = 0.0; //??currentUniverse.Crop_.PotentialWaterOnLeaves = 0.0; //??currentUniverse.Crop_.RootLength = 0.0; //currentUniverse.Crop_.LeafNumber = 0.0; //currentUniverse.Crop_.Ntip = 0.0; /*currentUniverse.ShootTemperature_.MinShootTemperature=0.0; * currentUniverse.ShootTemperature_.MaxShootTemperature=0.0; * //currentUniverse.Soil_.Init(currentUniverse.Weather_.MinTemp(currentUniverse.CurrentDate/*.AddDays(1)*//*)/*, currentUniverse.Weather_.MaxTemp(currentUniverse.CurrentDate/*.AddDays(1)*//*), (currentUniverse.Weather_.MinTemp(currentUniverse.CurrentDate/*.AddDays(1)*//*) + currentUniverse.Weather_.MaxTemp(currentUniverse.CurrentDate/*.AddDays(1)*//*))/2, false);*/ //currentUniverse.Soil_.energyBalanceBiomaWrapper_.Init(false); //Debug /**/ //currentUniverse.Soil_.MaximumCanopyTemperature = currentUniverse.Weather_.MaxTemp(currentUniverse.CurrentDate/*.AddDays(1)*/);//?? //currentUniverse.Soil_.MinimumCanopyTemperature = currentUniverse.Weather_.MinTemp(currentUniverse.CurrentDate/*.AddDays(1)*/);//?? //currentUniverse.Soil_.SoilMinTemperature = currentUniverse.Weather_.MinTemp(currentUniverse.CurrentDate/*.AddDays(1)*/);//?? //currentUniverse.Soil_.SoilMaxTemperature = currentUniverse.Weather_.MaxTemp(currentUniverse.CurrentDate/*.AddDays(1)*/);//??; //currentUniverse.ShootTemperature_.MinShootTemperature = 0; //currentUniverse.ShootTemperature_.MaxShootTemperature = 0; //currentUniverse.ShootTemperature_.MeanShootTemperature = 0; //currentUniverse.Crop_.Universe_.thermalTimeWrapper_.Init(); initSoilAfterSowing = true; minTempInitSoilAfterSowing = currentUniverse.Weather_.MinTemp(currentUniverse.CurrentDate /*.AddDays(1)*/); maxTempInitSoilAfterSowing = currentUniverse.Weather_.MaxTemp(currentUniverse.CurrentDate /*.AddDays(1)*/); // meanTempInitSoilAfterSowing = (currentUniverse.Weather_.MinTemp(currentUniverse.CurrentDate/*.AddDays(1)*/) + currentUniverse.Weather_.MaxTemp(currentUniverse.CurrentDate/*.AddDays(1)*/)) / 2; //Debug /**/ currentUniverse.Crop_.Universe_.thermalTimeWrapper_.Init(); currentUniverse.Crop_.Init(currentUniverse.thermalTimeWrapper_.CumulTT, currentUniverse.CurrentDate.AddDays(1)); currentUniverse.CurrentDate = currentUniverse.CurrentDate.AddDays(1); meanTempInitSoilAfterSowing = currentUniverse.Weather_.GetMeanTemperatureBeforeSowing(SowingDate); } if (IsSowDateEstimate & flagReSow) // At least one of the sowing criteria is not met. { IsSowDateEstimate = true; // Sowing date search continues; SaveCurrentUniverse(); } else if (IsSowDateEstimate & !flagReSow) // All of the sowing criteria are met. { IsSowDateEstimate = false; // Sowing date search ends; currentUniverse.IsSowDateEstimate = false; management.FinalSowingDate = SowingDate; currentUniverse.CalcChangeinNFertilisation(); SaveCurrentUniverse(); } else if (!IsSowDateEstimate) // Sowing date search is OFF or all of the sowing criteria are met. { SaveCurrentUniverse(); currentUniverse.CurrentDate = currentUniverse.CurrentDate.AddDays(1); } } }
public override int[] EmulateBattle() { int[] hp = new int[12]; KCDatabase db = KCDatabase.Instance; Action <int, int> DealDamageFriend = (int index, int damage) => { //if ( hp[index] == -1 ) return; hp[index] -= Math.Max(damage, 0); if (hp[index] <= 0) { ShipData ship = db.Ships[db.Fleet[FleetIDFriend].Members[index]]; if (ship == null) { return; } foreach (int id in ship.SlotMaster) { if (id == 42) //応急修理要員 { hp[index] = (int)(ship.HPMax * 0.2); break; } else if (id == 43) //応急修理女神 { hp[index] = ship.HPMax; break; } } } }; Action <int, int> DealDamageEnemy = (int index, int damage) => { //if ( hp[index + 6] == -1 ) return; hp[index + 6] -= Math.Max(damage, 0); }; for (int i = 0; i < 12; i++) { hp[i] = (int)RawData.api_nowhps[i + 1]; } //第一次航空戦 if ((int)RawData.api_stage_flag[2] != 0) { for (int i = 0; i < 6; i++) { DealDamageFriend(i, (int)RawData.api_kouku.api_stage3.api_fdam[i + 1]); DealDamageEnemy(i, (int)RawData.api_kouku.api_stage3.api_edam[i + 1]); } } //*/ //今のところ未実装だけど念のため if (RawData.api_support_flag()) { //支援艦隊(空撃) if ((int)RawData.api_support_flag == 1) { for (int i = 0; i < 6; i++) { DealDamageEnemy(i, (int)RawData.api_support_info.api_support_airatack.api_stage3.api_edam[i + 1]); } } //支援艦隊(砲雷撃) if ((int)RawData.api_support_flag == 2 || (int)RawData.api_support_flag == 3) { for (int i = 0; i < 6; i++) { DealDamageEnemy(i, (int)RawData.api_support_info.api_support_hourai.api_damage[i + 1]); } } } //*/ //第二次航空戦 if ((int)RawData.api_stage_flag2[2] != 0) { for (int i = 0; i < 6; i++) { DealDamageFriend(i, (int)RawData.api_kouku2.api_stage3.api_fdam[i + 1]); DealDamageEnemy(i, (int)RawData.api_kouku2.api_stage3.api_edam[i + 1]); } } return(hp); }
/// <summary> /// Converts the <see cref="RawData.Data"/> array into a <see cref="string"/> using the <see cref="Encoding.ASCII"/> encoding, and returns it. /// </summary> /// <param name="rawData">The <see cref="RawData"/> packet whose data to deserialise.</param> /// <returns>The deserialised value.</returns> public static string ToASCIIString(RawData rawData) { return(Encoding.ASCII.GetString(rawData.Data)); }
/// <summary> /// Converts the <see cref="RawData.Data"/> array into a <see cref="bool"/> and returns it. /// </summary> /// <param name="rawData">The <see cref="RawData"/> packet whose data to deserialise.</param> /// <returns>The deserialised value.</returns> public static bool ToBoolean(RawData rawData) { return(BitConverter.ToBoolean(rawData.Data, 0)); }
/// <summary> /// Converts the <see cref="RawData.Data"/> array into a <see cref="float"/> and returns it. /// </summary> /// <param name="rawData">The <see cref="RawData"/> packet whose data to deserialise.</param> /// <returns>The deserialised value.</returns> public static float ToSingle(RawData rawData) { return(BitConverter.ToSingle(rawData.Data, 0)); }
public schemas(string connectionString) { RawData rd = new RawData(connectionString); rd.GetDataTable(out _schemas_dt, schemas.Query); }
}//Codabar /// <summary> /// Encode the raw data using the Codabar algorithm. /// </summary> private string Encode_Codabar() { if (Raw_Data.Length < 2) { Error("ECODABAR-1: Data format invalid. (Invalid length)"); } //check first char to make sure its a start/stop char switch (Raw_Data[0].ToString().ToUpper().Trim()) { case "A": break; case "B": break; case "C": break; case "D": break; default: Error("ECODABAR-2: Data format invalid. (Invalid START character)"); break; }//switch //check the ending char to make sure its a start/stop char switch (Raw_Data[Raw_Data.Trim().Length - 1].ToString().ToUpper().Trim()) { case "A": break; case "B": break; case "C": break; case "D": break; default: Error("ECODABAR-3: Data format invalid. (Invalid STOP character)"); break; }//switch //populate the hashtable to begin the process this.init_Codabar(); //replace non-numeric VALID chars with empty strings before checking for all numerics string temp = Raw_Data; foreach (char c in Codabar_Code.Keys) { if (!CheckNumericOnly(c.ToString())) { temp = temp.Replace(c, '1'); } //if } //if //now that all the valid non-numeric chars have been replaced with a number check if all numeric exist if (!CheckNumericOnly(temp)) { Error("ECODABAR-4: Data contains invalid characters."); } string result = ""; foreach (char c in Raw_Data) { result += Codabar_Code[c].ToString(); result += "0"; //inter-character space }//foreach //remove the extra 0 at the end of the result result = result.Remove(result.Length - 1); //clears the hashtable so it no longer takes up memory this.Codabar_Code.Clear(); //change the Raw_Data to strip out the start stop chars for label purposes Raw_Data = Raw_Data.Trim().Substring(1, RawData.Trim().Length - 2); return(result); }//Encode_Codabar
public procedures(string connectionString) { RawData rd = new RawData(connectionString); rd.GetDataTable(out _procedures_dt, procedures.Query); }
public abstract void Update(RawData rawdata);
public void WriteTo(RawData data) { throw new NotImplementedException(); }
public COLUMNS(string connectionString) { RawData rd = new RawData(connectionString); rd.GetDataTable(out _columns_dt, COLUMNS.Query); }
public NothingSaver(RawData data) { Data = data; }
public servers(string connectionString) { RawData rd = new RawData(connectionString); rd.GetDataTable(out _servers_dt, servers.Query); }
public KEY_COLUMN_USAGE(string connectionString) { RawData rd = new RawData(connectionString); rd.GetDataTable(out _key_col_use_dt, KEY_COLUMN_USAGE.Query); }
private void DecodeExtension() { _KeyId = string.Join("", RawData.Skip(4).Select(x => x.ToString("X2"))); _decoded = true; }
private object Deserialize(int protocolVersion) { switch (MessageOrigin) { case MessageOrigin.ClientRequest: return(null); case MessageOrigin.ServerReply: case MessageOrigin.ServerMessage: switch (MessageType) { case MessageType.Authenticate: return(null); case MessageType.Error: return(RawData.Read <Error>(protocolVersion)); case MessageType.ServerState: return(RawData.Read(reader => (ServerState)reader.ReadBigEndianInt16())); case MessageType.UserControl: var userControl = (UserControl)RawData[0]; var data = RawData.Skip(1).ToArray(); switch (userControl) { case UserControl.GetList: return(protocolVersion < ProtocolVersions.UserControl24 ? data.Read(reader => reader.ReadList16 <Connection>(protocolVersion)) : data.Read(reader => reader.ReadList24 <Connection>(protocolVersion))); case UserControl.ConnOp: var connOpType = (ConnOp)data[0]; data = data.Skip(1).ToArray(); switch (connOpType) { case ConnOp.Add: return(data.Read <ConnectionAdded>(protocolVersion)); case ConnOp.ChangeUser: return(data.Read <ConnectionUserChanged>(protocolVersion)); case ConnOp.Remove: return(data.Read <ConnectionRemoved>(protocolVersion)); case ConnOp.TransferInit: return(data.Read <Transfer>(protocolVersion)); case ConnOp.TransferOffsets: return(data.ReadArray <ConnectionTransferOffsets>(protocolVersion)); default: throw new ApiException("Unknown ConnOp: " + connOpType); } case UserControl.Kick: return(data.Read(reader => reader.ReadByte() == 0)); case UserControl.BanIp: return(data.Read(reader => reader.ReadByte() == 0)); default: throw new ApiException("Unknown UserControl: " + userControl); } case MessageType.Event: return(RawData.Read <Event>(protocolVersion)); case MessageType.Settings: return(RawData.Length == 1 ? (object)(RawData[0] == 0) : RawData.Read <Settings>(protocolVersion)); case MessageType.Transfer: return(RawData.Read <TransferInfo>(protocolVersion)); case MessageType.AccountSettings: return(RawData.Length == 1 ? (object)(RawData[0] == 0) : RawData.Read <AccountSettings>(protocolVersion)); case MessageType.Loopback: return(null); default: throw new ApiException("Unknown MessageType: " + MessageType); } default: throw new ApiException("Unknown MessageOrigin: " + MessageOrigin); } }
public VIEWS(string connectionString) { RawData rd = new RawData(connectionString); rd.GetDataTable(out _views_dt, VIEWS.Query); }
/// <summary> /// Converts the <see cref="RawData.Data"/> array into a <see cref="string"/> using the <see cref="Encoding.Unicode"/> (little endian) encoding, and /// returns it. Identical to the <see cref="ToUTF16_LittleEndian_String"/> /// method. /// </summary> /// <param name="rawData">The <see cref="RawData"/> packet whose data to deserialise.</param> /// <returns>The deserialised value.</returns> public static string ToUnicodeString(RawData rawData) { return(Encoding.Unicode.GetString(rawData.Data)); }
/// <summary> /// Converts the <see cref="RawData.Data"/> array into a <see cref="byte"/> and returns it. /// </summary> /// <param name="rawData">The <see cref="RawData"/> packet whose data to deserialise.</param> /// <returns>The deserialised value.</returns> public static byte ToUInt8(RawData rawData) { return(rawData.Data[0]); }
public SelectDataFromConnectionInfo(SqlBuiltinScalarFunctionCallExpression functionCall, RawData rawData, SelectDataFunctionInfo info) { _FunctionCall = functionCall; _RawData = rawData; if (info.ReturnDbType.HasValue) { _ReturnType = info.ReturnType; _DbType = info.ReturnDbType.Value; } }
public PARAMETERS(string connectionString) { RawData rd = new RawData(connectionString); rd.GetDataTable(out _params_dt, PARAMETERS.Query); }
/// <summary> /// Converts the <see cref="RawData.Data"/> array into a <see cref="sbyte"/> and returns it. /// </summary> /// <param name="rawData">The <see cref="RawData"/> packet whose data to deserialise.</param> /// <returns>The deserialised value.</returns> public static sbyte ToInt8(RawData rawData) { return((sbyte)rawData.Data[0]); }
public Frame(RawData serverPackage, int extrabits) { throw new NotImplementedException(); }
/// <summary> /// Converts the <see cref="RawData.Data"/> array into a <see cref="short"/> and returns it. /// </summary> /// <param name="rawData">The <see cref="RawData"/> packet whose data to deserialise.</param> /// <returns>The deserialised value.</returns> public static short ToInt16(RawData rawData) { return(BitConverter.ToInt16(rawData.Data, 0)); }
public event_notification_event_types(string connectionString) { RawData rd = new RawData(connectionString); rd.GetDataTable(out _event_notification_event_types_dt, event_notification_event_types.Query); }
/// <summary> /// Converts the <see cref="RawData.Data"/> array into a <see cref="int"/> and returns it. /// </summary> /// <param name="rawData">The <see cref="RawData"/> packet whose data to deserialise.</param> /// <returns>The deserialised value.</returns> public static int ToInt32(RawData rawData) { return(BitConverter.ToInt32(rawData.Data, 0)); }
/// <inheritdoc/> public void Send(Byte[] data, System.Net.EndPoint ep) { RawData raw = new RawData(); raw.Data = data; raw.EndPoint = ep; _sendingQueue.Enqueue(raw); if (System.Threading.Interlocked.CompareExchange(ref _writing, 1, 0) > 0) return; BeginSend(); }
/// <summary> /// Converts the <see cref="RawData.Data"/> array into a <see cref="long"/> and returns it. /// </summary> /// <param name="rawData">The <see cref="RawData"/> packet whose data to deserialise.</param> /// <returns>The deserialised value.</returns> public static long ToInt64(RawData rawData) { return(BitConverter.ToInt64(rawData.Data, 0)); }
public parameters(string connectionString) { RawData rd = new RawData(connectionString); rd.GetDataTable(out _parameters_dt, parameters.Query); }
/// <summary> /// Converts the <see cref="RawData.Data"/> array into a <see cref="string"/> using the <see cref="Encoding.Unicode"/> (little endian) encoding, and returns it. /// </summary> /// <param name="rawData">The <see cref="RawData"/> packet whose data to deserialise.</param> /// <returns>The deserialised value.</returns> public static string ToUTF16_LittleEndian_String(RawData rawData) { return(Encoding.Unicode.GetString(rawData.Data)); }