text:
<repo_name>geper/Decision_tree<file_sep>/DecisionTrees/Drawing.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Accord.MachineLearning;
using Accord.MachineLearning.DecisionTrees;
using Accord.MachineLearning.DecisionTrees.Learning;
using System.IO;
using System.Windows.Forms;

namespace DecisionTrees
{
    class Drawing
    {
        StringBuilder str;
        List<string> dinosaurs = new List<string>();

        public Drawing()
        {
            str = new StringBuilder();
            dinosaurs.Add("Root");
            str.AppendLine("Root");
        }
        /// <summary>
        /// перебор дерева по веткам
        /// </summary>
        /// <param name="D_Node"></param>
        /// <param name="D_B_N_C"></param>
        /// <param name="l"></param>
        public void recursion(DecisionNode D_Node, DecisionBranchNodeCollection D_B_N_C, int l)
        {
            int j;
            if (D_B_N_C != null)
            {
                for (j = 0; j < D_B_N_C.Count; j++)
                {
                    dinosaurs.Add(D_B_N_C[j].ToString());
                    str.AppendLine(D_B_N_C[j].ToString());
                    recursion(D_B_N_C[j].Parent, D_B_N_C[j].Branches, j);
                }
                dinosaurs.Add("E");
                dinosaurs.Add(D_Node.ToString());

                str.AppendLine("E");
                str.AppendLine(D_Node.ToString());
            }
            str.AppendLine(D_Node.Branches[l].Output.ToString());
            dinosaurs.Add(D_Node.Branches[l].Output.ToString());

            dinosaurs.Add("WER");
            str.AppendLine("WER");
            dinosaurs.Add(D_Node.ToString());
            str.AppendLine(D_Node.ToString());

        }
        /// <summary>
        /// Сохранение в файл
        /// </summary>
        public void Save_()
        {
            StreamWriter sr;
            string filename = ".//Resources//recursion.txt";
            sr = new StreamWriter(filename);
            sr.Write(str);
            sr.Close();

            Search_on();
            Str_To_gv(dinosaurs);
        }
        /// <summary>
        /// техт то gv
        /// </summary>
        /// <param name="str_"></param>
        public void Str_To_gv(List <string> str_)
        {
            StringBuilder Str_out = new StringBuilder();
            Str_out.AppendLine("digraph G {");

                for (int i =0;i<str_.Count-1;i++)
                {
                    if (str_[i + 1] == "WER" && str_[i] != "WER" && str_[i] != "E" || str_[i + 1] == "E" && str_[i] != "WER" && str_[i] != "E")
                    {
                        Str_out.AppendLine("\"" + str_[i]  + "\"");
                        Str_out.AppendLine(";");
                    }
                     if (i + 1 == str_.Count && str_[i] != "WER" && str_[i] != "E")
                    {
                        Str_out.AppendLine("\"" + str_[i] + "\"");
                        Str_out.AppendLine(";");
                    }
                     if (str_[i] != "WER" && str_[i] != "E"&&str_[i + 1] != "WER" && str_[i + 1] != "E" )
                    {
                        Str_out.AppendLine("\""+ str_[i] +"\"");
                      Str_out.AppendLine("->");
                    }
                }
                Str_out.AppendLine("}");

                StreamWriter sr;
                string filename = ".//Resources//recursion.gv";
                sr = new StreamWriter(filename);
                sr.Write(Str_out);
                sr.Close();
                GV_TO_Png();
        }
        /// <summary>
        /// Удаляем совпадения
        /// </summary>
        public void Search_on()
        {
            int indfg=0;
            dinosaurs.RemoveAt(dinosaurs.Count-1);
            for (int l = 0; l < dinosaurs.Count; l++)
            {
                if (dinosaurs[l] == "")
                {
                    dinosaurs.RemoveAt(l);
                }
            }
            for (int j = 0; j < dinosaurs.Count; j++)
            {
                if (dinosaurs[j] == "WER")
                {
                    indfg=j;
                    for (int i = j+1; i < dinosaurs.Count; i++)
                    {
                        if (dinosaurs[i] == "WER")
                        {
                            indfg = 0;
                            break;
                        }
                        if (dinosaurs[i] == "E" || indfg + 1 == dinosaurs.Count)
                        {
                            dinosaurs.RemoveRange(indfg, i - indfg);
                            break;
                        }
                    }
                }
            }
            for (int z = 0; z < dinosaurs.Count; z++)
            {
                if (dinosaurs[z] == "Root" && z + 1 != dinosaurs.Count&&dinosaurs[z + 1] == "WER")
                {
                        dinosaurs.RemoveAt(z);

                }
                if (dinosaurs[z] == "Root" && z + 1 == dinosaurs.Count)
                {
                    dinosaurs.RemoveAt(z);
                }

            }
        }
        /// <summary>
        /// GV to Png
        /// </summary>
        public void GV_TO_Png()
        {

            System.Diagnostics.Process MyProc = new System.Diagnostics.Process();
            string adss = Path.Combine(Application.StartupPath, "Resources\\recursion.gv");
            string adss_png = Path.Combine(Application.StartupPath, "Resources\\recursion.png");
            MyProc.StartInfo.FileName = "dot.exe";
            try
            {
                MyProc.StartInfo.Arguments = @" -Tpng -o " + "\"" + adss_png + "\"" + " " + "\"" + adss + "\"";
            }
            catch (IOException e)
            {
                String s = e.Message;
            }
            MyProc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
            bool gj = MyProc.StartInfo.UseShellExecute;
            bool g = MyProc.Start();
        }
    }
}
<file_sep>/DecisionTrees/MainForm.cs
//Decision Trees

using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using Accord.MachineLearning;
using Accord.MachineLearning.DecisionTrees;
using Accord.MachineLearning.DecisionTrees.Learning;
using Accord.Math;
using Accord.Statistics.Analysis;
using Accord.Statistics.Formats;
using ZedGraph;
using System.Text;
using DecisionTrees;

namespace DecisionTrees
{
    public partial class MainForm : Form
    {
        /// <summary>
        /// отображенийе дерева
        /// </summary>
        Tree_View asd;

        /// <summary>
        /// параметры построения дерева
        /// </summary>
        Property_Tree Tree_property;

       /// <summary>
       /// Дерево решений
       /// </summary>
        private DecisionTree tree;

        string[] sourceColumns;

        /// <summary>
        /// Инициализация
        /// </summary>
        public MainForm()
        {
            InitializeComponent();

            dgvLearningSource.AutoGenerateColumns = true;
            dgvPerformance.AutoGenerateColumns = false;
            Tree_property = new Property_Tree();

            asd = new Tree_View();
            openFileDialog.InitialDirectory = Path.Combine(Application.StartupPath, "Resources");

            toolTip1.SetToolTip(groupBox1, "+/- раскрыть/скрыть узел \n*-раскрыть полностью ветвь");
        }

