System.Text.StringBuilder.AppendFormat(System.IFormatProvider, string, params object[])

Here are the examples of the csharp api System.Text.StringBuilder.AppendFormat(System.IFormatProvider, string, params object[]) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1981 Examples 7

19 View Source File : HighlightingColor.cs
License : MIT License
Project Creator : Abdesol

[System.Diagnostics.Codereplacedysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Justification = "CSS usually uses lowercase, and all possible values are English-only")]
		public virtual string ToCss()
		{
			StringBuilder b = new StringBuilder();
			if (Foreground != null) {
				Color? c = Foreground.GetColor(null);
				if (c != null) {
					b.AppendFormat(CultureInfo.InvariantCulture, "color: #{0:x2}{1:x2}{2:x2}; ", c.Value.R, c.Value.G, c.Value.B);
				}
			}
			if (FontWeight != null) {
				b.Append("font-weight: ");
				b.Append(FontWeight.Value.ToString().ToLowerInvariant());
				b.Append("; ");
			}
			if (FontStyle != null) {
				b.Append("font-style: ");
				b.Append(FontStyle.Value.ToString().ToLowerInvariant());
				b.Append("; ");
			}
			if (Underline != null) {
				b.Append("text-decoration: ");
				b.Append(Underline.Value ? "underline" : "none");
				b.Append("; ");
			}
			if (Strikethrough != null) {
				if (Underline == null)
					b.Append("text-decoration:  ");

				b.Remove(b.Length - 1, 1);
				b.Append(Strikethrough.Value ? " line-through" : " none");
				b.Append("; ");
			}
			return b.ToString();
		}

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void UpdateHitTestInfo(IHitTestResult result) {
			StringBuilder text = new StringBuilder();

			if (result != null) {
				text.AppendFormat("Snapshot version {0}{1}", result.Snapshot.Version.Number, Environment.NewLine);

				if (result.View != null)
					text.AppendFormat("Over '{0}' view{1}", this.GetPlacementName(result.View), Environment.NewLine);

				switch (result.Type) {
					case HitTestResultType.Splitter: {
						EditorViewSplitter splitter = result.VisualElement as EditorViewSplitter;
						if (splitter != null)
							text.AppendLine("Over view splitter");
						break;
					}
					case HitTestResultType.ViewMargin:
						text.AppendFormat("Over '{0}' margin{1}", result.ViewMargin.Key, Environment.NewLine);
						text.AppendFormat("Closest text position is ({0},{1}){2}", result.Position.Line, result.Position.Character, Environment.NewLine);
						break;
					case HitTestResultType.ViewScrollBar: {
						System.Windows.Controls.Primitives.ScrollBar scrollBar = result.VisualElement as System.Windows.Controls.Primitives.ScrollBar;
						if (scrollBar != null)
							text.AppendFormat("Over '{0}' scrollbar{1}", scrollBar.Orientation, Environment.NewLine);
						break;
					}
					case HitTestResultType.ViewScrollBarBlock:
						text.AppendLine("Over scroll bar block");
						break;
					case HitTestResultType.ViewScrollBarSplitter: {
						ScrollBarSplitter splitter = result.VisualElement as ScrollBarSplitter;
						if (splitter != null)
							text.AppendLine("Over scroll bar splitter");
						break;
					}
					case HitTestResultType.ViewScrollBarTray:
						text.AppendLine("Over scroll bar tray (that can contain other controls like buttons)");
						break;
					case HitTestResultType.ViewTextArea:
						text.AppendFormat("Not directly over any view line or character{0}", Environment.NewLine);
						text.AppendFormat("Closest text position is ({0},{1}){2}", result.Position.Line, result.Position.Character, Environment.NewLine);
						break;
					case HitTestResultType.ViewTextAreaOverCharacter: {
						ITextSnapshotReader reader = result.GetReader();
						text.AppendFormat("Directly over offset {0} and text position ({1},{2}){3}", result.Offset, result.Position.Line, result.Position.Character, Environment.NewLine);
						text.AppendFormat("Directly over character '{0}'{1}", reader.Character, Environment.NewLine);
						
						IToken token = reader.Token;
						if (token != null) {
							text.AppendFormat("Directly over token '{0}' with range ({1},{2})-({3},{4}){5}", token.Key, 
								token.StartPosition.Line, token.StartPosition.Character, 
								token.EndPosition.Line, token.EndPosition.Character, Environment.NewLine);
							text.AppendFormat("Directly over token text '{0}'{1}", reader.TokenText, Environment.NewLine);
						}
						break;
					}
					case HitTestResultType.ViewTextAreaOverIntraTextSpacer:
						text.AppendFormat("Over spacer '{0}' on doreplacedent line {1}{2}", result.IntraTextSpacerTag, result.Position.Line, Environment.NewLine);
						break;
					case HitTestResultType.ViewTextAreaOverLine:
						text.AppendFormat("Over whitespace at the end of doreplacedent line {0}{1}", result.Position.Line, Environment.NewLine);
						break;
					default:
						if (result.VisualElement != null)
							text.AppendFormat("Over a '{0}' element{1}", result.VisualElement.GetType().FullName, Environment.NewLine);
						else
							text.AppendLine("No other hit test details available");
						break;
				}
			}
			else {
				text.AppendLine("Not over the SyntaxEditor");
			}

			resultsTextBox.Text = text.ToString();
		}

19 View Source File : QueryableSqlBuilder.cs
License : MIT License
Project Creator : 17MKH

public string BuildUpdateSql(IQueryParameters parameters)
    {
        var tableName = _queryBody.Joins.First().TableName;
        Check.NotNull(tableName, nameof(tableName), "未指定更新表");

        var sqlBuilder = new StringBuilder();

        //更新语句优先
        var updateSql = _queryBody.Update.Sql.NotNull() ? _queryBody.Update.Sql : ExpressionResolver.Resolve(_queryBody, _queryBody.Update.Lambda, parameters);
        Check.NotNull(updateSql, nameof(updateSql), "生成更新sql异常");

        sqlBuilder.AppendFormat("UPDATE {0} SET ", _dbAdapter.AppendQuote(tableName));
        sqlBuilder.Append(updateSql);

        SetUpdateInfo(sqlBuilder, parameters);

        var whereSql = ExpressionResolver.ResolveWhere(_queryBody, parameters);
        Check.NotNull(whereSql, nameof(whereSql), "批量更新必须指定条件,防止人为失误误操作");
        sqlBuilder.AppendFormat(" {0};", whereSql);

        return sqlBuilder.ToString();
    }

19 View Source File : Modifier_DefineSymbol.cs
License : MIT License
Project Creator : 5minlab

public string GetConfigText() {
            var sb = new StringBuilder();
            sb.AppendFormat("target={0}, ", targetGroup);
            sb.AppendFormat("defines={0}", defines);
            return sb.ToString();
        }

19 View Source File : CrudSqlBuilder.cs
License : MIT License
Project Creator : 17MKH

private void BuildSoftDeleteSql()
    {
        if (!_descriptor.IsSoftDelete)
            return;

        var dbAdapter = _descriptor.DbContext.Adapter;
        var sb = new StringBuilder("UPDATE {0} SET ");
        sb.AppendFormat("{0}={1},", dbAdapter.AppendQuote(_descriptor.GetDeletedColumnName()), dbAdapter.BooleanTrueValue);
        sb.AppendFormat("{0}={1},", dbAdapter.AppendQuote(_descriptor.GetDeletedTimeColumnName()), dbAdapter.AppendParameter("DeletedTime"));
        sb.AppendFormat("{0}={1} ", dbAdapter.AppendQuote(_descriptor.GetDeletedByColumnName()), dbAdapter.AppendParameter("DeletedBy"));

        _sql.SetSoftDelete(sb.ToString());

        var primaryKey = _descriptor.PrimaryKey;
        sb.AppendFormat(" WHERE {0}={1};", dbAdapter.AppendQuote(primaryKey.ColumnName), dbAdapter.AppendParameter(primaryKey.PropertyName));
        _sql.SetSoftDeleteSingle(sb.ToString());
    }

19 View Source File : QueryableSqlBuilder.cs
License : MIT License
Project Creator : 17MKH

public void ResolveSort(StringBuilder sqlBuilder)
    {
        if (_queryBody.Sorts.IsNullOrEmpty())
            return;

        var startLength = sqlBuilder.Length;
        sqlBuilder.Append(" ORDER BY");
        foreach (var sort in _queryBody.Sorts)
        {
            if (sort.Mode == QuerySortMode.Lambda)
            {
                ResolveSort(sqlBuilder, sort.Lambda.Body, sort.Lambda, sort.Type);
            }
            else
            {
                sqlBuilder.AppendFormat(" {0} {1},", sort.Sql, sort.Type == SortType.Asc ? "ASC" : "DESC");
            }
        }

        if (startLength + 9 == sqlBuilder.Length)
        {
            sqlBuilder.Remove(sqlBuilder.Length - 9, 9);
        }
        else if (startLength + 9 < sqlBuilder.Length)
        {
            sqlBuilder.Remove(sqlBuilder.Length - 1, 1);
        }
    }

19 View Source File : CreateInvertedIndex.cs
License : MIT License
Project Creator : ABTSoftware

private static string GetTextFromExample(Example example)
        {
            var sb = new StringBuilder();

            sb.AppendFormat("{0} ", example.replacedle);
            sb.AppendFormat("{0} ", example.Group);
            example.Features.ForEach(feature => sb.AppendFormat("{0} ", feature));
            sb.AppendFormat("{0} ", example.Description);

            return sb.ToString();
        }

