Beispiel #1
0
        public static Image LoadThumbnail(IMaterial material)
        {
            string TexturePath = string.Empty;
            Image  Thumbnail   = null;
            ulong  SamplerHash = 0;

            if (material != null)
            {
                HashName TextureHash = material.GetTextureByID("S000");

                if (TextureHash != null)
                {
                    SamplerHash = TextureHash.Hash;

                    // If our storage doesn't contain a thumbnail, then we go ahead and produce another.
                    if (!RenderStorageSingleton.Instance.TextureThumbnails.TryGetValue(SamplerHash, out Thumbnail))
                    {
                        TexturePath = GetTextureFromPath(TextureHash.String, false);
                    }
                }
            }
            else
            {
                Thumbnail = RenderStorageSingleton.Instance.TextureThumbnails[1];
            }

            return(Thumbnail != null ? Thumbnail : LoadDDSSquish(TexturePath, SamplerHash));
        }
Beispiel #2
0
        public FrameObjectLight(FrameObjectLight other) : base(other)
        {
            Flags             = other.Flags;
            LUnk1             = other.LUnk1;
            LUnk2             = other.LUnk2;
            LUnk3             = other.LUnk3;
            LUnk4             = other.LUnk4;
            LUnk5             = other.LUnk5;
            LUnk6             = other.LUnk6;
            UnkInt1           = other.UnkInt1;
            UnkVector_0       = other.UnkVector_0;
            LUnk7             = other.LUnk7;
            LUnk8             = other.LUnk8;
            UnkByte1          = other.UnkByte1;
            LUnk9             = other.LUnk9;
            LUnk10            = other.LUnk10;
            LUnk11            = other.LUnk11;
            LUnk12            = other.LUnk12;
            UnkVector_1       = other.UnkVector_1;
            UnkVector_2       = other.UnkVector_2;
            LUnk13            = other.LUnk13;
            LUnk14            = other.LUnk14;
            LUnk15            = other.LUnk15;
            UnkVector_3       = other.UnkVector_3;
            LUnk16            = other.LUnk16;
            LUnk17            = other.LUnk17;
            LUnk18            = other.LUnk18;
            UnkByte2          = other.UnkByte2;
            LUnk19            = other.LUnk19;
            LUnk20            = other.LUnk20;
            LUnk21            = other.LUnk21;
            LUnk22            = other.LUnk22;
            LUnk23            = other.LUnk23;
            ProjectionTexture = new HashName(other.ProjectionTexture);
            UnkInt2           = other.UnkInt2;
            LUnk24            = other.LUnk24;
            LUnk25            = other.LUnk25;
            UnkVector_4       = other.UnkVector_4;
            LUnk26            = other.LUnk26;
            LUnk27            = other.LUnk27;
            LUnk28            = other.LUnk28;
            LUnk29            = other.LUnk29;
            LUnk30            = other.LUnk30;
            UnkVector_5       = other.UnkVector_5;
            LUnk31            = other.LUnk31;
            LUnk32            = other.LUnk32;
            LUnk33            = other.LUnk33;
            LUnk34            = other.LUnk34;
            LUnk35            = other.LUnk35;

            TextureHashes = new HashName[4];
            for (int i = 0; i < 4; i++)
            {
                TextureHashes[i] = new HashName(other.TextureHashes[i].String);
            }

            UnkBox        = other.UnkBox;
            UnkByte3      = other.UnkByte3;
            UnknownMatrix = MatrixUtils.CopyFrom(other.UnknownMatrix);
        }
Beispiel #3
0
 public Material(string mat_name)
 {
     this.size     = 0;
     this.HashName = new HashName(mat_name);
     this.skipped  = new byte[48];
     this.count    = 0;
 }
