コード例 #1
0
ファイル: Read.cs プロジェクト: GatesKennedy/GK_ASP-NET
        //  MOD: FlagEmptyLines
        public void FlagEmptyLines(Parse_Pop _readObject, List <string> _readLines, out List <string> _outList)
        {
            //  Local var
            List <string> _sortedLines = new List <string>();

            //  Reduce Lines, Add FieldBreaks
            for (int i = 0; i < _readLines.Count(); i++)
            {
                //  add first line
                if (i == 0)
                {
                    _sortedLines.Add(_readLines[i]);
                }
                //  add Non-Empty Lines
                else if (_readLines[i].Trim() != "")
                {
                    _sortedLines.Add(_readLines[i].Trim());
                }
                //  add field break Lines
                else if (_readLines[i].Trim() == "" && _readLines[i - 1].Trim() != "#")
                {
                    _readLines[i] = "#";
                    _sortedLines.Add(_readLines[i]);
                }
            }
            _outList = _sortedLines;
        }
コード例 #2
0
 //==================================
 //  Routine: FULL READ
 //==================================
 public void FullRead(Parse_Pop _readObject, out List <string> reducedLinesList)
 {
     //  initialize linesArray
     PopulateLines(_readObject, out List <string> linesList);
     //  Remove/Reduce Empty Lines
     reducedLinesList = linesList;
 }
コード例 #3
0
ファイル: Read.cs プロジェクト: GatesKennedy/GK_ASP-NET
        //___________________
        //=====  FIND  =====

        //  GET: Populate Lines
        protected void PopulateLines(Parse_Pop _readObject, out List <string> _linesList)
        {
            //  Populate 'textLines' Array from .txt document
            string[] textArray = System.IO.File.ReadAllLines(_readObject.Txt_FilePath);
            _linesList            = textArray.ToList();
            _readObject.TextArray = textArray;
        }
コード例 #4
0
        //================================
        //  Routine: HALF READ
        //================================
        public void HalfRead(Parse_Pop _readObject)
        {
            PopulateLines(_readObject, out List <string> _linesList);
            FlagEmptyLines(_readObject, _linesList, out List <string> _outList);
            List <string> PageBreakPRE = new List <string>();

            PageBreakPRE = prependNumberList(_outList);
            Display.ExportCollection(PageBreakPRE, "PageBreakPRE");
        }
コード例 #5
0
        //  Displays Console: Object Properties 
        public static void ObjPropToConsole(Parse_Pop _targetObj)
        {
            foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(_targetObj))
            {
                string name = descriptor.Name;
                object value = descriptor.GetValue(_targetObj);

                Console.WriteLine("{0} = {1}", name, value);
            }
        }
コード例 #6
0
        static void Main(string[] args)
        {
            //==========================
            //  Prelim Processing
            //==========================

            //const string txt1_Numbered = @"C:\Users\gates\Documents\GatesKennedy\LMS_Recovery_Console\aolcc_versioncontrol\AOLCC_VC_TxtNum.txt";
            //const string txt2_Bulleted = @"C:\Users\gates\Documents\GatesKennedy\LMS_Recovery_Console\aolcc_versioncontrol\AOLCC_VC_TxtBull.txt";
            const string txt_Target = @"C:\Users\gates\Documents\GatesKennedy\LMS_Recovery_Console\aolcc_5_CSS-BootStrap\AOLCC_CSS_Preform_Mar11.txt";

            Parse_Pop ObjTarget = new Parse_Pop();

            ObjTarget.Read_InputDoc(txt_Target);


            //==========================
            //  Target Processing
            //==========================
            ObjTarget.Read_Clean();
            Display.ExportCollection(ObjTarget.LinesList, "LinesList_Clean");

            ObjTarget.SeparatePages();
            Display.ExportCollection(ObjTarget.PageList, "PageList_SeparatePages");
            Display.ExportCollection(ObjTarget.IsolatedList, "IsolatedList_SeparatePages");

            //ObjTarget.SeparateModules();
            //    Display.ExportCollection(ObjTarget.ModuleList, "ModuleList_SeparateModules");

            ObjTarget.RoutePageTypes();
            Display.ExportCollection(ObjTarget.PageList, "Handled_Pages");


            //ObjTarget.SeparateTests();
            //    Display.ExportCollection(ObjTarget.PageList, "PageList_SepTests");
            //    Display.ExportCollection(ObjTarget.ModuleList, "ModuleList_SeparateTests");

            //ObjTarget.GroupLessons();
            //    Display.ExportCollection(ObjTarget.FormatAOLCC, "FormatAOLCC");

            //ObjTarget.CompileQuestions_AOLCC();

            //var temp = ObjTarget.TestsList;
            //ObjTarget.PageList.Add(temp);

            ////ObjTarget.CompileText_AOLCC();

            //ObjTarget.CompTextClean();

            //ObjTarget.compText_LessonsLeft();

            //ObjTarget.CountAddKnowledge();

            Console.WriteLine("DONE.");
            Console.ReadLine();
        }
