예제 #1
0
        private static System.Text.StringBuilder insertSymbol(System.Text.StringBuilder record, string language)
        {
            Random rnd = new Random();

            CharArray[] charRange = new CharArray[3] {
                numberChar, upperAlphabetChar, lowerAlphabetChar
            };
            char symbol = charRange[rnd.Next(0, 2)](localCharRange(language));

            return(record.Insert(rnd.Next(0, record.Length - 1), symbol));
        }
        public static SaveGameHeader?CreateFromHeaderInfo(SourceSave?saveRef, ParsedDataMap dataHeader)
        {
            CharArray name = dataHeader.GetField <CharArray>("szName");

            switch (name)
            {
            case "Entities":
                return(new ETableHeader(saveRef, dataHeader));

            case "Physics":
                return(new PhysicsInfoHeader(saveRef, dataHeader));

            case "AI":
            case "Templates":
            case "ResponseSystem":
            case "Commentary":
            case "EventQueue":
            case "Achievement":
                return(new VersionableSaveGameHeader(saveRef, dataHeader));

            default:
                saveRef !.SaveInfo.AddError($"unknown header name: {name}");
                return(null);
                // todo VScriptServer and maybe PaintDatabase (will have to ree)
            }
        }
예제 #3
0
        private bool TryGetChar(char ch, out Char c)
        {
            var cr = CharArray.Where(o => o.Value == ch);

            c = cr.FirstOrDefault();
            return(cr.Count() != 0);
        }
예제 #4
0
        public void GetMutableHashCode_Works()
        {
            var ca1 = new CharArray(2);
            ca1.Append('a');
            ca1.Append('b');

            var ca2 = new CharArray(2);
            ca2.Append('b');
            ca2.Append('a');

            Assert.That(ca1.GetMutableHashCode(), Is.Not.EqualTo(ca2.GetMutableHashCode()));

            var ca3 = new CharArray(3);
            ca3.Append('a');
            ca3.Append('b');
            ca3.Append('c');

            Assert.That(ca2.GetMutableHashCode(), Is.Not.EqualTo(ca3.GetMutableHashCode()));

            var ca4 = new CharArray(3);
            ca4.Append('a');
            ca4.Append('b');
            ca4.Append('c');

            Assert.That(ca3.GetMutableHashCode(), Is.EqualTo(ca4.GetMutableHashCode()));
        }
예제 #5
0
        static void Main(string[] args)
        {
            IntArray  intArray  = new IntArray(10);
            CharArray charArray = new CharArray(15);

            charArray = intArray as CharArray;
        }
예제 #6
0
        public void GetMutableHashCode_Works()
        {
            var ca1 = new CharArray(2);

            ca1.Append('a');
            ca1.Append('b');

            var ca2 = new CharArray(2);

            ca2.Append('b');
            ca2.Append('a');

            Assert.That(ca1.GetMutableHashCode(), Is.Not.EqualTo(ca2.GetMutableHashCode()));

            var ca3 = new CharArray(3);

            ca3.Append('a');
            ca3.Append('b');
            ca3.Append('c');

            Assert.That(ca2.GetMutableHashCode(), Is.Not.EqualTo(ca3.GetMutableHashCode()));

            var ca4 = new CharArray(3);

            ca4.Append('a');
            ca4.Append('b');
            ca4.Append('c');

            Assert.That(ca3.GetMutableHashCode(), Is.EqualTo(ca4.GetMutableHashCode()));
        }
예제 #7
0
 public CharArrayWrapper(CharArrayPool pool, int size, int requestedSize)
 {
     this.UsedLength = requestedSize;
     this.pool       = pool;
     this.charArray  = new CharArray(size);
     this.RefCount   = 1;
 }
