private void method1()
		{
			LineNumbers = null;

			if (_codeFile != null)
			{
				Builder builder = new Builder("\r\n");

				for (int i = 0; i < _codeFile.Lines.Length; i++)
				{
					builder.Append(i);
				}

				LineNumbers = builder.ToString();
			}
		}
예제 #2
0
        public static string FindLcs(string str1, string str2)
        {
            string result;

            if (string.IsNullOrEmpty(str1) || string.IsNullOrEmpty(str2))
            {
                result = "";
            }
            else
            {
                int[,] array = new int[str1.Length, str2.Length];
                int           num           = 0;
                int           num2          = 0;
                StringBuilder stringBuilder = new StringBuilder();
                for (int i = 0; i < str1.Length; i++)
                {
                    for (int j = 0; j < str2.Length; j++)
                    {
                        if (str1[i] != str2[j])
                        {
                            array[i, j] = 0;
                        }
                        else
                        {
                            if (i == 0 || j == 0)
                            {
                                array[i, j] = 1;
                            }
                            else
                            {
                                array[i, j] = 1 + array[i - 1, j - 1];
                            }
                            if (array[i, j] > num)
                            {
                                num = array[i, j];
                                int num3 = i - array[i, j] + 1;
                                if (num2 == num3)
                                {
                                    stringBuilder.Append(str1[i]);
                                }
                                else
                                {
                                    num2 = num3;
                                    stringBuilder.Remove(0, stringBuilder.Length);
                                    stringBuilder.Append(str1.Substring(num2, i + 1 - num2));
                                }
                            }
                        }
                    }
                }
                Builder builder  = new Builder("\r\n");
                Builder builder2 = new Builder(".");
                for (int i = 0; i < str1.Length; i++)
                {
                    builder2.Clear();
                    for (int j = 0; j < str2.Length; j++)
                    {
                        builder2.Append(array[i, j].ToString().PadLeft(2, ' '));
                    }
                    builder.Append(builder2);
                }
                result = stringBuilder.ToString();
            }
            return(result);
        }
예제 #3
0
		public static string FindLcs(string str1, string str2)
		{
			string result;

			if (string.IsNullOrEmpty(str1) || string.IsNullOrEmpty(str2))
			{
				result = "";
			}
			else
			{
				int[,] array = new int[str1.Length, str2.Length];
				int num = 0;
				int num2 = 0;
				StringBuilder stringBuilder = new StringBuilder();

				for (int i = 0; i < str1.Length; i++)
				{
					for (int j = 0; j < str2.Length; j++)
					{
						if (str1[i] != str2[j])
						{
							array[i, j] = 0;
						}
						else
						{
							if (i == 0 || j == 0)
							{
								array[i, j] = 1;
							}
							else
							{
								array[i, j] = 1 + array[i - 1, j - 1];
							}
							if (array[i, j] > num)
							{
								num = array[i, j];
								int num3 = i - array[i, j] + 1;
								if (num2 == num3)
								{
									stringBuilder.Append(str1[i]);
								}
								else
								{
									num2 = num3;
									stringBuilder.Remove(0, stringBuilder.Length);
									stringBuilder.Append(str1.Substring(num2, i + 1 - num2));
								}
							}
						}
					}
				}

				Builder builder = new Builder("\r\n");
				Builder builder2 = new Builder(".");

				for (int i = 0; i < str1.Length; i++)
				{
					builder2.Clear();

					for (int j = 0; j < str2.Length; j++)
					{
						builder2.Append(array[i, j].ToString().PadLeft(2, ' '));
					}

					builder.Append(builder2);
				}

				result = stringBuilder.ToString();
			}

			return result;
		}
		private void method_1()
		{
			this.LineNumbers = null;
			if (this.codeFile_0 != null)
			{
				Builder builder = new Builder("\r\n");
				for (int i = 0; i < this.codeFile_0.Lines.Length; i++)
				{
					builder.Append(i);
				}
				this.LineNumbers = builder.ToString();
			}
		}