コード例 #1
0
        public override string ToString()
        {
            MBStringBuilder mbStringBuilder = new MBStringBuilder();

            mbStringBuilder.Initialize(150, nameof(ToString));
            mbStringBuilder.Append <string>("<BodyProperties version=\"4\" ");
            mbStringBuilder.Append <string>(this._dynamicBodyProperties.ToString() + " ");
            mbStringBuilder.Append <string>(this._staticBodyProperties.ToString());
            mbStringBuilder.Append <string>(" />");
            return(mbStringBuilder.ToStringAndRelease());
        }
コード例 #2
0
        public string GetAllBattleReports()
        {
            MBStringBuilder mbStringBuilder = new MBStringBuilder();

            mbStringBuilder.Initialize(callerMemberName: nameof(GetAllBattleReports));
            for (int index = this.BattleReports.Count - 1; index >= 0; --index)
            {
                mbStringBuilder.Append <string>(this.BattleReports[index]);
                mbStringBuilder.Append <string>("\n\n");
            }
            return(mbStringBuilder.ToStringAndRelease());
        }
コード例 #3
0
        internal static string GetAliveDotNetObjectNames()
        {
            MBStringBuilder mbStringBuilder = new MBStringBuilder();

            mbStringBuilder.Initialize(callerMemberName: nameof(GetAliveDotNetObjectNames));
            lock (DotNetObject.Locker)
            {
                Dictionary <string, int> dictionary = new Dictionary <string, int>();
                foreach (DotNetObjectReferenceCounter referenceCounter in DotNetObject.DotnetObjectReferences.Values)
                {
                    Type type = referenceCounter.DotNetObject.GetType();
                    if (!dictionary.ContainsKey(type.Name))
                    {
                        dictionary.Add(type.Name, 1);
                    }
                    else
                    {
                        dictionary[type.Name] = dictionary[type.Name] + 1;
                    }
                }
                foreach (string key in dictionary.Keys)
                {
                    mbStringBuilder.Append <string>(key + "," + (object)dictionary[key] + "-");
                }
            }
            return(mbStringBuilder.ToStringAndRelease());
        }
コード例 #4
0
        internal TextObject CallFunction(
            string functionName,
            List <TextExpression> functionParams,
            TextObject parent)
        {
            TextObject[] textObjectArray1 = new TextObject[functionParams.Count];
            TextObject[] textObjectArray2 = new TextObject[functionParams.Count];
            for (int index = 0; index < functionParams.Count; ++index)
            {
                textObjectArray1[index] = new TextObject(functionParams[index].EvaluateString(this, parent));
                textObjectArray2[index] = new TextObject(functionParams[index].RawValue);
            }
            this._curParams.Push(textObjectArray1);
            this._curParamsWithoutEvaluate.Push(textObjectArray2);
            MBStringBuilder mbStringBuilder = new MBStringBuilder();
            MBTextModel     functionBody    = this.GetFunctionBody(functionName);

            mbStringBuilder.Initialize(callerMemberName: nameof(CallFunction));
            foreach (TextExpression rootExpression in (IEnumerable <TextExpression>)functionBody.RootExpressions)
            {
                mbStringBuilder.Append <string>(rootExpression.EvaluateString(this, parent));
            }
            string stringAndRelease = mbStringBuilder.ToStringAndRelease();

            this._curParams.Pop();
            return(new TextObject(stringAndRelease));
        }
コード例 #5
0
        public override string ToString()
        {
            MBStringBuilder mbStringBuilder = new MBStringBuilder();

            mbStringBuilder.Initialize(150, nameof(ToString));
            mbStringBuilder.Append <string>("key=\"");
            mbStringBuilder.Append <string>(this.KeyPart1.ToString("X").PadLeft(16, '0'));
            mbStringBuilder.Append <string>(this.KeyPart2.ToString("X").PadLeft(16, '0'));
            mbStringBuilder.Append <string>(this.KeyPart3.ToString("X").PadLeft(16, '0'));
            mbStringBuilder.Append <string>(this.KeyPart4.ToString("X").PadLeft(16, '0'));
            mbStringBuilder.Append <string>(this.KeyPart5.ToString("X").PadLeft(16, '0'));
            mbStringBuilder.Append <string>(this.KeyPart6.ToString("X").PadLeft(16, '0'));
            mbStringBuilder.Append <string>(this.KeyPart7.ToString("X").PadLeft(16, '0'));
            mbStringBuilder.Append <string>(this.KeyPart8.ToString("X").PadLeft(16, '0'));
            mbStringBuilder.Append <string>("\" ");
            return(mbStringBuilder.ToStringAndRelease());
        }