Beispiel #4
0
        public MaterialSampler_v58(IMaterialSampler OtherSampler) : base(OtherSampler)
        {
            ID            = OtherSampler.ID;
            SamplerStates = OtherSampler.SamplerStates;

            // TODO: Setup is essentially the same, maybe we can somehow make v57 and v58 share the same interface?
            if (OtherSampler.GetVersion() == VersionsEnumerator.V_57)
            {
                MaterialSampler_v57 CastedSampler = (OtherSampler as MaterialSampler_v57);
                TextureName = new HashName(CastedSampler.TextureName);
                TexType     = CastedSampler.TexType;
                UnkZero     = CastedSampler.UnkZero;
                UnkSet1     = CastedSampler.UnkSet1;

                UnkSet0 = new int[4];
                Array.Copy(CastedSampler.UnkSet0, 0, UnkSet0, 0, 2);
            }
            else if (OtherSampler.GetVersion() == VersionsEnumerator.V_58)
            {
                MaterialSampler_v58 CastedSampler = (OtherSampler as MaterialSampler_v58);
                TextureName = new HashName(CastedSampler.TextureName);
                TexType     = CastedSampler.TexType;
                UnkZero     = CastedSampler.UnkZero;
                UnkSet1     = CastedSampler.UnkSet1;

                UnkSet0 = new int[4];
                Array.Copy(CastedSampler.UnkSet0, 0, UnkSet0, 0, 2);
            }
            else
            {
                string message = string.Format("Version {0} cannot be converted from Version {1}", GetVersion(), OtherSampler.GetVersion());
                Console.WriteLine(message);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Read data from file.
        /// </summary>
        /// <param name="reader"></param>
        public void ReadFromFile(MemoryStream reader, bool isBigEndian)
        {
            isScene              = reader.ReadBoolean();
            numFolderNames       = reader.ReadInt32(isBigEndian);
            numGeometries        = reader.ReadInt32(isBigEndian);
            numMaterialResources = reader.ReadInt32(isBigEndian);
            numBlendInfos        = reader.ReadInt32(isBigEndian);
            numSkeletons         = reader.ReadInt32(isBigEndian);
            numSkelHierachies    = reader.ReadInt32(isBigEndian);
            numObjects           = reader.ReadInt32(isBigEndian);

            if (isScene)
            {
                unk1      = reader.ReadSingle(isBigEndian);
                unk2      = reader.ReadSingle(isBigEndian);
                sceneName = new HashName(reader, isBigEndian);

                for (int i = 0; i < (4 * 3); i++)
                {
                    unkData[i] = reader.ReadSingle(isBigEndian);
                }
                unk3 = reader.ReadBoolean();
            }

            for (int i = 0; i != numFolderNames; i++)
            {
                FrameHeaderScene scene = new FrameHeaderScene();
                scene.ReadFromFile(reader, isBigEndian);
                sceneFolders.Add(scene);
            }
        }
Beispiel #6
0
        public FrameObjectLight() : base()
        {
            flags     = 0;
            unkFloat1 = new float[7];
            unk_int   = 0;
            unkFloat2 = new float[5];
            unk_byte1 = 0;
            unkFloat3 = new float[17];
            unk_byte2 = 0;
            unkFloat4 = new float[5];
            nameLight = new HashName();
            unk_int2  = 0;
            unkFloat5 = new float[20];
            names     = new HashName[4];

            for (int i = 0; i != 4; i++)
            {
                names[i] = new HashName();
            }

            unkVector1 = new Vector3(0);
            unkVector2 = new Vector3(0);
            unk_byte3  = 0;
            unkVector3 = new Vector3(0);
            unkVector4 = new Vector3(0);
            unkVector5 = new Vector3(0);
            unkVector6 = new Vector3(0);
        }
Beispiel #7
0
        public FrameObjectLight(FrameObjectLight other) : base(other)
        {
            flags     = other.flags;
            unkFloat1 = other.unkFloat1;
            unk_int   = other.unk_int;
            unkFloat2 = other.unkFloat1;
            unk_byte1 = other.unk_byte1;
            unkFloat3 = other.unkFloat1;
            unk_byte2 = other.unk_byte2;
            unkFloat4 = other.unkFloat4;
            nameLight = new HashName(other.name.String);
            unk_int2  = other.unk_int2;
            unkFloat5 = other.unkFloat5;

            names = new HashName[4];
            for (int i = 0; i != 4; i++)
            {
                names[i] = new HashName(names[i].String);
            }

            unkVector1 = other.unkVector1;
            unkVector2 = other.unkVector2;
            unk_byte3  = other.unk_byte3;
            unkVector3 = other.unkVector3;
            unkVector4 = other.unkVector4;
            unkVector5 = other.unkVector5;
            unkVector6 = other.unkVector6;
        }
Beispiel #8
0
 public FrameObjectSector() : base()
 {
     bounds         = new BoundingBox();
     unk_13_vector3 = new Vector3(0);
     unk_14_vector3 = new Vector3(0);
     sectorName     = new HashName();
 }
Beispiel #9
0
        public Topology(string objectName)
        {
            this.unknown1 = 0;

            this.count2   = 0;
            this.items2   = new byte[0];
            this.HashName = new HashName(objectName + ".Topology");
        }
Beispiel #10
0
        public bool VerifyHash(string plainText, string hashValue, HashName hashName)
        {
            var computedHash = ComputeHash(plainText, hashName);

            WebLog.Log("Correct Hashvalue: " + computedHash);
            WebLog.Log("wrong Hashvalue: " + hashValue);
            return(hashValue.ToLower().ToString() == computedHash.ToLower().ToString());
        }
        public void Hint(HashName hashname)
        {
            if (!hashname.Known)
            {
                return;
            }

            Strings.Add(hashname.String);
        }
        public LookAtConstrRotationController(BinaryReader br, SectionHeader sh)
        {
            this.SectionId = sh.id;

            HashName = new HashName(br.ReadUInt64());
            Unknown1 = br.ReadUInt32();
            PostLoadRef <ISection>(br.ReadUInt32(), s => Unknown2 = s);
            PostLoadRef <ISection>(br.ReadUInt32(), s => Unknown3 = s);
            PostLoadRef <ISection>(br.ReadUInt32(), s => Unknown4 = s);
        }
Beispiel #13
0
 public virtual void ReadFromFile(MemoryStream stream, bool isBigEndian)
 {
     name           = new HashName(stream, isBigEndian);
     secondaryFlags = stream.ReadInt32(isBigEndian);
     localTransform = MatrixExtensions.ReadFromFile(stream, isBigEndian);
     unk3           = stream.ReadInt16(isBigEndian);
     parentIndex1   = new ParentStruct(stream.ReadInt32(isBigEndian));
     parentIndex2   = new ParentStruct(stream.ReadInt32(isBigEndian));
     unk6           = stream.ReadInt16(isBigEndian);
 }
Beispiel #14
0
 public IAssetPackage GetAssetPackage(HashName packageName)
 {
     IAssetPackage result = null;
     if (this.cachePackage.TryGetValue(packageName.GetId(), out result))
     {
         return result;
     }
     result = this.CreatePackage(packageName);
     return result;
 }
Beispiel #15
0
        // IComparable interface
        public int CompareTo(object obj)
        {
            var obj2  = obj as Channel;
            int first = _isPrivMsgChannel.CompareTo(obj2._isPrivMsgChannel);

            if (first != 0)
            {
                return(first);
            }
            return(HashName.CompareTo(obj2.HashName));
        }
Beispiel #16
0
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hash = (int)2166136261;
         // Suitable nullity checks etc, of course :)
         hash = hash * 16777619 ^ HashName.GetHashCode();
         hash = hash * 16777619 ^ Server.IsWormNet.GetHashCode();
         return(hash);
     }
 }