コード例 #7
0
        //  Displays Console: Object List Metrics

        public static void MetricsToConsole(Parse_Pop _targetObj)
        {
            List<int> tempList = new List<int>
            {
                _targetObj.LinesList.Count(),
                _targetObj.PageList.Count(),
                _targetObj.LinesList.Count(),
                _targetObj.PageBreaks.Count()
            };

            ToConsole(tempList);
        }
コード例 #8
0
ファイル: Read.cs プロジェクト: GatesKennedy/GK_ASP-NET
        //==========================================================================================
        //========  Main Methods  ==================================================================
        //==========================================================================================

        //================================
        //  Routine: COMPARE Page Breaks
        //================================

        //  CREATE List of PageBreaks
        public static void CompareTxtDocs(Parse_Pop _txtObjNum, Parse_Pop _txtObjBull, out Dictionary <int, string> _PageBreaks)
        {
            Dictionary <int, string> tempDict = new Dictionary <int, string>();

            if (_txtObjBull.LineCount == _txtObjNum.LineCount)
            {
                for (int i = 0; i < _txtObjNum.LinesList.Count(); i++)
                {
                    if (_txtObjBull.LinesList[i] != _txtObjNum.LinesList[i])
                    {
                        tempDict.Add(i, _txtObjBull.LinesList[i]);
                    }
                }
            }
            else
            {
                Console.WriteLine("ERROR: Lines of Txt Docs are NOT the same.");
            }
            _PageBreaks = tempDict;

            Console.WriteLine("PageBreaks: " + tempDict.Count());
        }