コード例 #6
0
        public string GetID()
        {
            MBStringBuilder mbStringBuilder = new MBStringBuilder();

            mbStringBuilder.Initialize(callerMemberName: nameof(GetID));
            if (this.Value != null && this.Value.Length > 2 && (this.Value[0] == '{' && this.Value[1] == '='))
            {
                for (int index = 2; index < this.Value.Length && this.Value[index] != '}'; ++index)
                {
                    mbStringBuilder.Append(this.Value[index]);
                }
            }
            return(mbStringBuilder.ToStringAndRelease());
        }
コード例 #7
0
        public override string ToString()
        {
            MBStringBuilder mbStringBuilder = new MBStringBuilder();

            mbStringBuilder.Initialize(150, nameof(ToString));
            mbStringBuilder.Append <string>("age=\"");
            mbStringBuilder.Append <string>(this.Age.ToString("0.##"));
            mbStringBuilder.Append <string>("\" weight=\"");
            mbStringBuilder.Append <string>(this.Weight.ToString("0.####"));
            mbStringBuilder.Append <string>("\" build=\"");
            mbStringBuilder.Append <string>(this.Build.ToString("0.####"));
            mbStringBuilder.Append <string>("\" ");
            return(mbStringBuilder.ToStringAndRelease());
        }
コード例 #8
0
        public static string Process(
            MBTextModel dataRepresentation,
            TextProcessingContext textContext,
            TextObject parent = null)
        {
            MBStringBuilder mbStringBuilder = new MBStringBuilder();

            mbStringBuilder.Initialize(callerMemberName: nameof(Process));
            foreach (TextExpression rootExpression in (IEnumerable <TextExpression>)dataRepresentation.RootExpressions)
            {
                if (rootExpression != null)
                {
                    string str = rootExpression.EvaluateString(textContext, parent).ToString();
                    mbStringBuilder.Append <string>(str);
                }
            }
            return(mbStringBuilder.ToStringAndRelease());
        }
コード例 #9
0
        internal override string EvaluateString(TextProcessingContext context, TextObject parent)
        {
            int            asNumber    = this.EvaluateAsNumber(this._indexExp, context, parent);
            MultiStatement arrayAccess = context.GetArrayAccess(this.RawValue, asNumber);

            if (arrayAccess == null)
            {
                return("");
            }
            MBStringBuilder mbStringBuilder = new MBStringBuilder();

            mbStringBuilder.Initialize(callerMemberName: nameof(EvaluateString));
            foreach (TextExpression subStatement in (IEnumerable <TextExpression>)arrayAccess.SubStatements)
            {
                mbStringBuilder.Append <string>(subStatement.EvaluateString(context, parent));
            }
            return(mbStringBuilder.ToStringAndRelease());
        }
コード例 #10
0
        private string MarkerOccuranceExpression(string identifierName, string text)
        {
            int             i               = 0;
            int             num1            = 0;
            int             num2            = 0;
            MBStringBuilder mbStringBuilder = new MBStringBuilder();

            mbStringBuilder.Initialize(callerMemberName: nameof(MarkerOccuranceExpression));
            for (; i < text.Length; ++i)
            {
                if (text[i] != '{')
                {
                    if (num1 == 1 && num2 == 0)
                    {
                        mbStringBuilder.Append(text[i]);
                    }
                }
                else
                {
                    string token = TextProcessingContext.ReadFirstToken(text, ref i);
                    if (TextProcessingContext.IsDeclarationFinalizer(token))
                    {
                        --num1;
                        if (num2 > num1)
                        {
                            num2 = num1;
                        }
                    }
                    else if (TextProcessingContext.IsDeclaration(token))
                    {
                        string strB = token.Substring(1);
                        int    num3 = num2 != num1 ? 0 : (string.Compare(identifierName, strB, StringComparison.InvariantCultureIgnoreCase) == 0 ? 1 : 0);
                        ++num1;
                        if (num3 != 0)
                        {
                            num2 = num1;
                        }
                    }
                }
            }
            return(mbStringBuilder.ToStringAndRelease());
        }
