public void Load(byte[] data)
        {
            if (data.Length != 292)
            {
                throw new FormatException("GTS record length is incorrect.");
            }

            Data = new byte[0xEC];
            Array.Copy(data, 0, Data, 0, 0xEC);
            Species           = BitConverter.ToUInt16(data, 0xEC);
            Gender            = (Genders)data[0xEE];
            Level             = data[0xEF];
            RequestedSpecies  = BitConverter.ToUInt16(data, 0xF0);
            RequestedGender   = (Genders)data[0xF2];
            RequestedMinLevel = data[0xF3];
            RequestedMaxLevel = data[0xF4];
            Unknown1          = data[0xF5];
            TrainerGender     = (GtsTrainerGenders)data[0xF6];
            Unknown2          = data[0xF7];
            TimeDeposited     = TimestampToDate(BitConverter.ToUInt64(data, 0xF8));
            TimeWithdrawn     = TimestampToDate(BitConverter.ToUInt64(data, 0x100));
            PID             = BitConverter.ToInt32(data, 0x108);
            TrainerName     = new String4(data, 0x10C, 0x10);
            TrainerOT       = BitConverter.ToUInt16(data, 0x11C);
            TrainerCountry  = data[0x11E];
            TrainerRegion   = data[0x11F];
            TrainerClass    = data[0x120];
            IsExchanged     = data[0x121];
            TrainerVersion  = data[0x122];
            TrainerLanguage = data[0x123];
        }
Beispiel #2
0
 public StandardGuitar() : base()
 {
     String1.SetTuneNote("E", 4);
     String2.SetTuneNote("B", 3);
     String3.SetTuneNote("G", 3);
     String4.SetTuneNote("D", 3);
     s5 = new GuitarString("A", 2);
     s6 = new GuitarString("E", 2);
 }
Beispiel #3
0
 public StandardGuitar() : base()
 {
     String1.SetTuneNote("E", 4);
     String2.SetTuneNote("B", 3);
     String3.SetTuneNote("G", 3);
     String4.SetTuneNote("D", 3);
     _guitarStrings.Add(new GuitarString("A", 2));
     _guitarStrings.Add(new GuitarString("E", 2));
 }
Beispiel #4
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = String0.GetHashCode();
         hashCode = (hashCode * 397) ^ String1.GetHashCode();
         hashCode = (hashCode * 397) ^ String2.GetHashCode();
         hashCode = (hashCode * 397) ^ String3.GetHashCode();
         hashCode = (hashCode * 397) ^ String4.GetHashCode();
         hashCode = (hashCode * 397) ^ String5.GetHashCode();
         return(hashCode);
     }
 }
Beispiel #5
0
        private void butValidate4_Click(object sender, EventArgs e)
        {
            try
            {
                int x = int.Parse(String4.Text, System.Globalization.NumberStyles.None);
                String4.Text = x.ToString();
            }

            catch (Exception)
            {
                MessageBox.Show("Enter only numbers");
                String4.Clear();
            }
        }
Beispiel #6
0
        public void TestCamelCaseSplit()
        {
            const string String1   = "ThisIsOneTestString";
            const string String2   = "ThisOneABCContainsAbreviation";
            const string String3   = "ThisOneContainsASingleCharacterWord";
            const string String4   = "ThisOneEndsWithAbbreviationABC";
            const string String5   = "ThisOneEndsWithASingleCharacterWordZ";
            var          expected1 = new[] { "This", "Is", "One", "Test", "String" };
            var          expected2 = new[] { "This", "One", "ABC", "Contains", "Abreviation" };
            var          expected3 = new[] { "This", "One", "Contains", "A", "Single", "Character", "Word" };
            var          expected4 = new[] { "This", "One", "Ends", "With", "Abbreviation", "ABC" };
            var          expected5 = new[] { "This", "One", "Ends", "With", "A", "Single", "Character", "Word", "Z" };

            var split1 = String1.CamelCaseSplit();

            Assert.AreEqual(expected1.Length, split1.Count);
            for (int i = 0; i < expected1.Length; ++i)
            {
                Assert.AreEqual(expected1[i], split1[i]);
            }
            var split2 = String2.CamelCaseSplit();

            Assert.AreEqual(expected2.Length, split2.Count);
            for (int i = 0; i < expected2.Length; ++i)
            {
                Assert.AreEqual(expected2[i], split2[i]);
            }
            var split3 = String3.CamelCaseSplit();

            Assert.AreEqual(expected3.Length, split3.Count);
            for (int i = 0; i < expected3.Length; ++i)
            {
                Assert.AreEqual(expected3[i], split3[i]);
            }
            var split4 = String4.CamelCaseSplit();

            Assert.AreEqual(expected4.Length, split4.Count);
            for (int i = 0; i < expected4.Length; ++i)
            {
                Assert.AreEqual(expected4[i], split4[i]);
            }
            var split5 = String5.CamelCaseSplit();

            Assert.AreEqual(expected5.Length, split5.Count);
            for (int i = 0; i < expected5.Length; ++i)
            {
                Assert.AreEqual(expected5[i], split5[i]);
            }
        }