コード例 #9
0
ファイル: Read.cs プロジェクト: GatesKennedy/GK_ASP-NET
        public void CompareLinesList(Parse_Pop _ObjTxt, out List <string> _isolatedList)
        {
            // Target Object
            List <string> TarList = this.LinesList;
            //  Input Compare Object
            List <string> TxtList  = _ObjTxt.LinesList;
            List <string> tempList = new List <string>();

            int j = 0;

            for (int i = 0; i < TxtList.Count(); i++)
            {
                Console.WriteLine("lineList: " + i);
                string TxtLine = _ObjTxt.LinesList[i];
                string TarLine = this.LinesList[i];

                string fLineTxt = _ObjTxt.GetFlaglessLine(i);
                string fLineTar = this.GetFlaglessLine(i);

                string fLastTxt = "";
                string fLastTar = "";
                if (i != 0)
                {
                    fLastTxt = TxtList[i - 1];
                    fLastTar = TarList[i - 1];
                }

                string fNextTxt = "";
                string fNextTar = "";
                if (i < tempList.Count - 1)
                {
                    fNextTxt = TxtList[i + 1];
                    fNextTar = TarList[i + 1];
                }

                //  ADD Line: First
                if (i == 0)
                {
                    tempList.Add(TxtLine);
                }
                //  ADD Line: Lines are equivalent
                else if (fLineTar.ToLower() == fLineTxt.ToLower() || String.Equals(TarLine, TxtLine))
                {
                    tempList.Add(TarLine);
                }
                //  ADD Line: First words are equivalent
                else if (TarLine != "" && TxtLine != "" && TarLine.Split(' ').FirstOrDefault() == TxtLine.Split(' ').FirstOrDefault())
                {
                    tempList.Add(TarLine);
                }
                else if (fLineTxt.ToLower() == fLineTar.ToLower())
                {
                    tempList.Add(TarLine);
                }
                //  Txt Overrides
                else if (fLineTxt != fLineTar)
                {
                    //  Videos
                    if (TarLine.StartsWith("!!!"))
                    {
                        char[] separator   = "!!! ".ToCharArray();
                        string urlStripped = TarLine.Substring(11).Split(separator).FirstOrDefault();

                        tempList.Add(String.Format("VIDEO~{0}~{1}", TxtLine, urlStripped));
                    }
                    //  PageBreaks
                    if ((fLineTxt.Trim() == "$$$" && fLastTxt == fLastTar) || fNextTar == fNextTxt)
                    {
                        tempList.Add(TxtLine);
                    }
                    //  Quizzes
                    else if (fLineTxt.Contains(fLineTar))
                    {
                        string firstChar = fLineTxt.ElementAtOrDefault(0).ToString();
                        bool   isInt     = Int32.TryParse(firstChar, out int listNum);

                        if (isInt)
                        {
                            tempList.Add(TxtLine);
                        }
                        else
                        {
                            if (fLineTxt.Count() > fLineTar.Count())
                            {
                                tempList.Add(fLineTxt);
                            }
                            else
                            {
                                tempList.Add(fLineTar);
                            }
                        }
                    }
                }

                //  NOT EQUIVALENT LINES
                else
                {
                    for (j = i; j < TarList.Count(); j++)
                    {
                        TarLine = this.LinesList[j].ToString();
                        Console.Clear();
                        Display.FormatLinesCheck_Add(i, j, TarList, TxtList);
                        Console.WriteLine("Do you these Lines match?\n" +
                                          "'F': Yes, Next\n" +
                                          "'D': No, Insert Line: TxtList\n" +
                                          "'S': No, Insert Line: TarList\n" +
                                          "'A': Back 2 Lines\n" +
                                          "'G': Decrement 'Offset'");
                        Console.WriteLine();
                        var userChoice = Console.ReadKey();

                        try
                        {
                            if (ConsoleKey.F == userChoice.Key)
                            {
                                //NEXT
                                tempList.Add(this.LinesList[j]);
                                Console.WriteLine(" >> *Added*\n");
                                break;
                            }
                            else if (ConsoleKey.D == userChoice.Key)
                            {
                                //ADD Line: TxtList

                                TxtList.Insert(i, "^^^");
                                Console.WriteLine("*ADD to TXT* \n");
                            }
                            else if (ConsoleKey.S == userChoice.Key)
                            {
                                //ADD Line: TarList
                                TarList.Insert(j, "^^^");
                                Console.WriteLine("*ADD to TAR* \n");
                                //j = j - 2;
                            }
                            else if (ConsoleKey.A == userChoice.Key)
                            {
                                //RETARD HTML -1
                                //RETARD TXT  -1
                                j = j - 2;
                                i = i - 1;
                                Console.WriteLine("*BACK* \n");
                            }
                            else if (ConsoleKey.G == userChoice.Key)
                            {
                                i = i - 20;
                                break;
                            }
                            else
                            {
                                j = j - 1;
                                continue;
                            }
                        }
                        catch (Exception)
                        {
                            i--;
                            j--;
                            Console.WriteLine("~ Unrecognized Key ~\n");
                            throw;
                        }
                    }
                }
                j++;
            }
            _isolatedList     = tempList;
            this.IsolatedList = tempList;
        }