19 View Source File : SqlServerCodeFirstProvider.cs
License : MIT License
Project Creator : 17MKH

private string GenerateCreateTableSql(IEnreplacedyDescriptor descriptor)
    {
        var columns = descriptor.Columns;
        var sql = new StringBuilder();
        sql.AppendFormat("CREATE TABLE {0}(", AppendQuote(descriptor.TableName));

        for (int i = 0; i < columns.Count; i++)
        {
            var column = columns[i];

            sql.Append(GenerateColumnAddSql(column, descriptor));

            if (i < columns.Count - 1)
            {
                sql.Append(",");
            }
        }

        sql.Append(");");

        foreach (var column in columns)
        {
            if (column.Description.NotNull())
            {
                sql.AppendFormat("EXECUTE sp_addextendedproperty N'MS_Description','{0}',N'user',N'dbo',N'table',N'{1}',N'column',N'{2}';", column.Description, descriptor.TableName, column.Name);
            }
        }

        return sql.ToString();
    }

19 View Source File : QuoteFunctions.cs
License : MIT License
Project Creator : Adoxio

public static string GetQuoteInstructions(IEnumerable<LineItem> lineItems)
		{
			return lineItems.Aggregate(
				new StringBuilder(),
				(sb, lineItem) => lineItem.Instructions == null
					? sb
					: sb.AppendFormat("{0}: {1}\n\n", lineItem.Product.GetAttributeValue<string>("name"), lineItem.Instructions))
				.ToString();
		}

19 View Source File : ExpressionResolver.cs
License : MIT License
Project Creator : 17MKH

private static void ResolveMember(QueryBody queryBody, MemberExpression exp, LambdaExpression fullLambda, StringBuilder sqlBuilder, IQueryParameters parameters)
    {
        if (exp.Expression != null)
        {
            switch (exp.Expression.NodeType)
            {
                case ExpressionType.Parameter:
                    sqlBuilder.Append(queryBody.GetColumnName(exp));
                    break;
                case ExpressionType.Constant:
                    var val = ResolveDynamicInvoke(exp);
                    AppendValue(queryBody, val, sqlBuilder, parameters);
                    break;
                case ExpressionType.MemberAccess:
                    if (exp.Expression is MemberExpression subMemberExp && subMemberExp.Expression!.NodeType == ExpressionType.Constant)
                    {
                        val = ResolveDynamicInvoke(exp);
                        AppendValue(queryBody, val, sqlBuilder, parameters);
                    }
                    else if (exp.Expression.Type.IsString())
                    {
                        var columnName = queryBody.GetColumnName(exp.Expression);
                        sqlBuilder.AppendFormat("{0}", queryBody.DbAdapter.FunctionMapper(exp.Member.Name, columnName));
                    }
                    else if (DbConstants.ENreplacedY_INTERFACE_TYPE.IsImplementType(exp.Expression.Type))
                    {
                        //多表连接解析列信息,如:m.T1.Id
                        var columnName = queryBody.GetColumnName(exp);
                        sqlBuilder.Append(columnName);
                    }
                    break;
            }

            //针对简写方式的布尔类型解析 m => m.Deleted
            if (exp == fullLambda.Body && exp.NodeType == ExpressionType.MemberAccess && exp.Type == typeof(bool))
            {
                sqlBuilder.Append(" = ");
                AppendValue(queryBody, queryBody.DbAdapter.BooleanTrueValue, sqlBuilder, parameters);
            }
        }
    }

19 View Source File : Helper.cs
License : MIT License
Project Creator : 5minlab

public void Append<T>(string key, replacedignableType<T> value) {
            if (value.Flag) {
                sb.AppendFormat("{0}={1}, ", key, value);
            };
        }

19 View Source File : CrudSqlBuilder.cs
License : MIT License
Project Creator : 17MKH

private void BuildQuerySql()
    {
        var dbAdapter = _descriptor.DbContext.Adapter;
        var sb = new StringBuilder("SELECT ");
        for (var i = 0; i < _descriptor.Columns.Count; i++)
        {
            var col = _descriptor.Columns[i];
            sb.AppendFormat("{0} AS {1}", dbAdapter.AppendQuote(col.Name), dbAdapter.AppendQuote(col.PropertyName));

            if (i != _descriptor.Columns.Count - 1)
            {
                sb.Append(",");
            }
        }
        sb.Append(" FROM {0} ");

        var querySql = sb.ToString();
        var getSql = querySql;
        var getAndRowLockSql = querySql;
        var getAndNoLockSql = querySql;
        // SqlServer行锁
        if (dbAdapter.Provider == DbProvider.SqlServer)
        {
            getAndRowLockSql += " WITH (ROWLOCK, UPDLOCK) ";
            getAndNoLockSql += "WITH (NOLOCK) ";
        }

        var primaryKey = _descriptor.PrimaryKey;
        if (!primaryKey.IsNo)
        {
            var appendSql = $" WHERE {dbAdapter.AppendQuote(primaryKey.ColumnName)}={dbAdapter.AppendParameter(primaryKey.PropertyName)} ";
            getSql += appendSql;
            getAndRowLockSql += appendSql;
            getAndNoLockSql += appendSql;

            //过滤软删除
            if (_descriptor.IsSoftDelete)
            {
                appendSql = $" AND {dbAdapter.AppendQuote(_descriptor.GetDeletedColumnName())}={dbAdapter.BooleanFalseValue} ";
                getSql += appendSql;
                getAndRowLockSql += appendSql;
                getAndNoLockSql += appendSql;
            }

            //MySql和PostgreSQL行锁
            if (dbAdapter.Provider == DbProvider.MySql || dbAdapter.Provider == DbProvider.PostgreSQL)
            {
                getAndRowLockSql += " FOR UPDATE;";
            }
        }

        _sql.SetGet(getSql);
        _sql.SetGetAndRowLock(getAndRowLockSql);
        _sql.SetGetAndNoLock(getAndNoLockSql);
    }

19 View Source File : QueryableSqlBuilder.cs
License : MIT License
Project Creator : 17MKH

public void ResolveSelectForNew(StringBuilder sqlBuilder, NewExpression newExp, LambdaExpression fullLambda, List<IColumnDescriptor> excludeColumns = null)
    {
        for (var i = 0; i < newExp.Arguments.Count; i++)
        {
            var arg = newExp.Arguments[i];
            var alias = newExp.Members![i].Name;
            //成员
            if (arg.NodeType == ExpressionType.MemberAccess)
            {
                ResolveSelectForMember(sqlBuilder, arg as MemberExpression, fullLambda, excludeColumns, alias);
                continue;
            }
            //实体
            if (arg.NodeType == ExpressionType.Parameter && arg is ParameterExpression parameterExp)
            {
                ResolveSelectForEnreplacedy(sqlBuilder, fullLambda.Parameters.IndexOf(parameterExp), excludeColumns);
                continue;
            }
            //方法
            if (arg.NodeType == ExpressionType.Call && arg is MethodCallExpression callExp)
            {
                var columnName = _queryBody.GetColumnName(callExp!.Object);
                var args = ExpressionResolver.Arguments2Object(callExp.Arguments);
                sqlBuilder.AppendFormat("{0} AS {1},", _dbAdapter.FunctionMapper(callExp.Method.Name, columnName, callExp.Object!.Type, args), _dbAdapter.AppendQuote(alias));
            }
        }
    }

19 View Source File : PlayerBuildExecutor.cs
License : MIT License
Project Creator : 5minlab

internal string GetConfigText() {
            var sb = new StringBuilder();
            sb.AppendFormat("buildTarget={0}, ", Target);
            sb.AppendFormat("buildTargetGroup={0}, ", TargetGroup);
            sb.AppendFormat("options={0}, ", Options);
            sb.AppendFormat("scenes={0}", string.Join(",", scenes));
            return sb.ToString();
        }

19 View Source File : GroupBySqlBuilder.cs
License : MIT License
Project Creator : 17MKH

private void ResolveSort(StringBuilder sqlBuilder, MemberExpression memberExp, string sort)
        {
            switch (memberExp.Expression!.NodeType)
            {
                case ExpressionType.MemberAccess:
                    sqlBuilder.AppendFormat(" {0} {1},", GetColumnName(memberExp), sort);
                    break;
            }
        }

19 View Source File : OVRControllerTest.cs
License : MIT License
Project Creator : absurd-joy