        internal Drawing Drawing
        {
            get
            {
                throw new System.NotImplementedException();
            }
            set
            {
            }
        }
        /// <summary>
        /// Импорт .xls
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MenuFileOpen_Click(object sender, EventArgs e)
        {
            #region загрузка пользователем XLS
            //if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            //{
            //    string filename = openFileDialog.FileName;
            //    string extension = Path.GetExtension(filename);
            //    if (extension == ".xls" || extension == ".xlsx")
            //    {
            //        ExcelReader db = new ExcelReader(filename, true, false);
            //        TableSelectDialog t = new TableSelectDialog(db.GetWorksheetList());

            //        if (t.ShowDialog(this) == DialogResult.OK)
            //        {
            //            DataTable tableSource = db.GetWorksheet(t.Selection);

            //            double[,] sourceMatrix = tableSource.ToMatrix(out sourceColumns);

            //            // Detect the kind of problem loaded.
            //            if (sourceMatrix.GetLength(1) == 2)
            //            {
            //                MessageBox.Show("Недостаточно данных");
            //            }
            //            else
            //            {
            //                this.dgvLearningSource.DataSource = tableSource;
            //                this.dgvTestingSource.DataSource = tableSource.Copy();

            //               // CreateScatterplot(graphInput, sourceMatrix);
            //            }
            //        }
            //    }
            //}
            #endregion
            #region быстрая загрузка
            string filename = ".//Resources//3.xls";

            string extension = Path.GetExtension(filename);

            ExcelReader db = new ExcelReader(filename, true, false);
            //ЛИСТЫ
            string[] sd = db.GetWorksheetList();

            TableSelectDialog t = new TableSelectDialog(sd);

            if (t.ShowDialog(this) == DialogResult.OK)
            {
                //заставка импорт
                System.Windows.SplashScreen splashScreen = new System.Windows.SplashScreen("2.png");
                splashScreen.Show(true);

                DataTable tableSource = db.GetWorksheet(t.Selection);
                double[,] sourceMatrix = tableSource.ToMatrix(out sourceColumns);
                if (sourceMatrix.GetLength(1) == 2)
                {
                    MessageBox.Show("Недостаточно данных");
                }
                else
                {
                    this.dgvLearningSource.DataSource = tableSource;
                    this.dgvTestingSource.DataSource = tableSource.Copy();
                    // CreateScatterplot(graphInput, sourceMatrix);
                }
            }
            # endregion
        }
        /// <summary>
        /// Создание дерева
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCreate_Click(object sender, EventArgs e)
        {

            try
            {
                if (dgvLearningSource.DataSource == null)
                {
                    MessageBox.Show("Загрузите данные");
                    return;
                }
                if (Tree_property.Property_View == true)
                {
                    Tree_property.ShowDialog();
                }
                // Завершаем операцию с DataGridView
                dgvLearningSource.EndEdit();

                #region Алгоритм С4.5
                ///
                ///Алгоритм С4.5
                ///
                if (Tree_property.Alg == "C4.5")
                {
                    // // создаем матрицу из  data table
                    double[,] sourceMatrix = (dgvLearningSource.DataSource as DataTable).ToMatrix(out sourceColumns);

                    C45Learning c45;

                    // получаем входные значения
                    double[][] inputs = sourceMatrix.Submatrix(null, 0, Tree_property.Coun_In - 1).ToArray();

                    // получаем выходные значения
                    int[] outputs = sourceMatrix.GetColumn(Tree_property.Coun_Out - 1).ToInt32();

                    DecisionVariable[] attributes = new DecisionVariable[Tree_property.Coun_In];

                    for (int j = 0; j < Tree_property.Coun_In; j++)
                    {
                        attributes[j] = new DecisionVariable(dgvLearningSource.Columns[j].Name, DecisionAttributeKind.Continuous);
                    }

                    // создаем дерево решений
                    tree = new DecisionTree(attributes, 60);

                    c45 = new C45Learning(tree);
                    double error = c45.Run(inputs, outputs);
                }
                #endregion

                #region Алгоритм ID3
                ///
                ///Алгоритм ID3
                ///
                if (Tree_property.Alg == "ID3")
                {
                    // создаем матрицу из дататыйбл
                    int[][] arr = (dgvLearningSource.DataSource as DataTable).ToIntArray(sourceColumns);
                    int[,] sourceMatrix = arr.ToMatrix();

                    //// получаем входные значения

                    int[][] inputs = sourceMatrix.Submatrix(null, 0, Tree_property.Coun_In - 1).ToArray();

                    //// получаем выходные значения
                    int[] outputs = sourceMatrix.GetColumn(Tree_property.Coun_In - 1);

                    DecisionVariable[] attributes = new DecisionVariable[Tree_property.Coun_In];

                    for (int j = 0; j < Tree_property.Coun_In; j++)
                    {
                        attributes[j] = new DecisionVariable(j.ToString(), DecisionAttributeKind.Continuous);
                    }

                    // создаем дерево решений
                    tree = new DecisionTree(attributes, 60);

                    ID3Learning id3learning = new ID3Learning(tree);

                    double error = id3learning.Run(inputs, outputs);

                }
                #endregion

                asd.Dispose();
                asd.Close();

                Drawing dr = new Drawing();

                dr.recursion(tree.Root, tree.Root.Branches, 0);
                dr.Save_();

                asd = new Tree_View();
                asd.userControl11.Load_f(Application.StartupPath);

                System.Linq.Expressions.Expression df = tree.ToExpression();

               // выбираем tabe page для просмотра дерева
                tabControl.SelectTab(tabOverview);

                // отображаем построенной дереыыо решений
                decisionTreeView1.TreeSource = tree;

                try
                {
                    File.Copy(@".\Resources\recursion.png", @".\Resources\recursion2.png", true);
                }
                catch
                {
                }
                using (Stream s = File.OpenRead(@".\Resources\recursion2.png"))
                {
                    pictureBox1.Image = Image.FromStream(s);
                }

            }
            catch (Exception t)
            {
                MessageBox.Show(t.Message);
            }
        }
       private void btnTestingRun_Click(object sender, EventArgs e)
        {
            if (tree == null || dgvTestingSource.DataSource == null)
            {
                MessageBox.Show("Постройте дерево решений в первую очередь.");
                return;
            }

            //создаем матрицу из  data table
            double[,] sourceMatrix = (dgvLearningSource.DataSource as DataTable).ToMatrix();

           //получаем входные значения
            double[][] inputs = sourceMatrix.Submatrix(null, 0, Tree_property.Coun_In - 1).ToArray();

            //получаем вsходные значения
            int[] expected = new int[sourceMatrix.GetLength(0)];
            for (int i = 0; i < expected.Length; i++)
                expected[i] = (int)sourceMatrix[i, Tree_property.Coun_Out - 1];

            // вычисление
            int[] output = new int[inputs.Length];
            for (int i = 0; i < inputs.Length; i++)
                output[i] = tree.Compute(inputs[i]);

            // Использование матрицы неточностей вычислить  статистические данные.
            ConfusionMatrix confusionMatrix = new ConfusionMatrix(output, expected, 1, 0);
            dgvPerformance.DataSource = new List<ConfusionMatrix> { confusionMatrix };

            foreach (DataGridViewColumn col in dgvPerformance.Columns)
                col.Visible = true;
            Column1.Visible = Column2.Visible = false;

           CreateResultScatterplot(zedGraphControl1, inputs, expected.ToDouble(), output.ToDouble());
        }
        public void CreateScatterplot(ZedGraphControl zgc, double[,] graph)
        {
            GraphPane myPane = zgc.GraphPane;
            myPane.CurveList.Clear();

            // устанавливаем titles
            myPane.Title.IsVisible = false;
            myPane.XAxis.Title.Text = sourceColumns[0];
            myPane.YAxis.Title.Text = sourceColumns[1];

            PointPairList list1 = new PointPairList(); // Z = 0
            PointPairList list2 = new PointPairList(); // Z = 1
            for (int i = 0; i < graph.GetLength(0); i++)
            {
                if (graph[i, 2] == 0)
                    list1.Add(graph[i, 0], graph[i, 1]);
                if (graph[i, 2] == 1)
                    list2.Add(graph[i, 0], graph[i, 1]);
            }

            // Add the curve
            LineItem myCurve = myPane.AddCurve("G1", list1, Color.Blue, SymbolType.Square);
            myCurve.Line.IsVisible = false;
            myCurve.Symbol.Border.IsVisible = false;
            myCurve.Symbol.Fill = new Fill(Color.Blue);

            myCurve = myPane.AddCurve("G2", list2, Color.Green, SymbolType.Square);
            myCurve.Line.IsVisible = false;
            myCurve.Symbol.Border.IsVisible = false;
            myCurve.Symbol.Fill = new Fill(Color.Green);

            //myPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45.0f);
            //myPane.Fill = new Fill(Color.White, Color.SlateGray, 45.0f);
            myPane.Fill = new Fill(Color.WhiteSmoke);

            zgc.AxisChange();
            zgc.Invalidate();
        }
        public void CreateResultScatterplot(ZedGraphControl zgc, double[][] inputs, double[] expected, double[] output)
        {
            GraphPane myPane = zgc.GraphPane;
            myPane.CurveList.Clear();

            myPane.Title.IsVisible = false;
            myPane.XAxis.Title.Text = sourceColumns[0];
            myPane.YAxis.Title.Text = sourceColumns[1];

            PointPairList list1 = new PointPairList(); // Z = 0, OK
            PointPairList list2 = new PointPairList(); // Z = 1, OK
            PointPairList list3 = new PointPairList(); // Z = 0, Error
            PointPairList list4 = new PointPairList(); // Z = 1, Error
            for (int i = 0; i < output.Length; i++)
            {
                if (output[i] == 0)
                {
                    if (expected[i] == 0)
                        list1.Add(inputs[i][0], inputs[i][1]);
                    if (expected[i] == 1)
                        list3.Add(inputs[i][0], inputs[i][1]);
                }
                else
                {
                    if (expected[i] == 0)
                        list4.Add(inputs[i][0], inputs[i][1]);
                    if (expected[i] == 1)
                        list2.Add(inputs[i][0], inputs[i][1]);
                }
            }

            LineItem
            myCurve = myPane.AddCurve("G1 Hits", list1, Color.Blue, SymbolType.Diamond);
            myCurve.Line.IsVisible = false;
            myCurve.Symbol.Border.IsVisible = false;
            myCurve.Symbol.Fill = new Fill(Color.Blue);

            myCurve = myPane.AddCurve("G2 Hits", list2, Color.Green, SymbolType.Diamond);
            myCurve.Line.IsVisible = false;
            myCurve.Symbol.Border.IsVisible = false;
            myCurve.Symbol.Fill = new Fill(Color.Green);

            myCurve = myPane.AddCurve("G1 Miss", list3, Color.Blue, SymbolType.Plus);
            myCurve.Line.IsVisible = false;
            myCurve.Symbol.Border.IsVisible = true;
            myCurve.Symbol.Fill = new Fill(Color.Blue);

            myCurve = myPane.AddCurve("G2 Miss", list4, Color.Green, SymbolType.Plus);
            myCurve.Line.IsVisible = false;
            myCurve.Symbol.Border.IsVisible = true;
            myCurve.Symbol.Fill = new Fill(Color.Green);

            //myPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45.0f);
            //myPane.Fill = new Fill(Color.White, Color.SlateGray, 45.0f);
            myPane.Fill = new Fill(Color.WhiteSmoke);

            zgc.AxisChange();
            zgc.Invalidate();
        }
        private void process1_Exited(object sender, EventArgs e)
        {
        }

        private void toolStripMenuItem5_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        /// <summary>
        /// О программе
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripMenuItem7_Click(object sender, EventArgs e)
        {
            AboutBox1 About = new AboutBox1();
            About.AccessibleDescription = "Программа для построения деревьев решений";
            About.ShowDialog();
        }

        /// <summary>
        ///  Просмотреть дерево
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            asd.Visible = true;
        }
        /// <summary>
        /// Показать окно свойств для построения дерева
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void показатьОкноToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Tree_property.ShowDialog();
        }
        /// <summary>
        /// Экспорт картинки
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripMenuItem4_Click(object sender, EventArgs e)
        {
            saveFileDialog1.Filter = "Files png (*.png)|*.png|All files (*.*)|*.*";
            saveFileDialog1.FilterIndex = 2;
            saveFileDialog1.RestoreDirectory = true;
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string adss_png = Path.Combine(Application.StartupPath, "Resources\\recursion.png");
                string filename = saveFileDialog1.FileName;
                try
                {
                    File.Copy(adss_png, filename, true);
                }
                catch (Exception a)
                {
                    string h = a.Message;
                }
            }
        }
        private void toolStripMenuItem3_Click(object sender, EventArgs e)
        {

        }

        private void toolTip1_Popup(object sender, PopupEventArgs e)
        {
            e.ToolTipSize = new Size(200, 70);
            var s = e.AssociatedControl;
        }

        private void decisionTreeView1_MouseEnter(object sender, EventArgs e)
        {

        }

        private void groupBox1_Enter(object sender, EventArgs e)
        {

        }
    }
}
<file_sep>/DecisionTrees/bin/Debug/Resources/recursion.gv
digraph G {
"Root"
->
"чашелистик ширина в см <= 3,3"
->
"чашелистиков длиной <= 5,1"
->
"лепесток длиной в см <= 2,45"
->
"1"
;
"чашелистиков длиной <= 5,1"
->
"лепесток длиной в см > 2,45"
->
"лепесток ширина в см <= 1,4"
->
"0"
;
"лепесток длиной в см > 2,45"
->
"лепесток ширина в см > 1,4"
->
"3"
;
"чашелистиков длиной <= 5,1"
;
"чашелистик ширина в см <= 3,3"
;
"чашелистик ширина в см <= 3,3"
->
"чашелистиков длиной > 5,1"
->
"лепесток длиной в см <= 4,75"
->
"0"
;
"чашелистиков длиной > 5,1"
->
"лепесток длиной в см > 4,75"
->
"лепесток ширина в см <= 1,7"
->
"0"
;
"лепесток длиной в см > 4,75"
->
"лепесток ширина в см > 1,7"
->
"3"
;
"чашелистиков длиной > 5,1"
;
"чашелистик ширина в см <= 3,3"
;
"Root"
->
"чашелистик ширина в см > 3,3"
->
"чашелистиков длиной <= 5,8"
->
"1"
;
"чашелистик ширина в см > 3,3"
->
"чашелистиков длиной > 5,8"
->
"лепесток длиной в см <= 4,5"
->
"0"
;
"чашелистиков длиной > 5,8"
->
"лепесток длиной в см > 4,5"
->
"3"
;
"чашелистик ширина в см > 3,3"
;
"Root"
;
}
<file_sep>/DecisionTrees/Property_Tree.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace DecisionTrees
{
    /// <summary>
    /// Окно параметров построения дерева решений
    /// </summary>
    public partial class Property_Tree : Form
    {
        #region параметры
        /// <summary>
        /// Алгоритм построения дерева решений
        /// </summary>
        public String Alg;

        /// <summary>
        /// Количество входных параметров
        /// </summary>
        public int Coun_In;

        /// <summary>
        /// Количество выходных параметров
        /// </summary>
        public int Coun_Out;

        /// <summary>
        /// Показывать окно или нет
        /// </summary>
        public bool Property_View;

        #endregion
        /// <summary>
        /// Инициализация
        /// </summary>
        public Property_Tree()
        {
            InitializeComponent();
            Alg_Tree.SelectedIndex = 0;
            Property_View = true;
            Load_P();

            toolTip1.SetToolTip(numericUpDown_Out, "введите элемент считая \n пробировать в селпрор");
        }
        private void Property_Tree_Load(object sender, EventArgs e)
        {
            checkBox1.Checked =! Property_View;

           Alg_Tree.Items[Alg_Tree.SelectedIndex] = Alg;
           numericUpDown_In.Text=Coun_In.ToString();
           numericUpDown_Out.Text=Coun_Out.ToString();

        }
        /// <summary>
        /// Сохранение в файл
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Save_P_Click(object sender, EventArgs e)
        {
            StreamWriter sr;
            string filename = ".//Resources//Property.txt";
            sr = new   StreamWriter (filename);
            sr.WriteLine(Alg_Tree.Items[Alg_Tree.SelectedIndex]);
            sr.WriteLine(numericUpDown_In.Text);
            sr.WriteLine(numericUpDown_Out.Text);
            sr.Close();
        }
        /// <summary>
        /// Чтение параметров из файла
        /// </summary>
        private void Load_P()
        {
            try
            {
                StreamReader sr;
                string filename = ".//Resources//Property.txt";
                sr = new StreamReader(filename, Encoding.GetEncoding(1251));

                Alg = sr.ReadLine();
                Coun_In = Convert.ToInt32(sr.ReadLine());
                Coun_Out = Convert.ToInt32(sr.ReadLine());

                sr.Close();

                View();
            }
            catch
            {
                MessageBox.Show("Файл ненайден");
            }
        }
        /// <summary>
        /// Отображаем в компонентах параметры
        /// </summary>
        private void View()
        {
            numericUpDown_Out.Text = Coun_Out.ToString();
            numericUpDown_In.Text = Coun_In.ToString();
            for (int j = 0; j < Alg_Tree.Items.Count; j++)
            {
                if (Alg_Tree.Items[j].ToString() == Alg)
                {
                    Alg_Tree.SelectedIndex = j;
                }
            }
        }
        /// <summary>
        /// Возврат к главному окну
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Continyu_Click(object sender, EventArgs e)
        {

            Property_View = !checkBox1.Checked;
            Alg = Alg_Tree.Items[Alg_Tree.SelectedIndex].ToString();
            Coun_In = Convert.ToInt32(numericUpDown_In.Text);
            Coun_Out = Convert.ToInt32(numericUpDown_Out.Text);
            this.Close();
        }

        private void toolTip1_Popup(object sender, PopupEventArgs e)
        {
            e.ToolTipSize = new Size(100, 50);
            var s= e.AssociatedControl;
            if (s != null)
            {
            }
        }
    }
}
<file_sep>/DecisionTrees/bin/Release/Resources/recursion.gv
digraph G {
"Root"
->
"чашелистик ширина в см <= 3,3"
->
"чашелистиков длиной <= 5,1"
->
"лепесток длиной в см <= 2,453"
;
"чашелистиков длиной <= 5,1"
->
"лепесток длиной в см > 2,45"
->
"лепесток ширина в см <= 1,47"
;
"лепесток длиной в см > 2,45"
->
"лепесток ширина в см > 1,410"
;
"чашелистик ширина в см <= 3,3"
->
"чашелистиков длиной > 5,1"
->
"лепесток длиной в см <= 4,7516"
;
"чашелистиков длиной > 5,1"
->
"лепесток длиной в см > 4,75"
->
"лепесток ширина в см <= 1,720"
;
"лепесток длиной в см > 4,75"
->
"лепесток ширина в см > 1,723"
;
"Root"
->
"чашелистик ширина в см > 3,3"
->
"чашелистиков длиной <= 5,830"
;
"чашелистик ширина в см > 3,3"
->
"чашелистиков длиной > 5,8"
->
"лепесток длиной в см <= 4,534"
;
"чашелистиков длиной > 5,8"
->
"лепесток длиной в см > 4,537"
;
}
<file_sep>/DecisionTrees/UserControl1.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using System.IO;

