Exemple #1
0
        public void Load_4_0_1(FileStream fs)
        {
            Money = false;

            min     = QuestStreamReader.ReadInt(fs);
            max     = QuestStreamReader.ReadInt(fs);
            value   = QuestStreamReader.ReadInt(fs);
            ParType = QuestStreamReader.ReadInt(fs);

            Hidden     = QuestStreamReader.ReadBool(fs);
            ShowIfZero = QuestStreamReader.ReadBool(fs);
            LoLimit    = QuestStreamReader.ReadBool(fs);
            Enabled    = QuestStreamReader.ReadBool(fs);

            ValueOfViewStrings = QuestStreamReader.ReadInt(fs);
            Money = QuestStreamReader.ReadBool(fs);

            Name = QuestStreamReader.ReadTextField(fs);

            ViewFormatStrings = new ParameterViewString[10];
            for (var i = 0; i < ValueOfViewStrings; ++i)
            {
                ViewFormatStrings[i].Load(fs);
            }

            CriticalMessage = QuestStreamReader.ReadTextField(fs);

            var AltDiapStartValuesStr = QuestStreamReader.ReadTextField(fs);

            AltDiapStartValues.Assign(AltDiapStartValuesStr);
        }
Exemple #2
0
        // упрощает и распознает диапазон
        private string FixLitD(string str)
        {
            string tstr = "";
            int    l    = str.Length;

            foreach (char c in str)
            {
                if (((c >= '0') && (c <= '9')) || (c == '-') || (c == ';') || (c == 'h'))
                {
                    tstr += c;
                }
            }
            str  = ';' + tstr + ';';
            tstr = str;
            while (true)
            {
                str  = tstr;
                tstr = StringReplace(tstr, "--", "");
                tstr = StringReplace(tstr, ";;", ";");
                tstr = StringReplace(tstr, "h;", ";");
                tstr = StringReplace(tstr, ";h", ";");
                tstr = StringReplace(tstr, "-;", ";");
                tstr = StringReplace(tstr, "-h", "h");
                tstr = StringReplace(tstr, "hh", "h");
                if (str == tstr)
                {
                    break;
                }
            }
            if ((tstr != ";") && (str.Length > 0))
            {
                str = "[" + str.Substring(1, str.Length - 2) + "]";
                QuestTCPRange d = new QuestTCPRange();
                d.Assign(str);
                str = d.GetString();
                return(str);
            }
            else
            {
                diapazone_error = true;
                error           = true;
                return("[err]");
            }
        }
Exemple #3
0
        public bool Assign(string str)
        {
            int l = str.Length;

            if (l == 0)
            {
                str = "0";
            }
            if (strIsValue(str, l))
            {
                vtype = QuestTCPVType.vtExt;
                vd.Clear();

                if (!double.TryParse(str.Replace(',', '.'), out vf))
                {
                    vf = 0;
                }
                return(true);
            }
            if ((l > 1) && (str[0] == '[') && (str[l - 1] == ']'))
            {
                char[] chs = { 'h', ';', '[', ']', '-' };
                for (int i = 0; i < l; i++)
                {
                    char c = str[i];

                    if (((c >= '0') && (c <= '9')) || chs.Contains(c))
                    {
                        continue;
                    }
                    return(false);
                }
                vtype = QuestTCPVType.vtRange;
                vd.Assign(str);
                vf = 0;
                return(true);
            }
            return(false);
        }