コード例 #10
0
ファイル: Read.cs プロジェクト: GatesKennedy/GK_ASP-NET
        //  CLEAN Reduce Lines of List<string>
        public static void CompareLinesList(Parse_Pop _ObjTarget, Parse_Pop _ObjTxt, out List <string> _isolatedList)
        {
            List <string> TarList  = _ObjTarget.LinesList;
            List <string> TxtList  = _ObjTxt.LinesList;
            List <string> tempList = new List <string>();
            int           offset   = 0;
            int           j        = 0;

            for (int i = 0; i < TxtList.Count(); i++)
            {
                Console.WriteLine("lineList" + i);
                string TxtLine = _ObjTxt.LinesList[i];
                string TarLine = _ObjTarget.LinesList[j + offset];

                if ((TarLine.StartsWith("<a") || TarLine.StartsWith("<p") || TarLine.StartsWith("<img")) && TarList[j + 1] == "")
                {
                    tempList.Add(TarLine);
                }
                else if (TarLine.StartsWith("<a") || TarLine.StartsWith("<p") || TarLine.StartsWith("<img"))
                {
                    if (TxtLine.Contains("Template"))
                    {
                        TarList.Insert(i, "^^^");
                    }
                    else if (TxtLine == "^^^")
                    {
                        tempList.Add(TarLine);
                    }
                    else if (!TarLine.Contains(TxtLine) && TxtLine != "")
                    {
                        TxtList.Insert(i + 1, "^^^");
                    }
                    else
                    {
                        tempList.Add(TarLine);
                    }
                }
                //else if (TarLine == "") TxtList.Insert(i, "^^^");
                else if (TxtLine == "")
                {
                    TarList.Insert(i, "^^^");
                }
                else if (TarLine != "" && TxtLine != "" && TarLine.Split(' ').FirstOrDefault() == TxtLine.Split(' ').FirstOrDefault())
                {
                    tempList.Add(TarLine);
                }
                else if (TarLine.ToLower() == TxtLine.ToLower())
                {
                    tempList.Add(TarLine);
                }
                else
                {
                    for (j = i; j < TarList.Count(); j++)
                    {
                        TarLine = _ObjTarget.LinesList[j + offset].ToString();
                        Console.Clear();
                        Display.FormatLinesCheck_Scroll(i, j + offset, TarList, TxtList);
                        Console.WriteLine("Do you want to Add the 'HTML " + j + "' to the Iso List?\n'F': Yes\n" +
                                          "'D': No\n'S': Back\n'A': Back 20 Lines\n'G': Decrement 'Offset'");
                        Console.WriteLine();
                        var userChoice = Console.ReadKey();

                        try
                        {
                            if (ConsoleKey.F == userChoice.Key)
                            {
                                //STORE Line
                                Console.WriteLine(" >> *Added*\n");
                                tempList.Add(_ObjTarget.LinesList[j]);
                                break;
                            }
                            else if (ConsoleKey.D == userChoice.Key)
                            {
                                //ADVANCE Offset +1
                                Console.WriteLine("*Ignored*");
                                j = j - 1;
                                offset++;
                            }
                            else if (ConsoleKey.S == userChoice.Key)
                            {
                                //RETARD HTML -1

                                j = j - 2;
                            }
                            else if (ConsoleKey.A == userChoice.Key)
                            {
                                //RETARD HTML -1
                                //RETARD TXT  -1
                                j = j - 2;
                                i = i - 1;
                            }
                            else if (ConsoleKey.G == userChoice.Key)
                            {
                                i = i - 20;
                                break;
                            }
                            else
                            {
                                j = j - 1;
                                continue;
                            }
                        }
                        catch (Exception)
                        {
                            i--;
                            j--;
                            Console.WriteLine("~ Unrecognized Key ~");
                            throw;
                        }
                    }
                }
                j++;
            }
            _isolatedList = tempList;
        }
コード例 #11
0
ファイル: Read.cs プロジェクト: GatesKennedy/GK_ASP-NET
        //=======================================================
        //  SubRead: Reduce Elements of 'textLines' to 'linesList'

        public void ReduceLines(Parse_Pop _readObject, string[] textLines, out List <string> LinesList)
        {
            int pageCount = 0;

            for (int i = 1; i < textLines.Length; i++)
            {
                //  Line is not empty
                if (textLines[i] != "")
                {
                    //  Line is the Start of a new Page
                    //if (textLines[i].Contains("1.") && textLines[i].Contains("<") && textLines[i].Contains(">"))

                    if (isPage(textLines[i]))
                    {
                        pageCount++;
                        textLines[i].Insert(0, "$$$");
                        _readObject.LinesList.Add("$$$ Page: " + pageCount.ToString() + " Line: " + i.ToString());  // New Page Symbol ($$$ pg#)
                    }

                    //  Submodules or Titleless Pages
                    if (textLines[i].Contains("SUBMODULE") || textLines[i].Contains("MODULE") || textLines[i].Trim() == "1.")
                    {
                        pageCount++;
                        textLines[i].Insert(0, "$$$ "); //  Prepend PageFlag ($$$) to line
                        _readObject.LinesList.Add(textLines[i] + " Page: " + pageCount.ToString());
                        //_readObject.LinesList.Add("$$$ Page: " + pageCount.ToString() + " Line: " + i.ToString());  // New Page Symbol ($$$ pg#)
                    }
                    else if ((textLines[i].Trim() == "<p>" || textLines[i].Trim() == "</p>") && textLines[i - 1] != "#")
                    {
                        textLines[i] = "#";
                        _readObject.LinesList.Add("#");  // New Field Symbol (#)
                    }
                    // Valid Text Content
                    else
                    {
                        //  Clean lines from html tags i.e. '</li>'
                        char[] webTag_1 = "<li>".ToCharArray();
                        char[] webTag_2 = "</li>".ToCharArray();
                        textLines[i].Trim(webTag_1);
                        textLines[i].Trim(webTag_2);

                        //  Add Clean Line to 'Object.LinesList' prop
                        _readObject.LinesList.Add(textLines[i].Trim()); // Text Content
                    }
                }
                //  Line is Empty
                else if (textLines[i] == "" && textLines[i - 1] != "#")
                {
                    textLines[i] = "#";
                    _readObject.LinesList.Add("#");  // New Field Symbol (#)
                }
                //  Redundant Line is Empty
                else if (textLines[i] == "" && textLines[i - 1] == "#")
                {
                    // Do Nothing
                }
            }

            //  Assign out-param Value
            LinesList = _readObject.LinesList;
        }