using WPFExtensions;
using System.Net.Cache;

namespace DecisionTrees
{

    /// <summary>
    /// Загрузка дерева
    /// </summary>
    public partial class UserControl1 : UserControl
    {

        int g;

        public UserControl1()
        {
            InitializeComponent();
            g = this.GetHashCode();

        }
        public void Load_f(string str)
        {
            // Create source.
            BitmapImage bi = new BitmapImage();

            string adss_png = System.IO.Path.Combine(str, "Resources\\recursion.png");
            string to_adss_png = System.IO.Path.Combine(str, "Resources\\recursion1.png");
          //  string adss_png = System.IO.Path.Combine( ".\\Resources\\recursion.png");
          //  string to_adss_png = System.IO.Path.Combine(".\\Resources\\recursion1.png");

            image1.Source = null;

           // bi.BeginInit();
           // bi.
           //// bi.UriSource = new Uri("");
           // bi.EndInit();

            try
            {
                File.Copy(adss_png, to_adss_png, true);
            }
            catch (Exception e)
            {
                string g =e.Message;
            }

            // File.Delete(".\\Resources\\recursion1.png");
            bi.BeginInit();
            bi.CacheOption=BitmapCacheOption.OnLoad;
            bi.UriSource = new Uri(to_adss_png);
            // Tells the networking code to ignore the download cache
            bi.UriCachePolicy = new RequestCachePolicy(RequestCacheLevel.BypassCache);
            // Tells our Uri cache to ignore the image we already have for this Uri
            bi.CreateOptions = BitmapCreateOptions.IgnoreImageCache;

            bi.EndInit();

            image1.Source = bi;

           // image1.Source = null;
           // bi.UriSource = null;

        }

        private void image1_Unloaded(object sender, RoutedEventArgs e)
        {
            image1.Source = null;

        }

    }
}
<file_sep>/README.md
Decision_tree-
==============

Decision_tree <file_sep>/DecisionTrees/TableSelectDialog.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DecisionTrees
{
    public partial class TableSelectDialog : Form
    {

        public TableSelectDialog(string[] tables)
        {
            InitializeComponent();

            this.listBox1.DataSource = tables;
        }

        public string Selection
        {
            get { return this.listBox1.SelectedItem as string; }
        }
    }
}<file_sep>/DecisionTrees/Tree_View.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DecisionTrees
{
    /// <summary>
    /// Просмотр дерева
    /// </summary>
    public partial class Tree_View : Form
    {
        public Tree_View()
        {
            InitializeComponent();

        }
       /// <summary>
       /// Блокируем кнопку закрытия главного окна
       /// </summary>
        private const int CP_NOCLOSE_BUTTON = 0x200;
        protected override CreateParams CreateParams
        {
            get
            {
                CreateParams myCp = base.CreateParams;
                myCp.ClassStyle = myCp.ClassStyle | CP_NOCLOSE_BUTTON;
                return myCp;
            }
        }

        public UserControl1 UserControl1
        {
            get
            {
                throw new System.NotImplementedException();
            }
            set
            {
            }
        }
    /// <summary>
    /// Продолжить:скрыть форму
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            Visible = false;
        }
        /// <summary>
        /// закрытие окна свойств
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Tree_View_FormClosing(object sender, FormClosingEventArgs e)
        {
            userControl11.image1.Source = null;
            this.Dispose(true);
        }

    }
}

languages:
C#
Markdown
Graphviz (DOT)

repo_language: C#


text:
<repo_name>sergem155/wikibook<file_sep>/WikiBookLocalSettings.php
<?php
wfLoadExtension( 'CanonicalNamespace' );
$wgCanonicalNamespaceName = 'latest';
$wgLatestNamespaceName = '5.3';
wfLoadExtension( 'SuperPageTOC' );
wfLoadExtension( 'NamespaceLocalLinks' );
wfLoadExtension( 'BookExport' );
wfLoadExtension( 'ListArticleNamespaces' );
wfLoadExtension( 'WikibookBreadcrumbs' );
<file_sep>/extensions/WikibookBreadcrumbs/WikibookBreadcrumbs.class.php
<?php

/* Copyright 2018 <NAME>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */

class WikibookBreadcrumbs {

	// register tag
	public static function onParserSetup( Parser $parser ) {
		$parser->setHook( 'wikibook-breadcrumbs', 'WikibookBreadcrumbs::renderTag' );
	}

	// render tag
	public static function renderTag( $input, array $args, Parser $parser, PPFrame $frame ) {
		$title = $parser->getTitle();
		$linkRenderer = $parser->getLinkRenderer();
		$tuple = self::getHeadingTextAndFirstLink($title);
		$parent = self::findSuperpage($title);
		$output = "
";
		$output = "
".$tuple[0]."
".$output;
		while($parent){
			$tuple = self::getHeadingTextAndFirstLink($parent);
			if($tuple){
				$link_title =  Title::newFromText($parent->getNsText().':'.$tuple[1]);
				if($link_title){
					$link = 'getLinkURL().'">'.$tuple[0].'';
					$output = "
$link
".$output;
				}else
					$output = "
Broken TOC:".$parent->getText()."
".$output;
			}else
				$output = "
a book
".$output;
			$parent = self::findSuperpage($parent);
		}
		return '
'.$output;
	}

	public static function findSuperpage($title){
		if(!$title->isSubpage())
			return null;
		// find a superpage, if exists
		$doc = $title->getFullText();
		//echo "SUPERPAGE FOR: ".$doc;
		$page_lang_code = $title->getPageLanguage()->getCode();
		// strip lang superpage suffix
		$langsuffix="";
		$langsuffix_len = strlen($page_lang_code)+1;
		if(substr($doc, -$langsuffix_len) === ('/'.$page_lang_code)){
			$doc = substr($doc,0,-$langsuffix_len);
			$langsuffix = '/'.$page_lang_code;
		}
		// find a parent
		$separator_pos = strrpos($doc,'/');
		if($separator_pos < 1) // calling not from a subpage
			return null;
		$superpage_doc = substr($doc, 0, $separator_pos);
		// see if there is a language-specific version of the superpage (only if page had the suffix)
		if($langsuffix){
			$link_lang_title = Title::newFromText($superpage_doc.$langsuffix);
			if($link_lang_title->exists())
				$superpage_doc .= $langsuffix;
		}
		// get the superpage
		$superpage = Title::newFromText($superpage_doc);
		return $superpage;
	}

	public static function getHeadingTextAndFirstLink($title){
		$article = new Article($title);
		$heading = "";
		$url = "";
		if($article){
			$text = ContentHandler::getContentText( $article->getPage()->getContent() );
			if($text){
				if(preg_match("/=+([^=]+)=+/", $text, $matches)){
					$heading = $matches[1];
				}
				if(preg_match("/\[\[([^\|]+)\|?.*\]\]/",$text,$matches)==1){
					$url = $matches[1];
				}
				return array($heading,$url);
			}
		}
		return null;
	}
}

?>
<file_sep>/extensions/NamespaceLocalLinks/NamespaceLocalLinks.class.php
<?php

/* Copyright 2018 <NAME>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */

class NamespaceLocalLinks {
	public static function onParserBeforeStrip( &$parser, &$text, &$strip_state ) {
		global $wgExtraNamespaces, $wgContLang;
		$title = $parser->getTitle();
		// only do this for pages, and only for those in custom namespaces
		if(empty($title) || !array_key_exists($title->getNamespace(),$wgExtraNamespaces)) {
			return true;
		}
		// check if page is translated, come up with lang suffix
		$langSuffix = false;
		$pageLang = $title->getPageLanguage()->getCode();
		if($pageLang !=  $wgContLang->getCode()){ // page lang != sitewide lang, need suffixes for all links
			$langSuffix = "/".$pageLang;
		}
		// for all links without a colon in URL part, do replacement
		if( preg_match_all(
						"/\[\[([A-Za-z0-9,.\/_ \(\)-]+)(\#[A-Za-z0-9 ._-]*)?([|](.*?))?\]\]/",
						$text,
						$matches,
						PREG_SET_ORDER ) ) {
			foreach ( $matches as $match ) {
				// see if language variant exists
				$linkDoc = trim($title->getSubjectNsText().":".$match[1]);
				if($langSuffix){
					$linkLangTitle = Title::newFromText($linkDoc.$langSuffix);
					if($linkLangTitle->exists())
						$linkDoc .= $langSuffix;
				}
				// replace link
				$text =	str_replace($match[0], "[[".$linkDoc.$match[2].$match[3]."]]", $text );
			}
			return true;
		}
	}

