C# (CSharp) Класс System.Text. StringBuilder Code Examples

C# (CSharp) System.Text.StringBuilder - 30 примеров найдено. Это лучшие примеры C# (CSharp) кода для класса System.Text.StringBuilder, полученные из open source проектов. Вы можете ставить оценку каждому примеру, чтобы помочь нам улучшить качество примеров.
Пример #1
0
	/// <summary>
	/// 	Concatenates any given IEnumerable to joined string, null-ignorance
	/// </summary>
	/// <param name="objects"> any set of objects of any type </param>
	/// <param name="delimiter"> delimiter between strings </param>
	/// <param name="empties"> true - empties included in result </param>
	/// <param name="nullstring"> null replacer (null by default) </param>
	/// <param name="useTrailDelimiters"> if true - trail delimiters will be generated </param>
	/// <returns> </returns>
	public string ConcatString(IEnumerable objects, string delimiter, bool empties = true,
	                           string nullstring = null,
	                           bool useTrailDelimiters = false) {
		if (null == objects) {
			return string.Empty;
		}
		if (null == delimiter) {
			delimiter = string.Empty;
		}
		var result = new StringBuilder();
		if (useTrailDelimiters) {
			result.Append(delimiter);
		}
		var first = true;
		foreach (var obj in objects) {
			var val = obj.ToStr();
			if (val.IsEmpty() && !empties) {
				continue;
			}
			if (null == obj && null != nullstring) {
				val = nullstring;
			}
			if (!first) {
				result.Append(delimiter);
			}
			if (first) {
				first = false;
			}
			result.Append(val);
		}
		if (useTrailDelimiters) {
			result.Append(delimiter);
		}
		return result.ToString();
	}
Пример #2
0
        // Create an md5 sum string of this string
        public static string GetMd5Sum(this string str)
        {
            // First we need to convert the string into bytes, which
            // means using a text encoder.
            Encoder enc = System.Text.Encoding.Unicode.GetEncoder();

            // Create a buffer large enough to hold the string
            byte[] unicodeText = new byte[str.Length * 2];
            enc.GetBytes(str.ToCharArray(), 0, str.Length, unicodeText, 0, true);

            // Now that we have a byte array we can ask the CSP to hash it
            MD5 md5 = new MD5CryptoServiceProvider();
            byte[] result = md5.ComputeHash(unicodeText);

            // Build the final string by converting each byte
            // into hex and appending it to a StringBuilder
            var sb = new StringBuilder();
            for (int i = 0; i < result.Length; i++)
            {
                sb.Append(result[i].ToString("X2"));
            }

            // And return it
            return sb.ToString();
        }
Пример #3
0
 public string GetDetails()
 {
     StringBuilder sb = new StringBuilder();
     sb.AppendLine("This demo shows how to setup complex collision scenerios.");
     sb.AppendLine("In this demo:");
     sb.AppendLine("  - Circles and rectangles are set to only collide with themselves.");
     sb.AppendLine("  - Stars are set to collide with gears.");
     sb.AppendLine("  - Gears are set to collide with stars.");
     sb.AppendLine("  - The agent is set to collide with everything but stars");
     sb.AppendLine(string.Empty);
     sb.AppendLine("GamePad:");
     sb.AppendLine("  - Rotate agent: left and right triggers");
     sb.AppendLine("  - Move agent: right thumbstick");
     sb.AppendLine("  - Move cursor: left thumbstick");
     sb.AppendLine("  - Grab object (beneath cursor): A button");
     sb.AppendLine("  - Drag grabbed object: left thumbstick");
     sb.AppendLine("  - Exit to menu: Back button");
     sb.AppendLine(string.Empty);
     sb.AppendLine("Keyboard:");
     sb.AppendLine("  - Rotate agent: left and right arrows");
     sb.AppendLine("  - Move agent: A,S,D,W");
     sb.AppendLine("  - Exit to menu: Escape");
     sb.AppendLine(string.Empty);
     sb.AppendLine("Mouse / Touchscreen");
     sb.AppendLine("  - Grab object (beneath cursor): Left click");
     sb.AppendLine("  - Drag grabbed object: move mouse / finger");
     return sb.ToString();
 }