예제 #8
0
        /**
         * Tests the performance of MyersDiff for texts which are similar (not
         * random data). The CPU time is measured and returned. Because of bad
         * accuracy of CPU time information the diffs are repeated. During each
         * repetition the interim CPU time is checked. The diff operation is
         * repeated until we have seen the CPU time clock changed its value at least
         * {@link #minCPUTimerTicks} times.
         *
         * @param characters
         *            the size of the diffed character sequences.
         * @return performance data
         */
        private PerfData test(int characters)
        {
            PerfData  ret            = new PerfData();
            string    a              = DiffTestDataGenerator.generateSequence(characters, 971, 3);
            string    b              = DiffTestDataGenerator.generateSequence(characters, 1621, 5);
            CharArray ac             = new CharArray(a);
            CharArray bc             = new CharArray(b);
            MyersDiff myersDiff      = null;
            int       cpuTimeChanges = 0;
            long      lastReadout    = 0;
            long      interimTime    = 0;
            int       repetitions    = 0;

            stopwatch.start();
            while (cpuTimeChanges < minCPUTimerTicks && interimTime < longTaskBoundary)
            {
                myersDiff = new MyersDiff(ac, bc);
                repetitions++;
                interimTime = stopwatch.readout();
                if (interimTime != lastReadout)
                {
                    cpuTimeChanges++;
                    lastReadout = interimTime;
                }
            }
            ret.runningTime = stopwatch.stop() / repetitions;
            ret.N           = (ac.size() + bc.size());
            ret.D           = myersDiff.getEdits().size();

            return(ret);
        }
