当前位置: 首页>>代码示例>>C#>>正文


C# StringBuilder.Equals方法代码示例

本文整理汇总了C#中System.Text.StringBuilder.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# StringBuilder.Equals方法的具体用法?C# StringBuilder.Equals怎么用?C# StringBuilder.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Text.StringBuilder的用法示例。


在下文中一共展示了StringBuilder.Equals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetIniValue

 /// <summary>
 /// INIファイルから読み込む
 /// </summary>
 /// <param name="iSection">セクション</param>
 /// <param name="iKey">キー</param>
 /// <param name="iDefault">デフォルト文字列</param>
 /// <returns>INIファイルから読み込んだ値を返す</returns>
 public string GetIniValue(string iSection, string iKey, string iDefault)
 {
     StringBuilder sb = new StringBuilder(BufferLength);
     IniFileHandler.GetPrivateProfileString( iSection, iKey, iDefault, sb, (uint)sb.Capacity, FileName);
     if (sb.Equals(null))
     {
         return null;
     }
     return sb.ToString(); ;
 }
开发者ID:kool924jp,项目名称:BoxUnlocker,代码行数:17,代码来源:IniControl.cs

示例2: StringBuilderEquals

        public void StringBuilderEquals()
        {
            StringBuilder s = new StringBuilder("test");
             StringBuilder idem_s = new StringBuilder("test");
             StringBuilder s3 = new StringBuilder("test1".Substring(0, 4));
             object s4 = s3;

             Assert.IsFalse(object.ReferenceEquals(s, idem_s));
             Assert.IsFalse(s == idem_s);         //!= from string --> operator == pour string est surchargé, ici reference comparison
             Assert.IsTrue(s.Equals(idem_s));

             Assert.IsFalse(object.ReferenceEquals(s, s3));
             Assert.IsFalse(s == s3);
             Assert.IsTrue(s.Equals(s3));

             Assert.IsFalse(object.ReferenceEquals(s, s4));
             Assert.IsFalse(s == s4);  //warning CS0253: Possible unintended reference comparison; to get a value comparison, cast the right hand side to type 'string'
             Assert.IsFalse(s == (StringBuilder)s4);
             Assert.IsFalse(s.Equals(s4));

            //ici, il n'y que .Equals qui marche
        }
开发者ID:psallandre,项目名称:TestProject_csharp,代码行数:22,代码来源:ReferenceEqualsTest.cs

示例3: GetParametr

        public static string GetParametr(string par)
        {
            StringBuilder buffer = new StringBuilder(100, 350);

            GetPrivateProfileString("SETTINGS", par, "null", buffer, 100, Environment.CurrentDirectory + "\\config.ini");

            if (buffer.Equals("null"))
            {
                Console.WriteLine("[GetPrivateProfileString] Внимание в конфигурационом файле не найден параметр " + par + "\n Для продолжения нажмите любую клавишу.");
                Console.ReadKey(true);
                return "";
            }

            return buffer.ToString();
        }
开发者ID:partizanes,项目名称:DiscountSharp,代码行数:15,代码来源:Config.cs

示例4: getCourseIDs

        public static int[] getCourseIDs(string courseName)
        {
            List<int> courseIDs = new List<int>();

            try
            {
                courseName = courseName.Replace(" ", String.Empty);
                string pattern = @"([A-Za-z]+)";
                string[] result = Regex.Split(courseName, pattern);

                string coursePrefix = result[1];
                StringBuilder courseNumber = new StringBuilder();
                for (int i = 2; i < result.Length; i++)
                {
                    courseNumber.Append(result[i]);
                }

                string whereClause = String.Empty;
                if (courseNumber.Equals(String.Empty))
                {
                    whereClause = String.Format("CourseName LIKE '%{0}%'", coursePrefix);
                }
                else
                {
                    whereClause = String.Format("CourseName LIKE '%{0}%{1}%'", coursePrefix, courseNumber.ToString());
                }

                DataAccessLayer DAL = new DataAccessLayer();
                DataTable dt = DAL.select(whereClause, "CourseInfo", new string[] { "CourseID" });

                foreach (DataRow row in dt.Rows)
                {
                    int courseID = Convert.ToInt32(row["CourseID"]);

                    courseIDs.Add(courseID);
                }
            }
            catch (Exception ex)
            {
                Console.Write("ERROR: An error occured in retrieving course IDs by course name --- " + ex.Message);
            }

            return courseIDs.ToArray();
        }
