Ejemplo n.º 1
0
        private void btnFixAss_Click(object sender, EventArgs e)
        {
            AssFile af = new AssFile();

            af.Load(txtAssFile.Text);
            if (af.Warnings.Count > 0)
            {
                Debug.WriteLine("Found warnings, writing down fixed file");
                af.SaveAs(txtAssFile.Text + ".FIXED.ass");
                AcControls.AcMessageBox.AcMessageBox.Show("Fixed file!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                AcControls.AcMessageBox.AcMessageBox.Show("No need to fix file!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 2
0
        private void btnChangeAssTiming_Click(object sender, EventArgs e)
        {
            try
            {
                String newStartStr = AcControls.AcInputBox.AcInputBox.Show("Give the new start of the first subtitle:", "New start...", "");
                String newEndStr   = AcControls.AcInputBox.AcInputBox.Show("Give the new start of the last subtitle:", "New end...", "");

                AssFile assF = new AssFile(txtAssFile.Text);
                assF.SectionEvents.SortEventLines(AssEventsSortType.ByStartTime, AcToolsLibrary.Core.Subtitles.ASS.SortOrder.Ascending);
                Int64 newStart = assF.SectionEvents.EventLines[0].GetTimeInMs(newStartStr);
                Int64 newEnd   = assF.SectionEvents.EventLines[0].GetTimeInMs(newEndStr) +
                                 assF.SectionEvents.EventLines[assF.SectionEvents.EventLines.Count - 1].Duration;
                Double ratio = Convert.ToDouble((newEnd - newStart)) /
                               Convert.ToDouble((assF.SectionEvents.EventLines[assF.SectionEvents.EventLines.Count - 1].EndValue
                                                 - assF.SectionEvents.EventLines[0].StartValue));

                Int64 lastOldEnd = 0;
                for (Int32 i = 0; i < assF.SectionEvents.EventLines.Count; i++)
                {
                    AssLineEvent assL = assF.SectionEvents.EventLines[i];
                    // if its the first line
                    if (i == 0)
                    {
                        Int64 oldDuration = assL.Duration;
                        Int64 newDuration = Convert.ToInt64(oldDuration * ratio);
                        lastOldEnd      = assL.EndValue;
                        assL.StartValue = newStart;
                        assL.EndValue   = assL.StartValue + newDuration;
                    }
                    else
                    {
                        Int64 oldDuration    = assL.Duration;
                        Int64 newDuration    = Convert.ToInt64(oldDuration * ratio);
                        Int64 oldGapDuration = assL.StartValue - lastOldEnd;
                        Int64 newGapDuration = Convert.ToInt64(oldGapDuration * ratio);
                        lastOldEnd      = assL.EndValue;
                        assL.StartValue = assF.SectionEvents.EventLines[i - 1].EndValue + newGapDuration;
                        assL.EndValue   = assL.StartValue + newDuration;
                    }
                }
                assF.SaveAs(assF.Filename + ".new.ass");
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
        }
Ejemplo n.º 3
0
 private void btnFixAss2_Click(object sender, EventArgs e)
 {
     try
     {
         AssFile assF = new AssFile(txtAssFile.Text);
         assF.SectionEvents.SortEventLines(AssEventsSortType.ByStartTime, AcToolsLibrary.Core.Subtitles.ASS.SortOrder.Ascending);
         List <Int32> lineIndecesToBeRemoved = new List <int>();
         for (int i = 0; i < assF.SectionEvents.EventLines.Count; i++)
         {
             if (lineIndecesToBeRemoved.Contains(i))
             {
                 continue;
             }
             AssLineEvent myLine = assF.SectionEvents.EventLines[i];
             for (int j = i + 1; j < assF.SectionEvents.EventLines.Count; j++)
             {
                 // check only 50 lines ahead
                 if (j - i > 50)
                 {
                     break;
                 }
                 AssLineEvent lineToTest = assF.SectionEvents.EventLines[j];
                 if (myLine.Text.Trim() == lineToTest.Text.Trim())
                 {
                     lineIndecesToBeRemoved.Add(j);
                     myLine.EndValue = lineToTest.EndValue;
                 }
             }
         }
         // processing ended, time to remove lines
         List <Int32> sortedList = lineIndecesToBeRemoved.OrderByDescending(t => t).ToList();
         foreach (var i in sortedList)
         {
             assF.SectionEvents.EventLines.RemoveAt(i);
         }
         assF.SectionEvents.SortEventLines(AssEventsSortType.ByStartTime, AcToolsLibrary.Core.Subtitles.ASS.SortOrder.Ascending);
         assF.SaveAs(assF.Filename + ".fixed.ass");
     }
     catch (Exception ex)
     {
         ShowExceptionMessage(ex);
     }
 }
Ejemplo n.º 4
0
 public void Compare(AssFile originalFile, AssFile newFile)
 {
     _originalFile = originalFile;
     _newFile      = newFile;
 }
Ejemplo n.º 5
0
 public AssComparator(AssFile originalFile, AssFile newFile)
 {
     Compare(originalFile, newFile);
 }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            Smi smi = new Smi()
            {
                text = "가<font face='궁서체'>나<font color='#abcdef' face=\"돋움체\" fade=\"in\">다</font>라</font>마<b>바</b>사<br>아<u>자</u>차<b>카<u>타<i>파</i></u></b>하"
            };
            Ass         ass;
            string      text;
            SmiFile     file;
            List <Attr> attrs;
            bool        doThis = false;

            doThis = false;
            if (doThis)
            {
                Console.WriteLine("샘플1");
                Console.WriteLine(smi);
                Console.WriteLine();

                Console.WriteLine("SMI -> 자체 형식");
                attrs = smi.ToAttr();
                Console.WriteLine();

                Console.WriteLine("자체 형식 -> ASS (fade 손실)");
                ass = new Ass().FromAttr(attrs);
                Console.WriteLine(ass.text);
                Console.WriteLine();

                Console.WriteLine("자체 형식 -> SMI");
                smi = new Smi().FromAttr(attrs);
                Console.WriteLine(smi.text);
                Console.WriteLine();

                Console.WriteLine("ASS -> 자체 형식");
                attrs = ass.ToAttr();
                Console.WriteLine();

                Console.WriteLine("자체 형식 -> SMI");
                smi = new Smi().FromAttr(attrs);
                Console.WriteLine(smi.text);
                Console.WriteLine();

                Console.WriteLine("자체 형식 -> ASS");
                ass = new Ass().FromAttr(attrs);
                Console.WriteLine(ass.text);
                Console.WriteLine();

                Console.WriteLine();
            }

            doThis = false;
            if (doThis)
            {
                Console.WriteLine("샘플2");
                text = "<Sync Start=1000><P Class=KRCC>\n"
                       + "asdf\n"
                       + "<Sync Start=1250><P Class=KRCC >\n"
                       + "가<font color='#abcdef'>나</font>다<font color='#9abcde' fade='in'>라</font>마<font color='#89abcd' fade='out'>바</font>사\n"
                       + "<Sync Start=1500><P Class=KRCC >\n"
                       + "가<font color='#abcdef'>나</font>다<font color='#9abcde'>라</font>마<font color='#000000'>바</font>사\n"
                ;
                Console.WriteLine(text);
                Console.WriteLine();

                Console.WriteLine("가공");
                file = new SmiFile().FromTxt(text);
                Smi.Normalize(file.body);
                text = Smi.Smi2txt(file.body);
                Console.WriteLine(text);
                Console.WriteLine();

                Console.WriteLine();
            }

            doThis = false;
            if (doThis)
            {
                Console.WriteLine("샘플3");
                text = "<Sync Start=61379><P Class=KRCC>\n"
                       + "<font color=\"#cccc88\">I</font><font color=\"#997722\">n the dreaming 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<font color=\"#cccc88\">In</font> <font color=\"#997722\">the dreaming 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<Sync Start=61687><P Class=KRCC>\n"
                       + "<font color=\"#cccc88\">In t</font><font color=\"#997722\">he dreaming 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<font color=\"#cccc88\">In th</font><font color=\"#997722\">e dreaming 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<font color=\"#cccc88\">In the</font> <font color=\"#997722\">dreaming 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<Sync Start=61957><P Class=KRCC>\n"
                       + "<font color=\"#cccc88\">In the d</font><font color=\"#997722\">reaming 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<font color=\"#cccc88\">In the dr</font><font color=\"#997722\">eaming 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<font color=\"#cccc88\">In the dre</font><font color=\"#997722\">aming 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<font color=\"#cccc88\">In the drea</font><font color=\"#997722\">ming 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<Sync Start=62595><P Class=KRCC>\n"
                       + "<font color=\"#cccc88\">In the dream</font><font color=\"#997722\">ing 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<font color=\"#cccc88\">In the dreami</font><font color=\"#997722\">ng 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<font color=\"#cccc88\">In the dreamin</font><font color=\"#997722\">g 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<font color=\"#cccc88\">In the dreaming</font> <font color=\"#997722\">誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<Sync Start=63710><P Class=KRCC>\n"
                ;
                Console.WriteLine(text);
                Console.WriteLine();

                Console.WriteLine("가공");
                file = new SmiFile().FromTxt(text);
                Smi.FillEmptySync(file.body);
                text = Smi.Smi2txt(file.body);
                Console.WriteLine(text);
                Console.WriteLine();

                Console.WriteLine();
            }

            doThis = false;
            if (doThis)
            {
                Console.WriteLine("샘플4");
                smi.text = "테스트<font typing='TypeWriter'>테스트</font>테스트";
                Console.WriteLine(smi.text);
                Console.WriteLine();

                Console.WriteLine("SMI -> 자체 형식");
                attrs = smi.ToAttr();
                Console.WriteLine();

                Console.WriteLine("자체 형식 -> ASS");
                ass = new Ass().FromAttr(attrs);
                Console.WriteLine(ass.text);
                Console.WriteLine();

                Console.WriteLine("자체 형식 -> SMI");
                smi = new Smi().FromAttr(attrs);
                Console.WriteLine(smi.text);
                Console.WriteLine();
            }

            doThis = false;
            if (doThis)
            {
                Console.WriteLine("샘플5");
                text = "<Sync Start=1000><P Class=KRCC>\n"
                       + "테스트   테스트\n"
                       + "<Sync Start=2000><P Class=KRCC>\n"
                       + "테스트<font typing='typewriter'>텍스트</font>테스트\n"
                       + "<Sync Start=3000><P Class=KRCC>\n"
                       + "테스트<font typing='keyboard'>텍스트</font>테스트\n"
                       + "<Sync Start=4000><P Class=KRCC>\n"
                       + "테스트<font typing='keyboard'>테스트</font>테스트\n"
                       + "<Sync Start=5000><P Class=KRCC>\n"
                       + "테스트<font typing='keyboard(0,1)'>테스트</font>테스트\n"
                       + "<Sync Start=6000><P Class=KRCC>\n"
                       + "테스트<font typing='keyboard(1,1)'>테스트</font>테스트\n"
                       + "<Sync Start=7000><P Class=KRCC>\n"
                       + "테스트<font typing='keyboard'>테test</font>테스트\n"
                       + "<Sync Start=8000><P Class=KRCC>\n"
                       + "테스트<font typing='keyboard invisible'>테test</font>테스트\n"
                       + "<Sync Start=9000><P Class=KRCC>\n"
                       + "테스트<font typing='keyboard hangeul'>테test</font><br>테스트\n"
                       + "<Sync Start=10000><P Class=KRCC>\n"
                       + "테스트테스트<font typing='keyboard'>테스트</font>\n"
                       + "<Sync Start=11000><P Class=KRCC>\n"
                       + "테스트테스트테스트\n"
                ;
                Console.WriteLine(text);
                Console.WriteLine();

                Console.WriteLine("가공");
                file = new SmiFile().FromTxt(text);
                Smi.Normalize(file.body);
                text = Smi.Smi2txt(file.body);
                Console.WriteLine(text);
                Console.WriteLine();
            }

            doThis = false;
            if (doThis)
            {
                string input = "실홰롻튄즤륢 ㅁㄴㅇㄻㄴ";
                Console.WriteLine("입력값");
                Console.WriteLine(input);
                Console.WriteLine();

                Console.WriteLine("타자기");
                char[] type   = Typing.ToType(input, Typing.Mode.typewriter);
                Typing typing = new Typing(Typing.Mode.typewriter, Typing.Cursor.invisible);
                foreach (char c in type)
                {
                    typing.Type(c);
                    Console.WriteLine(typing.Out());
                }

                Console.WriteLine();

                Console.WriteLine("키보드");
                type   = Typing.ToType(input, Typing.Mode.keyboard);
                typing = new Typing(Typing.Mode.keyboard, Typing.Cursor.invisible);
                foreach (char c in type)
                {
                    typing.Type(c);
                    Console.WriteLine(typing.Out());
                }
            }

            doThis = false;
            if (doThis)
            {
                Console.WriteLine("샘플 몇이냐");
                text = "<Sync Start=1379><P Class=KRCC>\n"
                       + "<font color=\"#cccc88\">I</font><font color=\"#997722\">n the dreaming 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<Sync Start=61533><P Class=KRCC	>\n"
                       + "<font color=\"#cccc88\">In</font> <font color=\"#997722\">the dreaming 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<Sync Start=1687><P Class=KRCC>\n"
                       + "<font color=\"#cccc88\">In t</font><font color=\"#997722\">he dreaming 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<Sync Start=61777><P Class=KRCC	>\n"
                       + "<font color=\"#cccc88\">In th</font><font color=\"#997722\">e dreaming 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<Sync Start=61867><P Class=KRCC	>\n"
                       + "<font color=\"#cccc88\">In the</font> <font color=\"#997722\">dreaming 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<Sync Start=1957><P Class=KRCC>\n"
                       + "<font color=\"#cccc88\">In the d</font><font color=\"#997722\">reaming 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<Sync Start=62116><P Class=KRCC	>\n"
                       + "<font color=\"#cccc88\">In the dr</font><font color=\"#997722\">eaming 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<Sync Start=62276><P Class=KRCC	>\n"
                       + "<font color=\"#cccc88\">In the dre</font><font color=\"#997722\">aming 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<Sync Start=62435><P Class=KRCC	>\n"
                       + "<font color=\"#cccc88\">In the drea</font><font color=\"#997722\">ming 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<Sync Start=2595><P Class=KRCC>\n"
                       + "<font color=\"#cccc88\">In the dream</font><font color=\"#997722\">ing 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<Sync Start=62873><P Class=KRCC	>\n"
                       + "<font color=\"#cccc88\">In the dreami</font><font color=\"#997722\">ng 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<Sync Start=63152><P Class=KRCC	>\n"
                       + "<font color=\"#cccc88\">In the dreamin</font><font color=\"#997722\">g 誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<Sync Start=63431><P Class=KRCC	>\n"
                       + "<font color=\"#cccc88\">In the dreaming</font> <font color=\"#997722\">誰かのために</font><br>In the dreaming 누군가를 위해서\n"
                       + "<Sync Start=3710><P Class=KRCC>asdf\n";
                Console.WriteLine(text);
                Console.WriteLine();

                Console.WriteLine("중간싱크 조절 가공");
                file = new SmiFile().FromTxt(text);
                Smi.Normalize(file.body);
                text = Smi.Smi2txt(file.body);
                Console.WriteLine(text);
                Console.WriteLine();

                Console.WriteLine();
            }

            doThis = false;
            if (doThis)
            {
                text = "<Sync Start=1293110><P Class=KRCC>"
                       + "<i><font color=\"#ccbbdd\">나란히 날아가는 한 쌍의 새</font></i>"
                       + "<Sync Start=1299594><P Class=KRCC>"
                       + "<i><font color=\"#ccbbdd\">손을 맞잡은</font></i>"
                       + "<Sync Start=1302545><P Class=KRCC>"
                       + "<i><font color=\"#ccbbdd\">부모·자식이 만드는 그림자</font></i>"
                       + "<Sync Start=1305823><P Class=KRCC>"
                       + "<i><font color=\"#ccbbdd\">저녁 해가 비춘 아름다운 것</font></i>"
                       + "<Sync Start=1312310><P Class=KRCC>"
                       + "<i><font color=\"#ccbbdd\">그런 “평범”한 게 눈부셨어</font></i>"
                       + "<Sync Start=1318632><P Class=KRCC>"
                       + "<i><font color=\"#ccbbdd\">푸른색 벤치가 허전해서</font></i>"
                       + "<Sync Start=1323976><P Class=KRCC>"
                       + "<i><font color=\"#ccbbdd\">나 혼자 외톨이 로 느껴졌어</font></i>"
                       + "<Sync Start=1331612><P Class=KRCC>"
                       + "&nbsp;"
                       + "<Sync Start=1333917><P Class=KRCC>"
                       + "<i><font color=\"#ccbbdd\">평범한 게 좋아서</font></i>";

                doThis = false;
                if (doThis)
                {
                    text = "<Sync Start=65483><P Class=KRCC >\n"
                           + "카나???\n"
                           + "<Sync Start=66293><P Class=KRCC >\n"
                           + "&nbsp;\n"
                           + "<Sync Start=68324><P Class=KRCC>\n"
                           + "하루코 ???\n"
                           + "<Sync Start=69054><P Class=KRCC >\n"
                           + "&nbsp;\n"
                           + "<Sync Start=72223><P Class=KRCC >\n"
                           + "슈퍼바이저\n"
                           + "<Sync Start=73504><P Class=KRCC >\n"
                           + "&nbsp;\n"
                           + "<Sync Start=169787><P Class=KRCC >\n"
                           + "히도미 미나세 이노리\n"
                           + "<Sync Start=170883><P Class=KRCC >\n"
                           + "&nbsp;\n"
                           + "<Sync Start=172325><P Class=KRCC >\n"
                           + "진유\n"
                           + "사와시로 미유키\n"
                           + "<Sync Start=173349><P Class=KRCC >\n"
                           + "&nbsp;\n"
                           + "<Sync Start=175555><P Class=KRCC >\n"
                           + "라하루\n"
                           + "하야시바라 메구미\n"
                           + "<Sync Start=176463><P Class=KRCC >\n"
                           + "슈퍼바이저 캐릭터 원안 주제가\n"
                           + "<Sync Start=177671><P Class=KRCC >\n"
                           + "&nbsp;";
                }

                file = new SmiFile().FromTxt(text);
                List <Ass> assBody = new AssFile().FromSync(file.ToSync()).body;
                foreach (Ass line in assBody)
                {
                    Console.WriteLine(line.ToTxt());
                }
            }

            System.Threading.Thread.Sleep(int.MaxValue);
        }
Ejemplo n.º 7
0
        private void btnTestCharset_Click(object sender, EventArgs e)
        {
            //Load a file
            AssFile af = new AssFile();

            af.Load(txtAssFile.Text);
            //Load b file
            AssFile bf = new AssFile();

            bf.Load(txtSectionsFile.Text);

            //sort a file by time
            //af.SectionEvents.SortEventLines(AssEventsSortType.ByStartTime, Core.ASS.SortOrder.Ascending);
            //sort b file by time
            //bf.SectionEvents.SortEventLines(AssEventsSortType.ByStartTime, Core.ASS.SortOrder.Ascending);

            List <String> diffs = new List <String>();

            //Compare event lines
            Int32 bIdx = 0;

            //second more accurate attempt
            diffs.Clear();
            //Create a working copy for the event lines
            List <AssLineEvent> bLines = new List <AssLineEvent>(bf.SectionEvents.EventLines);

            foreach (AssLineEvent aLine in af.SectionEvents.EventLines)
            {
                //begin loop for each line in b file
                Int32 minDiff     = LD(aLine.Text, bLines[0].Text);
                Int64 minTimeDiff = Math.Abs(aLine.StartValue - bLines[0].StartValue);
                //lines are the same
                if (minDiff == 0)
                {
                    //remove the line from the working copy
                    bLines.RemoveAt(0);
                    continue;
                }
                else
                {
                    bIdx = 0;
                    for (Int32 i = 1; i < bLines.Count; i++)
                    {
                        Int32 cDiff     = LD(aLine.Text, bLines[i].Text);
                        Int64 cTimeDiff = Math.Abs(aLine.StartValue - bLines[i].StartValue);
                        Debug.WriteLine(String.Format("a: {0} b: {1} cdiff: {2}", aLine.OriginalOrder, bLines[i].OriginalOrder, cDiff));
                        //lines are the same
                        if (cDiff == 0)
                        {
                            minDiff = 0;
                            //remove the line from the working copy
                            bLines.RemoveAt(i);
                            break;
                        }
                        else
                        {
                            //Find the minimum difference
                            if (cDiff + cTimeDiff < minDiff + minTimeDiff)
                            {
                                minDiff     = cDiff;
                                minTimeDiff = cTimeDiff;
                                bIdx        = i;
                            }
                        }
                    }
                    //lines are the same
                    if (minDiff == 0)
                    {
                        continue;
                    }
                    else
                    {
                        //lines are different
                        //check the line with the smallest text difference
                        //Find the differences
                        StringBuilder     oldBuilder = new StringBuilder();
                        StringBuilder     newBuilder = new StringBuilder();
                        AcStringTokenizer a          = new AcStringTokenizer(aLine.Text);
                        AcStringTokenizer b          = new AcStringTokenizer(bLines[bIdx].Text);
                        a.IgnoreWhiteSpace = false;
                        b.IgnoreWhiteSpace = false;

                        List <String> aList = a.GetAllTokenValues();
                        List <String> bList = b.GetAllTokenValues();

                        foreach (String token in aList)
                        {
                            oldBuilder.AppendLine(token);
                        }
                        if (oldBuilder.Length > 1)
                        {
                            oldBuilder.Length -= 1;
                        }
                        foreach (String token in bList)
                        {
                            newBuilder.AppendLine(token);
                        }
                        if (newBuilder.Length > 1)
                        {
                            newBuilder.Length -= 1;
                        }

                        AcDiff.AcDiffItem[] f = AcDiff.DiffText(oldBuilder.ToString(), newBuilder.ToString(), true, true, false);

                        //Change tokens
                        foreach (AcDiff.AcDiffItem it in f)
                        {
                            for (Int32 i = it.StartA; i < it.StartA + it.deletedA; i++)
                            {
                                aList[i] = "--" + aList[i] + "--";
                            }
                            for (Int32 i = it.StartB; i < it.StartB + it.insertedB; i++)
                            {
                                bList[i] = "++" + bList[i] + "++";
                            }
                        }

                        //Add the old and new string to the list
                        oldBuilder.Length = 0;
                        foreach (String token in aList)
                        {
                            oldBuilder.Append(token);
                        }
                        newBuilder.Length = 0;
                        foreach (String token in bList)
                        {
                            newBuilder.Append(token);
                        }

                        diffs.Add("-- [" + aLine.OriginalOrder + "] " + oldBuilder.ToString());
                        diffs.Add("++ [" + bLines[bIdx].OriginalOrder + "] " + newBuilder.ToString());
                    }
                }
            }
            lstAss2.SuspendLayout();
            lstAss2.Items.Clear();
            foreach (String s in diffs)
            {
                lstAss2.Items.Add(s);
            }
            lstAss2.ResumeLayout();


            String oldLine = txtAssFile.Text;
            String newLine = txtSectionsFile.Text;

            //Check if lines are the same:
            if (oldLine != newLine)
            {
                StringBuilder     oldBuilder = new StringBuilder();
                StringBuilder     newBuilder = new StringBuilder();
                AcStringTokenizer a          = new AcStringTokenizer(oldLine);
                AcStringTokenizer b          = new AcStringTokenizer(newLine);
                a.IgnoreWhiteSpace = false;
                a.SymbolChars      = new List <char> {
                    ',', ':', '\\'
                };
                b.IgnoreWhiteSpace = false;
                b.SymbolChars      = new List <char> {
                    ',', ':', '\\'
                };

                List <AcStringToken> aList = a.GetAllTokens();
                List <AcStringToken> bList = b.GetAllTokens();

                foreach (AcStringToken token in aList)
                {
                    oldBuilder.AppendLine(token.Value);
                }
                oldBuilder.Length -= 1;
                foreach (AcStringToken token in bList)
                {
                    newBuilder.AppendLine(token.Value);
                }
                newBuilder.Length -= 1;

                AcDiff.AcDiffItem[] f = AcDiff.DiffText(oldBuilder.ToString(), newBuilder.ToString(), true, true, false);
            }
        }