예제 #1
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     TextList.Add(new testclass()
     {
         HeaderText = "Item neu"
     });
 }
예제 #2
0
        public void readDataFromConsole()
        {
            string input = Console.ReadLine();

            while (!string.IsNullOrEmpty(input))
            {
                TextList.Add(input);
                input = Console.ReadLine();
            }
            if (TextList != null)
            {
                foreach (string s in TextList)
                {
                    Console.WriteLine(s);
                }

                for (int i = 0; i <= 5; i++)
                {
                    DataList.Add(TextList[i]);
                }
                Console.WriteLine("Count : {0}", DataList.Count);
                Console.WriteLine("Count : {0}", TextList.Count);
                EnteredDateForAverageFootfallsPerHour      = TextList[6];
                EnteredDateForAverageDailyFootfallsInAWeek = TextList[7];
                MonthAndYear = TextList[8];
                IsDataRead   = true;
            }
        }
예제 #3
0
        private void CreateTextList()
        {
            // Now fill up the List
            var fields = Text.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var field in fields)
            {
                if (TextList.Count > 0 && !field.Contains(":"))
                {
                    var text = TextList[TextList.Count - 1];
                    if (text.EndsWith(":"))
                    {
                        text += field;
                    }
                    else
                    {
                        text += " " + field;
                    }
                    TextList[TextList.Count - 1] = text;
                }
                else
                {
                    TextList.Add(field);
                }
            }
        }
예제 #4
0
        public void TextListTest()
        {
            var textList = new TextList();

            Assert.AreEqual(0, textList.Count);
            var i = textList.Add("Sample");

            Assert.AreEqual(0, i);
            Assert.AreEqual(0, textList.IndexOf("Sample"));
            Assert.AreEqual(-1, textList.IndexOf("SAMPLE"));
            Assert.AreEqual(-1, textList.IndexOf("Junk"));
            Assert.AreEqual(1, textList.Count);
        }
        public void LoadTextList(CustomBasicList <string> thisList)
        {
            int x;

            x = 1;
            foreach (var firstText in thisList)
            {
                ListViewPieceCP newText = new ListViewPieceCP();
                newText.Index       = x;
                newText.DisplayText = firstText;
                newText.IsEnabled   = true;
                TextList.Add(newText); //try this way.
                x += 1;
            }
            if (TextList.Count == 0)
            {
                throw new BasicBlankException("Failed to load text list");
            }
        }
예제 #6
0
        public void adding()
        {
            addText _otext = new addText();


            do
            {
                Console.Write("Podaj Nadawce wiadomości:");
                Console.WriteLine();

                newFrom = Console.ReadLine().ToLower();


                if (string.IsNullOrEmpty(newFrom))
                {
                    Console.WriteLine("Nadawca nie może być pusty!");
                }
                else
                {
                    break;
                }
            }while (true);

            do
            {
                Console.Write("Podaj temat wiadomości:");
                Console.WriteLine();
                newSubmit = Console.ReadLine().ToLower();


                if (string.IsNullOrEmpty(newSubmit))
                {
                    Console.WriteLine("Temat nie może być pusty!");
                }
                else
                {
                    break;
                }
            }while (true);

            do
            {
                Console.Write("Podaj treść wiadomości:");
                Console.WriteLine();

                newText = Console.ReadLine().ToLower();


                if (string.IsNullOrEmpty(newText))
                {
                    Console.WriteLine("Treść nie może być pusta!");
                }
                else
                {
                    break;
                }
            }while (true);



            Console.Clear();
            TextList _oLista = new TextList();

            if (File.Exists(@"wiadomosci.xml"))
            {
                _oLista.LoadFromXml(@"wiadomosci.xml");

                _oLista.Add(new Text {
                    From = newFrom, Submit = newSubmit, _Text = newText, time = DateTime.Today
                });


                _oLista.SaveAsXml(@"wiadomosci.xml");
            }
            else if (!File.Exists(@"wiadomosci.xml"))
            {
                _oLista.Add(new Text {
                    From = newFrom, Submit = newSubmit, _Text = newText, time = DateTime.Today
                });


                _oLista.SaveAsXml(@"wiadomosci.xml");
            }
            else
            {
                Console.WriteLine("Błąd wczytywania wiadomosci");
            }
        }