	public static function onInitializeArticleMaybeRedirect( $title, $request, &$ignoreRedirect, &$target, $article ) {
		$text = ContentHandler::getContentText( $article->getPage()->getContent() );
		if(preg_match("/^#REDIRECT\s+\[\[\s*(.*)\s*\]\]/",$text,$matches)){
			$link = $matches[1];
			if(strstr($link,":")) return; // main namespace or explicit namespace specification
			// check if page is translated, come up with lang suffix
			$langSuffix = false;
			$pageLang = $title->getPageLanguage()->getCode();
			if($pageLang != $wgLanguageCode){ // page lang != sitewide lang, need suffixes for all links
				$langSuffix = "/".$pageLang;
			}
			// get namespace-local title
			$linkDoc = trim($title->getSubjectNsText().":".$link);
			if($langSuffix){
				$linkLangTitle = Title::newFromText($linkDoc.$langSuffix);
				if($linkLangTitle->exists()){
					$target = $linkLangTitle;
					return;
				}
			}
			$target = Title::newFromText($linkDoc);
		}
	}

	public static function onHtmlPageLinkRendererBegin($linkRenderer, $target, &$text, &$extraAttribs, &$query, &$ret ) {
		// TODO: "unbreak" namespace-local links
	}

}
?>
<file_sep>/extensions/CanonicalNamespace/CanonicalNamespace.class.php
<?php

/* Copyright 2018, 2019 <NAME>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */

class CanonicalNamespace {

	public static function onBeforeDisplayNoArticleText($article) {
		global $wgCanonicalNamespaceName, $wgLatestNamespaceName;
		$prefix = $wgCanonicalNamespaceName.':';
		$title = $article->getTitle();
		if(strcasecmp(substr($title->getText(), 0, strlen($prefix)),$prefix)==0){
			$r_title = Title::newFromText($wgLatestNamespaceName . ':' . substr($title->getText(), strlen($prefix)));
			header('HTTP/1.1 302 Moved Temporarily');
			header('Location: ' . $r_title->getLocalURL() );
		}
	}

	public static function onBeforePageDisplay( OutputPage &$out, Skin &$skin ) {
		global $wgExtraNamespaces, $wgCanonicalNamespaceName;
		$title = $skin->getTitle();
		if(array_key_exists($title->getNamespace(), $wgExtraNamespaces)){
			// $r_title = Title::newFromText($wgCanonicalNamespaceName . ':' . $title->getText());
			// $out->setCanonicalUrl($r_title->getFullURL());
			if($title->getNamespace() != 208){
				$out->setCanonicalUrl("https://help.brightpattern.com/Latest:".$title->getText());
			}else{
				$out->setCanonicalUrl("https://help.brightpattern.com/draft:".$title->getText());
			}
		}
	}
}
?>
<file_sep>/extensions/ListArticleNamespaces/ListArticleNamespaces.class.php
<?php

/* Copyright 2018 <NAME>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */

class ListArticleNamespaces {

	// register tag
	public static function onParserSetup( Parser $parser ) {
		$parser->setHook( 'list-article-namespaces', 'ListArticleNamespaces::renderTag' );
	}

	// render tag
	public static function renderTag( $input, array $args, Parser $parser, PPFrame $frame ) {
		global $wgExtraNamespaces, $wgUser, $wgWhitelistReadRegexp;
		$loggedIn = $wgUser->isSafeToLoad() && $wgUser->isLoggedIn();
		$title = $parser->getTitle();
		$titleText = $title->getText(); // without namespace
		$nsText = $title->getNsText();
		$output = "
";
		$nslist = array();
		foreach ($wgExtraNamespaces as $index => $namespaceName){
			if($index&1) continue; // skip discussion namespaces
			$nslist[] = $namespaceName;
		}
		usort($nslist,'strcasecmp');
		foreach ($nslist as $namespaceName){
			if($index&1) continue; // skip discussion namespaces
			$possibleTitle = Title::newFromText($namespaceName.':'.$titleText);
			if($possibleTitle->exists()){
				$url = $possibleTitle->getFullUrl();
				// do not show non-whitelisted URLs
				if(!$loggedIn){
					$fullText = $possibleTitle->getFullText();
					$whitelisted = false;
					foreach ( $wgWhitelistReadRegexp as $listItem ) {
						if ( preg_match( $listItem, $fullText ) ) {
							$whitelisted = true;
							break;
						}
					}
					if(!$whitelisted) continue;
				}
				if($namespaceName == $nsText)
					$output .= "• $namespaceName ";
				else
					$output .= "• $namespaceName ";
			}
		}
		return $output."
";
	}
}

?>
<file_sep>/extensions/SuperPageTOC/SuperPageTOC.class.php
<?php

/* Copyright 2018 <NAME>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */

class SuperPageTOC {

	private static $mLevel;
	private static $mHeading; // last heading found - toplevel document's first h1
	private static $mBoolFlag;
	private static $mNamespace;
	private static $mCurrentLink;
	private static $mBoolTopicFound;
	private static $mContLangCode;
	private static $mPageLangCode;

	public static function onParserBeforeStrip( &$parser, &$text, &$strip_state ) {
		global $wgRequest;
		$title = $parser->getTitle();
		// only do this for pages
		if(empty($title)) {
			return true;
		}
		$action = $wgRequest->getVal('action','view');
		if (($action == ('view' || 'print' || 'purge' || null)) && ($parser->getOptions()->getEnableLimitReport())) {
			static $hasRun = false;
			if ($hasRun) return true;
			$hasRun = true;
			// ensure TOC is always shown
			$text = "__FORCETOC__\r\n".$text;
			$text = "<languages/><list-article-namespaces/>\n".$text; # show language bar for pages subject to translation
			// add /prevnext/ ? only from subpages
			$doc = $title->getFullText();
			$separator_pos = strpos($doc,'/');
			if($separator_pos > 1){ // calling from a subpage
				$text .= "/prevnext/";
			}
			return true;
		}
		return true;
	}