Beispiel #17
0
 public Object(Object other)
 {
     numInstance2 = 0;
     numInstances = 0;
     instances    = new Instance[0];
     unk02        = other.unk02;
     name         = other.name;
     unkBytes1    = other.unkBytes1;
     gridMax      = other.gridMax;
     gridMin      = other.gridMin;
 }
Beispiel #18
0
        public IMaterial()
        {
            MaterialName = new HashName();
            Parameters   = new List <MaterialParameter>();

            // TODO: Remove this from base class, make some kind of factory of Shader Types.
            MaterialName.Set("NEW_MATERIAL");
            ShaderHash = 3388704532;
            ShaderID   = 4894707398632176459;
            Flags      = (MaterialFlags)31461376;
        }
Beispiel #19
0
            public LensData(MemoryStream reader, bool isBigEndian)
            {
                unkFloats = new float[5];

                for (int i = 0; i != 5; i++)
                {
                    unkFloats[i] = reader.ReadSingle(isBigEndian);
                }

                unkHash = new HashName(reader, isBigEndian);
            }
Beispiel #20
0
        public override void ReadFromFile(MemoryStream reader, bool isBigEndian)
        {
            base.ReadFromFile(reader, isBigEndian);
            flags = reader.ReadInt32(isBigEndian);

            for (int i = 0; i < 7; i++)
            {
                unkFloat1[i] = reader.ReadSingle(isBigEndian);
            }

            unk_int = reader.ReadInt32(isBigEndian);

            for (int i = 0; i < 5; i++)
            {
                unkFloat2[i] = reader.ReadSingle(isBigEndian);
            }

            unk_byte1 = reader.ReadByte8();

            for (int i = 0; i < 17; i++)
            {
                unkFloat3[i] = reader.ReadSingle(isBigEndian);
            }

            unk_byte2 = reader.ReadByte8();

            for (int i = 0; i < 5; i++)
            {
                unkFloat4[i] = reader.ReadSingle(isBigEndian);
            }

            nameLight = new HashName(reader, isBigEndian);

            unk_int2 = reader.ReadInt32(isBigEndian);

            for (int i = 0; i < 20; i++)
            {
                unkFloat5[i] = reader.ReadSingle(isBigEndian);
            }

            for (int i = 0; i < 4; i++)
            {
                names[i] = new HashName(reader, isBigEndian);
            }

            unkVector1 = Vector3Extenders.ReadFromFile(reader, isBigEndian);
            unkVector2 = Vector3Extenders.ReadFromFile(reader, isBigEndian);
            unk_byte3  = reader.ReadByte8();
            unkVector3 = Vector3Extenders.ReadFromFile(reader, isBigEndian);
            unkVector4 = Vector3Extenders.ReadFromFile(reader, isBigEndian);
            unkVector5 = Vector3Extenders.ReadFromFile(reader, isBigEndian);
            unkVector6 = Vector3Extenders.ReadFromFile(reader, isBigEndian);
        }
        public Object3D GetObject3DByHash(HashName hashName)
        {
            foreach (Object3D object3D in SectionsOfType <Object3D>())
            {
                if (hashName.Hash == object3D.HashName.Hash)
                {
                    return(object3D);
                }
            }

            return(null);
        }