Пример #4
0
 /// <summary>
 /// 分配角色模块菜单权限
 /// </summary>
 /// <param name="KeyValue">主键值</param>
 /// <param name="RoleId">角色主键</param>
 /// <param name="CreateUserId">操作用户主键</param>
 /// <param name="CreateUserName">操作用户</param>
 /// <returns></returns>
 public bool AddModulePermission(string[] KeyValue, string RoleId, string CreateUserId, string CreateUserName)
 {
     //return dal.AddModulePermission(KeyValue, RoleId, CreateUserId, CreateUserName) >= 0 ? true : false;
     StringBuilder[] sqls = new StringBuilder[KeyValue.Length + 1];
     object[] objs = new object[KeyValue.Length + 1];
     sqls[0] = SqlParamHelper.DeleteSql("AMS_RoleMenu", "RoleId");
     objs[0] = new SqlParam[] { new SqlParam("@RoleId", RoleId) };
     int index = 1;
     foreach (string item in KeyValue)
     {
         if (item.Length > 0)
         {
             AMS_RoleMenu entity = new AMS_RoleMenu();
             entity.RoleMenuId = CommonHelper.GetGuid;
             entity.RoleId = RoleId;
             entity.MenuId = item;
             entity.CreateUserId = CreateUserId;
             entity.CreateUserName = CreateUserName;
             sqls[index] = SqlParamHelper.InsertSql(entity);
             objs[index] = SqlParamHelper.GetParameter(entity);
             index++;
         }
     }
     int IsOK = DbHelper.BatchExecuteBySql(sqls, objs);
     return IsOK >= 0 ? true : false;
 }
    void GenerateCode(string name)
    {
        System.Text.StringBuilder builder = new System.Text.StringBuilder ();
        builder.AppendLine ("using UnityEngine;");
        builder.AppendLine ("using System.Collections;");
        builder.AppendLine ("");
        builder.AppendLine ("public class " + name + " : State {");
        builder.AppendLine ("");
        builder.AppendLine ("public override void StateStart ()");
        builder.AppendLine ("{");
        builder.AppendLine ("	Debug.Log (this.ToString() + \" Start!\");");
        builder.AppendLine ("");
        builder.AppendLine ("}");
        builder.AppendLine ("");
        builder.AppendLine ("public override void StateUpdate ()");
        builder.AppendLine ("{");
        builder.AppendLine ("");
        builder.AppendLine ("	if(Input.GetKeyDown(KeyCode.A)){");
        builder.AppendLine ("		this.EndState();");
        builder.AppendLine ("	}");
        builder.AppendLine ("	");
        builder.AppendLine ("}");
        builder.AppendLine ("");
        builder.AppendLine ("public override void StateDestroy ()");
        builder.AppendLine ("{");
        builder.AppendLine ("	Debug.Log (this.ToString() + \" Destroy!\");");
        builder.AppendLine ("}");
        builder.AppendLine ("");
        builder.AppendLine ("}");

        System.IO.File.WriteAllText (ScriptsPath + "/" + name + ".cs", builder.ToString (), System.Text.Encoding.UTF8);
        AssetDatabase.Refresh (ImportAssetOptions.ImportRecursive);
    }
Пример #6
0
        internal override StringBuilder AsEsql(StringBuilder builder, bool isTopLevel, int indentLevel)
        {
            // The SELECT/DISTINCT part.
            StringUtil.IndentNewLine(builder, indentLevel);
            builder.Append("SELECT ");
            if (m_selectDistinct == CellQuery.SelectDistinct.Yes)
            {
                builder.Append("DISTINCT ");
            }
            GenerateProjectionEsql(builder, m_nodeTableAlias, true, indentLevel, isTopLevel);

            // Get the FROM part.
            builder.Append("FROM ");
            CqlWriter.AppendEscapedQualifiedName(builder, m_extent.EntityContainer.Name, m_extent.Name);
            builder.Append(" AS ").Append(m_nodeTableAlias);

            // Get the WHERE part only when the expression is not simply TRUE.
            if (!BoolExpression.EqualityComparer.Equals(WhereClause, BoolExpression.True))
            {
                StringUtil.IndentNewLine(builder, indentLevel);
                builder.Append("WHERE ");
                WhereClause.AsEsql(builder, m_nodeTableAlias);
            }

            return builder;
        }
