Beispiel #1
0
        static void Main(string[] args)
        {
            lineInsert inputs = new lineInsert();

            string [] s = new string[12];
            int       i = 0;

            for (i = 0; i < s.Length; i++)
            {
                s[i] = "line " + i.ToString();
            }

            Console.Write("\n!{0}", inputs.input(s, 12));
        }
Beispiel #2
0
            public Edit(string s)
            {
                int    i     = 0;
                bool   exits = false;
                string ss    = "";

                name        = s;
                list1.x     = 0;
                list1.w     = 78;
                list1.y     = 0;
                list1.h     = 20;
                list1.start = 0;
                list1.clear();
                if (name == "")
                {
                    list1.add("", list1.length + 1);
                }
                if (name == "")
                {
                    name = "new.lst";
                }
                try{
                    list1.load(name);
                }catch {
                    list1.add("", list1.length + 1);
                }


                pos = 0;
                int chrs = 0;

                while (!exits)
                {
                    lineInsert inputs = new lineInsert();
                    Console.Clear();
                    list1.report();
                    ss = list1.gets(pos);
                    Console.CursorLeft = list1.y;
                    Console.CursorTop  = pos - list1.start;
                    chrs         = 0;
                    inputs.value = ss;
                    returner rr = inputs.input(ss, chrs);
                    ss   = rr.rets;
                    chrs = rr.keys;
                    if (pos >= list1.length)
                    {
                        list1.add(ss, pos);
                    }
                    else
                    {
                        list1.change(ss, pos);
                    }

                    if (chrs == 8)
                    {
                        exits = true;
                    }

                    if (chrs == 1)
                    {
                        pos = pos + 1;
                        list1.add("", pos);
                    }
                    if (chrs == 2)
                    {
                        pos = pos - 1;
                    }
                    if (chrs == 3)
                    {
                        pos = pos + 1;
                        if (pos > list1.length)
                        {
                            list1.add("", pos);
                        }
                    }
                    if (chrs == 4)
                    {
                        list1.start = list1.start - 19;
                        pos         = pos - 19;
                    }
                    if (chrs == 5)
                    {
                        list1.start = list1.start + 19;
                        pos         = pos + 19;
                    }
                    if (pos < 0)
                    {
                        pos         = 0;
                        list1.start = 0;
                    }
                    if (pos > list1.length)
                    {
                        pos = list1.length;
                        list1.add("", pos);
                    }
                    if (list1.start > list1.length)
                    {
                        list1.start = list1.length - 1;
                    }
                    if (list1.start < 0)
                    {
                        list1.start = 0;
                    }
                    if (list1.start < pos - 19)
                    {
                        list1.start = pos - 19;
                    }
                    if (list1.start > list1.length)
                    {
                        list1.start = list1.length - 1;
                    }
                    if (list1.start > pos)
                    {
                        list1.start = pos;
                    }
                    if (list1.start < 0)
                    {
                        list1.start = 0;
                    }
                }
                try{
                    list1.save(name);
                }catch {
                }
            }