	public static function onParserAfterParse( &$parser, &$text, &$stripState ) {
		global $wgContLang;
		$tocText = $parser->mOutput->getTOCHTML();
		// if there is a TOC and we are not printing - substitute with a new TOC
		if(strlen($tocText) > 0 and !$parser->getOptions()->getIsPrintable()){
			$title = $parser->getTitle();
			if(empty($title))
				return true;
			// memorize lang codes
			self::$mNamespace = $title->getSubjectNsText();
			self::$mPageLangCode = $title->getPageLanguage()->getCode();
			self::$mContLangCode = $wgContLang->getCode();
			// build the TOC list
			self::$mHeading = self::findHeadingTextFromTitle($title);
			$tocList = self::generateSuperPageTocList($title, self::$mHeading, [['level'=>1,'title'=>1,'link'=>1]]);
			//
			$level=1;
			$section=1;
			$newTocText = "".'
'.self::$mHeading."
";
			$prev = false;
			$next = false;
			$last = false;
			$prev_last = false;
			$childFound = false;
			$openli = false;
			$index1 = stripos($tocText,'
')+4;
			$index2 = strripos($tocText,'
');
			foreach($tocList as $item){
				// not a link - text
				if($item['link']==null){
					// TODO close li before static if changing levels - save levels with static
					$newTocText .= ''.$item['title'].'';
					continue;
				}
				// if matches link = 1, insert this page's toc HTML
				if($item['link']==1){
					$tocSnippet = substr($tocText,$index1,$index2-$index1);
					if(preg_match('/<li\s.+?(<ul.+)<\/li>/s',$tocSnippet,$matches)==1){ // remove top heading
						$tocSnippet=$matches[1];
					}else{
						$tocSnippet="";
					}
					$tocSnippet = preg_replace('/toclevel-1 tocsection-1/', 'toclevel-'.$level.' tocsection-'.$section.' toc-open',$tocSnippet,1);
					$newTocText .= $tocSnippet;
					$prev = $prev_last;
					$childFound = true;
					$section += 1;
					continue;
				}
				// if prev link is set, then this one is next
				if($childFound and !$next)
					$next = $item;
				// adjust levels
				if($level < $item['level']){
					$newTocText .= str_repeat('
', $item['level']-$level);
					$level = $item['level'];
				}elseif($level > $item['level']){
					$newTocText .= str_repeat('

', $level-$item['level']);
					$level = $item['level'];
					$openli = false;
				}elseif($openli){
					$newTocText .= '
';
				}
				// render lines from toc list
				$url = self::renderLink($item['link']);
				$is_open="";
				if(array_key_exists('is_open',$item)) $is_open = "toc-open";
				$newTocText .= '
'
					.''.$item['title'].'';
				$openli = true;
				$section += 1;
				// memorize last item so we could set prev link
				$prev_last = $last;
				$last=$item;
			}
			if($openli){
				$newTocText .= '
';
			}
			// add beginning and end of the original HTML toc and replace TOC in the page
			$newToc = substr($tocText,0,$index1).$newTocText.substr($tocText,$index2);
			$text = str_replace($tocText,$newToc, $text);

			// generate Previous | Next links at the bottom of the page
			$prevnext = "";
			if ($prev){
				$prevnext .= '< '.(wfMessage( 'wikibook-prev' )->inLanguage(self::$mPageLangCode)->text()).'';
			}
			if($prev and $next)
				$prevnext .= ' | ';
			if ($next){
				$prevnext .= ''.(wfMessage( 'wikibook-next' )->inLanguage(self::$mPageLangCode)->text()).' >';
			}
			$prevnext = "".$prevnext."";
			$text = str_replace("/prevnext/",$prevnext, $text);
		}
		return true;
	}

	private static function renderLink($link)
	{
		// prepare link
		$linkDoc = trim(self::$mNamespace.':'.$link);
		// see if there is a language-specific version of the link doc
		if(self::$mPageLangCode != self::$mContLangCode){
			$linkLangTitle = Title::newFromText($linkDoc."/".self::$mPageLangCode);
			if($linkLangTitle->exists())
				$linkDoc .= "/".self::$mPageLangCode;
		}
		// render URL
		$doc = Title::newFromText($linkDoc);
		if($doc){
			$url = $doc->getFullURL();
			return $url;
		}
		return "bad+link";
	}

	// looks up for a parent title and returns TOC array; recurses if there are ancestors on top of the parent
	private static function generateSuperPageTocList($childTitle, $heading, $superTocArray){
		$topicFound = false;

		// find a superpage, if exists
		$parent = self::findSuperpage($childTitle);
		if(!$parent){
			return $superTocArray; // no parents, return whatever list was given as a parameter
		}

		// get parent body
		$article = new Article($parent);
		$superPageText = ContentHandler::getContentText( $article->getPage()->getContent() );
		self::$mHeading = self::findHeadingTextFromContent($superPageText);

		// remove lang suffix from pagetitle, so it would match toc entry
		if(self::$mPageLangCode != self::$mContLangCode){
			$pageTitleText = substr($pageTitleText, 0, strlen($pageTitleText)-1-strlen(self::$mPageLangCode));
		}

		// for each line in toc:, look for bullets with links; bullets can be multi-level
		$results = [];
		foreach(explode(PHP_EOL, $superPageText) as $line){
			// link, with a bullet
			if(preg_match("/^(\*+)\s*\[\[\s*([^|]+)\s*(?:\|\s*([^\]]*))?\]\]/",$line,$matches)==1){
				$asterisks = $matches[1];
				$level = strlen($asterisks);
				$url = trim($matches[2]);
				if(self::$mPageLangCode != self::$mContLangCode){
					$url .= "/".self::$mPageLangCode;
				}
				if(count($matches)>3)
					$title = $matches[3];
				else
					$title = $url;
				// toc item matching with child
				$parentTitleText = $childTitle->getDBKey();
				$len = strlen($parentTitleText);
				//echo $parentTitleText.'--'.$url."\n";
				//echo substr($url,$len,1)."\n";
				if(strtolower($url) == strtolower($parentTitleText) ||
				( (strtolower(substr($url,0,$len)) == strtolower($parentTitleText)) &&
					(substr($url,$len,1)=='/' || substr($url,$len,1)=='#') ) ){
					// incorporate param array here, add current level to each item, set bool flag
					array_push($results,['level'=>$level,'title'=>$title,'link'=>$url,'is_open'=>true]);
					foreach($superTocArray as $item){
						$item['level']+=$level;
						array_push($results, $item);
					}
					$topicFound = true;
				}
				else
					array_push($results,['level'=>$level,'title'=>$title,'link'=>$url]);
			// heading and markup - ignore
			}elseif(preg_match("/(=.+?=|<.+>)/", $line)){
			// text
			}elseif(strlen(trim($line))>0){
				array_push($results,['level'=>0,'title'=>$line,'link'=>null]);
			}
		}
		if(!$topicFound){ // paste child array to the and of the list
			foreach($superTocArray as $item){
				array_push($results, $item);
			}
		}
		// recurse parent ancestor tocs, if any
		return self::generateSuperPageTocList($parent,$heading,$results);
	}

	public static function findSuperpage($title){ // shared with wikibook-breadcrumbs extension
		if(!$title->isSubpage())
			return null;
		// find a superpage, if exists
		$doc = $title->getFullText();
		//echo "SUPERPAGE FOR: ".$doc;
		$page_lang_code = $title->getPageLanguage()->getCode();
		// strip lang superpage suffix
		$langsuffix="";
		$langsuffix_len = strlen($page_lang_code)+1;
		if(substr($doc, -$langsuffix_len) === ('/'.$page_lang_code)){
			$doc = substr($doc,0,-$langsuffix_len);
			$langsuffix = '/'.$page_lang_code;
		}
		// find a parent
		$separator_pos = strrpos($doc,'/');
		if($separator_pos < 1) // calling not from a subpage
			return null;
		$superpage_doc = substr($doc, 0, $separator_pos);
		// see if there is a language-specific version of the superpage (only if page had the suffix)
		if($langsuffix){
			$link_lang_title = Title::newFromText($superpage_doc.$langsuffix);
			if($link_lang_title->exists())
				$superpage_doc .= $langsuffix;
		}
		// get the superpage
		$superpage = Title::newFromText($superpage_doc);
		return $superpage;
	}

	public static function findHeadingTextFromTitle($title){
		$article = new Article($title);
		$heading = "";
		$url = "";
		if($article){
			$text = ContentHandler::getContentText( $article->getPage()->getContent() );
			if($text){
				return self::findHeadingTextFromContent($text);
			}
		}
		return null;
	}

	public static function findHeadingTextFromContent($text){
		if(preg_match("/=+([^=]+)=+/", $text, $matches)){
			return $matches[1];
		}
		return null;
	}

}
?>
<file_sep>/extensions/BookExport/BookExport.class.php
<?php

/* Copyright 2018-2021 <NAME>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */

function endsWith($haystack, $needle)
{
    $length = strlen($needle);
    if ($length == 0) {
        return true;
    }
    return (substr($haystack, -$length) === $needle);
}

class BookExport extends Action {

	// for Mediawiki 1.29+
	public function getName() {
		return 'pdf-export';
	}

	public function show() {
		//$title = $this->page->getTitle();
		//$article = new Article( Title::newFromText( $title ) ) ;
		self::exportPdf($this->getArticle());
		die();
	}

	// for older implementations, do onUnknownAction
	public static function onUnknownAction( $action, Article $article ) {
		// We don't do any processing unless it's pdfbook
		if ($action != 'pdf-export' && $action != 'html-localimages-export'
				 					&& $action != 'html-remoteimages-export'
				 					&& $action != 'wikimarkup-export' ) {
			return true;
		}
		if ($action == 'wikimarkup-export'){
			echo self::exportWikimarkup($article, $docTitleText, $lastTimestamp);
			die();
		}
		if ($action == 'html-localimages-export'){
			echo self::exportHtml($article);
			die();
		}
		if ($action == 'pdf-export'){
			self::exportPdf($article);
			die();
		}
	}

	private function sanitizeFragment($fragment){
		$str = preg_replace("/[^a-zA-Z0-9-._~:@!$&'\(\)*+,;=?\/]/","_",$fragment);
		return strtolower($str);
	}

	private function sanitizeLinks($match){
		return("[[#topic_".self::sanitizeFragment(trim($match[1])).$match[2]."]]");
	}

	public function exportWikimarkup(Article $article, &$docTitleText, &$lastTimestamp){
		$title = $article->getTitle();
		$titleNS = $title->getSubjectNsText().":";
		$parent = null;
		$doc = $title->getFullText();
		$lang = $title->getPageLanguage()->getCode();
		$separator_pos = strpos($doc,'/');
		$lastTimestamp = 0;
		$result = "";
		if($separator_pos < 1 || endsWith($doc,'/'.$lang)) { // calling not from a subpage
			$content = ContentHandler::getContentText( $article->getPage()->getContent() );
			if(preg_match('/=\s*Articles From Namespace (.+?)\s*=/i',$content,$matches)){
				$titleNS = $matches[1];
				if($titleNS == 'Main') $titleNS = "";
				$titleNS.=":";
				$parent = $title; // force TOC to this doc
			}else{
				// return the article's wikitext
				$content = 'getText())).'">'."\r\n".$content;
				$content = "\r\n".$content;
				$lastTimestamp = wfTimestamp( TS_UNIX, $title->getTouched());
				return $content;
			}
		}
		# find all doc names in super page toc (all links)
		if($parent == null){ // TOC is not forced
			$parent = self::findSuperpage($title);
		}
		// is there a localized version of parent?
		if($lang != $parent->getPageLanguage()->getCode()){
			$parentLangTitle = Title::newFromText($parent_doc."/".$lang);
			if($parentLangTitle->exists())
				$parent = $parentLangTitle;
		}
		// save last edit time
		$tmpTimestamp = wfTimestamp( TS_UNIX, $parent->getTouched());
		if($tmpTimestamp and $tmpTimestamp > $lastTimestamp)
			$lastTimestamp = $tmpTimestamp;
		//
		$article = new Article($parent);
		$superPageText = ContentHandler::getContentText( $article->getPage()->getContent() );
		// find title
		if(preg_match("/.*?=(.+?)=.*/s", $superPageText, $matches)){
			$docTitleText = $matches[1];
		}
		# make all TOC links namespace-local
		if( preg_match_all( // all links without a colon in URL part
						"/\[\[([A-Z:a-z0-9,.\/_ \(\)-]+)(\#[A-Za-z0-9 ._-]*)?([|](.*?))?\]\]/",
						$superPageText,
						$matches,
						PREG_SET_ORDER ) ) {
			foreach ( $matches as $match ) {
				if(strpos($match[1],':')){
					$rep_title = Title::newFromText($match[1]); // colon is included if needed
				}else{
					$rep_title = Title::newFromText($titleNS.$match[1]); // colon is included if needed
				}
				if($lang != $rep_title->getPageLanguage()->getCode()){
					$repLangTitle = Title::newFromText($rep_title->getFullText()."/".$lang);
					if($repLangTitle->exists())
						$rep_title = $repLangTitle;
				}
				$superPageText =	str_replace(
									$match[0],
									"[[".$rep_title->getFullText().$match[2].$match[3]."]]",
									$superPageText );
			}
		}
		# collect all docs pointed by links
		$docs = array();
		foreach(preg_split("/((\r?\n)|(\r\n?))/", $superPageText) as $line){
			if(preg_match("/\[\[\s*([^|]+)\s*\|?\s*([^\]]*)\]\]/",$line, $matches)==1){
				$docs[] = $matches[1];
			}
		}
		# ??? H1 title of the whole thing?
		foreach($docs as $doc){
			# ensure same namespace
			$doc_title = Title::newFromText($doc);
			// save last edit time
			$tmpTimestamp = wfTimestamp( TS_UNIX, $doc_title->getTouched());
			if($tmpTimestamp and $tmpTimestamp > $lastTimestamp)
				$lastTimestamp = $tmpTimestamp;
			//
			$doc_article = new Article($doc_title);
			$doc_content = ContentHandler::getContentText( $doc_article->getPage()->getContent() );
			// TODO warining - this replaces all links, including those outside the book
			$doc_content = preg_replace_callback("/\[\[([A-Za-z0-9,.\/_ \(\)-]+)([|](.*?))?\]\]/",
'self::sanitizeLinks',$doc_content);
			// TODO also need to replace all local hash links
			// TODO replace remote in-book hash links, to avoid double hash - just strip the file part
			$result .= 'getText())).'">'."\r\n"."\r\n".$doc_content."\r\n\r\n";
		}
		return $result;
	}

	public static function findSuperpage($title){ // shared with SuperPageTOC extension
		if(!$title->isSubpage())
			return null;
		// find a superpage, if exists
		$doc = $title->getFullText();
		//echo "SUPERPAGE FOR: ".$doc;
		$page_lang_code = $title->getPageLanguage()->getCode();
		// strip lang superpage suffix
		$langsuffix="";
		$langsuffix_len = strlen($page_lang_code)+1;
		if(substr($doc, -$langsuffix_len) === ('/'.$page_lang_code)){
			$doc = substr($doc,0,-$langsuffix_len);
			$langsuffix = '/'.$page_lang_code;
		}
		// find a parent
		$separator_pos = strrpos($doc,'/');
		if($separator_pos < 1) // calling not from a subpage
			return null;
		$superpage_doc = substr($doc, 0, $separator_pos);
		// see if there is a language-specific version of the superpage (only if page had the suffix)
		if($langsuffix){
			$link_lang_title = Title::newFromText($superpage_doc.$langsuffix);
			if($link_lang_title->exists())
				$superpage_doc .= $langsuffix;
		}
		// get the superpage
		$superpage = Title::newFromText($superpage_doc);
		return $superpage;
	}

	public function exportHtml(Article $article){
		global $wgOut, $wgUser, $wgTitle, $wgParser, $wgRequest;
		global $wgServer, $wgArticlePath, $wgScriptPath, $wgUploadPath, $wgUploadDirectory, $wgScript, $wgStylePath;
		$title = $article->getTitle();

		$opt = ParserOptions::newFromUser($wgUser);
		$opt->setIsPrintable(true);
		$wikimarkup = self::exportWikimarkup($article, $docTitleText, $lastTimestamp);
		$out = $wgParser->parse($wikimarkup, $title, $opt, true, true);
		$text = $out->getText(['enableSectionEditLinks'=>false]);
		$base = '<base href="'.($title->getFullUrl()).'?action=html-localimages-export">';
		return self::htmlPage(self::coverPageHtml($docTitleText).$text, $base);
	}

	private function coverPageHTML($docTitleText)
	{
		global $wgLogo, $wgRightsText, $wgSitename;
		$titleText  .= '

';
		if($wgLogo)
			$titleText .= '';
		$titleText .=
			 '
' . $docTitleText . '
';
		if($wgSitename)
			$titleText .= '
' .$wgSitename. '
';

		$titleText .= 'Generated: ' . date('n/d/Y g:i a', time())
			. '

'
			. str_replace('$1',$wgRightsText, wfMessage( 'copyright' )->text())
			. '

';
		return $titleText;
	}

	private function htmlPage($text, $additionalHeaderHtml=""){

		$html = <<<EOT
<!doctype html>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>

$additionalHeaderHtml

EOT;
		$html .= $text;
		$html .= "";
		return $html;
	}

	private function writeFile($data, $suffix = '.html'){
		$tempName = tempnam(sys_get_temp_dir(), 'wikibook');
		unlink($tempName);
		$file = fopen($tempName.$suffix, 'w+');
        $fileName = stream_get_meta_data($file)['uri'];
		fwrite($file, $data);
		fclose($file);
		return $fileName;
	}

	static public function serveFileAs($fileName, $filePath) {
		if (file_exists($filePath)) {
			header("Content-Type: application/pdf");
			header("Content-Disposition: attachment; filename=\"$fileName\"");
			readfile($filePath);
			die();
		} else {
			return false;
		}
	}

	private function exportPdf($article){
		global $wgParser, $wgUser, $wgUploadDirectory;
		$title = $article->getTitle();
		$docVersionText = $title->getSubjectNsText();
		$base = '<base href="'.($title->getFullUrl()).'?action=html-localimages-export">';

		$wikimarkup = self::exportWikimarkup($article, $docTitleText, $lastTimestamp);

		$opt = ParserOptions::newFromUser($wgUser);
		$opt->setIsPrintable(true);
		$out = $wgParser->parse($wikimarkup."\n__NOTOC__\n", $title, $opt, true, true);

		$body = self::htmlPage($out->getText(['enableSectionEditLinks'=>false]),$base);
		$cover = self::htmlPage(self::coverPageHTML($docVersionText.' '.$docTitleText),$base);

		$coverFileName = self::writeFile($cover);
		$bodyFileName = self::writeFile($body);
		// make converter happy
		rename($coverFileName, $coverFileName.".html");
		$coverFileName .= ".html";
		rename($bodyFileName, $bodyFileName.".html");
		$bodyFileName .= ".html";

		$pdfFileName = "wikibook-" . $docVersionText . "-" . ($title->getRootText()) .".pdf";
		$pdfFilePath = "$wgUploadDirectory/".$pdfFileName;

		//$wgOut->disable();
		$cmd = "/opt/wkhtmltox/bin/wkhtmltopdf -s Letter --outline --margin-bottom 0.5in --margin-top 0.5in --margin-left 0.5in --margin-right 0.5in --load-error-handling ignore --load-media-error-handling ignore "
			." cover $coverFileName toc $bodyFileName $pdfFilePath";
		$output = array();
		$returnVar = 1;
		exec($cmd, $output, $returnVar);
		unlink($coverFileName);
		unlink($bodyFileName);

		if($returnVar != 0) { // 0 is success
			error_log("INFO [PonyDocsPdfBook::onUnknownAction] " . php_uname('n') . ": Failed to run wkhtmltopdf (" . $returnVar . ") Output is as follows: " . implode("-", $output));
			print("Failed to create PDF.  Our team is looking into it.");
		}

		self::serveFileAs($pdfFileName , $pdfFilePath);
	}
}
?>

branch_name: refs/heads/master

repo_language: PHP


text:
<file_sep># odinGit_04
This is a faux Google page.

branch_name: refs/heads/main

repo_language: Markdown


text:
<repo_name>indexer/bilemo<file_sep>/README.md
# bilemo

# Login User information

User Name : yemonkyaw

Password : <PASSWORD>

# Used Libiary
  Hilt

  Retrofit

  Okhttp

  Room

  Android Material Libiary

  Gson

  DataStore

  KPermission

  Google Map

repo_name: indexer/bilemo


text:
<repo_name>swiftkickin/SwiftKick.SignalRCore<file_sep>/SwiftKick.SignalRCore/Hubs/ChatHub.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.SignalR;

namespace SwiftKick.SignalRCore.Hubs
{
    public class ChatHub : Hub
    {
        public void BroadcastMessage(string message)
        {
            Clients.All.SendAsync("writeMessage", message);
        }
    }
}
<file_sep>/SwiftKick.SignalRCore/Startup.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using SwiftKick.SignalRCore.Hubs;

namespace SwiftKick.SignalRCore
{
    public class Startup
    {
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            var azureConnectionString =
                "TODO";
            services.AddSignalR().AddMessagePackProtocol();
            //services.AddSignalR().AddMessagePackProtocol().AddAzureSignalR(azureConnectionString);
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseDefaultFiles();
            app.UseStaticFiles();
            app.UseSignalR(configure => { configure.MapHub<ChatHub>("/chatHub"); });
            //app.UseAzureSignalR(configure => { configure.MapHub<ChatHub>("/chatHub"); });
        }
    }
}
<file_sep>/SwiftKick.SignalRCore/wwwroot/app.ts
import * as SignalR from "@aspnet/signalr";
import * as msgPack from "@aspnet/signalr-protocol-msgpack";

let btn = document.getElementById("btnSend");
btn.addEventListener("click", () => sendMessage());

function sendMessage(): any {
    let messageToSend = (<HTMLInputElement>document.getElementById("messageToSend"));
    let val = messageToSend.value;
    connection.invoke("broadcastMessage", val);
}

var connection = new SignalR.HubConnectionBuilder()
    .withUrl("/chatHub").withHubProtocol(new msgPack.MessagePackHubProtocol())
    .configureLogging(SignalR.LogLevel.Information)
    .build();

connection.on("writeMessage",
    (message) => {

        var el = document.getElementById("messages");

        var li = document.createElement("li");
        li.appendChild(document.createTextNode(message));

        el.appendChild(li);
    });

connection.start().then(() => { console.log("Connected"); });

languages: C# TypeScript


text:
<file_sep># 多用户多级目录文件系统的实现

## 一、课程设计的内容
本课程设计要求设计一个模拟的多用户多级目录的文件系统。通过具体的文件存储空间的管理、文件的物理结构、目录结构和文件操作的实现,加深对文件系统内部功能和实现过程的理解。

## 二、课程设计的要求与数据
1. 在内存中开辟一个虚拟磁盘空间作为文件存储器,在其上实现一个多
用户多目录的文件系统。
2. 文件物理结构可采用显式链接或其他方法。
3. 磁盘空闲空间的管理可选择位示图或其他方法。如果采用位示图来管理文件存储空间,并采用显式链接分配方式,则可以将位示图合并到 FAT 中。
4. 文件目录结构采用多用户多级目录结构,每个目录项包含文件名、
物理地址、长度等信息,还可以通过目录项实现对文件的读和写的保护。
5. 设计一个较实用的用户界面,方便用户使用。至少要求提供以下相关文件操作:
    1. 具有 login (用户登录);
    1. 系统初始化(建文件卷、提供登录模块);
    1. 文件的创建: create;
    1. 文件的打开:open;
    1. 文件的读:read;
    1. 文件的写:write;
    1. 文件关闭:close;
    1. 删除文件:delete ;
    1. 创建目录(建立子目录):mkdir;
    1. 改变当前目录:cd;
    1. 列出文件目录:dir;
    1. 退出:logout。
6. 在 5 的基础上完成文件的复制粘贴,文件的共享“别名”,加快文件检索 ,
针对某项实际应用进行文件系统设计,具有良好的图形化界面等均可获得加分。
7. 系统必须可实际演示,选用程序设计语言:C++、C 等。

## 三、课程设计应完成的工作
1. 充分理解课程设计的任务,完成课程设计的基本要求,根据个人的基础和能力选择不同难度的算法和实现方式,以取得更高的分数。
2. 独立完成系统的分析、设计、编码和测试工作。
3. 撰写课程设计报告。
4. 最后需要提交的内容如下:
    1. 以光盘(以班为单位刻录)方式提交:已调试通过的完整的相关源程序和能够运行的执行文件;“课程设计报告”的 word 文档。采用学号加姓名为每位同学文件夹的文件名。
    1. “课程设计报告”的书面打印版本。
<file_sep># 一、设计目的
本课程设计要求设计一个模拟的多用户多级目录的文件系统。通过具体的文件存储空间的管理、文件的物理结构、目录结构和文件操作的实现,加深对文件系统内部功能和实现过程的理解。

# 二、设计内容
1. 在内存中开辟一个虚拟磁盘空间作为文件存储器,在其上实现一个多用户多目录的文件系统。
2. 文件物理结构可采用显式链接或其他方法。
3. 磁盘空闲空间的管理可选择位示图或其他方法。如果采用位示图来管
理文件存储空间,并采用显式链接分配方式,则可以将位示图合并到 FAT 中。
4. 文件目录结构采用多用户多级目录结构,每个目录项包含文件名、
物理地址、长度等信息,还可以通过目录项实现对文件的读和写的保护。
5. 设计一个较实用的用户界面,方便用户使用。至少要求提供以下相关文件操作:
    1. 具有 login (用户登录);
    1. 系统初始化(建文件卷、提供登录模块);
    1. 文件的创建: create;
    1. 文件的打开:open;
    1. 文件的读:read;
    1. 文件的写:write;
    1. 文件关闭:close;
    1. 删除文件:delete ;
    1. 创建目录(建立子目录):mkdir;
    1. 改变当前目录:cd;
    1. 列出文件目录:dir;
    1. 退出:logout。
6. 在 5 的基础上完成文件的复制粘贴,文件的共享“别名”,加快文件检索 ,
针对某项实际应用进行文件系统设计,具有良好的图形化界面等均可获得加分。
7. 系统必须可实际演示,选用程序设计语言:C++、C 等。

# 三、设计步骤

1. ## 需求分析

1. ## 概要设计

1. ## 详细设计

1. ## 调试分析

1. ## 系统测试

1. ## 使用说明

# 四、经验与体会

# 五、附录
<file_sep>var Files = [
    {
        "name": "/",
        "node_id": 0
    },
    {
        "name": "bin",
        "node_id": 1
    },
    {
        "name": "home",
        "node_id": 2
    },
    {
        "name": "Link",
        "node_id": 3
    },
    {
        "name": "myfile1",
        "node_id": 4
    },
    {
        "name": "myfile2",
        "node_id": 5
    }
];
var Nodes = [
    {"block": 0, "type": "dir"},
    {"block": 1, "type": "dir"},
    {"block": 2, "type": "dir"},
    {"block": 3, "type": "dir"},
    {"block": 4, "type": "file"},
    {"block": 5, "type": "file"}
];
var Blocks = [
    {"content": ["bin", "home", "myfile1", "myfile2"], "used": true},
    {"content": [], "used": true},
    {"content": ["Link"], "used": true},
    {"content": ["myfile2"], "used": true},
    {"content": "this is myfile 1", "used": true},
    {"content": "this is myfile 2", "used": true},
    {"content": "", "used": false},
    {"content": "", "used": false},
    {"content": "", "used": false},
    {"content": "", "used": false},
    {"content": "", "used": false},
    {"content": "", "used": false},
    {"content": "", "used": false},
    {"content": "", "used": false},
    {"content": "", "used": false},
    {"content": "", "used": false},
    {"content": "", "used": false},
    {"content": "", "used": false},
    {"content": "", "used": false},
    {"content": "", "used": false}
];

languages: Markdown JavaScript

repo_name: RMA-KAKA/vfs


text:
<file_sep>//
//  Dynamic.swift
//  TextFieldBindings
//
//  Created by <NAME> on 11/28/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import Foundation

class Dynamic<T> {

    var bind: ((T) -> ())?

    var value :T? {
        didSet {
            bind?(value!)
        }
    }

    init(_ v :T) {
        value = v
    }

}
<file_sep>//
//  BindingTextField.swift
//  TextFieldBindings
//
//  Created by <NAME> on 11/28/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import UIKit

class BindingTextField: UITextField {

    // MARK: Public

    var textChanged: ((_ text: String?) -> ())?

    func bind(callback: @escaping (_ text: String?) -> ()) {
        textChanged = callback
        addTarget(self, action: #selector(textFieldDidChange), for: .editingChanged)
    }

    // MARK: Private

    @objc private func textFieldDidChange(_ textField: UITextField) {
        textChanged?(textField.text)
    }

}
<file_sep>//
//  ViewController.swift
//  TextFieldBindings
//
//  Created by <NAME> on 11/28/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    // MARK: Lifecycle

    override func viewDidLoad() {
        super.viewDidLoad()
        setupView()
    }

    // MARK: Outlet

    @IBOutlet private weak var textField: BindingTextField!

    // MARK: Private

    private var changedValue: String? {
        didSet {
            print("Changed value: \(String(describing: changedValue))")
        }
    }

    private func setupView() {
        setupTextField()
    }

    private func setupTextField() {
        textField.bind { [weak self] (text) in
            guard let strongSelf = self else { return }
            strongSelf.changedValue = text
        }
    }

}

repo_language: Swift

repo_name: sutstefan/TextFieldBindings


text:
<repo_name>kerf007/react-spa<file_sep>/src/Components/Routes.js
import React from 'react'
import {Route, IndexRoute, IndexRedirect} from 'react-router'
import App from '.././App';
import Home from './Home';
import Contact from './Contact';
import Stuff from './Stuff';
import Item from './Item';

module.exports = (
      <Route path="/" component={App}>
        <IndexRoute component={Home} />
        <Route path="/stuff" component={Stuff}>
          <IndexRedirect to="/stuff/item1"/>
          <Route path="/stuff/:item" component={Item}/>
        </Route>
        <Route path="/contact" component={Contact} />
      </Route>
    );
<file_sep>/README.md
# The simple SPA with react & react-router

### Links

* [react-router](https://github.com/ReactTraining/react-router)
* This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).


text:
<repo_name>nhatquang237/contents_mixing_tools<file_sep>/mix.py
# -*- coding: utf-8 -*-
"""
Created on Tue Jun  1 15:32:18 2021

@author: NhatQuang
"""

import random
import os
from tkinter import *
from tkinter import filedialog
from openpyxl import load_workbook

def tem_list(A, B):
    tem_list = list()
    for i in A:
        if(i!=B):
            tem_list.append(i)
    return tem_list

def random_pick(collection,slot):
    result = list()
    tempory_list = collection
    count = 0
    while count<slot:
        result.append(random.choice(tempory_list))
        tempory_list = tem_list(tempory_list, result[count])
        count+=1
    return result

def file_open():
    global link
    root.filename = filedialog.askopenfilename(initialdir = "/",
                                               title = "Select File",
                                               filetype = (('xlsx', '*.xlsx'),
                                                           ('xls', '*.xls')))

    link_box.config(state='normal')
    link_box.delete(0, END)
    link_box.insert(0, root.filename)

    link = root.filename.replace('/', '\\\\')
    link_box.config(state='disabled')

def process():
    #Gather information from wookbook
    wb = load_workbook(link)
    ws = wb.active

    slot_title = ws.cell(1,4).value
    slot_content = ws.cell(2,4).value
    size_titles = ws.cell(3,4).value
    size_contents = ws.cell(4,4).value
    size_combination = ws.cell(5,4).value

    if size_combination > size_titles*size_contents:
        size_combination = size_titles*size_contents

    titles = list()
    for i in range(2,size_titles+2):
        titles.append(ws.cell(i,1).value)
    contents = list()
    for i in range(2,size_contents+2):
        contents.append(ws.cell(i,2).value)

    unique_list = list()
    while( len(unique_list)<size_combination):
        result_C = random_pick(titles,slot_title)
        result_N = random_pick(contents,slot_content)
        if(result_C+result_N) in unique_list:
            pass
        else:
            unique_list.append(result_C+result_N)

    for i in range(size_combination):
        for k in range(slot_content+slot_title):
            ws.cell(i+1,k+6).value = unique_list[i][k]
    wb.save(link)
    os.startfile(link)

###### GUI design

root = Tk()
root.resizable(width = 0, height = 0)
root.title("Copyright 2021 © <NAME>")
root.minsize(450, 70)

link_box = Entry(root, width=60, relief=FLAT, highlightbackground="black", highlightthickness=1)
link_box.grid(row = 0, column = 1, padx = 5, ipady = 2, sticky = "W", columnspan = 6)

button_1 = Button(root, text = 'Open File',
command=file_open,
background = 'SteelBlue1', borderwidth=4).grid(row = 0,
column = 0, padx = 10, pady = 2, ipady = 2,
sticky = "WE")

button_2 = Button(root, command=process, text = ' RUN ',
background = 'IndianRed3', highlightbackground="black",
highlightthickness=1, borderwidth=1).grid(row = 20,
column = 0, ipadx = 5, columnspan = 8)

root.mainloop()

repo_language: Python


text:
<repo_name>lhobbs/lisa-hobbs<file_sep>/app/components/resume/community-outreach/community-outreach.component.ts
import { Component, Input } from '@angular/core';

@Component({
  selector: 'community-outreach',
  templateUrl: 'app/components/resume/community-outreach/community-outreach.component.html',
})
export class CommunityOutreachComponent  {
  constructor () {
    }
 }<file_sep>/app/components/resume/resume-card/education-card.component.ts
import { Component, Input } from '@angular/core';

@Component({
  selector: 'education-card',
  templateUrl: 'app/components/resume/resume-card/education-card.component.html',
})
export class EducationCardComponent  {
    constructor () {
    //   this.showDescription = false;
    }

 }<file_sep>/app/components/home/home.component.ts
import { Component } from '@angular/core';

import { ConfigService } from './../../services/config.service';

@Component({
  selector: 'home',
  templateUrl: 'app/components/home/home.component.html',
})
export class HomeComponent  {
    constructor (private configService: ConfigService ) {
        this.configService.setTitle("Lisa Hobbs");
    }
 }<file_sep>/app/services/config.service.ts
import { Injectable }     from '@angular/core';
import { Http, Response } from '@angular/http';
import { Observable } from 'rxjs';

export interface PageTitle {
   value:string;
}

@Injectable()
export class ConfigService {

  constructor(private http: Http) {}

pageTitle: PageTitle = {value: "<NAME>"};

setTitle(title: string) {
    this.pageTitle.value = title;
}

getTitle() {
    return this.pageTitle.value;
}

}<file_sep>/app/components/projects/project-detail/project-detail.component.ts
import { Component, Input, OnInit } from '@angular/core';
import { Http } from '@angular/http';
import 'rxjs/add/operator/toPromise';
import { Observable } from 'rxjs/Observable';

import { ConfigService } from './../../../services/config.service';
import { ProjectService } from './../../../services/project.service';
import { Project } from './../../../models/project';

@Component({
  selector: 'project-detail',
  templateUrl: 'app/components/projects/project-detail/project-detail.component.html',
  providers: [ProjectService]
})

export class ProjectDetailComponent   {
@Input() project: Project;

constructor(private http: Http, private projectService: ProjectService,
    private configService: ConfigService ) {}

    ngOnInit () {
        this.configService.setTitle("Things I've Made");
    }
}<file_sep>/app/components/photo-menu/photo-menu.component.ts
import { Component } from '@angular/core';

import { ConfigService } from './../../services/config.service';

@Component({
  selector: 'photo-menu',
  templateUrl: 'app/components/photo-menu/photo-menu.component.html',
})
export class PhotoMenuComponent  {
    constructor (private configService: ConfigService ) {
        this.configService.setTitle("");
    }
 }<file_sep>/app/components/resume/resume-mobile.component.ts
import { Component } from '@angular/core';

import { ConfigService } from './../../services/config.service';
import { ResumeService } from './../../services/resume.service'

import { Job } from './../../models/job';

@Component({
  selector: 'resume-mobile',
  templateUrl: 'app/components/resume/resume-mobile.component.html',
  providers: [ResumeService],
})
export class ResumeMobileComponent  {
    jobs: Job[]
    jobsCol1: Job[];
    jobsCol2: Job[];

    constructor (private configService: ConfigService, private resumeService: ResumeService ) {
        this.configService.setTitle("Things I've Done");
    }

    ngOnInit () {
        this.resumeService.getJobs()
            .then(jobs =>{ this.jobs = jobs; })
            .then(j => this.filterJobs());
    }

    filterJobs() {
        this.jobsCol1 = this.jobs.filter((v, i) => i%2 == 0);
        this.jobsCol2 = this.jobs.filter((v,i) => i%2 == 1);
    }
 }<file_sep>/app/components/app/app.component.ts
import { Component } from '@angular/core';
// import $ from "jquery";
declare var $:JQueryStatic;

export interface PageTitle {
  value:string;
}

import { ConfigService } from './../../services/config.service';

@Component({
  selector: 'my-app',
  templateUrl: 'app/components/app/app.component.html',
  providers: [ConfigService]
})
export class AppComponent  {
pageTitle: PageTitle;

  constructor (private configService: ConfigService) {
    this.pageTitle = configService.pageTitle;
  }

 }

$(function(){
    // $('#navTitle').css('display', 'none');

    // $(window).scroll(function(){
    //         if( $(window).scrollTop() > 50 ) {
    //                 $('#navTitle').css('display', 'block');
    //         } else {
    //                 $('#navTitle').css('display', 'none');
    //         }
    //   });
  });<file_sep>/app/components/resume/resume-card/resume-card-mobile.component.ts
import { Component, Input } from '@angular/core';

import { Job } from './../../../models/job'

@Component({
  selector: 'resume-card-mobile',
  templateUrl: 'app/components/resume/resume-card/resume-card-mobile.component.html',
})
export class ResumeCardMobileComponent  {
    @Input() job: Job;
    showDescription: boolean;

    constructor () {
    //   this.showDescription = false;
    }

 }<file_sep>/app/services/resume.service.ts
import { Injectable }    from '@angular/core';
import { Headers, Http } from '@angular/http';

import 'rxjs/add/operator/toPromise';

import { Job } from './../models/job';

@Injectable()
export class ResumeService {

  private headers = new Headers({'Content-Type': 'application/json'});

  constructor(private http: Http) { }

  getJobs(): Promise<Job[]> {
    return this.http.get('/data/jobs.json')
               .toPromise()
               .then(response => response.json() as Job[])
               .catch(this.handleError);
  }

  getJob(id: number): Promise<Job> {
    return this.http.get('data/jobs.json')
      .toPromise()
      .then(response => response.json().data as Job)
      .catch(this.handleError);
  }

  private handleError(error: any): Promise<any> {
    console.error('An error occurred', error); // for demo purposes only
    return Promise.reject(error.message || error);
  }
}
<file_sep>/app/components/projects/projects.component.ts
import { Component, Output, EventEmitter } from '@angular/core';
import { Http } from '@angular/http';
import 'rxjs/add/operator/toPromise';
import { Observable } from 'rxjs/Observable';

import { ProjectCardComponent } from './project-card/project-card.component';

import { Project } from './../../models/project';
import { Category } from './../../models/category';

import { ConfigService } from './../../services/config.service';
import { ProjectService } from './../../services/project.service';

@Component({
  selector: 'projects',
  templateUrl: 'app/components/projects/projects.component.html',
  providers: [ProjectService],
})
export class ProjectsComponent  {
projects: Project[];
projectsAll: Project[];
projectsCol1: Project[];
projectsCol2: Project[];
projectsCol3: Project[];
selectedProject: Project;

constructor(private http: Http, private configService: ConfigService, private projectService: ProjectService ) {
    this.configService.setTitle("Things I've Made");
    this.selectedProject = null;
}

ngOnInit () {
     this.projectService.getProjects()
     .then(projects =>{ this.projects = projects.reverse(); })
     .then(p => this.filterProjs());
 }

 filterProjs() {
    this.projectsCol1 = this.projects.filter((v, i) => i%3 == 0);
     this.projectsCol2 = this.projects.filter((v, i) => i%3 == 1);
     this.projectsCol3 = this.projects.filter((v, i) => i%3 == 2);
 }

selectProj(proj) {
    this.selectedProject = proj;
}

}<file_sep>/app/models/project.ts
import {Category} from './category';

export class Project {
	id: number;
    title: string;
    name: string;
	descriptionShort: string;
    descriptionLong: string;
    images: {
        icon: string;
        poster: string;
    };
    categories: Category[];
    links: [{
        url: string;
        description: string;
    }];
}<file_sep>/app/app.module.ts
//import './rxjs-extensions';

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule }   from '@angular/forms';
import { HttpModule }    from '@angular/http';

// import { AppRoutingModule } from './app-routing.module';

import { ConfigService } from './services/config.service';

// Imports for loading & configuring the in-memory web api
// import { InMemoryWebApiModule } from 'angular-in-memory-web-api';
// import { InMemoryDataService }  from './in-memory-data.service';

import { AppComponent }         from './components/app/app.component';
import { HomeComponent }   from './components/home/home.component';
import { HomeMobileComponent } from './components/home/home-mobile.component';
import { ChatBotComponent } from './components/chat-bot/chat-bot.component';
import { PhotoMenuComponent } from './components/photo-menu/photo-menu.component';
import { AboutComponent }   from './components/about/about.component';
import { AboutMobileComponent } from './components/about/about-mobile.component';
import { ProjectsComponent }   from './components/projects/projects.component';
import { ProjectsMobileComponent } from './components/projects/projects-mobile.component';
import { ResumeComponent }   from './components/resume/resume.component';
import { ResumeMobileComponent } from './components/resume/resume-mobile.component';
import { ResumeCardComponent } from './components/resume/resume-card/resume-card.component';
import { ResumeCardMobileComponent } from './components/resume/resume-card/resume-card-mobile.component';
import { EducationComponent } from './components/resume/education/education.component';
import { EducationCardComponent } from './components/resume/resume-card/education-card.component';
import { CommunityOutreachComponent } from './components/resume/community-outreach/community-outreach.component';
import { CommunityOutreachMobileComponent } from './components/resume/community-outreach/community-outreach-mobile.component';
import { ContactComponent }   from './components/contact/contact.component';
import { ContactMobileComponent } from './components/contact/contact-mobile.component';
import { ProjectCardComponent } from './components/projects/project-card/project-card.component';
import { ProjectDetailComponent } from './components/projects/project-detail/project-detail.component';
// import { ProjectCategoryComponent } from './components/projects/project-category/project-category.component';

@NgModule({
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule
    //InMemoryWebApiModule.forRoot(InMemoryDataService),
    //AppRoutingModule
  ],
  declarations: [
    AppComponent,
    HomeComponent,
    HomeMobileComponent,
    ChatBotComponent,
    PhotoMenuComponent,
    AboutComponent,
    AboutMobileComponent,
    ProjectsComponent,
    ProjectsMobileComponent,
    ResumeComponent,
    ResumeMobileComponent,
    ResumeCardComponent,
    ResumeCardMobileComponent,
    EducationComponent,
    EducationCardComponent,
    CommunityOutreachComponent,
    CommunityOutreachMobileComponent,
    ContactComponent,
    ContactMobileComponent,
    ProjectDetailComponent,
    ProjectCardComponent
  ],
  providers: [ ConfigService ],
  bootstrap: [ AppComponent ]
})
export class AppModule { }
<file_sep>/app/components/about/about.component.ts
import { Component } from '@angular/core';

import { ConfigService } from './../../services/config.service';

@Component({
  selector: 'about',
  templateUrl: 'app/components/about/about.component.html'
})

export class AboutComponent {

constructor (private configService: ConfigService ) {
    this.configService.setTitle("A Little About Me");
}

}<file_sep>/app/components/home/home-mobile.component.ts
import { Component } from '@angular/core';

import { ConfigService } from './../../services/config.service';

@Component({
  selector: 'home-mobile',
  templateUrl: 'app/components/home/home-mobile.component.html',
})
export class HomeMobileComponent  {
    constructor (private configService: ConfigService ) {
        this.configService.setTitle("<NAME>");
    }
 }<file_sep>/app/components/resume/education/education.component.ts
import { Component, Input } from '@angular/core';

@Component({
  selector: 'education',
  templateUrl: 'app/components/resume/education/education.component.html',
})
export class EducationComponent  {
  constructor () {
    }
 }<file_sep>/app/components/contact/contact-mobile.component.ts
import { Component } from '@angular/core';

import { ConfigService } from './../../services/config.service';

@Component({
  selector: 'contact-mobile',
  templateUrl: 'app/components/contact/contact-mobile.component.html',
})
export class ContactMobileComponent  {
    constructor (private configService: ConfigService ) {
        this.configService.setTitle("Say Hello");
    }
 }<file_sep>/app/services/project.service.ts
import { Injectable }    from '@angular/core';
import { Headers, Http } from '@angular/http';

import 'rxjs/add/operator/toPromise';

import { Project } from './../models/project';
import { Category } from './../models/category';

@Injectable()
export class ProjectService {