Пример #7
0
		public string Replace (string str)
		{
			if (string.IsNullOrEmpty (str)) {
				return str;
			}

			System.Text.StringBuilder formatted = new System.Text.StringBuilder ();

			int lastMatch = 0;

			string variable;
			string replacement;
			foreach (System.Text.RegularExpressions.Match m in re.Matches(str)) {

				formatted.Append (str.Substring (lastMatch, m.Index - lastMatch));

				variable = m.Groups [1].Value;
				if (vars.TryGetValue (variable, out replacement))
					formatted.Append (this.Replace (replacement));
				else
                    throw new ObfuscarException("Unable to replace variable:  " + variable);

				lastMatch = m.Index + m.Length;
			}

			formatted.Append (str.Substring (lastMatch));

			return formatted.ToString ();
		}
 public static string CloneCmd(string fromSvn, string toPath, string username, 
     string authorsFile, int fromRevision, 
     string trunk, string tags, string branches)
 {
     toPath = GitCommandHelpers.FixPath(toPath);
     StringBuilder sb = new StringBuilder();
     sb.AppendFormat("{0} clone \"{1}\" \"{2}\"", SvnPrefix, fromSvn, toPath);
     if (!string.IsNullOrEmpty(username))
     {
         sb.AppendFormat(" --username=\"{0}\"", username);
     }
     if (!string.IsNullOrEmpty(authorsFile))
     {
         sb.AppendFormat(" --authors-file=\"{0}\"", authorsFile);
     }
     if (fromRevision != 0)
     {
         sb.AppendFormat(" -r \"{0}\"", fromRevision);
     }
     if (!string.IsNullOrEmpty(trunk))
     {
         sb.AppendFormat(" --trunk=\"{0}\"", trunk);
     }
     if (!string.IsNullOrEmpty(tags))
     {
         sb.AppendFormat(" --tags=\"{0}\"", tags);
     }
     if (!string.IsNullOrEmpty(branches))
     {
         sb.AppendFormat(" --branches=\"{0}\"", branches);
     }
     return sb.ToString();
 }
Пример #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ReciboBE reciboBE;

        //if (Session["ReciboBE"] != null)
        //{
        reciboBE = Session["ReciboBE"] as ReciboBE;
        //}

        CarregaProfissional(Convert.ToInt32(reciboBE.RefProfissionalBE.id));
        lblReciboNumero.Text = Convert.ToString(reciboBE.id);
        lblValorTotalCabecalho.Text = String.Format("{0:C2}", reciboBE.ValorTotal);
        lblValorTotal.Text = String.Format("{0:C2}", reciboBE.ValorTotal);
        lblSessoesQtd.Text = Convert.ToString(reciboBE.RefReciboAgendamentoSessoesBE.Count.ToString("00"));
        lblPacienteNome.Text = Convert.ToString(reciboBE.PacienteNome);
        //Pego a possicao zero da lista de sessooes
        lblValorSessao.Text = String.Format("{0:C2}", reciboBE.RefReciboAgendamentoSessoesBE[0].Valor);

        StringBuilder sb = new System.Text.StringBuilder();
        for (int i = 0; i < reciboBE.RefReciboAgendamentoSessoesBE.Count; i++)
        {
            if (i > 0)
                sb.Append(", ");

            sb.Append(reciboBE.RefReciboAgendamentoSessoesBE[i].Data.ToString("dd/MM/yyyy"));
        }

        lblDatas.Text = Convert.ToString(sb);

        DataExtenso();
    }