Beispiel #22
0
 public FrameObjectBase() : base()
 {
     //do example name.
     name           = new HashName("NewObject");
     secondaryFlags = 1;
     localTransform = Matrix.Identity;
     worldTransform = Matrix.Identity;
     unk3           = -1;
     parentIndex1   = new ParentStruct(-1);
     parentIndex2   = new ParentStruct(-1);
     unk6           = -1;
 }
            /// <summary>
            /// Method encrypts plain text to encrypted text
            /// </summary>
            /// <param name="plainText">Plain text</param>
            /// <param name="useHashing">Compute hash or not</param>
            /// <returns>Ciphered text</returns>
            public string EncryptText(string plainText, bool useHashing, HashName hashName)
            {
                string cipherText = string.Empty;

                byte[]        arrayToEncrypt  = Encoding.UTF8.GetBytes(plainText);
                StringBuilder sbEncryptedText = new StringBuilder();

                HashAlgorithm hash = null;

                if (useHashing)
                {
                    switch (hashName)
                    {
                    case HashName.SHA1:
                        hash = SHA1.Create();
                        break;

                    case HashName.SHA256:
                        hash = SHA256.Create();
                        break;

                    case HashName.SHA384:
                        hash = SHA384.Create();
                        break;

                    case HashName.SHA512:
                        hash = SHA512.Create();
                        break;

                    default:
                        hash = MD5.Create();
                        break;
                    }

                    byte[] encryptedArray = hash.ComputeHash(arrayToEncrypt);

                    for (int i = 0; i < encryptedArray.Length; i++)
                    {
                        sbEncryptedText.Append(encryptedArray[i].ToString("x2"));
                    }
                    cipherText = sbEncryptedText.ToString();
                }
                else
                {
                    for (int i = 0; i < arrayToEncrypt.Length; i++)
                    {
                        sbEncryptedText.Append(arrayToEncrypt[i].ToString("x2"));
                    }
                    cipherText = sbEncryptedText.ToString();
                }

                return(cipherText);
            }