  private headers = new Headers({'Content-Type': 'application/json'});

  constructor(private http: Http) { }

  getProjects(): Promise<Project[]> {
    return this.http.get('/data/projects.json')
               .toPromise()
               .then(response => response.json() as Project[])
               .catch(this.handleError);
  }

  getProject(id: number): Promise<Project> {
    return this.http.get('data/projects.json')
      .toPromise()
      .then(response => response.json().data as Project)
      .catch(this.handleError);
  }

  getCategories(): Promise<Category[]> {
    return this.http.get('/data/categories.json')
               .toPromise()
               .then(response => response.json() as Category[])
               .catch(this.handleError);
  }

  private handleError(error: any): Promise<any> {
    console.error('An error occurred', error); // for demo purposes only
    return Promise.reject(error.message || error);
  }
}
<file_sep>/app/components/resume/community-outreach/community-outreach-mobile.component.ts
import { Component, Input } from '@angular/core';

@Component({
  selector: 'community-outreach-mobile',
  templateUrl: 'app/components/resume/community-outreach/community-outreach-mobile.component.html',
})
export class CommunityOutreachMobileComponent  {
  constructor () {
    }
 }<file_sep>/app/components/projects/project-card/project-card.component.ts
import { Component, Output, EventEmitter, Input } from '@angular/core';
import { Http } from '@angular/http';
import 'rxjs/add/operator/toPromise';
import { Observable } from 'rxjs/Observable';

import { Project } from './../../../models/project';

@Component({
  selector: 'project-card',
  templateUrl: 'app/components/projects/project-card/project-card.component.html',
})
export class ProjectCardComponent  {
@Input() project: Project;
@Input() hideInfoBtn: boolean;
@Output()
  selected:EventEmitter<string> = new EventEmitter();

constructor() {
    // this.configService.setTitle("Things I've Made");
}

ngOnInit () {
    //  this.projectService.getProjects().then(projects =>{ this.projects = projects; });
 }