Пример #10
0
 public static IEnumerable<string> GetHelp(ScriptSession session, string command)
 {
     Collection<PSParseError> errors;
     var tokens = PSParser.Tokenize(command, out errors);
     var lastPsToken = tokens.LastOrDefault(t => t.Type == PSTokenType.Command);
     if (lastPsToken != null)
     {
         session.Output.Clear();
         var lastToken = lastPsToken.Content;
         session.SetVariable("helpFor", lastToken);
         var platformmodule = ModuleManager.GetModule("Platform");
         var scriptItem = Database.GetDatabase(platformmodule.Database)
             .GetItem(platformmodule.Path + "/Internal/Context Help/Command Help");
         if (scriptItem == null)
         {
             scriptItem = Factory.GetDatabase(ApplicationSettings.ScriptLibraryDb)
                 .GetItem(ApplicationSettings.ScriptLibraryPath + "Internal/Context Help/Command Help");
         }
         session.ExecuteScriptPart(scriptItem[ScriptItemFieldNames.Script], true, true);
         var sb = new StringBuilder("<div id=\"HelpClose\">X</div>");
         if (session.Output.Count == 0 || session.Output[0].LineType == OutputLineType.Error)
         {
             return new[]
             {
                 "<div class='ps-help-command-name'>&nbsp;</div><div class='ps-help-header' align='center'>No Command in line or help information found</div><div class='ps-help-parameter' align='center'>Cannot provide help in this context.</div>"
             };
         }
         session.Output.ForEach(l => sb.Append(l.Text));
         session.Output.Clear();
         var result = new[] {sb.ToString()};
         return result;
     }
     return new[] {"No Command in line found - cannot provide help in this context."};
 }
        public override string ToString()
        {
            if (PageCount == 1)
                return "";

            var sb = new StringBuilder(512);

            sb.Append(@"<div class=""");
            sb.Append(CssClass);
            sb.Append(@""">");

            foreach (int pageSize in PageSizes)
            {
                sb.Append(@"<a href=""");
                sb.Append(HRef.Replace("pagesize=-1", "pagesize=" + pageSize));
                sb.Append(@""" title=""");
                sb.Append("show ");
                sb.Append(pageSize);
                sb.Append(@" items per page""");
                if (pageSize == CurrentPageSize)
                    sb.Append(@" class=""current page-numbers""");
                else
                    sb.Append(@" class=""page-numbers""");
                sb.Append(">");
                sb.Append(pageSize);
                sb.AppendLine("</a>");
            }
            sb.AppendLine(@"<span class=""page-numbers desc"">per page</span>");
            sb.Append("</div>");

            return sb.ToString();
        }
Пример #12
0
		protected virtual string FormatAlterTable(string sql)
		{
			StringBuilder result = new StringBuilder(60).Append(Indent1);
			IEnumerator<string> tokens = (new StringTokenizer(sql, " (,)'[]\"", true)).GetEnumerator();

			bool quoted = false;
			while (tokens.MoveNext())
			{
				string token = tokens.Current;
				if (IsQuote(token))
				{
					quoted = !quoted;
				}
				else if (!quoted)
				{
					if (IsBreak(token))
					{
						result.Append(Indent3);
					}
				}
				result.Append(token);
			}

			return result.ToString();
		}
Пример #13
0
		protected virtual string FormatCommentOn(string sql)
		{
			StringBuilder result = new StringBuilder(60).Append(Indent1);
			IEnumerator<string> tokens = (new StringTokenizer(sql, " '[]\"", true)).GetEnumerator();

			bool quoted = false;
			while (tokens.MoveNext())
			{
				string token = tokens.Current;
				result.Append(token);
				if (IsQuote(token))
				{
					quoted = !quoted;
				}
				else if (!quoted)
				{
					if ("is".Equals(token))
					{
						result.Append(Indent2);
					}
				}
			}

			return result.ToString();
		}
        public string GetRouteDescriptorKey(HttpContextBase httpContext, RouteBase routeBase) {
            var route = routeBase as Route;
            var dataTokens = new RouteValueDictionary();

            if (route != null) {
                dataTokens = route.DataTokens;
            }
            else {
            var routeData = routeBase.GetRouteData(httpContext);

                if (routeData != null) {
                    dataTokens = routeData.DataTokens;
                }
            }

            var keyBuilder = new StringBuilder();

            if (route != null) {
                keyBuilder.AppendFormat("url={0};", route.Url);
            }

            // the data tokens are used in case the same url is used by several features, like *{path} (Rewrite Rules and Home Page Provider)
            if (dataTokens != null) {
                foreach (var key in dataTokens.Keys) {
                    keyBuilder.AppendFormat("{0}={1};", key, dataTokens[key]);
                }
            }

            return keyBuilder.ToString().ToLowerInvariant();
        }