Beispiel #24
0
        public IMaterial(IMaterial OtherMaterial)
        {
            MaterialName = new HashName(OtherMaterial.MaterialName);
            Flags        = OtherMaterial.Flags;
            ShaderID     = OtherMaterial.ShaderID;
            ShaderHash   = OtherMaterial.ShaderHash;

            Parameters = new List <MaterialParameter>();
            foreach (var Param in OtherMaterial.Parameters)
            {
                Parameters.Add(Param);
            }
        }
Beispiel #25
0
 public FrameObjectBase(FrameObjectBase other) : base(other)
 {
     name           = new HashName(other.name.String);
     secondaryFlags = other.secondaryFlags;
     localTransform = other.localTransform;
     worldTransform = other.worldTransform;
     unk3           = other.unk3;
     parentIndex1   = new ParentStruct(other.parentIndex1);
     parentIndex2   = new ParentStruct(other.parentIndex2);
     unk6           = -1;
     isOnTable      = other.isOnTable;
     nameTableFlags = other.nameTableFlags;
 }
Beispiel #26
0
        private static string a(HashName A_0)
        {
            string[] array = A_0.GetName().Split(new char[]
			{
				'@'
			});
            string str = array[array.Length - 1];
            for (int i = array.Length - 2; i >= 0; i--)
            {
                str = str + "/" + array[i];
            }
            return str + ".assetbundle";
        }
 public override void ReadFromFile(MemoryStream reader, bool isBigEndian)
 {
     base.ReadFromFile(reader, isBigEndian);
     flags         = (SingleMeshFlags)reader.ReadInt32(isBigEndian);
     bounds        = BoundingBoxExtenders.ReadFromFile(reader, isBigEndian);
     unk14         = reader.ReadByte8();
     meshIndex     = reader.ReadInt32(isBigEndian);
     materialIndex = reader.ReadInt32(isBigEndian);
     omTextureHash = new HashName(reader, isBigEndian);
     unk18_1       = reader.ReadByte8();
     unk18_2       = reader.ReadByte8();
     unk18_3       = reader.ReadByte8();
 }
 public FrameObjectSingleMesh() : base()
 {
     flags          = SingleMeshFlags.Unk14_Flag | SingleMeshFlags.flag_32 | SingleMeshFlags.flag_67108864;
     bounds         = new BoundingBox();
     unk14          = 255;
     meshIndex      = 0;
     materialIndex  = 0;
     localTransform = new Matrix();
     omTextureHash  = new HashName();
     unk18_1        = 0;
     unk18_2        = 0;
     unk18_3        = 0;
 }
 public FrameObjectSingleMesh(FrameObjectSingleMesh other) : base(other)
 {
     flags         = other.flags;
     bounds        = other.bounds;
     unk14         = other.unk14;
     meshIndex     = other.meshIndex;
     materialIndex = other.materialIndex;
     omTextureHash = new HashName(other.omTextureHash.String);
     unk18_1       = other.unk18_1;
     unk18_2       = other.unk18_2;
     unk18_3       = other.unk18_3;
     material      = other.material;
     geometry      = other.geometry;
 }
Beispiel #30
0
 public FrameObjectSector(FrameObjectSector other) : base(other)
 {
     bounds     = other.bounds;
     unk_08_int = other.unk_08_int;
     planesSize = other.planesSize;
     planes     = new Vector4[planesSize];
     for (int i = 0; i < planesSize; i++)
     {
         planes[i] = other.planes[i];
     }
     unk_13_vector3 = other.unk_13_vector3;
     unk_14_vector3 = other.unk_14_vector3;
     sectorName     = new HashName(other.sectorName.String);
 }