void Update()
	{
		OVRInput.Controller activeController = OVRInput.GetActiveController();

		data.Length = 0;
		byte battery = OVRInput.GetControllerBatteryPercentRemaining();
		data.AppendFormat("Battery: {0}\n", battery);

		float framerate = OVRPlugin.GetAppFramerate();
		data.AppendFormat("Framerate: {0:F2}\n", framerate);

		string activeControllerName = activeController.ToString();
		data.AppendFormat("Active: {0}\n", activeControllerName);

		string connectedControllerNames = OVRInput.GetConnectedControllers().ToString();
		data.AppendFormat("Connected: {0}\n", connectedControllerNames);

		data.AppendFormat("PrevConnected: {0}\n", prevConnected);

		controllers.Update();
		controllers.AppendToStringBuilder(ref data);

		prevConnected = connectedControllerNames;

		Quaternion rot = OVRInput.GetLocalControllerRotation(activeController);
		data.AppendFormat("Orientation: ({0:F2}, {1:F2}, {2:F2}, {3:F2})\n", rot.x, rot.y, rot.z, rot.w);

		Vector3 angVel = OVRInput.GetLocalControllerAngularVelocity(activeController);
		data.AppendFormat("AngVel: ({0:F2}, {1:F2}, {2:F2})\n", angVel.x, angVel.y, angVel.z);

		Vector3 angAcc = OVRInput.GetLocalControllerAngularAcceleration(activeController);
		data.AppendFormat("AngAcc: ({0:F2}, {1:F2}, {2:F2})\n", angAcc.x, angAcc.y, angAcc.z);

		Vector3 pos = OVRInput.GetLocalControllerPosition(activeController);
		data.AppendFormat("Position: ({0:F2}, {1:F2}, {2:F2})\n", pos.x, pos.y, pos.z);

		Vector3 vel = OVRInput.GetLocalControllerVelocity(activeController);
		data.AppendFormat("Vel: ({0:F2}, {1:F2}, {2:F2})\n", vel.x, vel.y, vel.z);

		Vector3 acc = OVRInput.GetLocalControllerAcceleration(activeController);
		data.AppendFormat("Acc: ({0:F2}, {1:F2}, {2:F2})\n", acc.x, acc.y, acc.z);

		float indexTrigger = OVRInput.Get(OVRInput.Axis1D.PrimaryIndexTrigger);
		data.AppendFormat("PrimaryIndexTriggerAxis1D: ({0:F2})\n", indexTrigger);

		float handTrigger = OVRInput.Get(OVRInput.Axis1D.PrimaryHandTrigger);
		data.AppendFormat("PrimaryHandTriggerAxis1D: ({0:F2})\n", handTrigger);

		for (int i = 0; i < monitors.Count; i++)
		{
			monitors[i].Update();
			monitors[i].AppendToStringBuilder(ref data);
		}

		if (uiText != null)
		{
			uiText.text = data.ToString();
		}
	}

19 View Source File : QueryableSqlBuilder.cs
License : MIT License
Project Creator : 17MKH

private void ResolveSort(StringBuilder sqlBuilder, MemberExpression memberExp, SortType sortType)
    {
        var sort = sortType == SortType.Asc ? "ASC" : "DESC";
        switch (memberExp.Expression!.NodeType)
        {
            case ExpressionType.Parameter:
                //m => m.replacedle
                var columnName = _queryBody.GetColumnName(memberExp);
                sqlBuilder.AppendFormat(" {0} {1},", columnName, sort);
                break;
            case ExpressionType.MemberAccess:
                //m => m.replacedle.Length
                //m => m.T1.replacedle
                //m => m.T1.Length
                //m => m.T1.replacedle.Length
                if (memberExp.Expression.Type.IsString())
                {
                    columnName = _queryBody.GetColumnName(memberExp.Expression);
                    sqlBuilder.AppendFormat(" {0} {1},", _dbAdapter.FunctionMapper(memberExp.Member.Name, columnName), sort);
                }
                else if (DbConstants.ENreplacedY_INTERFACE_TYPE.IsImplementType(memberExp.Expression.Type))
                {
                    columnName = _queryBody.GetColumnName(memberExp);
                    sqlBuilder.AppendFormat(" {0} {1},", columnName, sort);
                }

                break;
        }
    }

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void OnDockSiteMenuOpening(object sender, DockingMenuEventArgs e) {
			var sb = new StringBuilder(String.Format("WindowContextMenu: Kind={0}", e.Kind));

			if (e.Window != null) {
				sb.AppendFormat(", replacedle={0} ", e.Window.replacedle);

				if (e.Window == outputToolWindow) {
					e.Menu.Items.Add(new Separator());

					var menuItem = new MenuItem() { Header = "Activation Events", IsCheckable = true };
					menuItem.BindToProperty(MenuItem.IsCheckedProperty, this, "IsWindowActivationEventOutputEnabled", BindingMode.TwoWay);
					e.Menu.Items.Add(menuItem);

					menuItem = new MenuItem() { Header = "Registration Events", IsCheckable = true };
					menuItem.BindToProperty(MenuItem.IsCheckedProperty, this, "IsWindowRegistrationEventOutputEnabled", BindingMode.TwoWay);
					e.Menu.Items.Add(menuItem);
				}
			}

			this.AppendMessage(sb.ToString());
		}

19 View Source File : SqlServerCodeFirstProvider.cs
License : MIT License
Project Creator : 17MKH

private string GenerateColumnAddSql(IColumnDescriptor column, IEnreplacedyDescriptor descriptor)
    {
        var sql = new StringBuilder();
        sql.AppendFormat("{0} ", AppendQuote(column.Name));

        switch (column.TypeName)
        {
            case "NVARCHAR":
                sql.AppendFormat("NVARCHAR({0}) ", column.Length < 1 ? "MAX" : column.Length.ToString());
                break;
            case "DECIMAL":
            case "DOUBLE":
            case "FLOAT":
                var precision = column.Precision < 1 ? 18 : column.Precision;
                var scale = column.Scale < 1 ? 4 : column.Scale;
                sql.AppendFormat("{0}({1},{2}) ", column.TypeName, precision, scale);
                break;
            default:
                sql.AppendFormat("{0} ", column.TypeName);
                break;
        }
        if (column.IsPrimaryKey)
        {
            sql.Append("PRIMARY KEY ");

            //整数主键要自增
            if (descriptor.PrimaryKey.IsInt || descriptor.PrimaryKey.IsLong)
            {
                sql.Append("IDENreplacedY(1,1) ");
            }
        }

        if (!column.Nullable)
        {
            sql.Append("NOT NULL ");
        }

        if (!column.IsPrimaryKey && column.DefaultValue.NotNull())
        {
            sql.AppendFormat("DEFAULT({0})", column.DefaultValue);
        }

        return sql.ToString();
    }

19 View Source File : DiagnosticVerifier.cs
License : GNU General Public License v3.0
Project Creator : Acumatica

private static string FormatDiagnostics(Diagnosticreplacedyzer replacedyzer, params Diagnostic[] diagnostics)
		{
			var builder = new StringBuilder();
			for (int i = 0; i < diagnostics.Length; ++i)
			{
				builder.AppendLine("// " + diagnostics[i].ToString());

				var replacedyzerType = replacedyzer.GetType();
				var rules = replacedyzer.SupportedDiagnostics;

				foreach (var rule in rules)
				{
					if (rule != null && rule.Id == diagnostics[i].Id)
					{
						var location = diagnostics[i].Location;
						if (location == Location.None)
						{
							builder.AppendFormat("GetGlobalResult({0}.{1})", replacedyzerType.Name, rule.Id);
						}
						else
						{
							replacedert.True(location.IsInSource,
								$"Test base does not currently handle diagnostics in metadata locations. Diagnostic in metadata: {diagnostics[i]}\r\n");

							string resultMethodName = diagnostics[i].Location.SourceTree.FilePath.EndsWith(".cs") ? "GetCSharpResultAt" : "GetBasicResultAt";
							var linePosition = diagnostics[i].Location.GetLineSpan().StartLinePosition;

							builder.AppendFormat("{0}({1}, {2}, {3}.{4})",
								resultMethodName,
								linePosition.Line + 1,
								linePosition.Character + 1,
								replacedyzerType.Name,
								rule.Id);
						}

						if (i != diagnostics.Length - 1)
						{
							builder.Append(',');
						}

						builder.AppendLine();
						break;
					}
				}
			}
			return builder.ToString();
		}

19 View Source File : ExpressionResolver.cs
License : MIT License
Project Creator : 17MKH

private static void ResolveWhereForSoftDelete(QueryBody queryBody, StringBuilder sqlBuilder)
    {
        //未开启软删除过滤
        if (!queryBody.FilterDeleted)
            return;

        var dbAdapter = queryBody.DbAdapter;

        //单表
        if (queryBody.Joins.Count < 2)
        {
            var first = queryBody.Joins.First();
            if (!first.EnreplacedyDescriptor.IsSoftDelete)
                return;

            sqlBuilder.AppendFormat("{0} = {1} AND ", dbAdapter.AppendQuote(first.EnreplacedyDescriptor.GetDeletedColumnName()), dbAdapter.BooleanFalseValue);

            return;
        }

        //多表
        foreach (var join in queryBody.Joins)
        {
            if (!join.EnreplacedyDescriptor.IsSoftDelete || join.Type == JoinType.Inner)
                return;

            sqlBuilder.AppendFormat("{0}.{1} = {2} AND ", join.Alias, dbAdapter.AppendQuote(join.EnreplacedyDescriptor.GetDeletedColumnName()), dbAdapter.BooleanFalseValue);
        }
    }

19 View Source File : ExpressionResolver.cs
License : MIT License
Project Creator : 17MKH

private static void ResolveWhereForTenant(QueryBody queryBody, StringBuilder sqlBuilder)
    {
        //未开启过滤租户
        if (!queryBody.FilterTenant)
            return;

        var dbAdapter = queryBody.DbAdapter;
        var tenantId = queryBody.Repository.DbContext.AccountResolver.TenantId;
        //单表
        if (queryBody.Joins.Count < 2)
        {
            var first = queryBody.Joins.First();
            if (!first.EnreplacedyDescriptor.IsTenant)
                return;

            //单表
            var x0 = dbAdapter.AppendQuote(DbConstants.TENANT_COLUMN_NAME);
            if (tenantId == null)
            {
                sqlBuilder.AppendFormat("{0} IS NULL AND ", x0);
            }
            else
            {
                sqlBuilder.AppendFormat("{0} = '{1}' AND ", x0, tenantId);
            }

            return;
        }

        //多表
        foreach (var join in queryBody.Joins)
        {
            if (!join.EnreplacedyDescriptor.IsTenant || join.Type == JoinType.Inner)
                return;

            //多表时附加别名
            var x0 = join.Alias;
            var x1 = dbAdapter.AppendQuote(DbConstants.TENANT_COLUMN_NAME);
            if (tenantId == null)
            {
                sqlBuilder.AppendFormat("{0}.{1} IS NULL AND ", x0, x1);
            }
            else
            {
                sqlBuilder.AppendFormat("{0}.{1} = '{2}' AND", x0, x1, tenantId);
            }
        }
    }