Пример #15
0
 internal override StringBuilder AsNegatedUserString(StringBuilder builder, string blockAlias, bool skipIsNotNull)
 {
     builder.Append("NOT(");
     builder = AsUserString(builder, blockAlias, skipIsNotNull);
     builder.Append(")");
     return builder;
 }
        public string Visit(string text)
        {
            text = text.Trim();

            var lines = new List<string>();
            using (var stringReader = new StringReader(text))
            {
                string line;
                while ((line = stringReader.ReadLine()) != null)
                {
                    line = line.Trim();
                    lines.Add(line);
                }
            }

            lines.Sort();

            var stringBuilder = new StringBuilder();
            foreach (var line in lines)
            {
                stringBuilder.AppendLine(line);
            }

            return stringBuilder.ToString();
        }
Пример #17
0
 public override void AsText(StringBuilder b, int pad)
 {
     b.Append(' ', pad);
     b.AppendLine("JewelerDataInitialMessage:");
     b.Append(' ', pad++);
     b.Append(CrafterData.ToString());
 }
        public string CreateReference(int size)
        {
            const int byteSize = 0x100;
            var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".ToCharArray();
            var allowedCharSet = new HashSet<char>(chars).ToArray();

            using (var cryptoProvider = new RNGCryptoServiceProvider())
            {
                var result = new StringBuilder();
                var buffer = new byte[128];

                while (result.Length < size)
                {
                    cryptoProvider.GetBytes(buffer);

                    for (var i = 0; i < buffer.Length && result.Length < size; ++i)
                    {
                        var outOfRangeStart = byteSize - (byteSize % allowedCharSet.Length);

                        if (outOfRangeStart <= buffer[i])
                        {
                            continue;
                        }

                        result.Append(allowedCharSet[buffer[i] % allowedCharSet.Length]);
                    }
                }
                return result.ToString();
            }
        }
Пример #19
0
        /// <summary/>
        protected CodeFormat()
        {
            //generate the keyword and preprocessor regexes from the keyword lists
            var r = new Regex(@"\w+|-\w+|#\w+|@@\w+|#(?:\\(?:s|w)(?:\*|\+)?\w+)+|@\\w\*+");
            string regKeyword = r.Replace(Keywords, @"(?<=^|\W)$0(?=\W)");
            string regPreproc = r.Replace(Preprocessors, @"(?<=^|\s)$0(?=\s|$)");
            r = new Regex(@" +");
            regKeyword = r.Replace(regKeyword, @"|");
            regPreproc = r.Replace(regPreproc, @"|");

            if (regPreproc.Length == 0)
            {
                regPreproc = "(?!.*)_{37}(?<!.*)"; //use something quite impossible...
            }

            //build a master regex with capturing groups
            var regAll = new StringBuilder();
            regAll.Append("(");
            regAll.Append(CommentRegex);
            regAll.Append(")|(");
            regAll.Append(StringRegex);
            if (regPreproc.Length > 0)
            {
                regAll.Append(")|(");
                regAll.Append(regPreproc);
            }
            regAll.Append(")|(");
            regAll.Append(regKeyword);
            regAll.Append(")");

            RegexOptions caseInsensitive = CaseSensitive ? 0 : RegexOptions.IgnoreCase;
            CodeRegex = new Regex(regAll.ToString(), RegexOptions.Singleline | caseInsensitive);
        }
Пример #20
0
 public static object MediaHelper(string image)
 {
     var sb = new StringBuilder();
     sb.Append(ConfigurationManager.AppSettings["MediaPath"]);
     sb.Append(image);
     return new MvcHtmlString(sb.ToString());
 }
Пример #21
0
 public void AsText(StringBuilder b, int pad)
 {
     b.Append(' ', pad);
     b.AppendLine("LearnedLore:");
     b.Append(' ', pad++);
     b.AppendLine("{");
     b.Append(' ', pad);
     b.AppendLine("Count: 0x" + Count.ToString("X8") + " (" + Count + ")");
     b.Append(' ', pad);
     b.AppendLine("m_snoLoreLearned:");
     b.Append(' ', pad);
     b.AppendLine("{");
     for (int i = 0; i < m_snoLoreLearned.Length;)
     {
         b.Append(' ', pad + 1);
         for (int j = 0; j < 8 && i < m_snoLoreLearned.Length; j++, i++)
         {
             b.Append("0x" + m_snoLoreLearned[i].ToString("X8") + ", ");
         }
         b.AppendLine();
     }
     b.Append(' ', pad);
     b.AppendLine("}");
     b.AppendLine();
     b.Append(' ', --pad);
     b.AppendLine("}");
 }