开发者ID:hw3jung,项目名称:BookSpade,代码行数:44,代码来源:CourseInfoHandler.cs

示例5: Equals

 public static void Equals(StringBuilder sb1, StringBuilder sb2, bool expected)
 {
     Assert.Equal(expected, sb1.Equals(sb2));
 }
开发者ID:dotnet,项目名称:corefx,代码行数:4,代码来源:StringBuilderTests.cs

示例6: Main


//.........这里部分代码省略.........

              Console.Write ("\n\n     PQLaserDrv   Read ALL Values Demo : \n");
              Console.Write ("    =================================================\n\n");
              //
              // preliminaries: check library version
              //
              try {
            Sepia2_Import.SEPIA2_LIB_GetVersion (cLibVersion);
              }
              catch (Exception ex) {
            Console.Write ("\nerror using Sepia2_Lib");
            Console.Write ("\n  Check the existence of the library 'Sepia2_Lib.dll'!");
            Console.Write ("\n  Make sure that your runtime and the library are both either 32-bit or 64-bit!");
            Console.Write ("\n\n  system message: \n{0}\n", ex.Message);
            if (!bNoWait)
            {
              Console.Write ("\npress RETURN... ");
              Console.Read ();
            }
            return;
              }
              Console.Write ("     Lib-Version    = {0}\n", cLibVersion);
              //
              // establish USB connection to the sepia first matching all given conditions
              //
              for (i = (bUSBInstGiven ? iGivenDevIdx : 0); i < (bUSBInstGiven ? iGivenDevIdx+1 : Sepia2_Import.SEPIA2_MAX_USB_DEVICES); i++)
              {
            cSepiaSerNo.Length = 0;
            cProductModel.Length = 0;
            //
            iRetVal = Sepia2_Import.SEPIA2_USB_OpenGetSerNumAndClose (i, cProductModel, cSepiaSerNo);
            if ( (iRetVal == Sepia2_Import.SEPIA2_ERR_NO_ERROR)
            && (  (  (bSerialGiven && bProductGiven)
               && (cGivenSerNo.Equals (cSepiaSerNo)  )
               && (cGivenProduct.Equals (cProductModel)  )
               )
            ||  (  (!bSerialGiven != !bProductGiven)
             && (  (cGivenSerNo.Equals (cSepiaSerNo)  )
            || (cGivenProduct.Equals (cProductModel)  )
            )
             )
            ||  ( !bSerialGiven && !bProductGiven)
            )
            )
            {
              iDevIdx = bUSBInstGiven ? ((iGivenDevIdx == i) ? i : -1) : i;
              break;
            }
              }
              //
              if ((iRetVal = Sepia2_Import.SEPIA2_USB_OpenDevice (iDevIdx, cProductModel, cSepiaSerNo)) == Sepia2_Import.SEPIA2_ERR_NO_ERROR)
              {
            Console.Write ("     Product Model  = '{0}'\n\n",     cProductModel);
            Console.Write ("    =================================================\n\n");
            Sepia2_Import.SEPIA2_FWR_GetVersion (iDevIdx, cFWVersion);
            Console.Write ("     FW-Version     = {0}\n",     cFWVersion);
            //
            Console.Write ("     USB Index      = {0}\n", iDevIdx);
            Sepia2_Import.SEPIA2_USB_GetStrDescriptor  (iDevIdx, cDescriptor);
            Console.Write ("     USB Descriptor = {0}\n", cDescriptor);
            Console.Write ("     Serial Number  = '{0}'\n\n", cSepiaSerNo);
            Console.Write ("    =================================================\n\n");
            //
            // get sepia's module map and initialise datastructures for all library functions
            // there are two different ways to do so:
            //
开发者ID:PicoQuant,项目名称:PQLaserDrv,代码行数:67,代码来源:ReadAllDataByCSharp.cs

示例7: ScanForLinks


//.........这里部分代码省略.........
					} else {
						if (char.IsLetterOrDigit (line_no_breaks_string [i]) == false &&
							"@-/:~.?=_&".IndexOf (line_no_breaks_string [i].ToString ()) == -1) {
							link_end = i - 1;
							line_no_breaks_index = i;
							break;
						}
					}
				}

				string link_text = line_no_breaks_string.Substring (index_found, link_end - index_found + 1);
				int current_cumulative = 0;

				// we've found a link - index_found -> link_end
				// now we just make all the tags as containing link and
				// point them to the text for the whole link

				current_line = start_line;

				//find the line we start on
				for (current_cumulative = 1; current_cumulative < cumulative_length_list.Count; current_cumulative++)
					if ((int)cumulative_length_list [current_cumulative] > index_found)
						break;

				current_line = GetLine (start_line.LineNo + current_cumulative - 1);

				// find the tag we start on
				LineTag current_tag = current_line.FindTag (index_found - (int)cumulative_length_list [current_cumulative - 1] + 1);

				if (current_tag.Start != (index_found - (int)cumulative_length_list [current_cumulative - 1]) + 1) {
					if (current_tag == CaretTag)
						update_caret_tag = true;

					current_tag = current_tag.Break ((index_found - (int)cumulative_length_list [current_cumulative - 1]) + 1);
				}

				// set the tag
				current_tag.IsLink = true;
				current_tag.LinkText = link_text;

				//go through each character
				// find the tag we are in
				// skip the number of characters in the tag
				for (int i = 1; i < link_text.Length; i++) {
					// on to a new word-wrapped line
					if ((int)cumulative_length_list [current_cumulative] <= index_found + i) {

						current_line = GetLine (start_line.LineNo + current_cumulative++);
						current_tag = current_line.FindTag (index_found + i - (int)cumulative_length_list [current_cumulative - 1] + 1);

						current_tag.IsLink = true;
						current_tag.LinkText = link_text;

						continue;
					}

					if (current_tag.End < index_found + 1 + i - (int)cumulative_length_list [current_cumulative - 1]) {
						// skip empty tags in the middle of the URL
						do {
							current_tag = current_tag.Next;
						} while (current_tag.Length == 0);

						current_tag.IsLink = true;
						current_tag.LinkText = link_text;
					}
				}

				//if there are characters left in the tag after the link
				// split the tag
				// make the second part a non link
				if (current_tag.End > (index_found + link_text.Length + 1) - (int)cumulative_length_list [current_cumulative - 1]) {
					if (current_tag == CaretTag)
						update_caret_tag = true;

					current_tag.Break ((index_found + link_text.Length + 1) - (int)cumulative_length_list [current_cumulative - 1]);
				}
			}

			if (update_caret_tag) {
				CaretTag = LineTag.FindTag (CaretLine, CaretPosition);
				link_changed = true;
			} else {
				if (link_changed == false) {
					current_line = start_line;
					StringBuilder new_link_record = new StringBuilder ();

					while (current_line != null) {
						current_line.LinkRecord (new_link_record);

						if (current_line.ending == LineEnding.Wrap)
							current_line = GetLine (current_line.LineNo + 1);
						else
							break;
					}

					if (new_link_record.Equals (line_link_record) == false)
						link_changed = true;
				}
			}
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:101,代码来源:TextControl.cs