19 View Source File : ExpressionResolver.cs
License : MIT License
Project Creator : 17MKH

public static void ResolveFrom(QueryBody queryBody, StringBuilder sqlBuilder, IQueryParameters parameters)
    {
        var dbAdapter = queryBody.DbAdapter;
        var first = queryBody.Joins.First();

        if (queryBody.Joins.Count < 2)
        {
            sqlBuilder.AppendFormat("{0}", dbAdapter.AppendQuote(first.TableName));

            //附加SqlServer的NOLOCK特性
            if (dbAdapter.Provider == DbProvider.SqlServer && first.NoLock)
            {
                sqlBuilder.Append(" WITH (NOLOCK)");
            }

            return;
        }

        sqlBuilder.AppendFormat("{0} AS {1}", dbAdapter.AppendQuote(first.TableName), first.Alias);
        //附加NOLOCK特性
        if (dbAdapter.Provider == DbProvider.SqlServer && first.NoLock)
        {
            sqlBuilder.Append(" WITH (NOLOCK)");
        }

        for (var i = 1; i < queryBody.Joins.Count; i++)
        {
            var join = queryBody.Joins[i];
            switch (join.Type)
            {
                case JoinType.Inner:
                    sqlBuilder.Append(" INNER");
                    break;
                case JoinType.Right:
                    sqlBuilder.Append(" RIGHT");
                    break;
                default:
                    sqlBuilder.Append(" LEFT");
                    break;
            }

            sqlBuilder.AppendFormat(" JOIN {0} AS {1}", dbAdapter.AppendQuote(join.TableName), join.Alias);
            //附加SqlServer的NOLOCK特性
            if (dbAdapter.Provider == DbProvider.SqlServer && first.NoLock)
            {
                sqlBuilder.Append(" WITH (NOLOCK)");
            }

            sqlBuilder.Append(" ON ");
            sqlBuilder.Append(Resolve(queryBody, join.On, parameters));

            if (join.Type == JoinType.Inner)
            {
                //过滤软删除
                if (queryBody.FilterDeleted && join.EnreplacedyDescriptor.IsSoftDelete)
                {
                    sqlBuilder.AppendFormat(" AND {0}.{1} = {2}", join.Alias, dbAdapter.AppendQuote(join.EnreplacedyDescriptor.GetDeletedColumnName()), dbAdapter.BooleanFalseValue);
                }

                //添加租户过滤
                if (queryBody.FilterTenant && join.EnreplacedyDescriptor.IsTenant)
                {
                    var x1 = dbAdapter.AppendQuote(DbConstants.TENANT_COLUMN_NAME);
                    var tenantId = queryBody.Repository.DbContext.AccountResolver.TenantId;
                    if (tenantId == null)
                    {
                        sqlBuilder.AppendFormat(" AND {0}.{1} IS NULL", join.Alias, x1);
                    }
                    else
                    {
                        sqlBuilder.AppendFormat(" AND {0}.{1} = '{2}'", join.Alias, x1, tenantId);
                    }
                }
            }
        }
    }

19 View Source File : CrudSqlBuilder.cs
License : MIT License
Project Creator : 17MKH

private void BuildUpdateSql()
    {
        var sb = new StringBuilder();
        sb.Append("UPDATE {0} SET");

        _sql.SetUpdate(sb.ToString());

        var dbAdapter = _descriptor.DbContext.Adapter;
        var primaryKey = _descriptor.PrimaryKey;
        if (!primaryKey.IsNo)
        {
            var columns = _descriptor.Columns.Where(m => !m.IsPrimaryKey);

            foreach (var col in columns)
            {
                sb.AppendFormat("{0}={1}", dbAdapter.AppendQuote(col.Name), dbAdapter.AppendParameter(col.PropertyName));

                //针对PostgreSQL数据库的json和jsonb类型字段的处理
                if (dbAdapter.Provider == DbProvider.PostgreSQL)
                {
                    if (col.TypeName.EqualsIgnoreCase("jsonb"))
                    {
                        sb.Append("::jsonb");
                    }
                    else if (col.TypeName.EqualsIgnoreCase("json"))
                    {
                        sb.Append("::json");
                    }
                }

                sb.Append(",");
            }

            sb.Remove(sb.Length - 1, 1);

            sb.AppendFormat(" WHERE {0}={1};", dbAdapter.AppendQuote(primaryKey.ColumnName), dbAdapter.AppendParameter(primaryKey.PropertyName));

            _sql.SetUpdateSingle(sb.ToString());
        }
    }

19 View Source File : QueryableSqlBuilder.cs
License : MIT License
Project Creator : 17MKH

public string BuildDeleteSql(IQueryParameters parameters)
    {
        var tableName = _queryBody.Joins.First().TableName;
        Check.NotNull(tableName, nameof(tableName), "未指定更新表");

        var sqlBuilder = new StringBuilder();

        sqlBuilder.AppendFormat("DELETE FROM {0} ", _dbAdapter.AppendQuote(tableName));

        var whereSql = ExpressionResolver.ResolveWhere(_queryBody, parameters);
        Check.NotNull(whereSql, nameof(whereSql), "生成条件sql异常,删除必须指定条件,防止误操作");
        sqlBuilder.AppendFormat(" {0}", whereSql);

        return sqlBuilder.ToString();
    }

19 View Source File : GroupBySqlBuilder.cs
License : MIT License
Project Creator : 17MKH

public void ResolveSort(StringBuilder sqlBuilder)
        {
            if (_queryBody.Sorts.IsNullOrEmpty())
                return;

            var startLength = sqlBuilder.Length;
            sqlBuilder.Append(" ORDER BY");

            foreach (var sort in _queryBody.Sorts)
            {
                if (sort.Mode == QuerySortMode.Lambda)
                {
                    ResolveSort(sqlBuilder, sort.Lambda.Body, sort.Type);
                }
                else
                {
                    sqlBuilder.AppendFormat(" {0} {1},", sort.Sql, sort.Type == SortType.Asc ? "ASC" : "DESC");
                }
            }

            if (startLength + 9 == sqlBuilder.Length)
            {
                sqlBuilder.Remove(sqlBuilder.Length - 9, 9);
            }
            else if (startLength + 9 < sqlBuilder.Length)
            {
                sqlBuilder.Remove(sqlBuilder.Length - 1, 1);
            }
        }

19 View Source File : GroupBySqlBuilder.cs
License : MIT License
Project Creator : 17MKH