Пример #22
0
 public static object MediaHelper(string image, int width, int height, bool forceFit)
 {
     var sb = new StringBuilder();
     sb.Append(MediaHelper(image));
     sb.Append(string.Format("?width={0}&height={1}&force={2}", width, height,forceFit));
     return sb.ToString();
 }
 private static string GetKeyHash(string alias, string keyStore, string password)
 {
     var proc = new Process();
     var arguments = @"""keytool -storepass {0} -keypass {1} -exportcert -alias {2} -keystore {3} | openssl sha1 -binary | openssl base64""";
     if (Application.platform == RuntimePlatform.WindowsEditor)
     {
         proc.StartInfo.FileName = "cmd";
         arguments = @"/C " + arguments;
     }
     else
     {
         proc.StartInfo.FileName = "bash";
         arguments = @"-c " + arguments;
     }
     proc.StartInfo.Arguments = string.Format(arguments, password, password, alias, keyStore);
     proc.StartInfo.UseShellExecute = false;
     proc.StartInfo.CreateNoWindow = true;
     proc.StartInfo.RedirectStandardOutput = true;
     proc.Start();
     var keyHash = new StringBuilder();
     while (!proc.HasExited)
     {
         keyHash.Append(proc.StandardOutput.ReadToEnd());
     }
     return keyHash.ToString();
 }
Пример #24
0
 public override string ToString()
 {
     var settings = new XmlWriterSettings
     {
         Indent = false,
         Encoding = new UTF8Encoding(false),
         NamespaceHandling = NamespaceHandling.OmitDuplicates,
         OmitXmlDeclaration = true,
         NewLineOnAttributes = false,
         DoNotEscapeUriAttributes = true
     };
     var sb = new StringBuilder();
     using (var xw = XmlWriter.Create(sb, settings))
     {
         xw.WriteStartElement("Role", Xmlnamespace);
         xw.WriteAttributeString("xmlns", "xsi", null, Xsinamespace);
         xw.WriteAttributeString("xsi", "type", Xsinamespace, Type);
         xw.WriteAttributeString("code", Code);
         xw.WriteAttributeString("codeSystem", CodeSystem);
         xw.WriteAttributeString("codeSystemName", CodeSystemName);
         xw.WriteAttributeString("displayName", DisplayName);
         xw.WriteEndElement();
         xw.Flush();
         return sb.ToString();
     }
 }
Пример #25
0
 private string Postfix(string prefix)
 {
     var result = new StringBuilder(prefix);
     result.Append(TileDirectionUtil.GetChar(Direction));
     result.Append(TurnDirectionUtil.GetChar(Turn));
     return result.ToString();
 }
        /// <summary> Renders the HTML for this element </summary>
        /// <param name="Output"> Textwriter to write the HTML for this element </param>
        /// <param name="Bib"> Object to populate this element from </param>
        /// <param name="Skin_Code"> Code for the current skin </param>
        /// <param name="isMozilla"> Flag indicates if the current browse is Mozilla Firefox (different css choices for some elements)</param>
        /// <param name="popup_form_builder"> Builder for any related popup forms for this element </param>
        /// <param name="Current_User"> Current user, who's rights may impact the way an element is rendered </param>
        /// <param name="CurrentLanguage"> Current user-interface language </param>
        /// <param name="Translator"> Language support object which handles simple translational duties </param>
        /// <param name="Base_URL"> Base URL for the current request </param>
        /// <remarks> This simple element does not append any popup form to the popup_form_builder</remarks>
        public override void Render_Template_HTML(TextWriter Output, SobekCM_Item Bib, string Skin_Code, bool isMozilla, StringBuilder popup_form_builder, User_Object Current_User, Web_Language_Enum CurrentLanguage, Language_Support_Info Translator, string Base_URL )
        {
            // Check that an acronym exists
            if (Acronym.Length == 0)
            {
                const string defaultAcronym = "Enter the name(s) of the publisher(s) of the larger body of work. If your work is currently unpublished, you may enter your name as the publisher or leave the field blank. If you are adding administrative material (newsletters, handbooks, etc.) on behalf of a department within the university, enter the name of your department as the publisher.";
                switch (CurrentLanguage)
                {
                    case Web_Language_Enum.English:
                        Acronym = defaultAcronym;
                        break;

                    case Web_Language_Enum.Spanish:
                        Acronym = defaultAcronym;
                        break;

                    case Web_Language_Enum.French:
                        Acronym = defaultAcronym;
                        break;

                    default:
                        Acronym = defaultAcronym;
                        break;
                }
            }

            List<string> instanceValues = new List<string>();
            if (Bib.Bib_Info.Publishers_Count > 0)
            {
                instanceValues.AddRange(Bib.Bib_Info.Publishers.Select(thisName => thisName.Name));
            }

            render_helper(Output, instanceValues, Skin_Code, Current_User, CurrentLanguage, Translator, Base_URL);
        }