Beispiel #31
0
        private void CreateSkinnedObjectsFromModel()
        {
            blendInfo         = new FrameBlendInfo();
            skeleton          = new FrameSkeleton();
            skeletonHierarchy = new FrameSkeletonHierachy();

            int jointCount = model.SkeletonData.Joints.Length;

            skeleton.BoneNames    = new HashName[jointCount];
            skeleton.NumBones     = new int[4];
            skeleton.UnkLodData   = new int[1];
            skeleton.BoneLODUsage = new byte[jointCount];

            skeleton.NumBlendIDs   = jointCount;
            skeleton.NumUnkCount2  = jointCount;
            skeleton.UnkLodData[0] = jointCount;


            for (int i = 0; i < 4; i++)
            {
                skeleton.NumBones[i] = jointCount;
            }

            for (int i = 0; i < jointCount; i++)
            {
                HashName bone = new HashName();
                bone.Set(model.SkeletonData.Joints[i].Name);
                skeleton.BoneNames[i] = bone;

                if (model.Lods.Length == 1)
                {
                    skeleton.BoneLODUsage[i] = 1;
                }
            }

            skeletonHierarchy.ParentIndices    = new byte[jointCount];
            skeletonHierarchy.LastChildIndices = new byte[jointCount];
            skeletonHierarchy.UnkData          = new byte[jointCount];
            skeleton.JointTransforms           = new Matrix[jointCount];

            skeletonHierarchy.UnkData[0] = (byte)(jointCount + 1);

            for (int i = 0; i < jointCount; i++)
            {
                skeletonHierarchy.ParentIndices[i] = model.SkeletonData.Joints[i].ParentIndex;
                skeletonHierarchy.UnkData[i]       = (byte)(i != jointCount ? i : 0);
                skeleton.JointTransforms[i]        = model.SkeletonData.Joints[i].LocalTransform;
            }
        }
        public override void SetShaderParameters(Device device, DeviceContext deviceContext, MaterialParameters matParams)
        {
            base.SetShaderParameters(device, deviceContext, matParams);

            Shader_50760736Params parameters = new Shader_50760736Params();
            var material = matParams.MaterialData;

            var param = material.GetParameterByKey("C005");

            if (param != null)
            {
                parameters.C005_EmissiveFacadeColorAndIntensity = new Vector4(param.Paramaters[0], param.Paramaters[1], param.Paramaters[2], param.Paramaters[3]);
            }

            if (material == null)
            {
                ShaderResourceView texture = RenderStorageSingleton.Instance.TextureCache[0];
                deviceContext.PixelShader.SetShaderResource(0, texture);
                ShaderParams = parameters;
            }
            else
            {
                ShaderResourceView[] textures = new ShaderResourceView[2];

                HashName TextureFile = material.GetTextureByID("S000");
                if (TextureFile != null)
                {
                    textures[0] = RenderStorageSingleton.Instance.TextureCache[TextureFile.Hash];
                }
                else
                {
                    textures[0] = RenderStorageSingleton.Instance.TextureCache[0];
                }

                TextureFile = material.GetTextureByID("S011");
                if (TextureFile != null)
                {
                    textures[1] = RenderStorageSingleton.Instance.TextureCache[TextureFile.Hash];
                }
                else
                {
                    textures[1] = RenderStorageSingleton.Instance.TextureCache[0];
                }

                deviceContext.PixelShader.SetShaderResources(0, textures.Length, textures);
            }

            ShaderParams = parameters;
        }
Beispiel #33
0
 public static WWW ReadNetFile(string path, bool isCache, ResourceTool.FinishReadNotify notify)
 {
     WWW wWW = null;
     HashName hashName = new HashName(path);
     if (ResourceTool.msCache.TryGetValue(hashName.GetId(), out wWW))
     {
         notify(true, wWW);
         return wWW;
     }
     ResourceTool.DownloadCommand item = default(ResourceTool.DownloadCommand);
     item.resource = new WWW(path);
     item.isCache = isCache;
     item.notify = notify;
     ResourceTool.msDownloadCommands.Add(item);
     return item.resource;
 }