コード例 #11
0
        private static string GetFieldValue(string text, string[] fieldNames)
        {
            int             i               = 0;
            int             index           = 0;
            int             num1            = 0;
            MBStringBuilder mbStringBuilder = new MBStringBuilder();

            mbStringBuilder.Initialize(callerMemberName: nameof(GetFieldValue));
            for (; i < text.Length; ++i)
            {
                if (text[i] != '{')
                {
                    if (index == fieldNames.Length && num1 == index)
                    {
                        mbStringBuilder.Append(text[i]);
                    }
                }
                else
                {
                    string token = TextProcessingContext.ReadFirstToken(text, ref i);
                    if (TextProcessingContext.IsDeclarationFinalizer(token))
                    {
                        --index;
                        if (num1 > index)
                        {
                            num1 = index;
                        }
                    }
                    else if (TextProcessingContext.IsDeclaration(token))
                    {
                        string strB = token.Substring(1);
                        int    num2 = num1 != index || index >= fieldNames.Length ? 0 : (string.Compare(fieldNames[index], strB, StringComparison.InvariantCultureIgnoreCase) == 0 ? 1 : 0);
                        ++index;
                        if (num2 != 0)
                        {
                            num1 = index;
                        }
                    }
                }
            }
            return(mbStringBuilder.ToStringAndRelease());
        }
コード例 #12
0
        internal override string EvaluateString(TextProcessingContext context, TextObject parent)
        {
            MultiStatement multiStatement = this.GetValue(context, parent);

            if (multiStatement == null)
            {
                return("");
            }
            MBStringBuilder mbStringBuilder = new MBStringBuilder();

            mbStringBuilder.Initialize(callerMemberName: nameof(EvaluateString));
            foreach (TextExpression subStatement in (IEnumerable <TextExpression>)multiStatement.SubStatements)
            {
                if (subStatement != null)
                {
                    mbStringBuilder.Append <string>(subStatement.EvaluateString(context, parent));
                }
            }
            return(mbStringBuilder.ToStringAndRelease());
        }
コード例 #13
0
        private List <TokenMatch> FindTokenMatchesAndText(string text)
        {
            List <TokenMatch> tokenMatches    = new List <TokenMatch>();
            MBStringBuilder   mbStringBuilder = new MBStringBuilder();

            mbStringBuilder.Initialize(callerMemberName: nameof(FindTokenMatchesAndText));
            int num = 0;

            while (num < text.Length)
            {
                if (text[num] == '{')
                {
                    if (mbStringBuilder.Length > 0)
                    {
                        tokenMatches.Add(new TokenMatch(TokenType.Text, mbStringBuilder.ToStringAndRelease(), 0, num, 1));
                        mbStringBuilder.Initialize(callerMemberName: nameof(FindTokenMatchesAndText));
                    }
                    int expressionEnd = this.FindExpressionEnd(text, num + 1);
                    if (!this.FindTokenMatches(text, num, expressionEnd, tokenMatches))
                    {
                        tokenMatches.Clear();
                        tokenMatches.Add(new TokenMatch(TokenType.Text, mbStringBuilder.ToStringAndRelease(), 0, text.Length, 1));
                        return(tokenMatches);
                    }
                    num = expressionEnd;
                }
                else
                {
                    mbStringBuilder.Append(text[num]);
                    ++num;
                }
            }
            string stringAndRelease = mbStringBuilder.ToStringAndRelease();

            if (stringAndRelease.Length > 0)
            {
                tokenMatches.Add(new TokenMatch(TokenType.Text, stringAndRelease, 0, num, 1));
            }
            return(tokenMatches);
        }
コード例 #14
0
        public string Serialize()
        {
            MBStringBuilder mbStringBuilder = new MBStringBuilder();

            mbStringBuilder.Initialize(callerMemberName: nameof(Serialize));
            bool flag = true;

            foreach (BannerData bannerData in this.BannerDataList)
            {
                if (!flag)
                {
                    mbStringBuilder.Append('.');
                }
                flag = false;
                mbStringBuilder.Append(bannerData.MeshId);
                mbStringBuilder.Append('.');
                mbStringBuilder.Append(bannerData.ColorId);
                mbStringBuilder.Append('.');
                mbStringBuilder.Append(bannerData.ColorId2);
                mbStringBuilder.Append('.');
                mbStringBuilder.Append((int)bannerData.Size.x);
                mbStringBuilder.Append('.');
                mbStringBuilder.Append((int)bannerData.Size.y);
                mbStringBuilder.Append('.');
                mbStringBuilder.Append((int)bannerData.Position.x);
                mbStringBuilder.Append('.');
                mbStringBuilder.Append((int)bannerData.Position.y);
                mbStringBuilder.Append('.');
                mbStringBuilder.Append(bannerData.DrawStroke ? 1 : 0);
                mbStringBuilder.Append('.');
                mbStringBuilder.Append(bannerData.Mirror ? 1 : 0);
                mbStringBuilder.Append('.');
                mbStringBuilder.Append((int)((double)bannerData.RotationValue / 0.002779999980703));
            }
            return(mbStringBuilder.ToStringAndRelease());
        }