예제 #7
0
        public Text_4(Narc files, CharTable charTable)
        {
            Version = 3;
            TextList.Clear();
            TextList.Add(new List <List <string> >());
            foreach (byte[] bytes in files.Files)
            {
                BinaryReader  br = new BinaryReader(new MemoryStream(bytes));
                List <string> s4 = new List <string>();
                bool          flag2 = false;
                int           stringCount = br.ReadUInt16(), originalKey = br.ReadUInt16();
                OriginalKeys.Add(originalKey);
                int   num = (originalKey * 0x2fd) & 0xffff;
                int[] numArray  = new int[stringCount];
                int[] numArray2 = new int[stringCount];
                for (int i = 0; i < stringCount; i++)
                {
                    int num2 = (num * (i + 1)) & 0xffff;
                    int num3 = num2 | (num2 << 16);
                    numArray[i]  = br.ReadInt32();
                    numArray[i]  = numArray[i] ^ num3;
                    numArray2[i] = br.ReadInt32();
                    numArray2[i] = numArray2[i] ^ num3;
                }
                for (int j = 0; j < stringCount; j++)
                {
                    int control = 0;
                    num = (0x91bd3 * (j + 1)) & 0xffff;
                    string text = "";
                    for (int k = 0; k < numArray2[j]; k++)
                    {
                        int num4 = br.ReadUInt16();
                        num4 ^= num;
                        switch (control)
                        {
                        case 0:
                            switch (num4)
                            {
                            case 0xE000:
                                text += "\\n";
                                break;

                            case 0x25BC:
                                if (Version > 2)
                                {
                                    text += "\\f";
                                }
                                else
                                {
                                    text += "\\r";
                                }
                                break;

                            case 0x25BD:
                                if (Version > 2)
                                {
                                    text += "\\r";
                                }
                                else
                                {
                                    text += "\\f";
                                }
                                break;

                            case 0xF100:
                                flag2 = true;
                                break;

                            case 0xFFFE:
                                text   += "[";
                                control = 1;
                                break;

                            case 0xFFFF:
                                break;

                            default:
                                if (flag2)
                                {
                                    int    num5 = 0;
                                    int    num6 = 0;
                                    string str  = null;
                                    while (true)
                                    {
                                        if (num5 >= 15)
                                        {
                                            num5 -= 15;
                                            if (num5 > 0)
                                            {
                                                int num8 = num6 | (num4 << 9 - num5 & 511);
                                                if ((num8 & 255) == 255)
                                                {
                                                    break;
                                                }
                                                if (num8 != 0 && num8 != 1)
                                                {
                                                    char str2 = charTable.GetCharacter(num8);
                                                    if (str2 == '\0')
                                                    {
                                                        text += "\\x" + num8.ToString("X4");
                                                    }
                                                    else
                                                    {
                                                        text += str2;
                                                    }
                                                }
                                            }
                                        }
                                        else
                                        {
                                            int num8 = num4 >> num5 & 511;
                                            if ((num8 & 255) == 255)
                                            {
                                                break;
                                            }
                                            if (num8 != 0 && num8 != 1)
                                            {
                                                char str3 = charTable.GetCharacter(num8);
                                                if (str3 == '\0')
                                                {
                                                    text += "\\x" + num8.ToString("X4");
                                                }
                                                else
                                                {
                                                    text += str3;
                                                }
                                            }
                                            num5 += 9;
                                            if (num5 < 15)
                                            {
                                                num6  = num4 >> num5 & 511;
                                                num5 += 9;
                                            }
                                            num  += 18749;
                                            num  &= 65535;
                                            num4  = br.ReadUInt16();
                                            num4 ^= num;
                                            k++;
                                        }
                                    }
                                    text += str;
                                }
                                else
                                {
                                    char str3 = charTable.GetCharacter(num4);
                                    if (str3 == '\0')
                                    {
                                        text += "\\x" + num4.ToString("X4");
                                    }
                                    else
                                    {
                                        text += str3;
                                    }
                                }
                                break;
                            }
                            break;

                        case 1:
                            text += num4.ToString("X4");
                            if (num4 == 0x0129)     // 不知道为何,很奇怪的控制符
                            {
                                control = 3;
                            }
                            else
                            {
                                control = 2;
                            }
                            break;

                        case 2:
                            control = -num4;
                            if (control == 0)
                            {
                                text += "]";
                            }
                            break;

                        case 3:
                            control = -num4 + 1;
                            if (control == 0)
                            {
                                text += "]";
                            }
                            break;

                        default:
                            text += "," + num4.ToString("X4");
                            control++;
                            if (control == 0)
                            {
                                text += "]";
                            }
                            break;
                        }
                        num += 18749;
                        num &= 65535;
                    }
                    s4.Add(text);
                }
                TextList[0].Add(s4);
            }
        }