コード例 #12
0
        //  Displays Output Window and returns 
        public static List<List<StringBuilder>> Display_ToOutput(Parse_Pop _parseObj)
        {
            System.Diagnostics.Debug.WriteLine("Compiled PAGE COUNT: " + _parseObj.CompiledPages.Count());
            System.Diagnostics.Debug.WriteLine("List PAGE COUNT2: " + _parseObj.PageCount2);

            bool printCompare = false;
            bool printSection = false;
            bool printCompiled = true;

            //=========================================================
            //      Compare Single Pages (A and B)
            //=========================================================
            if (printCompare)
            {
                //  Print Page A
                System.Diagnostics.Debug.WriteLine("$$$$$$$$  PAGE A  $$$$$$$$$");
                int pageA = 786;
                int pageB = 787;

                //  Uncompiled Page A
                foreach (var line in _parseObj.PageList.ElementAt(pageA))
                {
                    System.Diagnostics.Debug.WriteLine(line);
                }
                //  Compiled Page A
                foreach (var field in _parseObj.CompiledPages.ElementAt(pageA))
                {
                    System.Diagnostics.Debug.WriteLine(field);
                }
                // Print Page B
                System.Diagnostics.Debug.WriteLine("$$$$$$$$  PAGE B  $$$$$$%$%$%$$");
                // Uncompiled Page B
                foreach (var line in _parseObj.PageList.ElementAt(pageB))
                {
                    System.Diagnostics.Debug.WriteLine(line);
                }
                //  Compiled Page B
                foreach (var field in _parseObj.CompiledPages.ElementAt(pageB))
                {
                    System.Diagnostics.Debug.WriteLine(field);
                }
                System.Diagnostics.Debug.WriteLine("$$$$$$$$$$  END SINGLE PAGE PRINT  $$$$$$$$$$");
            }

            //=========================================================
            //      Print Uncompiled Section of Pages (A-B)
            //=========================================================
            if (printSection)
            {
                int pageA = 783;
                int pageB = 788;
                int pageN = pageA;

                while (pageN <= pageB)
                {
                    System.Diagnostics.Debug.WriteLine("===============================");
                    foreach (var field in _parseObj.CompiledPages.ElementAt(pageN))
                    {
                        System.Diagnostics.Debug.WriteLine(field);
                    }
                    pageN++;
                }
                System.Diagnostics.Debug.WriteLine("$$$$$$$$$$  END SECTION PRINT  $$$$$$$$$$");
            }

            //=========================================================
            //      Print All Compiled Pages
            //=========================================================
            if (printCompiled)
            {
                //System.IO.File.Create(@"C:\Users\gates\OneDrive\Desktop");
                using (StreamWriter resultFile = new StreamWriter(@"C:\Users\gates\OneDrive\Desktop\CoolResult."))
                foreach (var page in _parseObj.SortedPages)
                {
                    System.Diagnostics.Debug.WriteLine("=============================");
                    foreach (var field in page)
                    {
                            resultFile.WriteLine(field.ToString());
                            System.Diagnostics.Debug.WriteLine(field);
                    }
                }
                System.Diagnostics.Debug.WriteLine("$$$$$$$$ END OF DISPLAY() $$$$$$%$%$%$$");
            }
            return _parseObj.SortedPages;
        }