Пример #27
0
 public string ReadNext(bool peek = false)
 {
     var isInQuote = false;
     var curToken = new StringBuilder();
     int i;
     for (i = 0; i < _cmd.Length; i++)
     {
         if (isInQuote && _cmd[i] == '"' && i < _cmd.Length - 1 && _cmd[i + 1] == '"')
         {
             curToken.Append('"');
             i++;
             continue;
         }
         if (isInQuote == false && _cmd[i] == '"')
             isInQuote = true;
         else if (isInQuote && _cmd[i] == '"')
         {
             i++;
             break;
         }
         else if (_cmd[i] == ' ' && isInQuote == false)
             break;
         else
             curToken.Append(_cmd[i]);
     }
     if (peek == false)
     {
         _cmd = _cmd.Substring(i);
         _cmd = _cmd.TrimStart();
     }
     return curToken.ToString();
 }
Пример #28
0
 internal override StringBuilder AsEsql(StringBuilder builder, string blockAlias, bool skipIsNotNull)
 {
     // Get e.g., T2._from1 using the table alias
     string qualifiedName = CqlWriter.GetQualifiedName(blockAlias, SlotName);
     builder.Append(qualifiedName);
     return builder;
 }
Пример #29
0
        /// <summary>
        /// 生成DAL带命名空间
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="dt"></param>
        /// <param name="strNamespace"></param>
        /// <returns></returns>
        public StringBuilder CreateDALCode(string tableName, DataTable dt, string strNamespace)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("using "+ strNamespace + ".IDAL.Bases;");
            sb.AppendLine("using " + strNamespace + ".DAL.Bases;");
            sb.AppendLine("using "+ strNamespace + ".Models;");
            sb.AppendLine("using System.Collections.Generic;");
            sb.AppendLine("using System;");
            sb.AppendLine("using System.Data;");
            string sqluse = sqltype == 2 ? "using MySql.Data.MySqlClient;" : "using System.Data.SqlClient;";
            sb.AppendLine(sqluse);
            sb.AppendLine("");
            sb.AppendLine("namespace " + strNamespace + ".DAL {");
            string cName = ":MsSqlDALConf";
            if (sqltype == (int)SQLType.MySql)
            {
                cName = ":MySqlDALConf";
            }
            sb.AppendLine("public  class  " + tableName + "DAL " + cName + ", I"+ tableName + "DAL{");
            sb.AppendLine("");
            sb.AppendLine("        public "+ tableName + "DAL() : base() { }");
            sb.AppendLine("        public " + tableName + "DAL(string name) : base(name) { }");

            GetAllDAL(tableName, dt, sb, "    ");
            sb.AppendLine("    }");
            sb.AppendLine("}");
            return sb;
        }
 private void AddLifecycleHandlers(StringBuilder stringBuilder)
 {
     AppendHandler(stringBuilder, "SetUp", "base.BeforeEach();");
     AppendHandler(stringBuilder, "TestFixtureSetUp", "SetListener(new StorEvil.CodeGeneration.NUnitListener()); base.BeforeAll();");
     AppendHandler(stringBuilder, "TearDown", "base.AfterEach();");
     AppendHandler(stringBuilder, "TestFixtureTearDown", "base.AfterAll();");
 }