예제 #8
0
        public void ScanObject()
        {
            if (_index > -1)
            {
                _values[0] = _names[_index];
                _index++;
                if (_index >= _names.Count)
                {
                    _index = -1;
                    _names.Clear();
                    return;
                }
            }

            ScanWhile(WhiteSpace);
            AtEnd = Eof || CheckChar('.');
            if (AtEnd)
            {
                SkipChar();
                ScanWhile(WhiteSpace);
                return;
            }

            _fields.Clear();
            _values.Clear();
            RecordType = ScanWhile(Identifier);
            if (RecordType == "")
            {
                throw new GeneratorException("Empty record type: " + Buffer);
            }
            ScanWhile(WhiteSpace);
            if (CheckChar('='))
            {
                SkipChar();
                if (CheckChar('{'))
                {
                    while (!Eof && !CheckChar('}'))
                    {
                        SkipChar(); // { or ,
                        ScanWhile(WhiteSpace);
                        var name = StringOrIdentifier();
                        _names.Add(name);
                        ScanWhile(WhiteSpace);
                    }
                    SkipChar();
                    _fields.Add("Name");
                    _values.Add(_names[0]);
                    _index = 1;
                }
                else
                {
                    var name = StringOrIdentifier();
                    ScanWhile(WhiteSpace);
                    _fields.Add("Name");
                    _values.Add(name);
                    if (CheckChar('['))
                    {
                        ScanAttributes();
                    }
                    if (Eof)
                    {
                        Rescan(" "); // Force processing of current record
                    }
                }
            }
            else if (CheckChar('['))
            {
                ScanAttributes();
            }
            Progress = true;
        }
        public Text_5(Narc files, CharTable charTable)
        {
            TextList.Clear();
            TextList.Add(new List <List <string> >());
            TextList.Add(new List <List <string> >());
            foreach (byte[] bytes in files.Files)
            {
                BinaryReader br = new BinaryReader(new MemoryStream(bytes));
                ushort       numSections, numEntries, tmpCharCount, tmpUnknown, tmpChar;
                uint         unk1, tmpOffset;
                uint[]       sizeSections  = new uint[] { 0, 0 };
                uint[]       sectionOffset = new uint[] { 0, 0 };
                ushort       key;
                numSections     = br.ReadUInt16();
                numEntries      = br.ReadUInt16();
                sizeSections[0] = br.ReadUInt32();
                unk1            = br.ReadUInt32();
                for (int i = 0; i < numSections; i++)
                {
                    sectionOffset[i] = br.ReadUInt32();
                }
                for (int i = 0; i < TextList.Count; i++)
                {
                    List <string> s              = new List <string>();
                    List <ushort> keys           = new List <ushort>();
                    List <ushort> unknowns       = new List <ushort>();
                    List <ushort> characterCount = new List <ushort>();
                    if (i < numSections)
                    {
                        br.BaseStream.Position = sectionOffset[i];
                        sizeSections[i]        = br.ReadUInt32();

                        List <uint>           tableOffsets = new List <uint>();
                        List <List <ushort> > encText      = new List <List <ushort> >();
                        for (int j = 0; j < numEntries; j++)
                        {
                            tmpOffset    = br.ReadUInt32();
                            tmpCharCount = br.ReadUInt16();
                            tmpUnknown   = br.ReadUInt16();
                            tableOffsets.Add(tmpOffset);
                            characterCount.Add(tmpCharCount);
                            unknowns.Add(tmpUnknown);
                        }
                        for (int j = 0; j < numEntries; j++)
                        {
                            List <ushort> tmpEncChars = new List <ushort>();
                            br.BaseStream.Position = sectionOffset[i] + tableOffsets[j];
                            for (int k = 0; k < characterCount[j]; k++)
                            {
                                tmpChar = br.ReadUInt16();
                                tmpEncChars.Add(tmpChar);
                            }
                            encText.Add(tmpEncChars);
                            key = (ushort)(encText[j][characterCount[j] - 1] ^ 0xFFFF);
                            for (int k = characterCount[j] - 1; k >= 0; k--)
                            {
                                encText[j][k] ^= key;
                                if (k == 0)
                                {
                                    keys.Add(key);
                                }
                                key = (ushort)(((key >> 3) | (key << 13)) & 0xFFFF);
                            }
                            string line = "";
                            for (int k = 0; k < characterCount[j]; k++)
                            {
                                if (encText[j][k] > 20 && encText[j][k] <= 0xFFF0 && encText[j][k] != 0xF000)
                                {
                                    line += (char)encText[j][k];
                                }
                                else if (encText[j][k] == 0xFFFE)
                                {
                                    line += "\\n";
                                }
                                else if (encText[j][k] == 0xFFFF)
                                {
                                    // line += "\\xFFFF";
                                }
                                else if (encText[j][k] == 0xF000)
                                {
                                    switch (encText[j][k + 1])
                                    {
                                    case 0xBE00:
                                        line += "\\r";
                                        break;

                                    case 0xBE01:
                                        line += "\\f";
                                        break;

                                    default:
                                        line += $"[{encText[j][k + 1]:X4}";
                                        for (int control = 0; control < encText[j][k + 2]; control++)
                                        {
                                            line += $",{encText[j][k + 3 + control]:X4}";
                                        }
                                        line += "]";
                                        break;
                                    }
                                    k += 2 + encText[j][k + 2];
                                }
                                else
                                {
                                    line += $"\\x{encText[j][k]:X4}";
                                }
                            }
                            s.Add(line);
                        }
                    }
                    TextList[i].Add(s);
                    Keys[i].Add(keys);
                    Unknowns[i].Add(unknowns);
                    OriginalLengths[i].Add(characterCount);
                }
            }
        }