 onSelect(project) {
    this.selected.emit(project);
  }

}<file_sep>/app/models/job.ts
export class Job {
	id: number;
    company: string;
    position: string;
	location: string;
    startDate: string;
    endDate: string;
    skills: string[];
    acheivements: string[];
}<file_sep>/app/components/about/about-mobile.component.ts
import { Component } from '@angular/core';

import { ConfigService } from './../../services/config.service';

@Component({
  selector: 'about-mobile',
  templateUrl: 'app/components/about/about-mobile.component.html'
})

export class AboutMobileComponent {

constructor (private configService: ConfigService ) {
    this.configService.setTitle("A Little About Me");
}

}<file_sep>/app/components/chat-bot/chat-bot.component.ts
import { Component } from '@angular/core';
const Typed = require('node_modules/typed.js/lib/typed.js');
// import Typed from './../../../node_modules/typed.js-master/lib/typed';

@Component({
  selector: 'chat-bot',
  templateUrl: 'app/components/chat-bot/chat-bot.component.html',
})
export class ChatBotComponent  {
  showTextBox: boolean;
  showQ1Buttons: boolean;
  showQ1: boolean;
  name: string;

    constructor () {
      this.showTextBox = false
      this.showQ1Buttons = false;
      this.showQ1 = false
    }