예제 #9
0
    void Awake( )
    {
        _charArray        = new CharArray(256);
        onAnimationEvent += (PhoneAnimationEvent e) => {
            switch (e)
            {
            case PhoneAnimationEvent.PhoneOpenStart:
                switch (_nextOpenScreen)
                {
                case PhoneScreen.Matches:
                    ShowMatches();
                    break;

                case PhoneScreen.NewMatch:
                    ShowNewMatchScreen(_targetProfile);
                    break;

                case PhoneScreen.Profile:
                    ShowProfileScreen(_targetProfile);
                    break;
                }
                break;
            }
        };
    }
 public static EmbeddedStateFile CreateFromName(SourceSave saveRef, CharArray fileName)
 {
     return(fileName.Str.Substring(fileName.Str.Length - 3, 3) switch {
         "hl1" => new SaveGameStateFile(saveRef, fileName),
         "hl2" => new ClientStateFile(saveRef, fileName),
         "hl3" => new EntityPatchFile(saveRef, fileName),
         _ => new UnknownStateFile(saveRef, fileName)
     });
예제 #11
0
    public static void Main()
    {
        /* ASCII文字列を標準入力から受け取って、同じ文字列を出力するBFのコードを返す */
        var line  = System.Console.ReadLine();
        var array = new CharArray(line);
        var res   = array.DifArray().Select(x => new BFBuilder(x).Build());

        Console.WriteLine(string.Join("", res));
    }
예제 #12
0
 protected static string toString(CharArray a, CharArray b,
                                  int x, int k)
 {
     return("(" + x + "," + (k + x)
            + (x < 0 ? '<' :
               (x >= a.array.Length ?
                '>' : a.array[x]))
            + (k + x < 0 ? '<' :
               (k + x >= b.array.Length ?
                '>' : b.array[k + x]))
            + ")");
 }
예제 #13
0
 protected bool Equals(KitchenSinkPortable other)
 {
     return(Bool == other.Bool && BoolArray.SequenceEqual(other.BoolArray) &&
            ByteArray.SequenceEqual(other.ByteArray) && Byte == other.Byte &&
            CharArray.SequenceEqual(other.CharArray) && Char == other.Char &&
            ShortArray.SequenceEqual(other.ShortArray) &&
            Short == other.Short && IntArray.SequenceEqual(other.IntArray) && Int == other.Int &&
            LongArray.SequenceEqual(other.LongArray) && Long == other.Long &&
            FloatArray.SequenceEqual(other.FloatArray) &&
            Float.Equals(other.Float) && DoubleArray.SequenceEqual(other.DoubleArray) &&
            Double.Equals(other.Double) &&
            string.Equals(String, other.String) && StringArray.SequenceEqual(other.StringArray)
            );
 }
예제 #14
0
 protected bool Equals(KitchenSinkDataSerializable other)
 {
     return(BoolArray.SequenceEqual(other.BoolArray) && Bool == other.Bool &&
            ByteArray.SequenceEqual(other.ByteArray) && Byte == other.Byte &&
            CharArray.SequenceEqual(other.CharArray) && Char == other.Char &&
            ShortArray.SequenceEqual(other.ShortArray) &&
            Short == other.Short && IntArray.SequenceEqual(other.IntArray) && Int == other.Int &&
            LongArray.SequenceEqual(other.LongArray) && Long == other.Long &&
            FloatArray.SequenceEqual(other.FloatArray) &&
            Float.Equals(other.Float) && DoubleArray.SequenceEqual(other.DoubleArray) &&
            Double.Equals(other.Double) &&
            string.Equals(Chars, other.Chars) && string.Equals(String, other.String) &&
            StringArray.SequenceEqual(other.StringArray) &&
            Equals(Serializable, other.Serializable) && Equals(Portable, other.Portable) &&
            Equals(Data, other.Data) && DateTime.Equals(other.DateTime));
 }
예제 #15
0
        static void Main(string[] args)
        {
            string z = "qqqwwwe";

            char[] a = { 'q', 'w', 'e', 'r', 't', 'y', 'y' };
            char[] b = { 'q', 'w', 'e', 'r', 't', 'y' };
            char[] c = { 'y', 't', 'r', 'e', 'w', 'q' };
            char[] d = { 'q', 'w', 'e', 'r', 't', 'y' };

            Console.WriteLine("Возвращаем элемент массива по индексу");
            Console.WriteLine(CharArray.Indexer(a, 3));

            Console.WriteLine();
            Console.WriteLine("Конвертируем строку в массив символов");
            CharArray.ConvertToChar(z);
            foreach (char item in z)
            {
                Console.Write(item + ", ");
            }

            Console.WriteLine();
            Console.WriteLine("Возвращаем количество символов в массиве");
            Console.WriteLine(CharArray.SumChar(a));

            Console.WriteLine();
            Console.WriteLine("Конвертируем массив символов в строку");
            Console.WriteLine(CharArray.ConvertToString(b));

            Console.WriteLine();
            Console.WriteLine("Находим символ в массиве и его позицию");
            CharArray.Search(c, 'e');
            CharArray.Search(c, 'b');

            Console.WriteLine();
            Console.WriteLine("Возвращаем новый массив символов состоящий из двух других массивов");
            Console.WriteLine(CharArray.Concatenation(a, c));

            Console.WriteLine();
            Console.WriteLine("Сравниваем массивы на равенство");
            CharArray.Comparison(b, d);
            CharArray.Comparison(c, d);

            Console.WriteLine();
            Console.WriteLine("Находим количество задоного символа в массиве");
            CharArray.SearchSumChar(a, 'y');
        }
예제 #16
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ NullableId.GetHashCode();
         hashCode = (hashCode * 397) ^ Byte.GetHashCode();
         hashCode = (hashCode * 397) ^ Short.GetHashCode();
         hashCode = (hashCode * 397) ^ Int;
         hashCode = (hashCode * 397) ^ Long.GetHashCode();
         hashCode = (hashCode * 397) ^ UShort.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)UInt;
         hashCode = (hashCode * 397) ^ ULong.GetHashCode();
         hashCode = (hashCode * 397) ^ Float.GetHashCode();
         hashCode = (hashCode * 397) ^ Double.GetHashCode();
         hashCode = (hashCode * 397) ^ Decimal.GetHashCode();
         hashCode = (hashCode * 397) ^ (String != null ? String.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ DateTime.GetHashCode();
         hashCode = (hashCode * 397) ^ TimeSpan.GetHashCode();
         hashCode = (hashCode * 397) ^ DateTimeOffset.GetHashCode();
         hashCode = (hashCode * 397) ^ Guid.GetHashCode();
         hashCode = (hashCode * 397) ^ Bool.GetHashCode();
         hashCode = (hashCode * 397) ^ Char.GetHashCode();
         hashCode = (hashCode * 397) ^ NullableDateTime.GetHashCode();
         hashCode = (hashCode * 397) ^ NullableTimeSpan.GetHashCode();
         hashCode = (hashCode * 397) ^ (ByteArray != null ? ByteArray.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CharArray != null ? CharArray.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (StringArray != null ? StringArray.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (IntArray != null ? IntArray.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LongArray != null ? LongArray.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (StringList != null ? StringList.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (StringMap != null ? StringMap.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (IntStringMap != null ? IntStringMap.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SubType != null ? SubType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SubTypes != null ? SubTypes.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CustomText != null ? CustomText.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (MaxText != null ? MaxText.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CustomDecimal.GetHashCode();
         return(hashCode);
     }
 }
    void Awake()
    {
        messageCharArray              = new CharArray(256);
        spriteRenderer.enabled        = false;
        profileSpriteRenderer.enabled = false;
        messageTextMeshPro.enabled    = false;

        onAnimationEvent += (CatchScreenAnimationEvent e) => {
            switch (e)
            {
            case CatchScreenAnimationEvent.CatchAnimationComplete:
                if (_goToPhone)
                {
                    phoneManager.ShowPhone(PhoneScreen.NewMatch);
                }
                else
                {
                    bobberAimBehaviour.enabled = true;
                }
                break;
            }
        };
    }
예제 #18
0
 protected bool Equals(AllTypes other)
 {
     return(Id == other.Id &&
            NullableId == other.NullableId &&
            Byte == other.Byte &&
            Short == other.Short &&
            Int == other.Int &&
            Long == other.Long &&
            UShort == other.UShort &&
            UInt == other.UInt &&
            ULong == other.ULong &&
            Float.Equals(other.Float) &&
            Double.Equals(other.Double) &&
            Decimal == other.Decimal &&
            string.Equals(String, other.String) &&
            DateTime.Equals(other.DateTime) &&
            TimeSpan.Equals(other.TimeSpan) &&
            DateTimeOffset.Equals(other.DateTimeOffset) &&
            Guid.Equals(other.Guid) &&
            Bool == other.Bool &&
            Char == other.Char &&
            NullableDateTime.Equals(other.NullableDateTime) &&
            NullableTimeSpan.Equals(other.NullableTimeSpan) &&
            ByteArray.SequenceEqual(other.ByteArray) &&
            CharArray.SequenceEqual(other.CharArray) &&
            IntArray.SequenceEqual(other.IntArray) &&
            LongArray.SequenceEqual(other.LongArray) &&
            StringArray.SequenceEqual(other.StringArray) &&
            StringList.SequenceEqual(other.StringList) &&
            StringMap.SequenceEqual(other.StringMap) &&
            IntStringMap.SequenceEqual(other.IntStringMap) &&
            SubType.Equals(other.SubType) &&
            SubTypes.SequenceEqual(other.SubTypes) &&
            CustomText == other.CustomText &&
            MaxText == other.MaxText &&
            CustomDecimal.Equals(other.CustomDecimal));
 }
예제 #19
0
 public StringBuffer insert(int arg0, CharArray arg1, int arg2, int arg3)
 {
     return Instance.CallMethod<StringBuffer>("insert", "(I[CII)Ljava/lang/StringBuffer;", arg0, arg1, arg2, arg3);
 }
예제 #20
0
 public bool CheckIfContains(char c)
 {
     return(CharArray.Contains(c));
 }
예제 #21
0
 public StringBuilder append(CharArray arg0)
 {
     return Instance.CallMethod<StringBuilder>("append", "([C)Ljava/lang/StringBuilder;", arg0);
 }
예제 #22
0
 public StringBuilder append(CharArray arg0, int arg1, int arg2)
 {
     return Instance.CallMethod<StringBuilder>("append", "([CII)Ljava/lang/StringBuilder;", arg0, arg1, arg2);
 }
예제 #23
0
 public void println(CharArray arg0)
 {
     Instance.CallMethod("println", "([C)V", arg0);
 }
예제 #24
0
        public override string ToString()
        {
            string newString = new string(CharArray.ToArray());

            return(newString);
        }
예제 #25
0
 public CharArrayReader(CharArray arg0)
     : base(ProxyCtor.I)
 {
     Instance.CallConstructor("([C)V", arg0);
 }
예제 #26
0
 public CharArrayReader(CharArray arg0, int arg1, int arg2)
     : base(ProxyCtor.I)
 {
     Instance.CallConstructor("([CII)V", arg0, arg1, arg2);
 }
예제 #27
0
 public int read(CharArray arg0, int arg1, int arg2)
 {
     return Instance.CallMethod<int>("read", "([CII)I", arg0, arg1, arg2);
 }
예제 #28
0
 public int read(CharArray arg0)
 {
     return Instance.CallMethod<int>("read", "([C)I", arg0);
 }
 protected override void Parse(ref ByteStreamReader bsr)
 {
     Id = bsr.ReadCharArray(4);
 }
 public SaveGameStateFile(SourceSave saveRef, CharArray name) : base(saveRef, name)
 {
 }
 public EmbeddedStateFile(SourceSave saveRef, CharArray name) : base(saveRef)
 {
     Name = name;
 }
예제 #32
0
 public void unread(CharArray arg0)
 {
     Instance.CallMethod("unread", "([C)V", arg0);
 }
예제 #33
0
 public void unread(CharArray arg0, int arg1, int arg2)
 {
     Instance.CallMethod("unread", "([CII)V", arg0, arg1, arg2);
 }
예제 #34
0
 public static bool requiresBidi(CharArray arg0, int arg1, int arg2)
 {
     return Static.CallMethod<bool>(typeof(Bidi), "requiresBidi", "([CII)Z", arg0, arg1, arg2);
 }
예제 #35
0
            public bool equals(int i, Sequence other, int j)
            {
                CharArray o = (CharArray)other;

                return(array[i] == o.array[j]);
            }
 public EntityPatchFile(SourceSave saveRef, CharArray name) : base(saveRef, name)
 {
 }
예제 #37
0
 public ClientStateFile(SourceSave saveRef, CharArray name) : base(saveRef, name)
 {
 }
예제 #38
0
 protected static string toString(CharArray a, CharArray b,
     int x, int k)
 {
     return "(" + x + "," + (k + x)
            + (x < 0 ? '<' :
                               (x >= a.array.Length ?
                                                        '>' : a.array[x]))
            + (k + x < 0 ? '<' :
                                   (k + x >= b.array.Length ?
                                                                '>' : b.array[k + x]))
            + ")";
 }
예제 #39
0
 public StringBuilder insert(int arg0, CharArray arg1)
 {
     return Instance.CallMethod<StringBuilder>("insert", "(I[C)Ljava/lang/StringBuilder;", arg0, arg1);
 }
예제 #40
0
 public override char[] MapCharArray(CharArray value)
 {
     return(value.AsObjectCopy());
 }
예제 #41
0
 public int GetIndexOfElement(char c)
 {
     return(CharArray.IndexOf(c));
 }
예제 #42
0
 public Bidi(CharArray arg0, int arg1, ByteArray arg2, int arg3, int arg4, int arg5)
     : base(ProxyCtor.I)
 {
     Instance.CallConstructor("([CI[BIII)V", arg0, arg1, arg2, arg3, arg4, arg5);
 }
예제 #43
0
 public static void SetText(this TMP_Text textMeshPro, CharArray charArray)
 {
     textMeshPro.SetCharArray(charArray.GetArray(), 0, charArray.count);
 }
 void Awake()
 {
     charArray = new CharArray(4);
 }
 public PasswordAuthentication(String arg0, CharArray arg1)
     : base(ProxyCtor.I)
 {
     Instance.CallConstructor("(Ljava/lang/String;[C)V", arg0, arg1);
 }
예제 #46
0
        protected static string toString(Sequence seq, int begin, int end)
        {
            CharArray a = (CharArray)seq;

            return(new string(a.array, begin, end - begin));
        }