コード例 #15
0
        public string CreateNewCodeString()
        {
            MBStringBuilder mbStringBuilder = new MBStringBuilder();

            mbStringBuilder.Initialize(callerMemberName: nameof(CreateNewCodeString));
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(this.EquipmentCode);
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(this.BodyProperties.ToString());
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(this.IsFemale ? "1" : "0");
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(this.IsHero ? "1" : "0");
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(((int)this.FormationClass).ToString());
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(this.Color1.ToString());
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(this.Color2.ToString());
            mbStringBuilder.Append <string>("@---@");
            return(mbStringBuilder.ToStringAndRelease());
        }
コード例 #16
0
        public static CharacterCode CreateFrom(BasicCharacterObject character)
        {
            CharacterCode characterCode = new CharacterCode();
            string        equipmentCode = character.Equipment?.CalculateEquipmentCode();

            characterCode.EquipmentCode  = equipmentCode;
            characterCode.BodyProperties = character.GetBodyProperties(character.Equipment);
            characterCode.IsFemale       = character.IsFemale;
            characterCode.IsHero         = character.IsHero;
            characterCode.FormationClass = character.DefaultFormationClass;
            MBStringBuilder mbStringBuilder = new MBStringBuilder();

            mbStringBuilder.Initialize(callerMemberName: nameof(CreateFrom));
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(equipmentCode);
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(characterCode.BodyProperties.ToString());
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(characterCode.IsFemale ? "1" : "0");
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(characterCode.IsHero ? "1" : "0");
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(((int)characterCode.FormationClass).ToString());
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(characterCode.Color1.ToString());
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(characterCode.Color2.ToString());
            mbStringBuilder.Append <string>("@---@");
            characterCode.Code = mbStringBuilder.ToStringAndRelease();
            return(characterCode);
        }
コード例 #17
0
        public static CharacterCode CreateFrom(
            string equipmentCode,
            BodyProperties bodyProperties,
            bool isFemale,
            bool isHero,
            uint color1,
            uint color2,
            FormationClass formationClass)
        {
            CharacterCode characterCode = new CharacterCode();

            characterCode.EquipmentCode  = equipmentCode;
            characterCode.BodyProperties = bodyProperties;
            characterCode.IsFemale       = isFemale;
            characterCode.IsHero         = isHero;
            characterCode.Color1         = color1;
            characterCode.Color2         = color2;
            characterCode.FormationClass = formationClass;
            MBStringBuilder mbStringBuilder = new MBStringBuilder();

            mbStringBuilder.Initialize(callerMemberName: nameof(CreateFrom));
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(equipmentCode);
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(characterCode.BodyProperties.ToString());
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(characterCode.IsFemale ? "1" : "0");
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(characterCode.IsHero ? "1" : "0");
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(((int)characterCode.FormationClass).ToString());
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(characterCode.Color1.ToString());
            mbStringBuilder.Append <string>("@---@");
            mbStringBuilder.Append <string>(characterCode.Color2.ToString());
            mbStringBuilder.Append <string>("@---@");
            characterCode.Code = mbStringBuilder.ToStringAndRelease();
            return(characterCode);
        }
コード例 #18
0
        public CharacterCode CreateFrom(FacGenRecordData item)
        {
            CharacterCode  characterCode  = CharacterCode.CreateEmpty();
            BodyProperties bodyProperties = BodyProperties.Default;

            BodyProperties.FromString(item.BodyPropertiesString, out bodyProperties);
            characterCode.BodyProperties = bodyProperties;
            string text = new Equipment().CalculateEquipmentCode();

            ReflectUtils.ReflectPropertyAndSetValue("EquipmentCode", text, characterCode);
            ReflectUtils.ReflectPropertyAndSetValue("IsHero", true, characterCode);
            MBStringBuilder mBStringBuilder = default(MBStringBuilder);

            mBStringBuilder.Initialize(16, "CreateFrom");
            mBStringBuilder.Append <string>("@---@");
            mBStringBuilder.Append <string>(text);
            mBStringBuilder.Append <string>("@---@");
            mBStringBuilder.Append <string>(characterCode.BodyProperties.ToString());
            mBStringBuilder.Append <string>("@---@");
            mBStringBuilder.Append <string>(item.IsFemale ? "1" : "0");
            mBStringBuilder.Append <string>("@---@");
            mBStringBuilder.Append <string>(characterCode.IsHero ? "1" : "0");
            mBStringBuilder.Append <string>("@---@");
            mBStringBuilder.Append <string>(((int)characterCode.FormationClass).ToString());
            mBStringBuilder.Append <string>("@---@");
            ReflectUtils.ReflectPropertyAndSetValue("Code", mBStringBuilder.ToStringAndRelease(), characterCode);
            return(characterCode);
        }