Beispiel #7
0
        private void butValidateall_Click(object sender, EventArgs e)
        {
            string a = string1.Text;

            for (int i = 0; i <= a.Length; i++)
            {
                a = a.Replace("$", "");
                a = a.Replace("@", "");
                a = a.Replace("#", "");
                a = a.Replace("%", "");
                a = a.Replace("&", "");
                a = a.Replace("^", "");
                a = a.Replace("*", "");
            }
            outptstring1.Text = a;
            string b = String3.Text;

            if (b.StartsWith(" ") || b.StartsWith("$") || b.StartsWith("@") || b.StartsWith("%") || b.StartsWith("#"))
            {
                MessageBox.Show("The string3 can't start with a space or $ or @ or % or #");
                String3.Clear();
                String3.Focus();
            }
            string c = string2.Text;

            if (c.EndsWith(" ") || c.EndsWith("$") || c.EndsWith("@") || c.EndsWith("%") || c.EndsWith("#"))
            {
                MessageBox.Show("The string2 can't End with a space or $ or @ or % or #");
                string2.Clear();
                string2.Focus();
            }

            try
            {
                int x = int.Parse(String4.Text, System.Globalization.NumberStyles.None);
                String4.Text = x.ToString();
            }

            catch (Exception)
            {
                MessageBox.Show("Enter only numbers");
                String4.Clear();
            }
        }
Beispiel #8
0
        public void ShowInfo()
        {
            Console.WriteLine("Card ID: " + CardID);

            ushort gameBitmask = BitConverter.ToUInt16(File, 0x14C);

            Console.Write("This Mystery Gift is valid for:");
            if ((gameBitmask & 0x0400) == 0x0400)
            {
                Console.Write(" Diamond");
            }
            if ((gameBitmask & 0x0800) == 0x0800)
            {
                Console.Write(" Pearl");
            }
            if ((gameBitmask & 0x1000) == 0x1000)
            {
                Console.Write(" Platinum");
            }
            if ((gameBitmask & 0x0080) == 0x0080)
            {
                Console.Write(" HeartGold");
            }
            if ((gameBitmask & 0x0100) == 0x0100)
            {
                Console.Write(" SoulSilver");
            }
            Console.WriteLine();
            Console.WriteLine();

            // short description displayed on download
            Console.WriteLine(String4.GetStringGeneration4(File, 0x104, 36));

            // long description on the wonder card
            Console.WriteLine(String4.GetStringGeneration4(File, 0x154, 250));

            Console.WriteLine();
        }