Beispiel #34
0
 public string GetLocalURL(HashName assetName)
 {
     return this.mLocalURL + BasePackageAdapt.a(assetName);
 }
Beispiel #35
0
 public string GetOuterURL(HashName assetName)
 {
     return this.mOuterURL + BasePackageAdapt.a(assetName);
 }
Beispiel #36
0
 protected override BaseAssetPackage CreatePackage(HashName packageName)
 {
     return new GameAssetPackage(packageName, this);
 }
Beispiel #37
0
 public static string ComputeHashString(HashName hashName, byte[] bytes)
 {
     return BitConverter.ToString(bytes).Replace("-", "");
 }
Beispiel #38
0
 public void SynchroVersion(HashName assetName)
 {
     if (this.mLocalVersion.ContainsKey(assetName.GetId()))
     {
         this.mLocalVersion[assetName.GetId()] = this.mOuterVersion[assetName.GetId()];
         return;
     }
     this.mLocalVersion.Add(assetName.GetId(), this.mOuterVersion[assetName.GetId()]);
 }
Beispiel #39
0
 public bool HasPackage(HashName packageName)
 {
     return this.cachePackage.ContainsKey(packageName.GetId());
 }
Beispiel #40
0
 protected virtual BaseAssetPackage CreatePackage(HashName packageName)
 {
     return new BaseAssetPackage(packageName, this);
 }
Beispiel #41
0
 public void WriteToLocal(HashName assetName, byte[] bytes)
 {
     string path = this.mLocalPath + BasePackageAdapt.a(assetName);
     ResourceTool.WriteLocalFile(path, bytes);
 }
Beispiel #42
0
        public static void Tick()
        {
            foreach (ResourceTool.DownloadCommand current in ResourceTool.msDownloadCommands)
            {
                if (current.resource.isDone)
                {
                    Debug.Log(current.resource.url + "resource finished =" + current.resource.error);
                    ResourceTool.msDownloadCommands.Remove(current);
                    if (current.resource.error == null)
                    {
                        HashName hashName = new HashName(current.resource.url);
                        if (current.isCache && !ResourceTool.msCache.ContainsKey(hashName.GetId()))
                        {
                            ResourceTool.msCache.Add(hashName.GetId(), current.resource);
                        }
                        Debug.Log(string.Concat(new object[]
						{
							"finish read ",
							current.resource.url,
							" ",
							Time.time
						}));
                        current.notify(true, current.resource);
                    }
                    else
                    {
                        Debug.LogWarning(current.resource.error);
                        current.notify(false, current.resource);
                    }
                    break;
                }
            }
        }
Beispiel #43
0
 public bool IsOuterVersion(HashName assetName)
 {
     return this.mOuterVersion != null && (!this.mLocalVersion.ContainsKey(assetName.GetId()) || this.mOuterVersion[assetName.GetId()] != this.mLocalVersion[assetName.GetId()]);
 }
Beispiel #44
0
 public static byte[] ComputeHash(HashName hashName, string input)
 {
     HashAlgorithm algorithm = HashAlgorithm.Create(hashName.ToString());
     return algorithm.ComputeHash(Encoding.Unicode.GetBytes(input));
 }
Beispiel #45
0
 public static string ComputeHashString(HashName hashName, Stream inputStream)
 {
     return BitConverter.ToString(ComputeHash(hashName, inputStream)).Replace("-", "");
 }
Beispiel #46
0
 public static byte[] ComputeHash(HashName hashName, Stream inputStream)
 {
     HashAlgorithm algorithm = HashAlgorithm.Create(hashName.ToString());
     return algorithm.ComputeHash(inputStream);
 }
Beispiel #47
0
 public HashNameNode()
 {
     this.mHashName = null;
     this.mNext = null;
 }