public void ResolveSelect(StringBuilder sqlBuilder)
        {
            var select = _queryBody.Select;
            if (select == null)
                throw new ArgumentException("未指定查询信息");

            if (select.Mode == QuerySelectMode.Sql)
            {
                //SQL语句
                sqlBuilder.Append(select.Sql);
            }
            else if (select.Mode == QuerySelectMode.Lambda)
            {
                //表达式
                var exp = select.Include.Body;
                if (exp.NodeType != ExpressionType.New)
                {
                    throw new ArgumentException("分组查询的列,必须使用匿名对象的方式");
                }

                var newExp = exp as NewExpression;
                for (var i = 0; i < newExp.Arguments.Count; i++)
                {
                    var arg = newExp.Arguments[i];
                    var alias = newExp.Members![i].Name;
                    string columnName;

                    switch (arg.NodeType)
                    {
                        case ExpressionType.MemberAccess:
                            var memExp = arg as MemberExpression;
                            columnName = GetColumnName(memExp);
                            sqlBuilder.AppendFormat("{0} AS {1},", columnName, _dbAdapter.AppendQuote(alias));
                            break;
                        case ExpressionType.Call:
                            if (arg is MethodCallExpression callExp)
                            {
                                var methodName = callExp.Method.Name;
                                switch (callExp.Object!.NodeType)
                                {
                                    case ExpressionType.Parameter:
                                        if (callExp.Arguments.Count > 0)
                                        {
                                            //m => m.Sum(x => x.Id)
                                            var s = (callExp.Arguments[0] as UnaryExpression)!.Operand as LambdaExpression;
                                            var memberExp = s.Body as MemberExpression;
                                            columnName = _queryBody.GetColumnName(memberExp);
                                            sqlBuilder.AppendFormat("{0} AS {1},", _dbAdapter.FunctionMapper(callExp.Method.Name, columnName, callExp.Object!.Type), _dbAdapter.AppendQuote(alias));
                                        }
                                        else
                                        {
                                            sqlBuilder.AppendFormat("{0} AS {1},", _dbAdapter.FunctionMapper(methodName, null), _dbAdapter.AppendQuote(alias));
                                        }
                                        break;
                                    case ExpressionType.MemberAccess:
                                        //m => m.Key.replacedle.Substring(3)
                                        columnName = GetColumnName(callExp!.Object as MemberExpression);
                                        var args = ExpressionResolver.Arguments2Object(callExp.Arguments);
                                        sqlBuilder.AppendFormat("{0} AS {1},", _dbAdapter.FunctionMapper(methodName, columnName, callExp.Object.Type, args), _dbAdapter.AppendQuote(alias));
                                        break;
                                    default:
                                        sqlBuilder.AppendFormat("{0} AS {1},", _dbAdapter.FunctionMapper(methodName, null), _dbAdapter.AppendQuote(alias));
                                        break;
                                }
                            }
                            break;
                    }

19 View Source File : QueryableSqlBuilder.cs
License : MIT License
Project Creator : 17MKH

public void ResolveSelectForEnreplacedy(StringBuilder sqlBuilder, int index = 0, List<IColumnDescriptor> excludeColumns = null)
    {
        var join = _queryBody.Joins[index];

        foreach (var col in join.EnreplacedyDescriptor.Columns)
        {
            if (excludeColumns != null && excludeColumns.Any(m => m == col))
                continue;

            //单个实体时不需要别名
            sqlBuilder.Append(IsSingleEnreplacedy ? $"{_dbAdapter.AppendQuote(col.Name)}" : $"{join.Alias}.{_dbAdapter.AppendQuote(col.Name)}");

            sqlBuilder.AppendFormat(" AS {0},", _dbAdapter.AppendQuote(col.PropertyInfo.Name));
        }
    }

19 View Source File : Modifier_AndroidSdkVersion.cs
License : MIT License
Project Creator : 5minlab

public string GetConfigText() {
            var sb = new StringBuilder();
            sb.AppendFormat("min={0}, ", min);
            sb.AppendFormat("target={0}", target);
            return sb.ToString();
        }

19 View Source File : GroupBySqlBuilder.cs
License : MIT License
Project Creator : 17MKH

private void ResolveSort(StringBuilder sqlBuilder, Expression exp, SortType sortType)
        {
            var sort = sortType == SortType.Asc ? "ASC" : "DESC";
            switch (exp.NodeType)
            {
                case ExpressionType.MemberAccess:
                    ResolveSort(sqlBuilder, exp as MemberExpression, sort);
                    break;
                case ExpressionType.Call:
                    var callExp = exp as MethodCallExpression;
                    var methodName = callExp.Method.Name;
                    switch (callExp.Object.NodeType)
                    {
                        case ExpressionType.Parameter:
                            //OrderBy(m => m.Sum(x => x.Id))
                            var fullLambda = (callExp.Arguments[0] as UnaryExpression).Operand as LambdaExpression;
                            var columnName = _queryBody.GetColumnName(fullLambda.Body);
                            sqlBuilder.AppendFormat(" {0} {1},", _queryBody.DbAdapter.FunctionMapper(methodName, columnName), sort);
                            break;
                        case ExpressionType.MemberAccess:
                            //OrderBy(m => m.Key.replacedle.Substring(3))
                            columnName = GetColumnName(callExp!.Object as MemberExpression);
                            var args = ExpressionResolver.Arguments2Object(callExp.Arguments);
                            sqlBuilder.AppendFormat(" {0} {1},", _dbAdapter.FunctionMapper(methodName, columnName, callExp.Object!.Type, args), sort);
                            break;
                    }
                    break;
            }
        }

19 View Source File : Modifier_XR.cs
License : MIT License
Project Creator : 5minlab

public string GetConfigText() {
            var sb = new StringBuilder();
            sb.AppendFormat("enabled={0}, ", enabled);
            sb.AppendFormat("devices={0}, ", string.Join(",", devices));
            sb.AppendFormat("stereoRenderingPath={0}", stereoRenderingPath);
            return sb.ToString();
        }

19 View Source File : QueryableSqlBuilder.cs
License : MIT License
Project Creator : 17MKH

public void ResolveSelectForMember(StringBuilder sqlBuilder, MemberExpression memberExp, LambdaExpression fullLambda, List<IColumnDescriptor> excludeCols, string alias = null)
    {
        alias ??= memberExp.Member.Name;
        string columnName;
        if (DbConstants.ENreplacedY_INTERFACE_TYPE.IsImplementType(memberExp.Type))
        {
            var index = _queryBody.Joins.FindIndex(m => m.EnreplacedyDescriptor.EnreplacedyType == memberExp.Type);
            ResolveSelectForEnreplacedy(sqlBuilder, index, excludeCols);
        }
        else if (memberExp.Expression!.Type.IsString())
        {
            columnName = _queryBody.GetColumnName(memberExp);
            sqlBuilder.AppendFormat("{0} AS {1},", _queryBody.DbAdapter.FunctionMapper(memberExp.Member.Name, columnName), _dbAdapter.AppendQuote(alias));
        }
        else if (DbConstants.ENreplacedY_INTERFACE_TYPE.IsImplementType(memberExp.Expression.Type))
        {
            var join = _queryBody.GetJoin(memberExp);
            if (excludeCols != null && excludeCols.Any(m => m == join.Item2))
                return;

            columnName = _queryBody.GetColumnName(join.Item1, join.Item2);
            sqlBuilder.AppendFormat("{0} AS {1},", columnName, _dbAdapter.AppendQuote(alias));
        }
    }

19 View Source File : ClassStruct.cs
License : MIT License
Project Creator : 91Act

public static void ReadClreplacedStruct(StringBuilder sb, List<ClreplacedMember> members, EndianBinaryReader a_Stream)
        {
            for (int i = 0; i < members.Count; i++)
            {
                var member = members[i];
                var level = member.Level;
                var varTypeStr = member.Type;
                var varNameStr = member.Name;
                object value = null;
                var align = (member.Flag & 0x4000) != 0;
                var append = true;
                if (member.alignBefore)
                    a_Stream.AlignStream(4);
                if (varTypeStr == "SInt8")//sbyte
                {
                    value = a_Stream.ReadSByte();
                }
                else if (varTypeStr == "UInt8")//byte
                {
                    value = a_Stream.ReadByte();
                }
                else if (varTypeStr == "short" || varTypeStr == "SInt16")//Int16
                {
                    value = a_Stream.ReadInt16();
                }
                else if (varTypeStr == "UInt16" || varTypeStr == "unsigned short")//UInt16
                {
                    value = a_Stream.ReadUInt16();
                }
                else if (varTypeStr == "int" || varTypeStr == "SInt32")//Int32
                {
                    value = a_Stream.ReadInt32();
                }
                else if (varTypeStr == "UInt32" || varTypeStr == "unsigned int" || varTypeStr == "Type*")//UInt32
                {
                    value = a_Stream.ReadUInt32();
                }
                else if (varTypeStr == "long long" || varTypeStr == "SInt64")//Int64
                {
                    value = a_Stream.ReadInt64();
                }
                else if (varTypeStr == "UInt64" || varTypeStr == "unsigned long long")//UInt64
                {
                    value = a_Stream.ReadUInt64();
                }
                else if (varTypeStr == "float")//float
                {
                    value = a_Stream.ReadSingle();
                }
                else if (varTypeStr == "double")//double
                {
                    value = a_Stream.ReadDouble();
                }
                else if (varTypeStr == "bool")//bool
                {
                    value = a_Stream.ReadBoolean();
                }
                else if (varTypeStr == "string")//string
                {
                    append = false;
                    var str = a_Stream.ReadAlignedString(a_Stream.ReadInt32());
                    sb.AppendFormat("{0}{1} {2} = \"{3}\"\r\n", (new string('\t', level)), varTypeStr, varNameStr, str);
                    i += 3;//skip
                }
                else if (varTypeStr == "Array")//Array
                {
                    append = false;
                    if ((members[i - 1].Flag & 0x4000) != 0)
                        align = true;
                    sb.AppendFormat("{0}{1} {2}\r\n", (new string('\t', level)), varTypeStr, varNameStr);
                    var size = a_Stream.ReadInt32();
                    sb.AppendFormat("{0}{1} {2} = {3}\r\n", (new string('\t', level)), "int", "size", size);
                    var array = ReadArray(members, level, i);
                    for (int j = 0; j < size; j++)
                    {
                        sb.AppendFormat("{0}[{1}]\r\n", (new string('\t', level + 1)), j);
                        ReadClreplacedStruct(sb, array, a_Stream);
                    }
                    i += array.Count + 1;//skip
                }
                else if (varTypeStr == "TypelessData")
                {
                    append = false;
                    var size = a_Stream.ReadInt32();
                    a_Stream.ReadBytes(size);
                    i += 2;
                    sb.AppendFormat("{0}{1} {2}\r\n", (new string('\t', level)), varTypeStr, varNameStr);
                    sb.AppendFormat("{0}{1} {2} = {3}\r\n", (new string('\t', level)), "int", "size", size);
                }
                else
                {
                    append = false;
                    if (align)
                    {
                        align = false;
                        SetAlignBefore(members, level, i + 1);
                    }
                    sb.AppendFormat("{0}{1} {2}\r\n", (new string('\t', level)), varTypeStr, varNameStr);
                }
                if (append)
                    sb.AppendFormat("{0}{1} {2} = {3}\r\n", (new string('\t', level)), varTypeStr, varNameStr, value);
                if (align)
                    a_Stream.AlignStream(4);
            }
        }

19 View Source File : SqliteCodeFirstProvider.cs
License : MIT License
Project Creator : 17MKH

private string GetColumnAddSql(IColumnDescriptor column, IEnreplacedyDescriptor descriptor)
    {
        var sql = new StringBuilder();
        sql.AppendFormat("{0} ", AppendQuote(column.Name));

        switch (column.TypeName)
        {
            case "decimal":
                var precision = column.Precision < 1 ? 18 : column.Precision;
                var scale = column.Scale < 1 ? 4 : column.Scale;
                sql.AppendFormat("{0}({1},{2}) ", column.TypeName, precision, scale);
                break;
            default:
                sql.AppendFormat("{0} ", column.TypeName);
                break;
        }
        if (column.IsPrimaryKey)
        {
            sql.Append("PRIMARY KEY ");

            if (descriptor.PrimaryKey.IsInt || descriptor.PrimaryKey.IsLong)
            {
                sql.Append("AUTOINCREMENT ");
            }
        }
        if (!column.IsPrimaryKey && column.DefaultValue.NotNull())
        {
            sql.AppendFormat("DEFAULT {0}", column.DefaultValue);
        }

        if (!column.Nullable)
        {
            sql.Append(" NOT NULL ");
        }

        return sql.ToString();
    }

19 View Source File : OVRHandTest.cs
License : MIT License
Project Creator : absurd-joy

void Update()
	{
		data.Length = 0;

		OVRInput.Controller activeController = OVRInput.GetActiveController();

		string activeControllerName = activeController.ToString();
		data.AppendFormat("Active: {0}\n", activeControllerName);

		string connectedControllerNames = OVRInput.GetConnectedControllers().ToString();
		data.AppendFormat("Connected: {0}\n", connectedControllerNames);

		data.AppendFormat("PrevConnected: {0}\n", prevConnected);

		controllers.Update();
		controllers.AppendToStringBuilder(ref data);
		prevConnected = connectedControllerNames;

		Vector3 pos = OVRInput.GetLocalControllerPosition(activeController);
		data.AppendFormat("Position: ({0:F2}, {1:F2}, {2:F2})\n", pos.x, pos.y, pos.z);

		Quaternion rot = OVRInput.GetLocalControllerRotation(activeController);
		data.AppendFormat("Orientation: ({0:F2}, {1:F2}, {2:F2}, {3:F2})\n", rot.x, rot.y, rot.z, rot.w);

		data.AppendFormat("HandTrackingEnabled: {0}\n", OVRPlugin.GetHandTrackingEnabled());

		bool result_hs_LH = OVRPlugin.GetHandState(OVRPlugin.Step.Render, OVRPlugin.Hand.HandLeft, ref hs_LH);
		data.AppendFormat("LH HS Query Res: {0}\n", result_hs_LH);
		data.AppendFormat("LH HS Status: {0}\n", hs_LH.Status);
		data.AppendFormat("LH HS Pose: {0}\n", hs_LH.RootPose);
		data.AppendFormat("LH HS HandConf: {0}\n", hs_LH.HandConfidence);

		bool result_hs_RH = OVRPlugin.GetHandState(OVRPlugin.Step.Render, OVRPlugin.Hand.HandRight, ref hs_RH);
		data.AppendFormat("RH HS Query Res: {0}\n", result_hs_RH);
		data.AppendFormat("RH HS Status: {0}\n", hs_RH.Status);
		data.AppendFormat("RH HS Pose: {0}\n", hs_RH.RootPose);
		data.AppendFormat("RH HS HandConf: {0}\n", hs_RH.HandConfidence);

		data.AppendFormat("LH Skel Query Res: {0}\n", result_skel_LH);
		data.AppendFormat("LH Skel Type: {0}\n", skel_LH.Type);
		data.AppendFormat("LH Skel NumBones: {0}\n", skel_LH.NumBones);

		data.AppendFormat("RH Skel Query Res: {0}\n", result_skel_RH);
		data.AppendFormat("RH Skel Type: {0}\n", skel_RH.Type);
		data.AppendFormat("RH Skel NumBones: {0}\n", skel_RH.NumBones);

		data.AppendFormat("LH Mesh Query Res: {0}\n", result_mesh_LH);
		data.AppendFormat("LH Mesh Type: {0}\n", mesh_LH.Type);
		data.AppendFormat("LH Mesh NumVers: {0}\n", mesh_LH.NumVertices);

		data.AppendFormat("RH Mesh Query Res: {0}\n", result_mesh_RH);
		data.AppendFormat("RH Mesh Type: {0}\n", mesh_RH.Type);
		data.AppendFormat("RH Mesh NumVers: {0}\n", mesh_RH.NumVertices);

		for (int i = 0; i < monitors.Count; i++)
		{
			monitors[i].Update();
			monitors[i].AppendToStringBuilder(ref data);
		}

		if (uiText != null)
		{
			uiText.text = data.ToString();
		}
	}

19 View Source File : QueryableSqlBuilder.cs
License : MIT License
Project Creator : 17MKH

private void ResolveSort(StringBuilder sqlBuilder, Expression exp, LambdaExpression fullExp, SortType sortType)
    {
        switch (exp.NodeType)
        {
            case ExpressionType.MemberAccess:
                //m => m.replacedle
                //m => m.replacedle.Length
                //m => m.T1.replacedle
                //m => m.T1.Length
                //m => m.T1.replacedle.Length
                ResolveSort(sqlBuilder, exp as MemberExpression, sortType);
                break;
            case ExpressionType.Convert:
                //m => m.replacedle.Length
                if (exp is UnaryExpression unaryExpression)
                {
                    ResolveSort(sqlBuilder, unaryExpression.Operand as MemberExpression, sortType);
                }
                break;
            case ExpressionType.Call:
                var callExp = exp as MethodCallExpression;
                var memberExp = callExp!.Object as MemberExpression;
                var columnName = _queryBody.GetColumnName(memberExp);
                object[] args = null;
                if (callExp.Arguments.Any())
                {
                    args = new object[callExp.Arguments.Count];
                    for (int i = 0; i < callExp.Arguments.Count; i++)
                    {
                        args[i] = ((ConstantExpression)callExp.Arguments[i]).Value;
                    }
                }
                sqlBuilder.AppendFormat(" {0} {1},", _dbAdapter.FunctionMapper(callExp.Method.Name, columnName, callExp.Object!.Type, args), sortType == SortType.Asc ? "ASC" : "DESC");
                break;
            case ExpressionType.New:
                //m=>new { m.replacedle.Substring(2) }
                if (exp is NewExpression newExp)
                {
                    foreach (var arg in newExp.Arguments)
                    {
                        ResolveSort(sqlBuilder, arg, fullExp, sortType);
                    }
                }
                break;
        }
    }

19 View Source File : LanguageCompiler.cs
License : MIT License
Project Creator : ABTSoftware

private static void CompileRule(LanguageRule languageRule,
                                                 StringBuilder regex,
                                                 ICollection<string> captures,
                                                 bool isFirstRule)
        {
            if (!isFirstRule)
            {
                regex.AppendLine();
                regex.AppendLine();
                regex.AppendLine("|");
                regex.AppendLine();
            }
            
            regex.AppendFormat("(?-xis)(?m)({0})(?x)", languageRule.Regex);

            int numberOfCaptures = GetNumberOfCaptures(languageRule.Regex);

            for (int i = 0; i <= numberOfCaptures; i++)
            {
                string scope = null;

                foreach (int captureIndex in languageRule.Captures.Keys)
                {
                    if (i == captureIndex)
                    {
                        scope = languageRule.Captures[captureIndex];
                        break;
                    }
                }

                captures.Add(scope);
            }
        }

19 View Source File : QueryableSqlBuilder.cs
License : MIT License
Project Creator : 17MKH

private void SetUpdateInfo(StringBuilder sqlBuilder, IQueryParameters parameters)
    {
        var descriptor = _queryBody.Joins.First().EnreplacedyDescriptor;
        if (descriptor.IsEnreplacedyBase)
        {
            if (_queryBody.UseParameters)
            {
                var p1 = parameters.Add(_dbContext.AccountResolver.AccountId);
                sqlBuilder.AppendFormat(",{0} = @{1}", _dbAdapter.AppendQuote(descriptor.GetModifiedByColumnName()), p1);
                var p2 = parameters.Add(_dbContext.AccountResolver.AccountName);
                sqlBuilder.AppendFormat(",{0} = @{1}", _dbAdapter.AppendQuote(descriptor.GetModifierColumnName()), p2);
                var p3 = parameters.Add(DateTime.Now);
                sqlBuilder.AppendFormat(",{0} = @{1}", _dbAdapter.AppendQuote(descriptor.GetModifiedTimeColumnName()), p3);
            }
            else
            {
                sqlBuilder.AppendFormat(",{0} = ", _dbAdapter.AppendQuote(descriptor.GetModifiedByColumnName()));
                ExpressionResolver.AppendValue(_queryBody, _dbContext.AccountResolver.AccountId, sqlBuilder, parameters);
                sqlBuilder.AppendFormat(",{0} = ", _dbAdapter.AppendQuote(descriptor.GetModifierColumnName()));
                ExpressionResolver.AppendValue(_queryBody, _dbContext.AccountResolver.AccountName, sqlBuilder, parameters);
                sqlBuilder.AppendFormat(",{0} = ", _dbAdapter.AppendQuote(descriptor.GetModifiedTimeColumnName()));
                ExpressionResolver.AppendValue(_queryBody, DateTime.Now, sqlBuilder, parameters);
            }
        }
    }

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void OnDockSiteMenuOpening(object sender, DockingMenuEventArgs e) {
			var sb = new StringBuilder(String.Format("WindowContextMenu: Kind={0}", e.Kind));

			if (e.Window != null) {
				sb.AppendFormat(", replacedle={0} ", e.Window.replacedle);

				if (e.Window == outputToolWindow) {
					e.Menu.Items.Add(new Separator());

					var menuItem = new MenuItem() { Header = "Location/Size Events", IsCheckable = true };
					menuItem.BindToProperty(MenuItem.IsCheckedProperty, this, "IsLocationSizeEventOutputEnabled", BindingMode.TwoWay);
					e.Menu.Items.Add(menuItem);
				}
			}

			this.AppendMessage(sb.ToString());
		}

19 View Source File : ValidateResultFormatAttribute.cs
License : MIT License
Project Creator : 17MKH

public override void OnResultExecuting(ResultExecutingContext context)
    {
        if (!context.ModelState.IsValid)
        {
            try
            {
                var errors = context.ModelState
                    .Where(m => m.Value!.ValidationState == ModelValidationState.Invalid)
                    .Select(m =>
                    {
                        var sb = new StringBuilder();
                        sb.AppendFormat("{0}:", m.Key);
                        sb.Append(m.Value.Errors.Select(n => n.ErrorMessage).Aggregate((x, y) => x + ";" + y));
                        return sb.ToString();
                    })
                    .Aggregate((x, y) => x + "|" + y);

                context.Result = new JsonResult(ResultModel.Failed(errors));
            }
            catch
            {
                context.Result = new StatusCodeResult(StatusCodes.Status500InternalServerError);
            }
        }
    }

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void OnDockSiteMenuOpening(object sender, DockingMenuEventArgs e) {
			var sb = new StringBuilder(String.Format("WindowContextMenu: Kind={0}", e.Kind));

			if (e.Window != null) {
				sb.AppendFormat(", replacedle={0} ", e.Window.replacedle);

				if (e.Window == customizedDoreplacedentWindow) {
					e.Menu.Items.Add(new Separator());

					var menuItem = new MenuItem() { Header = "Custom Menu Item Added at " + DateTime.Now.ToShortTimeString() };
					e.Menu.Items.Add(menuItem);
				}
				else if (e.Window == customizedToolWindow) {
					e.Menu.Items.Clear();

					var menuItem = new MenuItem() { Header = "Custom Menu Item Added at " + DateTime.Now.ToShortTimeString() };
					e.Menu.Items.Add(menuItem);
				}
			}

			this.AppendMessage(sb.ToString());
		}

19 View Source File : GmicPipeServer.cs
License : GNU General Public License v3.0
Project Creator : 0xC0000054

private unsafe string PrepareCroppedLayers(InputMode inputMode, RectangleF cropRect)
        {
            if (inputMode == InputMode.NoInput)
            {
                return string.Empty;
            }

            IReadOnlyList<GmicLayer> layers = GetRequestedLayers(inputMode);

            if (layers.Count == 0)
            {
                return string.Empty;
            }

            if (memoryMappedFiles.Capacity < layers.Count)
            {
                memoryMappedFiles.Capacity = layers.Count;
            }

            StringBuilder reply = new StringBuilder();

            foreach (GmicLayer layer in layers)
            {
                Surface surface = layer.Surface;
                bool disposeSurface = false;
                int destinationImageStride = surface.Stride;

                if (cropRect != WholeImageCropRect)
                {
                    int cropX = (int)Math.Floor(cropRect.X * layer.Width);
                    int cropY = (int)Math.Floor(cropRect.Y * layer.Height);
                    int cropWidth = (int)Math.Min(layer.Width - cropX, 1 + Math.Ceiling(cropRect.Width * layer.Width));
                    int cropHeight = (int)Math.Min(layer.Height - cropY, 1 + Math.Ceiling(cropRect.Height * layer.Height));

                    try
                    {
                        surface = layer.Surface.CreateWindow(cropX, cropY, cropWidth, cropHeight);
                    }
                    catch (ArgumentOutOfRangeException ex)
                    {
                        throw new InvalidOperationException(string.Format("Surface.CreateWindow bounds invalid, cropRect={0}", cropRect.ToString()), ex);
                    }
                    disposeSurface = true;
                    destinationImageStride = cropWidth * ColorBgra.SizeOf;
                }

                string mapName = "pdn_" + Guid.NewGuid().ToString();

                try
                {
                    MemoryMappedFile file = MemoryMappedFile.CreateNew(mapName, surface.Scan0.Length);
                    memoryMappedFiles.Add(file);

                    using (MemoryMappedViewAccessor accessor = file.CreateViewAccessor())
                    {
                        byte* destination = null;
                        RuntimeHelpers.PrepareConstrainedRegions();
                        try
                        {
                            accessor.SafeMemoryMappedViewHandle.AcquirePointer(ref destination);

                            for (int y = 0; y < surface.Height; y++)
                            {
                                ColorBgra* src = surface.GetRowAddressUnchecked(y);
                                byte* dst = destination + (y * destinationImageStride);

                                Buffer.MemoryCopy(src, dst, destinationImageStride, destinationImageStride);
                            }
                        }
                        finally
                        {
                            if (destination != null)
                            {
                                accessor.SafeMemoryMappedViewHandle.ReleasePointer();
                            }
                        }
                    }
                }
                finally
                {
                    if (disposeSurface)
                    {
                        surface.Dispose();
                    }
                }

                reply.AppendFormat(
                    CultureInfo.InvariantCulture,
                    "{0},{1},{2},{3}\n",
                    mapName,
                    surface.Width.ToString(CultureInfo.InvariantCulture),
                    surface.Height.ToString(CultureInfo.InvariantCulture),
                    destinationImageStride.ToString(CultureInfo.InvariantCulture));
            }

            return reply.ToString();
        }

19 View Source File : FunctionContentProvider.cs
License : MIT License
Project Creator : Actipro

public object GetContent() {
			var htmlSnippet = new StringBuilder();
			
			if (includeImage) {
				// Append icon
				htmlSnippet.Append("<img src=\"resource:");
				htmlSnippet.Append(HtmlContentProvider.Escape(CommonImageKind.MethodPublic.ToString()));
				htmlSnippet.Append("\" align=\"absbottom\" /> ");
			}
				
			// Append function name
			htmlSnippet.Append("<span style=\"color: " + HtmlContentProvider.GetKeywordForegroundColor(highlightingStyleRegistry).ToWebColor() + ";\">function</span> ");
			htmlSnippet.Append(HtmlContentProvider.Escape(functionDecl.Name));

			// Append parameters
			htmlSnippet.Append("(");
			for (int index = 0; index < functionDecl.Parameters.Count; index++) {
				if (index > 0)
					htmlSnippet.Append(", ");

				if (index == parameterIndex)
					htmlSnippet.Append("<b>");
				htmlSnippet.Append(functionDecl.Parameters[index]);
				if (index == parameterIndex)
					htmlSnippet.Append("</b>");
			}
			htmlSnippet.Append(")");

			// Append description
			htmlSnippet.AppendFormat("<br/><span style=\"color: " + HtmlContentProvider.GetCommentForegroundColor(highlightingStyleRegistry).ToWebColor() + ";\">This function has {0} parameter{1}.</span>", 
				functionDecl.Parameters.Count, (functionDecl.Parameters.Count == 1 ? String.Empty : "s"));

			return new HtmlContentProvider(htmlSnippet.ToString(), backgroundColorHint).GetContent();
		}

19 View Source File : ExpressionResolver.cs
License : MIT License
Project Creator : 17MKH

public static void ResolveWhere(QueryBody queryBody, StringBuilder sqlBuilder, IQueryParameters parameters)
    {
        sqlBuilder.Append("WHERE ");
        //记录下当前sqlBuilder的长度,用于解析完成后比对
        var length = sqlBuilder.Length;

        //解析where条件
        if (queryBody.Wheres.NotNullAndEmpty())
        {
            foreach (var w in queryBody.Wheres)
            {
                switch (w.Mode)
                {
                    case QueryWhereMode.Lambda:
                        Resolve(queryBody, w.Lambda.Body, w.Lambda, sqlBuilder, parameters);
                        break;
                    case QueryWhereMode.SubQuery:
                        Resolve(queryBody, w.SubQueryColumn.Body, w.SubQueryColumn, sqlBuilder, parameters);
                        var subSql = w.SubQueryable.ToListSql(parameters);
                        sqlBuilder.AppendFormat("{0} ({1})", w.SubQueryOperator, subSql);
                        break;
                    case QueryWhereMode.Sql:
                        sqlBuilder.AppendFormat("({0})", w.Sql);
                        break;
                }

                //通过比对长度判断是否有附加有效条件
                if (length != sqlBuilder.Length)
                    sqlBuilder.Append(" AND ");
            }
        }

        //解析软删除
        ResolveWhereForSoftDelete(queryBody, sqlBuilder);

        //解析租户
        ResolveWhereForTenant(queryBody, sqlBuilder);

        /*
         * 1、当没有过滤条件时,需要移除WHERE关键字,此时sqlBuilder是以"WHERE "结尾,只需删除最后面的6位即可
         * 2、当有过滤条件时,需要移除最后面的AND关键字,此时sqlBuilder是以" AND "结尾,也是只需删除最后面的5位即可
         */
        var removeLength = length == sqlBuilder.Length ? 6 : 5;
        sqlBuilder.Remove(sqlBuilder.Length - removeLength, removeLength);
    }

19 View Source File : ExpressionResolver.cs
License : MIT License
Project Creator : 17MKH

public static void AppendValue(QueryBody queryBody, object value, StringBuilder sqlBuilder, IQueryParameters parameters)
    {
        if (value == null)
        {
            var len = sqlBuilder.Length;
            if (sqlBuilder[len - 1] == ' ' && sqlBuilder[len - 2] == '>' && sqlBuilder[len - 3] == '<')
            {
                sqlBuilder.Remove(len - 3, 3);
                sqlBuilder.Append("IS NOT NULL");
                return;
            }

            if (sqlBuilder[len - 1] == ' ' && sqlBuilder[len - 2] == '=')
            {
                sqlBuilder.Remove(len - 2, 2);
                sqlBuilder.Append("IS NULL");
            }

            return;
        }

        var dbAdapter = queryBody.DbAdapter;
        if (queryBody.UseParameters)
        {
            //使用参数化
            var pName = parameters.Add(value);
            sqlBuilder.Append(dbAdapter.AppendParameter(pName));
        }
        else
        {
            var type = value.GetType();
            //不使用参数化
            if (type.IsNullable())
            {
                type = Nullable.GetUnderlyingType(type);
            }

            if (type!.IsEnum)
            {
                sqlBuilder.AppendFormat("{0}", value.ToInt());
            }
            else if (type.IsBool())
            {
                sqlBuilder.AppendFormat("{0}", value.ToBool() ? dbAdapter.BooleanTrueValue : dbAdapter.BooleanFalseValue);
            }
            else if (type.IsDateTime())
            {
                sqlBuilder.AppendFormat("'{0:yyyy-MM-dd HH:mm:ss}'", value);
            }
            else if (type.IsString() || type.IsGuid())
            {
                sqlBuilder.AppendFormat("'{0}'", value);
            }
            else
            {
                sqlBuilder.AppendFormat("{0}", value);
            }
        }
    }

19 View Source File : SqlBuilderBase.cs
License : MIT License
Project Creator : 0x1000000

public bool VisitExprByteArrayLiteral(ExprByteArrayLiteral byteArrayLiteral, IExpr? parent)
        {
            if (byteArrayLiteral.Value == null || byteArrayLiteral.Value.Count < 1)
            {
                this.AppendNull();
            }
            else
            {
                this.AppendByteArrayLiteralPrefix();
                for (int i = 0; i < byteArrayLiteral.Value.Count; i++)
                {
                    this.Builder.AppendFormat("{0:x2}", byteArrayLiteral.Value[i]);
                }
                this.AppendByteArrayLiteralSuffix();
            }

            return true;
        }

19 View Source File : MySqlCodeFirstProvider.cs
License : MIT License
Project Creator : 17MKH

private string GenerateColumnAddSql(IColumnDescriptor column, IEnreplacedyDescriptor descriptor)
    {
        var sql = new StringBuilder();
        sql.AppendFormat("{0} ", AppendQuote(column.Name));

        switch (column.TypeName)
        {
            case "CHAR":
                //MySql中使用CHAR(36)来保存GUID格式
                sql.AppendFormat("CHAR({0}) ", column.Length);
                break;
            case "VARCHAR":
                sql.AppendFormat("VARCHAR({0}) ", column.Length);
                break;
            case "DECIMAL":
            case "DOUBLE":
            case "FLOAT":
                var precision = column.Precision < 1 ? 18 : column.Precision;
                var scale = column.Scale < 1 ? 4 : column.Scale;
                sql.AppendFormat("{0}({1},{2}) ", column.TypeName, precision, scale);
                break;
            default:
                sql.AppendFormat("{0} ", column.TypeName);
                break;
        }
        if (column.IsPrimaryKey)
        {
            sql.Append("PRIMARY KEY ");

            if (descriptor.PrimaryKey.IsInt || descriptor.PrimaryKey.IsLong)
            {
                sql.Append("AUTO_INCREMENT ");
            }
        }

        if (!column.Nullable)
        {
            sql.Append("NOT NULL ");
        }

        if (!column.IsPrimaryKey && column.DefaultValue.NotNull())
        {
            sql.AppendFormat("DEFAULT {0}", column.DefaultValue);
        }

        if (column.Description.NotNull())
        {
            sql.AppendFormat(" COMMENT '{0}' ", column.Description);
        }

        return sql.ToString();
    }

19 View Source File : ExpressionResolver.cs
License : MIT License
Project Creator : 17MKH

private static void ResolveCall(QueryBody queryBody, MethodCallExpression exp, LambdaExpression fullLambda, StringBuilder sqlBuilder, IQueryParameters parameters)
    {
        string columnName;
        switch (exp.Method.Name)
        {
            case "Contains":
                ResolveMethodForContains(queryBody, exp, sqlBuilder, parameters);
                break;
            case "NotContains":
                ResolveMethodForNotContains(queryBody, exp, sqlBuilder);
                break;
            case "StartsWith":
                ResolveMethodForStartsWith(queryBody, exp, sqlBuilder, parameters);
                break;
            case "EndsWith":
                ResolveMethodForEndsWith(queryBody, exp, sqlBuilder, parameters);
                break;
            case "Equals":
                ResolveMethodForEquals(queryBody, exp, fullLambda, sqlBuilder, parameters);
                break;
            case "Sum":
            case "Avg":
            case "Max":
            case "Min":
                var fullExp = (exp.Arguments[0] as UnaryExpression)!.Operand as LambdaExpression;
                columnName = queryBody.GetColumnName(fullExp!.Body);
                sqlBuilder.AppendFormat(" {0}", queryBody.DbAdapter.FunctionMapper(exp.Method.Name, columnName));
                break;
            default:
                if (exp.Object != null)
                {
                    switch (exp.Object.NodeType)
                    {
                        case ExpressionType.Constant:
                            var val = ResolveDynamicInvoke(exp);
                            AppendValue(queryBody, val, sqlBuilder, parameters);
                            break;
                        case ExpressionType.MemberAccess:
                            columnName = queryBody.GetColumnName(exp!.Object);
                            var args = Arguments2Object(exp.Arguments);
                            sqlBuilder.AppendFormat("{0}", queryBody.DbAdapter.FunctionMapper(exp.Method.Name, columnName, exp.Object.Type, args));
                            break;
                    }
                }

                break;
        }
    }

19 View Source File : QueryableSqlBuilder.cs
License : MIT License
Project Creator : 17MKH

public string BuildSoftDeleteSql(IQueryParameters parameters)
    {
        var enreplacedyDescriptor = _queryBody.Joins.First().EnreplacedyDescriptor;
        if (!enreplacedyDescriptor.IsSoftDelete)
            throw new Exception("当前实体未实现软删除功能,无法调用该方法");

        var tableName = _queryBody.Joins.First().TableName;
        Check.NotNull(tableName, nameof(tableName), "未指定更新表");

        var deletedColumnName = enreplacedyDescriptor.GetDeletedColumnName();
        var deletedTimeColumnName = enreplacedyDescriptor.GetDeletedTimeColumnName();
        var deletedByColumnName = enreplacedyDescriptor.GetDeletedByColumnName();
        var deleterColumnName = enreplacedyDescriptor.GetDeleterColumnName();

        var sqlBuilder = new StringBuilder($"UPDATE {_dbAdapter.AppendQuote(tableName)} SET ");
        sqlBuilder.AppendFormat("{0} = {1},", _dbAdapter.AppendQuote(deletedColumnName), _dbAdapter.BooleanTrueValue);
        sqlBuilder.AppendFormat("{0} = ", _dbAdapter.AppendQuote(deletedTimeColumnName));
        ExpressionResolver.AppendValue(_queryBody, DateTime.Now, sqlBuilder, parameters);
        sqlBuilder.AppendFormat(",{0} = ", _dbAdapter.AppendQuote(deletedByColumnName));
        ExpressionResolver.AppendValue(_queryBody, _dbContext.AccountResolver.AccountId, sqlBuilder, parameters);
        sqlBuilder.AppendFormat(",{0} = ", _dbAdapter.AppendQuote(deleterColumnName));
        ExpressionResolver.AppendValue(_queryBody, _dbContext.AccountResolver.AccountName, sqlBuilder, parameters);

        var whereSql = ExpressionResolver.ResolveWhere(_queryBody, parameters);
        Check.NotNull(whereSql, nameof(whereSql), "生成条件sql异常");
        sqlBuilder.AppendFormat(" {0}", whereSql);

        return sqlBuilder.ToString();
    }

19 View Source File : GroupBySqlBuilder.cs
License : MIT License
Project Creator : 17MKH

private void ResolveGroupBy(StringBuilder sqlBuilder)
        {
            if (_queryBody.GroupBy.Body.NodeType != ExpressionType.New)
            {
                throw new ArgumentException("分组表达式必须使用匿名函数方式");
            }

            var newExp = _queryBody.GroupBy.Body as NewExpression;

            sqlBuilder.Append(" GROUP BY");

            for (var i = 0; i < newExp!.Arguments.Count; i++)
            {
                var arg = newExp.Arguments[i];
                switch (arg.NodeType)
                {
                    case ExpressionType.MemberAccess:
                        var memExp = arg as MemberExpression;
                        if (memExp!.Expression.Type.IsString())
                        {
                            //字符串的Length属性
                            var columnName = _queryBody.GetColumnName(memExp.Expression);
                            sqlBuilder.AppendFormat(" {0},", _queryBody.DbAdapter.FunctionMapper(memExp.Member.Name, columnName));
                        }
                        else if (DbConstants.ENreplacedY_INTERFACE_TYPE.IsImplementType(memExp.Expression.Type))
                        {
                            //解析列信息,如:m.T1.Id
                            var columnName = _queryBody.GetColumnName(memExp);
                            sqlBuilder.AppendFormat(" {0},", columnName);
                        }
                        break;
                    case ExpressionType.Call:
                        if (arg is MethodCallExpression callExp)
                        {
                            var columnName = _queryBody.GetColumnName(callExp!.Object);
                            var args = ExpressionResolver.Arguments2Object(callExp.Arguments);
                            sqlBuilder.AppendFormat(" {0},", _dbAdapter.FunctionMapper(callExp.Method.Name, columnName, callExp.Object!.Type, args));
                        }
                        break;
                }
            }

            //移除末尾的逗号
            if (sqlBuilder[^1] == ',')
            {
                sqlBuilder.Remove(sqlBuilder.Length - 1, 1);
            }
        }

See More Examples