    ngOnInit() {
      this.hello()
    }

    hello() {
      var options = {
        strings: ["<i>Hi</i> there.", "My name is Lisa.", "What is your name?"],
        typeSpeed: 40,
        showCursor: false,
        onComplete: (self) => {
          this.showTextBox = true
        },
      }
      var typed = new Typed("#hello", options);
    }
    btnSubmit() {
      this.showQ1 = true;

      setTimeout (() => {
        this.q1text()
      }, 100)

    }
    q1text() {

      var options = {
        strings: [`Hello, ${this.name}.`, "What would you like to know about me?"],
        typeSpeed: 40,
        showCursor: false,
        onComplete: (self) => {
          this.showQ1Buttons = true
        },
      }
      var typed = new Typed("#q1", options);
    }
 }<file_sep>/app/components/resume/resume-card/resume-card.component.ts
import { Component, Input } from '@angular/core';

import { Job } from './../../../models/job'

@Component({
  selector: 'resume-card',
  templateUrl: 'app/components/resume/resume-card/resume-card.component.html',
})
export class ResumeCardComponent  {
    @Input() job: Job;
    showDescription: boolean;

    constructor () {
      this.showDescription = false;
    }
    toggleExtra() {
      // console.log(this.showDescription)
      this.showDescription = !this.showDescription;
    }
 }

repo_language: TypeScript

repo_name: lhobbs/lisa-hobbs


text: <file_sep># gdaexperience7-story-a


text:
<repo_name>tjbarber/My-Vim-Confs<file_sep>/snippets/HTML.snippets
snippet fullsite
	<!DOCTYPE html>
		<html>
			<head>
				<title>${1:My Site}</title>
				<link rel="stylesheet" href="${2:style}.css">
			</head>
		<body>
			${3}
		</body>
	</html>

snippet jquery
	<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>

snippet jquery_local
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>

snippet scriptsrc
	<script src="${1}"></script>
snippet handle
	<script id="${1:template}" type="text/x-handlebars-template">
		${2}
	</script>
snippet scaf
	(function() {
		${1}
	})();
snippet script
	<script>
		${1}
	</script>

<file_sep>/.vimrc
syntax on
set number
colorscheme railscasts
set guifont=Monaco:h13
set tabstop=4
set shiftwidth=4
set smartindent
set autoindent
set linespace=3
"set hlsearch

"For autocompletion"

set wildmode=list:longest
set foldenable
set splitbelow
set runtimepath^=~/.vim/bundle/ctrlp.vim
filetype on
filetype indent on
filetype plugin on

nmap <space> :
nmap ,nt :NERDTreeToggle
nmap ,v :vert sb
imap ,e <esc>

abbrev gc :! open -a Google\ Chrome.app %:p<cr>

if has("autocmd")
	autocmd bufwritepost .vimrc source $MYVIMRC
endif

call pathogen#infect()

let g:user_zen_expandabbr_key = '<c-e>'
let g:neocomplcache_enable_at_startup = 1
let g:ctrlp_map = '<c-p>'
let NERDTreeShowHidden=1

languages:
Vim Snippet
Vim Script

repo_language: Vim Snippet

repo_name: tjbarber/My-Vim-Confs