public SpParam(SpParamDpo param) { this.param = param; this.name = param.name.Substring(1); this.type = ColumnSchema.GetFieldType(param.type, false); this.dbType = ColumnSchema.GetCType(param.type); }
private const decimal DefaultWholeSalePrice = 200; // Purchase price from manufacter #endregion Fields #region Constructors /// <summary> /// Fully qualified constructor of Canoe /// </summary> /// <param name="serialNumber">serial number of a canoe</param> /// <param name="modelName">model name of a canoe</param> /// <param name="capacity">max passengers that can fit in a canoe</param> /// <param name="wholesalePrice">price we pay manufacturer for a canoe</param> /// <param name="retailPrice">price we charge retail stores for a canoe</param> /// <param name="length">length of a canoe</param> /// <param name="weight">weight of a canoe</param> /// <param name="canoebrand">brand of canoe</param> /// <param name="canoetype">type of a canoe</param> public Canoe(string serialNumber, string modelName, int capacity, decimal wholesalePrice, decimal retailPrice, int length, int weight, CBrand canoebrand, CType canoetype) { // WaterCraft this.SerialNumber = serialNumber; this.ModelName = modelName; this.PassengerCapacity = capacity; this.WholeSalePrice = wholesalePrice; this.RetailPrice = retailPrice; this.Length = length; this.Weight = weight; // Specific to Canoe this.CanoeBrand = canoebrand; this.CanoeType = canoetype; }
/// <summary> /// Default constructor of a canoe /// </summary> /// <param name="serialNumber">serial number of a canoe</param> /// <param name="modelName">model name of a canoe</param> /// <param name="capacity">max passengers that can fit in a canoe</param> /// <param name="wholesalePrice">price we pay manufacturer for a canoe</param> /// <param name="retailPrice">price we charge retail stores for a canoe</param> /// <param name="length">length of a canoe</param> /// <param name="weight">weight of a canoe</param> /// <param name="canoebrand">brand of canoe</param> /// <param name="canoetype">type of a canoe</param> /// <param name="paddleType">paddle type need for canoe</param> public Canoe(string serialNumber, string modelName, int capacity, decimal wholesalePrice, decimal retailPrice, int length, int weight, CBrand canoebrand, CType canoetype, PType paddleType) { // WaterCraft this.SerialNumber = DefaultSN; this.ModelName = DefaultModelName; this.PassengerCapacity = DefaultPassengers; this.WholeSalePrice = DefaultWholeSalePrice; this.RetailPrice = DefaultRetailPrice; this.Length = DefaultLength; this.Weight = DefaultWeight; // Specific to Canoe this.CanoeBrand = DefaultCanoeBrand; this.CanoeType = DefaultCanoeType; this.PaddleType = DefaultPaddleType; }
public ColumnAttribute(string columnName, CType ctype) { this.columnName = columnName; this.Caption = columnName; this.ColumnNameSaved = columnName; this.ctype = ctype; switch (ctype) { case CType.Char: case CType.VarChar: case CType.NChar: case CType.NVarChar: Length = -1; break; default: Length = 0; break; } }
protected BaseController CFactory( CType cType, V.Index menu = null, M.MemberCatalog memberCatalog = null, M.Member member = null, M.BoatCatalog boatCatalog = null ) { switch (cType) { case CType.MemberCreate : return new C.MemberCreate(); case CType.MemberRead: return new C.MemberRead(memberCatalog, menu, boatCatalog); case CType.MemberReadAll : return new C.MemberReadAll(menu); case CType.MemberUpdate : return new C.MemberUpdate(memberCatalog, member, menu); case CType.MemberDelete : return new C.MemberDelete(memberCatalog, menu); case CType.BoatCreate: return new C.BoatCreate(); case CType.BoatDelete: return new C.BoatDelete(menu, memberCatalog, boatCatalog); default: //controllerToBeCrated fails matching! return null; } }
protected override void SolveInstance(IGH_DataAccess DA) { List<DHr> dhrs = new List<DHr>(); string period_string = ""; if ((DA.GetDataList(0, dhrs)) && (DA.GetData(1, ref period_string))) { if (period_string == "") { return; } period_string = period_string.ToLowerInvariant().Trim(); this.cycle_type = CType.Invalid; if (period_string.Contains("year")) { this.cycle_type = CType.Yearly; } else if (period_string.Contains("monthly diurnal")) { this.cycle_type = CType.MonthlyDiurnal; } else if (period_string.Contains("month")) { this.cycle_type = CType.Monthly; } else if (period_string.Contains("day") || period_string.Contains("daily")) { this.cycle_type = CType.Daily; } else if (period_string.Contains("weekly diurnal")) { this.cycle_type = CType.WeeklyDiurnal; } else if (period_string.Contains("weekly")) { this.cycle_type = CType.Weekly; } else { this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "I don't understand the time period you're looking for.\nPlease choose 'yearly', 'monthly', 'monthly diurnal', 'weekly', 'weekly diurnal', or 'daily'."); } string[] commonKeys = DHr.commonkeys(dhrs.ToArray()); Dictionary<string, List<DHr>> stat_hours = new Dictionary<string, List<DHr>>(); InitStatHours(ref stat_hours); HourMask mask = new HourMask(); switch (this.cycle_type) { case CType.MonthlyDiurnal: case CType.WeeklyDiurnal: Grasshopper.Kernel.Data.GH_Structure<DHr> meanTree = new Grasshopper.Kernel.Data.GH_Structure<DHr>(); Grasshopper.Kernel.Data.GH_Structure<DHr> modeTree = new Grasshopper.Kernel.Data.GH_Structure<DHr>(); Grasshopper.Kernel.Data.GH_Structure<DHr> highTree = new Grasshopper.Kernel.Data.GH_Structure<DHr>(); Grasshopper.Kernel.Data.GH_Structure<DHr> uqTree = new Grasshopper.Kernel.Data.GH_Structure<DHr>(); Grasshopper.Kernel.Data.GH_Structure<DHr> medianTree = new Grasshopper.Kernel.Data.GH_Structure<DHr>(); Grasshopper.Kernel.Data.GH_Structure<DHr> lqTree = new Grasshopper.Kernel.Data.GH_Structure<DHr>(); Grasshopper.Kernel.Data.GH_Structure<DHr> lowTree = new Grasshopper.Kernel.Data.GH_Structure<DHr>(); Grasshopper.Kernel.Data.GH_Structure<DHr> sumTree = new Grasshopper.Kernel.Data.GH_Structure<DHr>(); switch (this.cycle_type) { case CType.MonthlyDiurnal: for (int mth = 0; mth < 12; mth++) { InitStatHours(ref stat_hours); for (int hour = 0; hour < 24; hour++) { mask.maskByMonthAndHour(mth, hour); int hh = Util.hourOfYearFromDatetime(Util.baseDatetime().AddMonths(mth).AddHours(hour)) + 1; // had to add one, looks like Util function was designed for parsing non-zero-indexed hours CalculateStats(dhrs, commonKeys, stat_hours, mask, hh, true); } meanTree.AppendRange(stat_hours["meanHrs"], new Grasshopper.Kernel.Data.GH_Path(mth)); modeTree.AppendRange(stat_hours["modeHrs"], new Grasshopper.Kernel.Data.GH_Path(mth)); highTree.AppendRange(stat_hours["highHrs"], new Grasshopper.Kernel.Data.GH_Path(mth)); uqTree.AppendRange(stat_hours["uqHrs"], new Grasshopper.Kernel.Data.GH_Path(mth)); medianTree.AppendRange(stat_hours["medianHrs"], new Grasshopper.Kernel.Data.GH_Path(mth)); lqTree.AppendRange(stat_hours["lqHrs"], new Grasshopper.Kernel.Data.GH_Path(mth)); lowTree.AppendRange(stat_hours["lowHrs"], new Grasshopper.Kernel.Data.GH_Path(mth)); sumTree.AppendRange(stat_hours["sumHrs"], new Grasshopper.Kernel.Data.GH_Path(mth)); } break; case CType.WeeklyDiurnal: for (int wk = 0; wk < 52; wk++) { InitStatHours(ref stat_hours); for (int hour = 0; hour < 24; hour++) { mask.maskByWeekAndHour(wk, hour); int hh = Util.hourOfYearFromDatetime(Util.baseDatetime().AddDays(wk * 7).AddHours(hour)) + 1; // had to add one, looks like Util function was designed for parsing non-zero-indexed hours CalculateStats(dhrs, commonKeys, stat_hours, mask, hh, true); } meanTree.AppendRange(stat_hours["meanHrs"], new Grasshopper.Kernel.Data.GH_Path(wk)); modeTree.AppendRange(stat_hours["modeHrs"], new Grasshopper.Kernel.Data.GH_Path(wk)); highTree.AppendRange(stat_hours["highHrs"], new Grasshopper.Kernel.Data.GH_Path(wk)); uqTree.AppendRange(stat_hours["uqHrs"], new Grasshopper.Kernel.Data.GH_Path(wk)); medianTree.AppendRange(stat_hours["medianHrs"], new Grasshopper.Kernel.Data.GH_Path(wk)); lqTree.AppendRange(stat_hours["lqHrs"], new Grasshopper.Kernel.Data.GH_Path(wk)); lowTree.AppendRange(stat_hours["lowHrs"], new Grasshopper.Kernel.Data.GH_Path(wk)); sumTree.AppendRange(stat_hours["sumHrs"], new Grasshopper.Kernel.Data.GH_Path(wk)); } break; } DA.SetDataTree(0, meanTree); DA.SetDataTree(1, modeTree); DA.SetDataTree(2, highTree); DA.SetDataTree(3, uqTree); DA.SetDataTree(4, medianTree); DA.SetDataTree(5, lqTree); DA.SetDataTree(6, lowTree); DA.SetDataTree(7, sumTree); break; case CType.Daily: for (int day = 0; day < 365; day++) { mask.maskByDayOfYear(day, day); // passing in same day twice masks to this single day int hh = Util.hourOfYearFromDatetime(Util.baseDatetime().AddDays(day).AddHours(0)) + 1; // had to add one, looks like Util function was designed for parsing non-zero-indexed hours CalculateStats(dhrs, commonKeys, stat_hours, mask, hh, true); } SetOutputData(DA, stat_hours); break; case CType.Weekly: for (int wk = 0; wk < 52; wk++) { mask.maskByWeek(wk); int hh = Util.hourOfYearFromDatetime(Util.baseDatetime().AddDays(wk * 7).AddHours(0)) + 1; // had to add one, looks like Util function was designed for parsing non-zero-indexed hours CalculateStats(dhrs, commonKeys, stat_hours, mask, hh, true); } SetOutputData(DA, stat_hours); break; case CType.Monthly: for (int mth = 0; mth < 12; mth++) { mask.maskByMonthOfYear(mth); int hh = Util.hourOfYearFromDatetime(Util.baseDatetime().AddMonths(mth).AddHours(0)) + 1; // had to add one, looks like Util function was designed for parsing non-zero-indexed hours CalculateStats(dhrs, commonKeys, stat_hours, mask, hh, true); } SetOutputData(DA, stat_hours); break; case CType.Yearly: mask.fillMask(true); // all hours may pass int hhh = Util.hourOfYearFromDatetime(Util.baseDatetime().AddMonths(6).AddDays(15).AddHours(0)) + 1; // had to add one, looks like Util function was designed for parsing non-zero-indexed hours CalculateStats(dhrs, commonKeys, stat_hours, mask, hhh, true); SetOutputData(DA, stat_hours); break; default: this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Time period option not yet implimented. Cannot produce statistics."); break; } } }
public ExprFieldInfo(FieldSymbol f, AggregateType ft, CType type) : base(ExpressionKind.FieldInfo, type) { Field = f; FieldType = ft; }
public bool fUsedInAnonMeth; // Set if the local is ever used in an anon method public void SetType(CType pType) { type = pType; }
protected override void SolveInstance(IGH_DataAccess DA) { List<DHr> hrsIn = new List<DHr>(); string key = ""; string op_string = ""; double val = 0.0; this.comparison_type = CType.invalid; if (DA.GetDataList(0, hrsIn) && DA.GetData(1, ref key) && DA.GetData(2, ref op_string) && DA.GetData(3, ref val)) { if (op_string.Contains("!=")) { this.comparison_type = CType.ne; } else if (op_string.Contains(">=")||op_string.Contains("=>")) { this.comparison_type = CType.ge; } else if (op_string.Contains("<=")||op_string.Contains("=<")) { this.comparison_type = CType.le; } else if (op_string.Contains("=")) { this.comparison_type = CType.eq; } else if (op_string.Contains(">")) { this.comparison_type = CType.gt; } else if (op_string.Contains("<")) { this.comparison_type = CType.le; } else { this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "I don't understand the given comparison operator.\nPlease choose '==', '!=', '>', '>=', '<', or '<='."); } List<DHr> hrsOut = new List<DHr>(); foreach (DHr hour in hrsIn) { switch (this.comparison_type) { case CType.eq: if (hour.val(key) == val) hrsOut.Add(hour);break; case CType.ne: if (hour.val(key) != val) hrsOut.Add(hour);break; case CType.gt: if (hour.val(key) > val) hrsOut.Add(hour); break; case CType.ge: if (hour.val(key) >= val) hrsOut.Add(hour); break; case CType.lt: if (hour.val(key) < val) hrsOut.Add(hour); break; case CType.le: if (hour.val(key) <= val) hrsOut.Add(hour); break; } } DA.SetDataList(0, hrsOut); } }
public bool IsCircular() { bool isCircular = false; CType[] undefined = new CType[] { CType.Undefined, CType.CurveTo, CType.ShorthandCurveTo, CType.QuadraticCurveTo, CType.QuadraticCurveTo, CType.ShorthandQuadraticCurveTo }; if (undefined.Contains(CommandType)) { throw new NotImplementedException("Not implemented for the command type"); } if (CommandType == CType.EllipticalArc) { isCircular = RadiusX == RadiusY; } return isCircular; }
public bool fUsedInAnonMeth; // Set if the local is ever used in an anon method public void SetType(CType pType) { type = pType; }
public VariableReference(string Name, CType CType, FieldInfo Field) { this.Name = Name; this.CType = CType; this.Field = Field; }
public CIPHER(CType type, CMode mode, bool encrypt) { EVP_CIPHER *cipher = null; // Statically allocated (MT), don't free EVP_CIPHER_CTX *handle = null; try { cipher = (EVP_CIPHER*) _ciphers[new Tuple<CType, CMode>(type, mode)](); } catch (KeyNotFoundException) {} if (cipher == null) goto Bailout; if ((handle = _CIPHER.EVP_CIPHER_CTX_new()) == null) goto Bailout; _CIPHER.EVP_CIPHER_CTX_init(handle); if (_CIPHER.EVP_CipherInit_ex(handle, cipher, IntPtr.Zero, null, null, encrypt ? 1 : 0) == 0) goto Bailout; _CIPHER.EVP_CIPHER_CTX_set_padding(handle, 0); this._handle = handle; this._type = type; this._mode = mode; this._encrypt = encrypt; return ; Bailout: if (handle != null) _CIPHER.EVP_CIPHER_CTX_free(handle); throw new EVPException(); }
public ExprTypeOf(CType type, CType sourceType) : base(ExpressionKind.TypeOf, type) { Flags = EXPRFLAG.EXF_CANTBENULL; SourceType = sourceType; }
public ErrArgRef(CType pType, ErrArgFlags eaf) : base(pType) { this.eaf = eaf | ErrArgFlags.Ref; }
private bool Equals(CType other) { return(Name == other.Name); }
internal static string GetCSharpType(this CType type, bool nullable) { string ty = ""; switch (type) { case CType.VarChar: case CType.Char: case CType.Text: case CType.NVarChar: case CType.NChar: case CType.NText: ty = "string"; break; case CType.Date: case CType.DateTime: case CType.SmallDateTime: ty = "DateTime"; if (nullable) { ty += "?"; } break; case CType.DateTimeOffset: ty = "DateTimeOffset"; if (nullable) { ty += "?"; } break; case CType.Time: case CType.Timestamp: ty = "TimeSpan"; if (nullable) { ty += "?"; } break; case CType.Bit: ty = "bool"; if (nullable) { ty += "?"; } break; case CType.Money: case CType.SmallMoney: case CType.Decimal: ty = "decimal"; if (nullable) { ty += "?"; } break; case CType.Real: ty = "Single"; if (nullable) { ty += "?"; } break; case CType.Float: ty = "double"; if (nullable) { ty += "?"; } break; case CType.TinyInt: ty = "byte"; if (nullable) { ty += "?"; } break; case CType.SmallInt: ty = "short"; if (nullable) { ty += "?"; } break; case CType.Int: ty = "int"; if (nullable) { ty += "?"; } break; case CType.BigInt: ty = "long"; if (nullable) { ty += "?"; } break; case CType.VarBinary: case CType.Binary: case CType.Image: ty = "byte[]"; break; case CType.UniqueIdentifier: ty = "Guid"; break; case CType.Geography: ty = "SqlGeography"; break; case CType.Geometry: ty = "SqlGeometry"; break; case CType.HierarchyId: ty = "SqlHierarchyId"; break; case CType.Object: ty = "object"; break; default: ty = "object"; break; } return(ty); }
public static SqlDbType ToSqlDbType(this CType type) { return((SqlDbType)((int)type)); }
public ErrArg(CType pType) : this(pType, ErrArgFlags.None) { }
public ErrArgNoRef(CType pType) { this.eak = ErrArgKind.Type; this.eaf = ErrArgFlags.None; this.pType = pType; }
public ErrArg(CType pType, ErrArgFlags eaf) { this.eak = ErrArgKind.Type; this.eaf = eaf; this.pType = pType; }
public VariableReference(string Name, CType CType, FieldInfo Field) { this.Name = Name; this.CType = CType; this.Field = Field; }
public VariableReference(string Name, CType CType, SafeArgument Argument) { this.Name = Name; this.CType = CType; this.Argument = Argument; }
public VariableReference(string Name, CType CType, LocalBuilder Local) { this.Name = Name; this.CType = CType; this.Local = Local; }
public void SetParameterType(CType pType) { _pParameterType = pType; }
public VariableReference(string Name, CType CType, SafeArgument Argument) { this.Name = Name; this.CType = CType; this.Argument = Argument; }
public void SetReferentType(CType pType) { _pReferentType = pType; }
public ExprHoistedLocalExpr(CType type) : base(ExpressionKind.HoistedLocalExpression, type) { }
/// <summary> /// /// </summary> /// <param name="propertyType"></param> /// <param name="name"></param> /// <returns></returns> public static CProperty ConceptualProperty(CType propertyType, string name) => new CProperty(EmptyAnntations, propertyType, name);
public CError RealizeError(CParameterizedError parameterizedError) { // Create an arg array manually using the type information in the ErrArgs. string[] prgpsz = new string[parameterizedError.GetParameterCount()]; int[] prgiarg = new int[parameterizedError.GetParameterCount()]; int ppsz = 0; int piarg = 0; int cargUnique = 0; _userStringBuilder.ResetUndisplayableStringFlag(); for (int iarg = 0; iarg < parameterizedError.GetParameterCount(); iarg++) { ErrArg arg = parameterizedError.GetParameter(iarg); // If the NoStr bit is set we don't add it to prgpsz. if (0 != (arg.eaf & ErrArgFlags.NoStr)) { continue; } bool fUserStrings = false; if (!_userStringBuilder.ErrArgToString(out prgpsz[ppsz], arg, out fUserStrings)) { if (arg.eak == ErrArgKind.Int) { prgpsz[ppsz] = arg.n.ToString(CultureInfo.InvariantCulture); } } ppsz++; int iargRec; if (!fUserStrings || 0 == (arg.eaf & ErrArgFlags.Unique)) { iargRec = -1; } else { iargRec = iarg; cargUnique++; } prgiarg[piarg] = iargRec; piarg++; } // don't ever display undisplayable strings to the user // if this happens we should track down the caller to not display the error // this should only ever occur in a cascading error situation due to // error tolerance if (_userStringBuilder.HadUndisplayableString()) { return(null); } int cpsz = ppsz; if (cargUnique > 1) { // Copy the strings over to another buffer. string[] prgpszNew = new string[cpsz]; Array.Copy(prgpsz, 0, prgpszNew, 0, cpsz);; for (int i = 0; i < cpsz; i++) { if (prgiarg[i] < 0 || prgpszNew[i] != prgpsz[i]) { continue; } ErrArg arg = parameterizedError.GetParameter(prgiarg[i]); Debug.Assert(0 != (arg.eaf & ErrArgFlags.Unique) && 0 == (arg.eaf & ErrArgFlags.NoStr)); Symbol sym = null; CType pType = null; switch (arg.eak) { case ErrArgKind.Sym: sym = arg.sym; break; case ErrArgKind.Type: pType = arg.pType; break; case ErrArgKind.SymWithType: sym = arg.swtMemo.sym; break; case ErrArgKind.MethWithInst: sym = arg.mpwiMemo.sym; break; default: Debug.Assert(false, "Shouldn't be here!"); continue; } bool fMunge = false; for (int j = i + 1; j < cpsz; j++) { if (prgiarg[j] < 0) { continue; } Debug.Assert(0 != (parameterizedError.GetParameter(prgiarg[j]).eaf & ErrArgFlags.Unique)); if (prgpsz[i] != prgpsz[j]) { continue; } // The strings are identical. If they are the same symbol, leave them alone. // Otherwise, munge both strings. If j has already been munged, just make // sure we munge i. if (prgpszNew[j] != prgpsz[j]) { fMunge = true; continue; } ErrArg arg2 = parameterizedError.GetParameter(prgiarg[j]); Debug.Assert(0 != (arg2.eaf & ErrArgFlags.Unique) && 0 == (arg2.eaf & ErrArgFlags.NoStr)); Symbol sym2 = null; CType pType2 = null; switch (arg2.eak) { case ErrArgKind.Sym: sym2 = arg2.sym; break; case ErrArgKind.Type: pType2 = arg2.pType; break; case ErrArgKind.SymWithType: sym2 = arg2.swtMemo.sym; break; case ErrArgKind.MethWithInst: sym2 = arg2.mpwiMemo.sym; break; default: Debug.Assert(false, "Shouldn't be here!"); continue; } if (sym2 == sym && pType2 == pType && !fMunge) { continue; } prgpszNew[j] = prgpsz[j]; fMunge = true; } if (fMunge) { prgpszNew[i] = prgpsz[i]; } } prgpsz = prgpszNew; } CError err = CreateError(parameterizedError.GetErrorNumber(), prgpsz); return(err); }
public void SetElementType(CType pType) { _pElementType = pType; }
public virtual void AddRelatedTypeLoc(CParameterizedError err, CType pType) { }
//Call the base constructor public Dhr_PeriodStatsComponent() : base("Periodic Statistics", "Stats", "Performs statistical operations over a given time period (daily, monthly, or monthly diurnal) on a year's worth of Dhours", "Dhour", "Filter") { this.cycle_type = CType.Daily; }
public void AddVariable(string name, CType ctype) { Variables.Add(new CompiledVariable(name, 0, ctype)); }
public CExpression Cast(CType type, CExpression exp) { return new CastExpression { Type = type, Expression = exp }; }
private void AddTraceListener (IDictionary d, XElement child, IDictionary<string,XAttribute> attributes, TraceListenerCollection listeners) { string name = GetAttribute (attributes, "name", true, child); string type = null; #if CONFIGURATION_DEP type = GetAttribute (attributes, "type", false, child); if (type == null) { // indicated by name. TraceListener shared = GetSharedListeners (d)[name]; if (shared == null) throw new ConfigurationException (String.Format ("Shared trace listener {0} does not exist.", name)); if (child.HasAttributes) throw new ConfigurationErrorsException ( string.Format ("Listener '{0}' references a shared " + "listener and can only have a 'Name' " + "attribute.", name)); listeners.Add (shared, configValues); return; } #else type = GetAttribute (attributes, "type", true, child); #endif #if SSHARP CType t = Type.GetType (type); #else Type t = Type.GetType (type); #endif if (t == null) throw new ConfigurationException (string.Format ("Invalid Type Specified: {0}", type)); object[] args; #if SSHARP CType[] types; #else Type[] types; #endif string initializeData = GetAttribute (attributes, "initializeData", false, child); if (initializeData != null) { args = new object[] { initializeData }; #if SSHARP types = new CType[] { typeof (string) }; #else types = new Type[] { typeof (string) }; #endif } else { args = null; #if NETCF #if SSHARP types = new CType[0]; #else types = new Type[0]; #endif #else types = Type.EmptyTypes; #endif } #if SSHARP var ctor = t.GetConstructor (types); #else BindingFlags flags = BindingFlags.Public | BindingFlags.Instance; if (t.Assembly == GetType ().Assembly) flags |= BindingFlags.NonPublic; ConstructorInfo ctor = t.GetConstructor (flags, null, types, null); #endif if (ctor == null) throw new ConfigurationException ("Couldn't find constructor for class " + type); TraceListener l = (TraceListener)ctor.Invoke (args); l.Name = name; #if CONFIGURATION_DEP string trace = GetAttribute (attributes, "traceOutputOptions", false, child); if (trace != null) { if (trace != trace.Trim ()) throw new ConfigurationErrorsException (string.Format ( "Invalid value '{0}' for 'traceOutputOptions'.", trace), child); TraceOptions trace_options; try { trace_options = (TraceOptions)Enum.Parse ( typeof (TraceOptions), trace, false); } catch (ArgumentException) { throw new ConfigurationErrorsException (string.Format ( "Invalid value '{0}' for 'traceOutputOptions'.", trace), child); } l.TraceOutputOptions = trace_options; } string[] supported_attributes = l.GetSupportedAttributes (); if (supported_attributes != null) { for (int i = 0; i < supported_attributes.Length; i++) { string key = supported_attributes[i]; string value = GetAttribute (attributes, key, false, child); if (value != null) l.Attributes.Add (key, value); } } #endif listeners.Add (l, configValues); }
public void SetElementType(CType pType) { _pElementType = pType; }
private ErrArgRef(CType pType) : base(pType) { this.eaf = ErrArgFlags.Ref; }
public CExpression Sizeof(CType type) { return new SizeofExpression { Type = type }; }
public ExprField(CType type) : base(ExpressionKind.Field, type) { }
/// <summary> /// 6 parameter constructor of a canoe, matches ToString Method /// </summary> /// <param name="serialNumber">serial number of a canoe</param> /// <param name="retailPrice">price we charge retail stores for a canoe</param> /// <param name="modelName">model name of a canoe</param> /// <param name="canoebrand">brand of a canoe</param> /// <param name="canoetype">type of a canoe</param> /// <param name="paddleType">paddle type needed with canoe</param> public Canoe(string serialNumber, decimal retailPrice, string modelName, CBrand canoebrand, CType canoetype, PType paddleType) { this.SerialNumber = serialNumber; this.RetailPrice = retailPrice; this.ModelName = modelName; this.CanoeBrand = canoebrand; this.CanoeType = canoetype; this.PaddleType = paddleType; }
public void AddRoute(string routePattern, CType handlerType) { AddRoute(routePattern, handlerType, true); }
public CPtr TranslatePtr(IDiaSymbol sym) { CType next = Translate(sym.type); return(new CPtr(next)); }
private int chooseCode(String value, int start, int oldCode) { CType lookahead = findCType(value, start); if (lookahead == CType.ONE_DIGIT) { return(CODE_CODE_B); } if (lookahead == CType.UNCODABLE) { if (start < value.Length) { var c = value[start]; if (c < ' ' || (oldCode == CODE_CODE_A && c < '`')) { // can continue in code A, encodes ASCII 0 to 95 return(CODE_CODE_A); } } return(CODE_CODE_B); // no choice } if (oldCode == CODE_CODE_C) { // can continue in code C return(CODE_CODE_C); } if (oldCode == CODE_CODE_B) { if (lookahead == CType.FNC_1) { return(CODE_CODE_B); // can continue in code B } // Seen two consecutive digits, see what follows lookahead = findCType(value, start + 2); if (lookahead == CType.UNCODABLE || lookahead == CType.ONE_DIGIT) { return(CODE_CODE_B); // not worth switching now } if (lookahead == CType.FNC_1) { // two digits, then FNC_1... lookahead = findCType(value, start + 3); if (lookahead == CType.TWO_DIGITS) { // then two more digits, switch return(forceCodesetB ? CODE_CODE_B : CODE_CODE_C); } else { return(CODE_CODE_B); // otherwise not worth switching } } // At this point, there are at least 4 consecutive digits. // Look ahead to choose whether to switch now or on the next round. int index = start + 4; while ((lookahead = findCType(value, index)) == CType.TWO_DIGITS) { index += 2; } if (lookahead == CType.ONE_DIGIT) { // odd number of digits, switch later return(CODE_CODE_B); } return(forceCodesetB ? CODE_CODE_B : CODE_CODE_C); // even number of digits, switch now } // Here oldCode == 0, which means we are choosing the initial code if (lookahead == CType.FNC_1) { // ignore FNC_1 lookahead = findCType(value, start + 1); } if (lookahead == CType.TWO_DIGITS) { // at least two digits, start in code C return(forceCodesetB ? CODE_CODE_B : CODE_CODE_C); } return(CODE_CODE_B); }
public VariableReference(string Name, CType CType, LocalBuilder Local) { this.Name = Name; this.CType = CType; this.Local = Local; }
public override void Save() { var usuarioEmail = new Usuario(); usuarioEmail.Email = this.Email; usuarioEmail.Get(); if (usuarioEmail.IDUsuario != null && usuarioEmail.IDUsuario != this.IDUsuario) { throw new DidoxFrameworkError("Email já cadastrado."); } var usuarioLogin = new Usuario(); usuarioLogin.Login = this.Login; usuarioLogin.Get(); if (usuarioLogin.IDUsuario != null && usuarioLogin.IDUsuario != this.IDUsuario) { throw new DidoxFrameworkError("Login já cadastrado."); } this.Senha = ConfiguracaoSenha.GetSenhaCripto(this.Senha); base.Save(); var pessoa = this.Pessoa; if (CType.Exist(pessoa)) { pessoa.TipoPessoa = TipoPessoa.Fisica; pessoa.Nome = this.Nome; pessoa.Save(); } else { var pessoaCampanha = new PessoaCampanha(); try { pessoaCampanha.IsTransaction = true; pessoaCampanha.Usuario = this; pessoaCampanha.Get(); if (CType.Exist(pessoaCampanha)) { pessoa = pessoaCampanha.Pessoa; } else { pessoa = new Pessoa(Campanha); pessoa.Transaction = pessoaCampanha.Transaction; pessoa.TipoPessoa = TipoPessoa.Fisica; pessoa.Nome = this.Nome; pessoa.Save(); } var pessoaCampanhaNovo = new PessoaCampanha(); pessoaCampanhaNovo.Transaction = pessoaCampanha.Transaction; pessoaCampanhaNovo.Usuario = this; pessoaCampanhaNovo.Pessoa = pessoa; pessoaCampanhaNovo.Campanha = Campanha; pessoaCampanhaNovo.DataAdesao = DateTime.Now; pessoaCampanhaNovo.Save(); pessoaCampanha.Commit(); } catch (Exception err) { pessoaCampanha.Rollback(); throw err; } } var email = this.Pessoa.Email; email.EnderecoEmail = this.Email; email.TipoEmail = TipoEmail.Padrao(); email.Save(); }
public MetaColumn(DataRow dataRow) : base(dataRow) { this.ctype = GetCType(this.DataType); }
private void ErrAppendType(CType pType, SubstContext pCtx) { ErrAppendType(pType, pCtx, true); }
public Command(CType type, double x, double y) { this.type = type; this.x = x; this.y = y; }
private void ErrAppendType(CType pType, SubstContext pctx, bool fArgs) { if (pctx != null) { if (!pctx.FNop()) { pType = GetTypeManager().SubstType(pType, pctx); } // We shouldn't use the SubstContext again so set it to NULL. pctx = null; } switch (pType.GetTypeKind()) { case TypeKind.TK_AggregateType: { AggregateType pAggType = pType.AsAggregateType(); // Check for a predefined class with a special "nice" name for // error reported. string text = PredefinedTypes.GetNiceName(pAggType.getAggregate()); if (text != null) { // Found a nice name. ErrAppendString(text); } else if (pAggType.getAggregate().IsAnonymousType()) { ErrAppendPrintf("AnonymousType#{0}", GetTypeID(pAggType)); break; } else { if (pAggType.outerType != null) { ErrAppendType(pAggType.outerType, pctx); ErrAppendChar('.'); } else { // In a namespace. ErrAppendParentSym(pAggType.getAggregate(), pctx); } ErrAppendName(pAggType.getAggregate().name); } ErrAppendTypeParameters(pAggType.GetTypeArgsThis(), pctx, true); break; } case TypeKind.TK_TypeParameterType: if (null == pType.GetName()) { // It's a standard type variable. if (pType.AsTypeParameterType().IsMethodTypeParameter()) { ErrAppendChar('!'); } ErrAppendChar('!'); ErrAppendPrintf("{0}", pType.AsTypeParameterType().GetIndexInTotalParameters()); } else { ErrAppendName(pType.GetName()); } break; case TypeKind.TK_ErrorType: if (pType.AsErrorType().HasParent()) { Debug.Assert(pType.AsErrorType().nameText != null && pType.AsErrorType().typeArgs != null); ErrAppendParentType(pType, pctx); ErrAppendName(pType.AsErrorType().nameText); ErrAppendTypeParameters(pType.AsErrorType().typeArgs, pctx, true); } else { // Load the string "<error>". Debug.Assert(null == pType.AsErrorType().typeArgs); ErrAppendId(MessageID.ERRORSYM); } break; case TypeKind.TK_NullType: // Load the string "<null>". ErrAppendId(MessageID.NULL); break; case TypeKind.TK_OpenTypePlaceholderType: // Leave blank. break; case TypeKind.TK_BoundLambdaType: ErrAppendId(MessageID.AnonMethod); break; case TypeKind.TK_UnboundLambdaType: ErrAppendId(MessageID.Lambda); break; case TypeKind.TK_MethodGroupType: ErrAppendId(MessageID.MethodGroup); break; case TypeKind.TK_ArgumentListType: ErrAppendString(TokenFacts.GetText(TokenKind.ArgList)); break; case TypeKind.TK_ArrayType: { CType elementType = pType.AsArrayType().GetBaseElementType(); if (null == elementType) { Debug.Assert(false, "No element type"); break; } ErrAppendType(elementType, pctx); for (elementType = pType; elementType != null && elementType.IsArrayType(); elementType = elementType.AsArrayType().GetElementType()) { int rank = elementType.AsArrayType().rank; // Add [] with (rank-1) commas inside ErrAppendChar('['); #if !CSEE // known rank. if (rank > 1) { ErrAppendChar('*'); } #endif for (int i = rank; i > 1; --i) { ErrAppendChar(','); #if !CSEE ErrAppendChar('*'); #endif } ErrAppendChar(']'); } break; } case TypeKind.TK_VoidType: ErrAppendName(GetNameManager().Lookup(TokenFacts.GetText(TokenKind.Void))); break; case TypeKind.TK_ParameterModifierType: // add ref or out ErrAppendString(pType.AsParameterModifierType().isOut ? "out " : "ref "); // add base type name ErrAppendType(pType.AsParameterModifierType().GetParameterType(), pctx); break; case TypeKind.TK_PointerType: // Generate the base type. ErrAppendType(pType.AsPointerType().GetReferentType(), pctx); { // add the trailing * ErrAppendChar('*'); } break; case TypeKind.TK_NullableType: ErrAppendType(pType.AsNullableType().GetUnderlyingType(), pctx); ErrAppendChar('?'); break; case TypeKind.TK_NaturalIntegerType: default: // Shouldn't happen. Debug.Assert(false, "Bad type kind"); break; } }
public bool IsLeft() { bool isLeft = false; CType[] undefined = new CType[] { CType.Undefined, CType.CurveTo, CType.ShorthandCurveTo, CType.QuadraticCurveTo, CType.QuadraticCurveTo, CType.ShorthandQuadraticCurveTo }; if (undefined.Contains(CommandType)) { //adjust isLeft throw new NotImplementedException("Not implemented for the command type"); } if (CommandType == CType.EllipticalArc) { bool sweepFlag = relativeElements[5] == "1"; if (sweepFlag && StartY >= EndY || !sweepFlag && StartY <= EndY) { isLeft = true; } } return isLeft; }
private int GetTypeID(CType type) { return(0); }
public bool IsVertical() { bool isVertical = false; CType[] undefined = new CType[] { CType.Undefined, CType.CurveTo, CType.ShorthandCurveTo, CType.QuadraticCurveTo, CType.QuadraticCurveTo, CType.ShorthandQuadraticCurveTo }; if (undefined.Contains(CommandType)) { throw new NotImplementedException("Not implemented for the command type"); } if (CommandType == CType.EllipticalArc) { isVertical = StartX == EndX; } return isVertical; }
Executable CompileExecutable() { var exe = new Executable(options.MachineInfo); var exeContext = new ExecutableContext(exe, options.Report); // Put something at the zero address so we don't get 0 addresses of globals exe.AddGlobal("__zero__", CBasicType.SignedInt); // // Find Variables, Functions, Types // var exeInitBody = new Block(VariableScope.Local); var tucs = tus.Select(x => new TranslationUnitContext(x, exeContext)); var tuInits = new List <(CompiledFunction, EmitContext)> (); foreach (var tuc in tucs) { var tu = tuc.TranslationUnit; AddStatementDeclarations(tuc); if (tu.InitStatements.Count > 0) { var tuInitBody = new Block(VariableScope.Local); tuInitBody.AddStatements(tu.InitStatements); var tuInit = new CompiledFunction($"__{tu.Name}__cinit", CFunctionType.VoidProcedure, tuInitBody); exeInitBody.AddStatement(new ExpressionStatement(new FuncallExpression(new VariableExpression(tuInit.Name, Location.Null, Location.Null)))); tuInits.Add((tuInit, tuc)); exe.Functions.Add(tuInit); } } // // Generate a function to init globals // var exeInit = new CompiledFunction($"__cinit", CFunctionType.VoidProcedure, exeInitBody); exe.Functions.Add(exeInit); // // Link everything together // This is done before compilation to make sure everything is visible (for recursion) // var functionsToCompile = new List <(CompiledFunction, EmitContext)> { (exeInit, exeContext) }; functionsToCompile.AddRange(tuInits); foreach (var tuc in tucs) { var tu = tuc.TranslationUnit; foreach (var g in tu.Variables) { var v = exe.AddGlobal(g.Name, g.VariableType); v.InitialValue = g.InitialValue; } var funcs = tu.Functions.Where(x => x.Body != null).ToList(); exe.Functions.AddRange(funcs); functionsToCompile.AddRange(funcs.Select(x => (x, (EmitContext)tuc))); } // // Compile functions // foreach (var(f, pc) in functionsToCompile) { var body = f.Body; if (body == null) { continue; } var fc = new FunctionContext(exe, f, pc); AddStatementDeclarations(fc); body.Emit(fc); f.LocalVariables.AddRange(fc.LocalVariables); // Make sure it returns if (body.Statements.Count == 0 || !body.AlwaysReturns) { if (f.FunctionType.ReturnType.IsVoid) { fc.Emit(OpCode.Return); } else { options.Report.Error(161, "'" + f.Name + "' not all code paths return a value"); } } } return(exe); } void AddStatementDeclarations(BlockContext context) { var block = context.Block; foreach (var s in block.Statements) { AddStatementDeclarations(s, context); } } void AddStatementDeclarations(Statement statement, BlockContext context) { var block = context.Block; if (statement is MultiDeclaratorStatement multi) { if (multi.InitDeclarators != null) { foreach (var idecl in multi.InitDeclarators) { if ((multi.Specifiers.StorageClassSpecifier & StorageClassSpecifier.Typedef) != 0) { var name = idecl.Declarator.DeclaredIdentifier; var ttype = context.MakeCType(multi.Specifiers, idecl.Declarator, idecl.Initializer, block); block.Typedefs[name] = ttype; } else { CType ctype = context.MakeCType(multi.Specifiers, idecl.Declarator, idecl.Initializer, block); var name = idecl.Declarator.DeclaredIdentifier; if (ctype is CFunctionType ftype && !HasStronglyBoundPointer(idecl.Declarator)) { var nameContext = (idecl.Declarator.InnerDeclarator is IdentifierDeclarator ndecl && ndecl.Context.Count > 0) ? string.Join("::", ndecl.Context) : ""; var f = new CompiledFunction(name, nameContext, ftype); block.Functions.Add(f); } else { if ((ctype is CArrayType atype) && (atype.Length == null) && (idecl.Initializer != null)) { if (idecl.Initializer is StructuredInitializer structInit) { var len = 0; foreach (var i in structInit.Initializers) { if (i.Designation == null) { len++; } else { foreach (var de in i.Designation.Designators) { // TODO: Pay attention to designators len++; } } } atype = new CArrayType(atype.ElementType, len); } else { //Report.Error(); } } //var init = GetInitExpression(idecl.Initializer); block.AddVariable(name, ctype ?? CBasicType.SignedInt); } if (idecl.Initializer != null) { var varExpr = new VariableExpression(name, Location.Null, Location.Null); var initExpr = GetInitializerExpression(idecl.Initializer); block.InitStatements.Add(new ExpressionStatement(new AssignExpression(varExpr, initExpr))); } } } }
protected override void SolveInstance(IGH_DataAccess DA) { List<DHr> hours = new List<DHr>(); String key = ""; if (DA.GetDataList(0, hours) && DA.GetData(1, ref key)) { if (hours.Count == 0) { //TODO: we may want to return null values here instead. return; } Interval ival_r = new Interval(); float[] vals = new float[0]; if (!(DA.GetData(2, ref ival_r))) DHr.get_domain(key, hours.ToArray(), ref vals, ref ival_r); else { vals = new float[hours.Count]; for (int h = 0; h < hours.Count; h++) vals[h] = hours[h].val(key); /* FROM HEAD: ival_r = new Interval(hours[0].val(key), hours[0].val(key)); vals = new float[hours.Count]; for (int h = 0; h < hours.Count; h++) { vals[h] = hours[h].val(key); if (vals[h] < ival_r.T0) ival_r.T0 = vals[h]; if (vals[h] > ival_r.T1) ival_r.T1 = vals[h]; } */ } String period_string = "none"; cycle_type = CType.Invalid; DA.GetData(3, ref period_string); if (period_string.Contains("year")) { this.cycle_type = CType.Year; } else if (period_string.Contains("day") || period_string.Contains("daily")) { this.cycle_type = CType.Day; } else if (period_string.Contains("none")) { this.cycle_type = CType.None; } if (cycle_type == CType.Invalid) { this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "I don't understand the time period you're looking for.\nPlease choose 'year', 'day', or 'none'."); return; } Plane plane = new Plane(new Point3d(0, 0, 0), new Vector3d(0, 0, 1)); DA.GetData(4, ref plane); Interval ival_gr = new Interval(); Interval ival_ga = new Interval(Math.PI * 2, 0); // reversed interval to ensure clockwise direction DA.GetData(5, ref ival_gr); switch (this.cycle_type) { case CType.None: { List<Point3d> points = new List<Point3d>(); Rhino.Geometry.Mesh mesh = new Mesh(); for (int h = 0; h < hours.Count; h++) { double radius = ival_gr.ParameterAt(ival_r.NormalizedParameterAt(vals[h])); double theta = ival_ga.ParameterAt(h / (double)hours.Count); Point3d gpt = PointByCylCoords(radius, theta); // a point in graph coordinates hours[h].pos = gpt; // the hour records the point in graph coordinates Point3d wpt = plane.PointAt(gpt.X, gpt.Y); points.Add(wpt); // adds this point in world coordinates mesh.Vertices.Add(wpt); mesh.VertexColors.Add(hours[h].color); Point3d wbpt = PointByCylCoords(ival_gr.ParameterAt(-0.01), theta); mesh.Vertices.Add(plane.PointAt(wbpt.X, wbpt.Y)); mesh.VertexColors.Add(hours[h].color); if (h > 0) mesh.Faces.AddFace(h * 2, h * 2 + 1, h * 2 - 1); if (h > 0) mesh.Faces.AddFace(h * 2 - 1, h * 2 - 2, h * 2); } mesh.Normals.ComputeNormals(); mesh.Compact(); DA.SetDataList(0, hours); DA.SetDataList(1, points); //DA.SetDataTree(2, regions); DA.SetData(2, mesh); } break; case CType.Day: { Grasshopper.Kernel.Data.GH_Structure<Grasshopper.Kernel.Types.GH_Point> points = new Grasshopper.Kernel.Data.GH_Structure<Grasshopper.Kernel.Types.GH_Point>(); Grasshopper.Kernel.Data.GH_Structure<DHr> hourTreeOut = new Grasshopper.Kernel.Data.GH_Structure<DHr>(); List<Mesh> meshes = new List<Mesh>(); Rhino.Geometry.Mesh mesh = new Mesh(); int hour_of_day = 0; int cycle_count = 0; for (int i = 0; i < hours.Count; i++) { if (hours[i].hr % 24 != hour_of_day) { cycle_count++; hour_of_day = hours[i].hr % 24; mesh.Normals.ComputeNormals(); mesh.Compact(); meshes.Add(mesh); mesh = new Mesh(); } double radius = ival_gr.ParameterAt(ival_r.NormalizedParameterAt(vals[i])); double theta = ival_ga.ParameterAt(hour_of_day / 24.0); Point3d gpt = PointByCylCoords(radius, theta); // a point in graph coordinates hours[i].pos = gpt; // the hour records the point in graph coordinates Point3d wpt = plane.PointAt(gpt.X, gpt.Y); points.Append(new Grasshopper.Kernel.Types.GH_Point(wpt),new Grasshopper.Kernel.Data.GH_Path(cycle_count)); // adds this point in world coordinates hourTreeOut.Append(hours[i], new Grasshopper.Kernel.Data.GH_Path(cycle_count)); mesh.Vertices.Add(wpt); mesh.VertexColors.Add(hours[i].color); Point3d wbpt = PointByCylCoords(ival_gr.ParameterAt(-0.01), theta); mesh.Vertices.Add(plane.PointAt(wbpt.X, wbpt.Y)); mesh.VertexColors.Add(hours[i].color); if (hour_of_day > 0) mesh.Faces.AddFace(hour_of_day * 2, hour_of_day * 2 + 1, hour_of_day * 2 - 1); if (hour_of_day > 0) mesh.Faces.AddFace(hour_of_day * 2 - 1, hour_of_day * 2 - 2, hour_of_day * 2); hour_of_day++; } DA.SetDataTree(0, hourTreeOut); DA.SetDataTree(1, points); //DA.SetDataTree(2, regions); DA.SetDataList(2, meshes); } break; } } }
public RuntimeBinderException Error(ErrorCode id, params ErrArg[] args) { // Create an argument array manually using the type information in the ErrArgs. string[] prgpsz = new string[args.Length]; int[] prgiarg = new int[args.Length]; int ppsz = 0; int piarg = 0; int cargUnique = 0; for (int iarg = 0; iarg < args.Length; iarg++) { ErrArg arg = args[iarg]; // If the NoStr bit is set we don't add it to prgpsz. if (0 != (arg.eaf & ErrArgFlags.NoStr)) { continue; } if (!_userStringBuilder.ErrArgToString(out prgpsz[ppsz], arg, out bool fUserStrings)) { if (arg.eak == ErrArgKind.Int) { prgpsz[ppsz] = arg.n.ToString(CultureInfo.InvariantCulture); } } ppsz++; int iargRec; if (!fUserStrings || 0 == (arg.eaf & ErrArgFlags.Unique)) { iargRec = -1; } else { iargRec = iarg; cargUnique++; } prgiarg[piarg] = iargRec; piarg++; } int cpsz = ppsz; if (cargUnique > 1) { // Copy the strings over to another buffer. string[] prgpszNew = new string[cpsz]; Array.Copy(prgpsz, 0, prgpszNew, 0, cpsz); for (int i = 0; i < cpsz; i++) { if (prgiarg[i] < 0 || prgpszNew[i] != prgpsz[i]) { continue; } ErrArg arg = args[prgiarg[i]]; Debug.Assert(0 != (arg.eaf & ErrArgFlags.Unique) && 0 == (arg.eaf & ErrArgFlags.NoStr)); Symbol sym = null; CType pType = null; switch (arg.eak) { case ErrArgKind.Sym: sym = arg.sym; break; case ErrArgKind.Type: pType = arg.pType; break; case ErrArgKind.SymWithType: sym = arg.swtMemo.sym; break; case ErrArgKind.MethWithInst: sym = arg.mpwiMemo.sym; break; default: Debug.Assert(false, "Shouldn't be here!"); continue; } bool fMunge = false; for (int j = i + 1; j < cpsz; j++) { if (prgiarg[j] < 0) { continue; } Debug.Assert(0 != (args[prgiarg[j]].eaf & ErrArgFlags.Unique)); if (prgpsz[i] != prgpsz[j]) { continue; } // The strings are identical. If they are the same symbol, leave them alone. // Otherwise, munge both strings. If j has already been munged, just make // sure we munge i. if (prgpszNew[j] != prgpsz[j]) { fMunge = true; continue; } ErrArg arg2 = args[prgiarg[j]]; Debug.Assert(0 != (arg2.eaf & ErrArgFlags.Unique) && 0 == (arg2.eaf & ErrArgFlags.NoStr)); Symbol sym2 = null; CType pType2 = null; switch (arg2.eak) { case ErrArgKind.Sym: sym2 = arg2.sym; break; case ErrArgKind.Type: pType2 = arg2.pType; break; case ErrArgKind.SymWithType: sym2 = arg2.swtMemo.sym; break; case ErrArgKind.MethWithInst: sym2 = arg2.mpwiMemo.sym; break; default: Debug.Assert(false, "Shouldn't be here!"); continue; } if (sym2 == sym && pType2 == pType && !fMunge) { continue; } prgpszNew[j] = prgpsz[j]; fMunge = true; } if (fMunge) { prgpszNew[i] = prgpsz[i]; } } prgpsz = prgpszNew; } return(new RuntimeBinderException(string.Format(CultureInfo.InvariantCulture, ErrorFacts.GetMessage(id), prgpsz))); }
/* throws Exception */ /// <summary> /// Get BuildType by predefined CType /// </summary> /// <param name="type"></param> /// <returns></returns> public static Bridge.BuildType getByCommandId(CType type) { return (Bridge.BuildType)Enum.Parse(typeof(Bridge.BuildType), type.ToString()); }
public void TestMatch(CType aType, CType aPattern, bool aExpected) { var result = aType.MatchToPattern(aPattern); Assert.That(result.IsMatch, Is.EqualTo(aExpected)); }
/// <summary> /// /// </summary> /// <param name="annotations"></param> /// <param name="propertyType"></param> /// <param name="name"></param> /// <returns></returns> public static CProperty ConceptualProperty(IEnumerable<CAnntation> annotations, CType propertyType, string name) => new CProperty(annotations, propertyType, name);
protected ExprWithArgs(ExpressionKind kind, CType type) : base(kind, type) { }