예제 #10
0
        public bool ReadComboItem(InternetExplorer IE, HTMLDocument doc,
                                  string Depth1Txt, string Depth2Txt, string Depth3Txt, string Depth4Txt,
                                  int nCurDepth, int nLastDepth,
                                  string ID, string ID2, string ID3, string ID4, string Comment,
                                  ref List <Dictionary <KPMReadInfo, List <string> > > ReadList)
        {
            bool bResult = true;

#if (DEBUG)
            g_Util.DebugPrint("[ReadComboItem]");
#endif
            string[] IDAray     = { ID, ID2, ID3, ID4 };
            string[] ItemIDAray = { ID + "_items", ID2 + "_items", ID3 + "_items", ID4 + "_items" };

            TotalWait(IE, doc, IDAray[nCurDepth]);
            IHTMLElement SelectedElement = doc.getElementById(IDAray[nCurDepth]);
            SelectedElement.click();

            TotalWait(IE, doc, ItemIDAray[nCurDepth]);
            IHTMLElementCollection elemcoll = doc.getElementById(ItemIDAray[nCurDepth]).children as IHTMLElementCollection;

            Dictionary <KPMReadInfo, List <string> > LastList = null;
            List <string> TextList = null;
            KPMReadInfo   nInfo    = null;
            int           nLen     = elemcoll.length;
            foreach (IHTMLElement elem in elemcoll)
            {
                string ElemText = elem.innerText;

                if (nCurDepth < nLastDepth - 1)
                {
                    if (nCurDepth == 0)
                    {
                        Depth1Txt = ElemText;
                    }
                    else if (nCurDepth == 1)
                    {
                        Depth2Txt = ElemText;
                    }
                    else if (nCurDepth == 2)
                    {
                        Depth3Txt = ElemText;
                    }
                    else
                    {
                        Depth4Txt = ElemText;
                    }

                    elem.click();
                    TotalWait(IE, doc);

                    int nNextdepth = nCurDepth + 1;
                    ReadComboItem(IE, doc,
                                  Depth1Txt, Depth2Txt, Depth3Txt, Depth4Txt,
                                  nNextdepth, nLastDepth,
                                  ID, ID2, ID3, ID4, Comment,
                                  ref ReadList);
                }
                else
                {   // End. Let's add all texts.
                    if (nInfo == null)
                    {
                        nInfo           = new KPMReadInfo();
                        nInfo.Depth1    = Depth1Txt; nInfo.Depth2 = Depth2Txt;
                        nInfo.Depth3    = Depth3Txt; nInfo.Depth4 = Depth4Txt;
                        nInfo.nDepthCnt = nCurDepth;
                        nInfo.sDataType = Comment;
                    }
                    if (TextList == null)
                    {
                        TextList = new List <string>();
                    }
                    if (LastList == null)
                    {
                        LastList = new Dictionary <KPMReadInfo, List <string> >();
                    }

                    TextList.Add(ElemText);
                    g_Util.DebugPrint("\t[ReadComboItem] Text Add = (" + Depth1Txt + ")(" + Depth2Txt + ")(" + Depth3Txt + ")(" + Depth4Txt + ")-" + ElemText);
                }
            }
            if (LastList != null)
            {
                LastList.Add(nInfo, TextList);
                ReadList.Add(LastList);
            }
            return(bResult);
        }