예제 #1
0
파일: Languages.cs 프로젝트: mozkandemir/RE
        internal static string ClilocFormat(int num, params object[] args)
        {
            if (m_CliLoc == null)
            {
                return(String.Empty);
            }

            StringEntry se = m_CliLoc.GetEntry(num);

            return(se != null?se.Format(args) : string.Empty);
        }
예제 #2
0
파일: Languages.cs 프로젝트: mozkandemir/RE
        internal static string GetCliloc(int num)
        {
            if (m_CliLoc == null)
            {
                return(String.Empty);
            }

            StringEntry se = m_CliLoc.GetEntry(num);

            return(se != null?se.Format() : string.Empty);
        }
예제 #3
0
        public static string ClilocFormat(int num, params object[] args)
        {
            if (m_CliLoc == null)
            {
                return(String.Empty);
            }

            StringEntry se = m_CliLoc.GetEntry(num);

            if (se != null)
            {
                return(se.Format(args));
            }
            else
            {
                return(string.Empty);
            }
        }
예제 #4
0
        public static string GetCliloc(int num)
        {
            if (m_CliLoc == null)
            {
                return(String.Empty);
            }

            StringEntry se = m_CliLoc.GetEntry(num);

            if (se != null)
            {
                return(se.Format());
            }
            else
            {
                return(string.Empty);
            }
        }
예제 #5
0
        public static string GetItemName(Item item)
        {
            if (StringList == null || item.Name != null)
            {
                return(item.Name);
            }

            ObjectPropertyList opl = new ObjectPropertyList(item);

            item.GetProperties(opl);

            //since the object property list is based on a packet object, the property info is packed away in a packet format
            byte[] data = opl.UnderlyingStream.UnderlyingStream.ToArray();

            int    index      = 15; // First localization number index
            string basestring = null;

            //reset the number property
            uint number = 0;

            //if there's not enough room for another record, quit
            if (index + 4 >= data.Length)
            {
                return(null);
            }

            //read number property from the packet data
            number = (uint)(data[index++] << 24 | data[index++] << 16 | data[index++] << 8 | data[index++]);

            //reset the length property
            ushort length = 0;

            //if there's not enough room for another record, quit
            if (index + 2 > data.Length)
            {
                return(null);
            }

            //read length property from the packet data
            length = (ushort)(data[index++] << 8 | data[index++]);

            //determine the location of the end of the string
            int end = index + length;

            //truncate if necessary
            if (end >= data.Length)
            {
                end = data.Length - 1;
            }

            //read the string into a StringBuilder object

            StringBuilder s = new StringBuilder();

            while (index + 2 <= end + 1)
            {
                short next = (short)(data[index++] | data[index++] << 8);

                if (next == 0)
                {
                    break;
                }

                s.Append(Encoding.Unicode.GetString(BitConverter.GetBytes(next)));
            }

            basestring = StringList.GetString((int)number);
            string args = s.ToString();

            if (args == string.Empty)
            {
                return(basestring);
            }

            string[] parms = args.Split('\t');

            try
            {
                if (parms.Length > 1)
                {
                    for (int i = 0; i < parms.Length; i++)
                    {
                        parms[i] = parms[i].Trim(' ');

                        if (parms[i].IndexOf("#") == 0)
                        {
                            parms[i] = StringList.GetString(Convert.ToInt32(parms[i].Substring(1, parms[i].Length - 1)));
                        }
                    }
                }
                else if (parms.Length == 1 && parms[0].IndexOf("#") == 0)
                {
                    parms[0] = StringList.GetString(Convert.ToInt32(args.Substring(1, parms[0].Length - 1)));
                }
            }
            catch
            {
                return(null);
            }

            StringEntry entry = StringList.GetEntry((int)number);

            if (entry != null)
            {
                return(entry.Format(parms));
            }

            return(basestring);
        }