示例8: Main


//.........这里部分代码省略.........
              Console.Write ("\n\n     PQLaserDrv   Set SOME Values Demo : \n");
              Console.Write ("    =================================================\n\n\n");
              //
              // preliminaries: check library version
              //
              Sepia2_Import.SEPIA2_LIB_GetVersion (cLibVersion);
              Console.Write ("     Lib-Version   = {0}\n", cLibVersion);

            //      if (0 != strncmp (cLibVersion, LIB_VERSION_REFERENCE, LIB_VERSION_REFERENCE_COMPLEN))
            //      {
            //        Console.Write ("\n     Warning: This demo application was built for version  %s!\n", LIB_VERSION_REFERENCE);
            //        Console.Write ("              Continuing may cause unpredictable results!\n");
            //        Console.Write ("\n     Do you want to continue anyway? (y/n): ");
            //
            //        c = Console.Read();
            //        if ((c != 'y') && (c != 'Y'))
            //        {
            //          exit (-1);
            //        }
            //        while ((c = Console.Read()) != 0x0A ); // reject userinput 'til end of line
            //        Console.Write ("\n");
            //      }
              //
              // establish USB connection to the sepia first matching all given conditions
              //
              for (i = (bUSBInstGiven ? iGivenDevIdx : 0); i < (bUSBInstGiven ? iGivenDevIdx+1 : Sepia2_Import.SEPIA2_MAX_USB_DEVICES); i++)
              {
            cSepiaSerNo.Length = 0;
            cProductModel.Length = 0;
            //
            iRetVal = Sepia2_Import.SEPIA2_USB_OpenGetSerNumAndClose (i, cProductModel, cSepiaSerNo);
            if ( (iRetVal == Sepia2_Import.SEPIA2_ERR_NO_ERROR)
            && (  (  (bSerialGiven && bProductGiven)
               && (cGivenSerNo.Equals (cSepiaSerNo)  )
               && (cGivenProduct.Equals (cProductModel)  )
               )
            ||  (  (!bSerialGiven != !bProductGiven)
             && (  (cGivenSerNo.Equals (cSepiaSerNo)  )
            || (cGivenProduct.Equals (cProductModel)  )
            )
             )
            ||  ( !bSerialGiven && !bProductGiven)
            )
            )
            {
              iDevIdx = bUSBInstGiven ? ((iGivenDevIdx == i) ? i : -1) : i;
              break;
            }
              }
              //
              if ((iRetVal = Sepia2_Import.SEPIA2_USB_OpenDevice (iDevIdx, cProductModel, cSepiaSerNo)) == Sepia2_Import.SEPIA2_ERR_NO_ERROR)
              {
            Sepia2_Import.SEPIA2_FWR_GetVersion (iDevIdx, cFWVersion);
            Console.Write ("     FW-Version    = {0}\n",     cFWVersion);
            //
            Sepia2_Import.SEPIA2_USB_GetStrDescriptor  (iDevIdx, cDescriptor);
            Console.Write ("     Descriptor    = {0}\n", cDescriptor);
            Console.Write ("     Serial Number = '{0}'\n\n\n", cSepiaSerNo);
            Console.Write ("    =================================================\n\n\n");
            //
            // get sepia's module map and initialise datastructures for all library functions
            // there are two different ways to do so:
            //
            // first:  if sepia was not touched since last power on, it doesn't need to be restarted
            //
            if ((iRetVal = Sepia2_Import.SEPIA2_FWR_GetModuleMap (iDevIdx, Sepia2_Import.SEPIA2_NO_RESTART, out iModuleCount)) == Sepia2_Import.SEPIA2_ERR_NO_ERROR)
开发者ID:PicoQuant,项目名称:PQLaserDrv,代码行数:67,代码来源:SetSomeDataByCSharp.cs

示例9: IsLastDoc

        private bool IsLastDoc(TsImage tsImageInfo)
        {
            try
            {
                //  Get the LastDoc of the Batch string
                var sLastDocId = new StringBuilder();
                sLastDocId.Append(TsMemFiles.GetInt("Image", "Level4", 0, LastDocInfo));
                sLastDocId.Append("-");
                sLastDocId.Append(TsMemFiles.GetInt("Image", "Level3", 0, LastDocInfo));
                sLastDocId.Append("-");
                sLastDocId.Append(TsMemFiles.GetInt("Image", "Level2", 0, LastDocInfo));
                var sCurrentDocId = new StringBuilder();
                sLastDocId.Append(tsImageInfo.Level4);
                sLastDocId.Append("-");
                sLastDocId.Append(tsImageInfo.Level3);
                sLastDocId.Append("-");
                sLastDocId.Append(tsImageInfo.Level2);

                if (sLastDocId.Equals(sCurrentDocId))
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch (Exception)
            {

                throw;
            }
        }
开发者ID:JamisonHarris,项目名称:TurboscanNG,代码行数:33,代码来源:TSDataLookup.cs

示例10: GetDuration


//.........这里部分代码省略.........
            Date end = new Date(endDate, true);
            bool hasTime = false;
            StringBuilder duration = new StringBuilder();

            ZipDates(start, end);

            // Build the duration backwards so we can grab the correct diff
            // Also we need to roll everything up so we don't generate an invalid max year
            if (end.seconds != null)
            {
                while (end.seconds - start.seconds < 0)
                {
                    end.minutes -= 1;
                    end.seconds += 60;
                }
                if (end.seconds - start.seconds > 0)
                {
                    hasTime = true;
                    duration.Insert(0, 'S').Insert(0, String.Format("{0:00}", end.seconds - start.seconds));
                }
            }

            if (end.minutes != null)
            {
                while (end.minutes - start.minutes < 0)
                {
                    end.hours -= 1;
                    end.minutes += 60;
                }
                if (end.minutes - start.minutes > 0)
                {
                    hasTime = true;
                    duration.Insert(0, 'M').Insert(0, String.Format("{0:00}", end.minutes - start.minutes));
                }
            }

            if (end.hours != null)
            {
                while (end.hours - start.hours < 0)
                {
                    end.day -= 1;
                    end.hours += 24;
                }
                if (end.hours - start.hours > 0)
                {
                    hasTime = true;
                    duration.Insert(0, 'H').Insert(0, String.Format("{0:00}", end.hours - start.hours));
                }
            }

            if (hasTime)
            {
                duration.Insert(0, 'T');
            }

            if (end.day != null)
            {
                while (end.day - start.day < 0)
                {
                    end.day += DateTime.DaysInMonth(end.year.Value, end.month.Value);
                    end.month -= 1;
                    if (end.month < 1)
                    {
                        end.year -= 1;
                        end.month += 12;
                    }
                }
                if (end.day - start.day > 0)
                {
                    duration.Insert(0, 'D').Insert(0, String.Format("{0:00}", end.day - start.day));
                }
            }

            if (end.month != null)
            {
                while (end.month - start.month < 0)
                {
                    end.year -= 1;
                    end.month += 12;
                }
                if (end.month - start.month > 0)
                {
                    duration.Insert(0, 'M').Insert(0, String.Format("{0:00}", end.month - start.month));
                }
            }

            if (end.year - start.year > 0)
            {
                duration.Insert(0, 'Y').Insert(0, String.Format("%04d", end.year - start.year));
            }

            String finalDuration = duration.ToString();

            if (end.year - start.year < 0 || duration.Equals(""))
            {
                throw new GedcomxDateException("Start Date must be less than End Date");
            }

            return new GedcomxDateDuration("P" + finalDuration);
        }
开发者ID:Herbert42,项目名称:gedcomx-csharp,代码行数:101,代码来源:GedcomxDateUtil.cs

示例11: CheckDriver

        /// <summary>
        /// Check and fix any problem with hardware.
        /// </summary>
        private void CheckDriver()
        {
            //Get number of driver available
            int DriverNumber = 0;
            CheckError(m_System.getNumDrivers(ref DriverNumber));

            //Driver checking
            #region Solve hardware problems
            //If there's 0 driver, no sound
            if (DriverNumber <= 0) CheckError(m_System.setOutput(OUTPUTTYPE.NOSOUND));
            else {
                //Get driver capability
                int			MinFreq = 0, MaxFreq = 0;
                CAPS		Capability	= CAPS.NONE;
                SPEAKERMODE Speakermode = SPEAKERMODE.STEREO;
                CheckError(m_System.getDriverCaps(0, ref Capability, ref MinFreq, ref MaxFreq, ref Speakermode));

                //Set spearker mode according to the driver
                CheckError(m_System.setSpeakerMode(Speakermode));

                //Set buffer if not using hardware accceleration
                if ((Capability & CAPS.HARDWARE_EMULATED) == CAPS.HARDWARE_EMULATED)
                    CheckError(m_System.setDSPBufferSize(Global.EMULATED_BUFFERSIZE, Global.EMULATED_BUFFERCOUNT));

                //Get user driver data
                GUID			Guid = new GUID();
                StringBuilder	DriverName = new StringBuilder(Global.MAX_DRIVERNAME);
                CheckError(m_System.getDriverInfo(0, DriverName, Global.MAX_DRIVERNAME, ref  Guid));

                //If driver is sigmatel
                if (DriverName.Equals(new StringBuilder((Global.SIGMATEL_DRIVERNAME)))) {
                    //Fix crackling
                    CheckError(m_System.setSoftwareFormat(
                        Global.SIGMATEL_SAMPLERATE,
                        SOUND_FORMAT.PCMFLOAT,
                        0,
                        0,
                        DSP_RESAMPLER.LINEAR));
                }
            }
            #endregion
        }
开发者ID:yggy123,项目名称:closed-sky,代码行数:45,代码来源:SoundManager.cs

示例12: TrainingClusterSet

        public static bool TrainingClusterSet(Dictionary<string, int> clusterMap, string[] methods, ref int index, StringBuilder result)
        {
            var cluster = new StringBuilder();
            cluster.Append(methods[index] + "_"); // add the first important id
            string current = methods[index];

            var allclusters = clusterMap.Keys; // get all current found keys
            // if current method is the last one then return

            if (index + 1 > methods.Length - 1)
                return false;

            string next = methods[index + 1];

            cluster.Append(methods[index + 1] + "_"); // add the second important id

            //existedClusters(clusterMap, methods, index);

            int N = 1;
            int length = 2;  // record the number of ids in the cluster

            bool found = false;
            var size = methods.Length;
            int start;
            for (start = index + length; start < size; start++)
            {
                // length of rest part is less than cluster
                if (length > methods.Length - start)
                {
                    /*
                    for (int i = start; i < methods.Length; i++)
                    {
                        cluster.Append(methods[i] + "_");
                    }
                     * */
                    break;
                }

                var substring = new StringBuilder();
                int j;
                // find out next N numbers, see if they match cluster
                for (j = 0; j < length; j++)
                {
                    if (start + j == size) // over pipeline size
                        break;

                    substring.Append(methods[start + j] + "_");
                }

                if (cluster.Equals(substring))
                {
                    N++;
                    found = true;
                    start += length - 1;
                }
                else
                {
                    if (found)
                    {
                        break;
                    }

                    cluster.Append(methods[start] + "_");
                    length++; // cluster size increase

                }

            }

            if (N > 1)
            {
                string clusterString = cluster.Remove(cluster.Length - 1, 1).ToString();
                string temp = "[" + clusterString + "]x" + N;
                result.Append(temp + " "); // [12_3]x2 4 67
                //result.Append(substring.ToString());

                if (clusterMap.ContainsKey(temp))
                    clusterMap[temp]++;
                else
                    clusterMap.Add(temp, 1);
                /*
                if (!methodsMap.ContainsKey(temp))
                {
                    string origCluster = clusterString.Replace('_', ' ');
                    methodsMap.Add(temp, origCluster);

                }
                 */
                index = start - 1;
            }
            else
                return false;

            return true;
        }
开发者ID:yuanzheng,项目名称:logs-analysis,代码行数:95,代码来源:Program.cs

示例13: checkCluster2

        public static bool checkCluster2(Dictionary<string, int> diffClusterMap, Dictionary<string, int> clusterMap, Dictionary<string, int> uniqueCluster, Dictionary<string, string> methodsMap, string[] methods, ref int index, StringBuilder result)
        {
            var cluster = new StringBuilder();
            cluster.Append(methods[index] + "_"); // add the first important id
            //string current = methods[index];

            //var allclusters = diffClusterMap.Keys; // get all current found keys
            // if current method is the last one then return
            if (index + 1 > methods.Length - 1)
                return false;

            string next = methods[index+1];
            if (!methodsMap.ContainsKey(next))
                return false;
            cluster.Append(methods[index+1] + "_"); // add the second important id

            //existedClusters(clusterMap, methods, index);

            int N = 1;
            int length = 2;  // record the number of ids in the cluster

            bool found = false;
            var size = methods.Length;
            int start;
            for ( start = index + length ; start < size; start++)
            {
                // length of rest part is less than cluster
                if (length > methods.Length - start)
                    break;

                var substring = new StringBuilder();
                int j;
                // find out next N numbers, see if they match cluster
                for (j = 0; j < length; j++)
                {
                    if (start + j == size) // over pipeline size
                        break;

                    substring.Append(methods[start + j] + "_");
                }

                if (cluster.Equals(substring))
                {
                    N++;
                    found = true;
                    start += length-1;
                }
                else
                {
                    if (found)
                    {
                        break;
                    }

                    // if next length long string doesn't match cluster, then cluster add the start number
                    if (methodsMap.ContainsKey(methods[start]))
                    {
                        cluster.Append(methods[start] + "_");
                        length++; // cluster size increase

                    }
                    else
                        break;
                }

            }

            if (N >= 1)
            {
                string clusterString = cluster.Remove(cluster.Length-1, 1).ToString();
                string temp = "[" + clusterString + "]x" + N;
                result.Append(temp + " "); // [12_3]x2 4 67   ???     " " ???
                //result.Append(substring.ToString());
                buildCluster(N, temp, diffClusterMap, clusterMap, uniqueCluster, methodsMap);
                index = start-1;
            }
            else
            {
                /*
                size = methods.Length - index;
                for (int i = 0; i < size; i++)
                {
                    if (methodsMap.ContainsKey(methods[index + i]))
                    {
                        if (checkCluster2(clusterMap, methodsMap, modifiedPipeLine, ref i, secondStep_result))
                            continue;
                    }

                    secondStep_result.Append(modifiedPipeLine[i] + " ");  // current method id is not important

                }
                 * */
            }

            return true;
        }
开发者ID:yuanzheng,项目名称:logs-analysis,代码行数:96,代码来源:Program.cs

示例14: cmdDoEffects_Click


//.........这里部分代码省略.........
                                conditionOne = conditionOne.Replace("%layernumlpstot%", layerNumLPSTot.ToString(Util.nfi));
                                conditionOne = conditionOne.Replace("%layernumlps%", layerIndexInside.ToString(Util.nfi));
                                conditionOne = conditionOne.Replace("%linenum%", layerIndex.ToString(Util.nfi));
                                conditionOne = conditionOne.Replace("%linelen%", (endTime - startTime).ToString(Util.nfi));
                                conditionOne = conditionOne.Replace("%linestart%", startTime.ToString(Util.nfi));
                                conditionOne = conditionOne.Replace("%lineend%", endTime.ToString(Util.nfi));
                                conditionOne = conditionOne.Replace("%style%", dl.style.name);
                                conditionOne = conditionOne.Replace("%name%", dl.actor);

                                if (conditionOne.ToString().IndexOf("%") != -1) { // see if the % is STILL there
                                    string c1 = conditionOne.ToString();
                                    string cnew = String.Empty;
                                    int lastindex1=0,krindex=0,krcindex=0;
                                    while(true) {
                                        krindex = Math.Min(c1.IndexOf("%karastart[", krcindex) + 10, Math.Min(c1.IndexOf("%karaend[", krcindex) + 8, c1.IndexOf("%karalength[", krcindex) + 11));
                                        if (krindex==-1 || krindex<krcindex) break;
                                        krcindex = c1.IndexOf("]", krindex);
                                        if (krcindex==-1) break;
                                        string r1 = c1.Substring(krindex, krcindex-krindex);
                                        cnew = cnew + c1.Substring(lastindex1, krindex - lastindex1) + Evaluate.ScriptParse(r1);
                                        lastindex1 = krcindex;
                                    }
                                    if (lastindex1 < c1.Length) cnew += c1.Substring(lastindex1, c1.Length - lastindex1);
                                    conditionOne = new StringBuilder(cnew);

                                    for (krindex = 0; krindex != totKaraNum; krindex+=1) {
                                        conditionOne = conditionOne.Replace("%karastart[" + krindex.ToString(Util.cfi) + "]%", times[krindex, 0].ToString(Util.nfi));
                                        conditionOne = conditionOne.Replace("%karalength[" + krindex.ToString(Util.cfi) + "]%", times[krindex, 1].ToString(Util.nfi));
                                        conditionOne = conditionOne.Replace("%karaend[" + krindex.ToString(Util.cfi) + "]%", times[krindex, 2].ToString(Util.nfi));
                                    }
                                }
                            }

                            conditionMet = Evaluate.Eval(Evaluate.ScriptParse(conditionOne.ToString())).Equals(true);

                            if (conditionMet == false) break;
                        }

                        if (conditionMet == false) {
                            if ((thislayer.AddAll == true) || ((thislayer.AddOnce == true) && (layerIndexInside == 1)))
                                newList.Add(line);
                            continue;
                        }

                        sb = new System.Text.StringBuilder(1024); // create a new stringbuilder

                        lastindex = 0;
                        for (karaIndex = 0; karaIndex != mc.Count; karaIndex+=1) {
                            m = mc[karaIndex];
                            if (m.Index > lastindex) sb.Append(dl.text.Substring(lastindex, m.Index - lastindex));
                            thisKaraStart = times[karaIndex, 0];
                            thisKaraLen = times[karaIndex, 1];
                            thisKaraEnd = times[karaIndex, 2];
                            textstart = times[karaIndex, 3];
                            textlen = times[karaIndex, 4];

                            for (filterIndex = 0; filterIndex != thislayer.Count; filterIndex+=1) {
                                thisfilter = thislayer.GetFilter(filterIndex);
                                if (thisfilter.Enabled == false) continue;

                                conditionMet = true;

                                //effect conditions
                                for (int effectcondIndex = 0; effectcondIndex != thisfilter.ConditionCount; effectcondIndex+=1) {
                                    c = thisfilter.GetCondition(effectcondIndex);
                                    if (c.ConditionEnabled == false) continue;
开发者ID:Aegisub,项目名称:SSATool,代码行数:67,代码来源:Form1.cs

示例15: AllorsLargeString

        public void AllorsLargeString()
        {
            foreach (var init in this.Inits)
            {
                init();
                foreach (var mark in this.Markers)
                {
                    var aLarge = new StringBuilder().Insert(0, "a", 100000).ToString();
                    var bLarge = new StringBuilder().Insert(0, "b", 100000).ToString();
                    var cLarge = new StringBuilder().Insert(0, "c", 100000).ToString();

                    {
                        var values = C1.Create(this.Session);
                        values.C1StringLarge = aLarge;
                        values.I1StringLarge = bLarge;
                        values.S1StringLarge = cLarge;

                        mark();
                        Assert.IsTrue(values.ExistC1StringLarge);
                        Assert.IsTrue(values.ExistI1StringLarge);
                        Assert.IsTrue(values.ExistS1StringLarge);

                        Assert.IsTrue(aLarge.Equals(values.C1StringLarge));
                        Assert.IsTrue(bLarge.Equals(values.I1StringLarge));
                        Assert.IsTrue(cLarge.Equals(values.S1StringLarge));
                    }

                    {
                        // initial empty
                        var values = C1.Create(this.Session);

                        mark();
                        Assert.IsFalse(values.ExistC1StringLarge);
                        Assert.IsFalse(values.ExistI1StringLarge);
                        Assert.IsFalse(values.ExistS1StringLarge);

                        Assert.IsTrue(values.C1StringLarge == null);
                        Assert.IsTrue(values.I1StringLarge == null);
                        Assert.IsTrue(values.S1StringLarge == null);
                    }

                    {
                        // reset empty
                        var values = C1.Create(this.Session);
                        values.C1StringLarge = aLarge;
                        values.I1StringLarge = bLarge;
                        values.S1StringLarge = cLarge;

                        mark();
                        Assert.IsTrue(values.ExistC1StringLarge);
                        Assert.IsTrue(values.ExistI1StringLarge);
                        Assert.IsTrue(values.ExistS1StringLarge);

                        values.RemoveC1StringLarge();
                        values.RemoveI1StringLarge();
                        values.RemoveS1StringLarge();

                        mark();
                        Assert.IsFalse(values.ExistC1StringLarge);
                        Assert.IsFalse(values.ExistI1StringLarge);
                        Assert.IsFalse(values.ExistS1StringLarge);

                        Assert.IsTrue(values.C1StringLarge == null);
                        Assert.IsTrue(values.I1StringLarge == null);
                        Assert.IsTrue(values.S1StringLarge == null);
                    }

                    {
                        // reset null
                        var values = C1.Create(this.Session);
                        values.C1StringLarge = aLarge;
                        values.I1StringLarge = bLarge;
                        values.S1StringLarge = cLarge;

                        mark();
                        Assert.IsTrue(values.ExistC1StringLarge);
                        Assert.IsTrue(values.ExistI1StringLarge);
                        Assert.IsTrue(values.ExistS1StringLarge);

                        values.C1StringLarge = null;
                        values.I1StringLarge = null;
                        values.S1StringLarge = null;

                        mark();
                        Assert.IsFalse(values.ExistC1StringLarge);
                        Assert.IsFalse(values.ExistI1StringLarge);
                        Assert.IsFalse(values.ExistS1StringLarge);

                        Assert.IsTrue(values.C1StringLarge == null);
                        Assert.IsTrue(values.I1StringLarge == null);
                        Assert.IsTrue(values.S1StringLarge == null);
                    }

                    {
                        // large string in small string
                        var exceptionThrown = false;
                        var values = C1.Create(this.Session);
                        try
                        {
                            mark();
//.........这里部分代码省略.........
开发者ID:whesius,项目名称:allors,代码行数:101,代码来源:UnitTest.cs


注:本文中的System.Text.StringBuilder.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。