Ejemplo n.º 1
0
        public static CExoLocString ToExoLocString(this string?str, int nId = 0, byte gender = 0)
        {
            CExoLocString locString = new CExoLocString();

            locString.AddString(nId, str != null ? new CExoString(str) : new CExoString(), gender);
            return(locString);
        }
Ejemplo n.º 2
0
        public static CExoLocString ToExoLocString(this CExoString str, int nId = 0, byte gender = 0)
        {
            CExoLocString locString = new CExoLocString();

            locString.AddString(nId, str, gender);
            return(locString);
        }
Ejemplo n.º 3
0
        public static string ExtractLocString(this CExoLocString locStr, int nID = 0, byte gender = 0)
        {
            CExoStringData exoStringData;
            CExoString     exoString = CExoString.FromPointer(&exoStringData);

            try
            {
                locStr.GetStringLoc(nID, exoString, gender);
                return(exoString.ToString());
            }
            finally
            {
                exoString._Destructor();
            }
        }
Ejemplo n.º 4
0
            private static FIELD CreateNewField(BinaryReader br, int index, int fieldOffset, int dataOrDataOffset, GffFieldType fieldType)
            {
                FIELD data;

                switch (fieldType)
                {
                case GffFieldType.BYTE:
                    data = new BYTE(br, fieldOffset + dataOrDataOffset * 12);
                    break;

                case GffFieldType.CHAR:
                    data = new CHAR(br, fieldOffset + dataOrDataOffset * 12);
                    break;

                case GffFieldType.WORD:
                    data = new WORD(br, fieldOffset + dataOrDataOffset * 12);
                    break;

                case GffFieldType.SHORT:
                    data = new SHORT(br, fieldOffset + dataOrDataOffset * 12);
                    break;

                case GffFieldType.DWORD:
                    data = new DWORD(br, fieldOffset + dataOrDataOffset * 12);
                    break;

                case GffFieldType.INT:
                    data = new INT(br, fieldOffset + dataOrDataOffset * 12);
                    break;

                case GffFieldType.DWORD64:
                    data = new DWORD64(br, fieldOffset + dataOrDataOffset * 12);
                    break;

                case GffFieldType.INT64:
                    data = new INT64(br, fieldOffset + dataOrDataOffset * 12);
                    break;

                case GffFieldType.FLOAT:
                    data = new FLOAT(br, fieldOffset + dataOrDataOffset * 12);
                    break;

                case GffFieldType.DOUBLE:
                    data = new DOUBLE(br, fieldOffset + dataOrDataOffset * 12);
                    break;

                case GffFieldType.CExoString:
                    data = new CExoString(br, fieldOffset + dataOrDataOffset * 12);
                    break;

                case GffFieldType.ResRef:
                    data = new ResRef(br, fieldOffset + dataOrDataOffset * 12);
                    break;

                case GffFieldType.CExoLocString:
                    data = new CExoLocString(br, fieldOffset + dataOrDataOffset * 12);
                    break;

                case GffFieldType.VOID:
                    data = new VOID(br, fieldOffset + dataOrDataOffset * 12);
                    break;

                case GffFieldType.Struct:
                    int lbl_index = br.ReadInt32();
                    data = new STRUCT(br, br.ReadInt32(), lbl_index);
                    break;

                case GffFieldType.List:
                    data = new LIST(br, fieldOffset + dataOrDataOffset * 12);
                    break;

                case GffFieldType.Orientation:
                    data = new Orientation(br, fieldOffset + dataOrDataOffset * 12);
                    break;

                case GffFieldType.Vector:
                    data = new Vector(br, fieldOffset + dataOrDataOffset * 12);
                    break;

                case GffFieldType.StrRef:
                    data = new StrRef(br, fieldOffset + dataOrDataOffset * 12);
                    break;

                default:
                    throw new Exception(string.Format("UNEXPECTED FIELD TYPE \"{0}\", IN STRUCT INDEX \"{1}\"", fieldType, index));
                }

                return(data);
            }
Ejemplo n.º 5
0
        public static bool TryReadCExoLocString(this CResGFF resGff, CResStruct resStruct, byte *fieldName, out CExoLocString value)
        {
            int bSuccess;

            value = resGff.ReadFieldCExoLocString(resStruct, fieldName, &bSuccess);
            return(bSuccess.ToBool());
        }