Beispiel #9
0
            private void _read()
            {
                _code = ((PythonPickle.Opcode)m_io.ReadU1());
                switch (Code)
                {
                case PythonPickle.Opcode.Ext4: {
                    _arg = m_io.ReadU4le();
                    break;
                }

                case PythonPickle.Opcode.Tuple1: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Setitem: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.ReadonlyBuffer: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Stop: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Ext2: {
                    _arg = m_io.ReadU2le();
                    break;
                }

                case PythonPickle.Opcode.EmptyTuple: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Newtrue: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Long: {
                    _arg = new DecimalnlLong(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Newobj: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Bytearray8: {
                    _arg = new Bytearray8(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Put: {
                    _arg = new DecimalnlShort(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.StackGlobal: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.PopMark: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Append: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Newfalse: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binpersid: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Build: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.EmptyDict: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Tuple2: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Long4: {
                    _arg = new Long4(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.NextBuffer: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Appends: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binbytes: {
                    _arg = new Bytes4(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Dup: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.List: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Proto: {
                    _arg = m_io.ReadU1();
                    break;
                }

                case PythonPickle.Opcode.Pop: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Frame: {
                    _arg = m_io.ReadU8le();
                    break;
                }

                case PythonPickle.Opcode.String: {
                    _arg = new Stringnl(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binunicode: {
                    _arg = new Unicodestring4(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Float: {
                    _arg = new Floatnl(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Reduce: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.GlobalOpcode: {
                    _arg = new StringnlNoescapePair(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binput: {
                    _arg = m_io.ReadU1();
                    break;
                }

                case PythonPickle.Opcode.Memoize: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Persid: {
                    _arg = new StringnlNoescape(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Ext1: {
                    _arg = m_io.ReadU1();
                    break;
                }

                case PythonPickle.Opcode.None: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.ShortBinunicode: {
                    _arg = new Unicodestring1(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Obj: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binfloat: {
                    _arg = m_io.ReadF8be();
                    break;
                }

                case PythonPickle.Opcode.NewobjEx: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.EmptyList: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Tuple: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binunicode8: {
                    _arg = new Unicodestring8(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binget: {
                    _arg = m_io.ReadU1();
                    break;
                }

                case PythonPickle.Opcode.Dict: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binstring: {
                    _arg = new String4(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Setitems: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binint2: {
                    _arg = m_io.ReadU2le();
                    break;
                }

                case PythonPickle.Opcode.Binbytes8: {
                    _arg = new Bytes8(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binint1: {
                    _arg = m_io.ReadU1();
                    break;
                }

                case PythonPickle.Opcode.Inst: {
                    _arg = new StringnlNoescapePair(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.LongBinget: {
                    _arg = m_io.ReadU4le();
                    break;
                }

                case PythonPickle.Opcode.LongBinput: {
                    _arg = m_io.ReadU4le();
                    break;
                }

                case PythonPickle.Opcode.Int: {
                    _arg = new DecimalnlShort(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Binint: {
                    _arg = m_io.ReadS4le();
                    break;
                }

                case PythonPickle.Opcode.Unicode: {
                    _arg = new Unicodestringnl(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Long1: {
                    _arg = new Long1(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.ShortBinstring: {
                    _arg = new String1(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Mark: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Frozenset: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Tuple3: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Additems: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.Get: {
                    _arg = new DecimalnlShort(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.EmptySet: {
                    _arg = new NoArg(m_io, this, m_root);
                    break;
                }

                case PythonPickle.Opcode.ShortBinbytes: {
                    _arg = new Bytes1(m_io, this, m_root);
                    break;
                }
                }
            }
        protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
        {
            //validate
            if (item == null)
            {
                return(DefaultTemplate);
            }

            //get string
            var str = item as string;

            if (item.GetType().IsPrimitive || item.GetType().IsEnum)
            {
                str = item.ToString();
            }

            //select template
            if (str == null)
            {
                return(DefaultTemplate);
            }
            if (String1 != null && String1.Split(',').Contains(str))
            {
                return(Template1);
            }
            if (String2 != null && String2.Split(',').Contains(str))
            {
                return(Template2);
            }
            if (String3 != null && String3.Split(',').Contains(str))
            {
                return(Template3);
            }
            if (String4 != null && String4.Split(',').Contains(str))
            {
                return(Template4);
            }
            if (String5 != null && String5.Split(',').Contains(str))
            {
                return(Template5);
            }
            if (String6 != null && String6.Split(',').Contains(str))
            {
                return(Template6);
            }
            if (String7 != null && String7.Split(',').Contains(str))
            {
                return(Template7);
            }
            if (String8 != null && String8.Split(',').Contains(str))
            {
                return(Template8);
            }
            if (String9 != null && String9.Split(',').Contains(str))
            {
                return(Template9);
            }
            if (String10 != null && String10.Split(',').Contains(str))
            {
                return(Template10);
            }
            return(DefaultTemplate);
        }