1.md5使用规范统一使用spark-md5
Signed-off-by: zhoulisheng1 <zhoulisheng1@huawei.com>
This commit is contained in:
parent
8a007854cd
commit
61ff7a6e3e
|
@ -19,7 +19,6 @@
|
|||
*/
|
||||
|
||||
export * from './src/main/ets/components/cache/FileUtils'
|
||||
export * from './src/main/ets/components/cache/Md5'
|
||||
export * from './src/main/ets/components/cache/Base64'
|
||||
export * from './src/main/ets/components/cache/LruCache'
|
||||
export * from './src/main/ets/components/cache/diskstrategy/enum/ALL'
|
||||
|
@ -126,3 +125,4 @@ export type {IDrawLifeCycle} from './src/main/ets/components/imageknife/interfac
|
|||
|
||||
// 日志管理
|
||||
export * from './src/main/ets/components/imageknife/utils/LogUtil'
|
||||
export * from './src/main/ets/components/imageknife/utils/spark-md5'
|
|
@ -15,8 +15,6 @@
|
|||
|
||||
import type { IDataFetch } from '../networkmanage/IDataFetch'
|
||||
import { RequestOption } from '../RequestOption'
|
||||
import { Md5 } from '../../cache/Md5'
|
||||
import { FileUtils } from '../../cache/FileUtils'
|
||||
import { NetworkDownloadClient } from './NetworkDownloadClient'
|
||||
import { LoadLocalFileClient } from './LoadLocalFileClient'
|
||||
import { LoadDataShareFileClient } from './LoadDataShareFileClient'
|
||||
|
|
|
@ -15,9 +15,7 @@
|
|||
|
||||
import type { IDataFetch } from '../networkmanage/IDataFetch'
|
||||
import { RequestOption } from '../RequestOption'
|
||||
import { Md5 } from '../../cache/Md5'
|
||||
import { FileUtils } from '../../cache/FileUtils'
|
||||
import loadRequest from '@ohos.request';
|
||||
|
||||
export class LoadLocalFileClient implements IDataFetch {
|
||||
loadData(request: RequestOption, onComplete: (img: ArrayBuffer) => void, onError: (err: string) => void) {
|
||||
|
|
|
@ -15,14 +15,14 @@
|
|||
|
||||
import type { IDataFetch } from '../networkmanage/IDataFetch'
|
||||
import { RequestOption } from '../RequestOption'
|
||||
import { Md5 } from '../../cache/Md5'
|
||||
import { SparkMD5 } from '../utils/spark-md5'
|
||||
import { FileUtils } from '../../cache/FileUtils'
|
||||
import loadRequest from '@ohos.request';
|
||||
|
||||
// 数据加载器
|
||||
export class NetworkDownloadClient implements IDataFetch {
|
||||
loadData(request: RequestOption, onComplete: (img: ArrayBuffer) => void, onError: (err: string) => void) {
|
||||
let filename = Md5.hashStr(request.generateDataKey);
|
||||
let filename = SparkMD5.hash(request.generateDataKey);
|
||||
let downloadFolder = request.getFilesPath() + "/" + request.networkCacheFolder;
|
||||
let allpath = request.getFilesPath() + "/" + request.networkCacheFolder + "/" + filename + ".img";
|
||||
if (!FileUtils.getInstance().existFolder(downloadFolder)) {
|
||||
|
|
|
@ -13,25 +13,24 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { RequestOption } from "../../imageknife/RequestOption"
|
||||
import { DiskLruCache } from "@ohos/disklrucache"
|
||||
import { LruCache } from "../../cache/LruCache"
|
||||
import {FileUtils} from "../../cache/FileUtils"
|
||||
import {Md5} from "../../cache/Md5"
|
||||
import{MemoryCacheProxy} from "../requestmanage/MemoryCacheProxy"
|
||||
import{DiskCacheProxy} from "../requestmanage/DiskCacheProxy"
|
||||
import{FileTypeUtil} from "../utils/FileTypeUtil"
|
||||
import type {IDataFetch} from "../../imageknife/networkmanage/IDataFetch"
|
||||
import type {IResourceFetch} from "../../imageknife/resourcemanage/IResourceFetch"
|
||||
import{ImageKnifeData,ImageKnifeType} from "../ImageKnifeData"
|
||||
import {AllCacheInfo} from "../../imageknife/interface/IAllCacheInfoCallback"
|
||||
import{ParseImageUtil} from '../utils/ParseImageUtil'
|
||||
import type {IParseImage} from '../interface/IParseImage'
|
||||
import image from "@ohos.multimedia.image"
|
||||
import { RequestOption } from '../../imageknife/RequestOption'
|
||||
import { DiskLruCache } from '@ohos/disklrucache'
|
||||
import { LruCache } from '../../cache/LruCache'
|
||||
import { SparkMD5 } from '../utils/spark-md5'
|
||||
import { MemoryCacheProxy } from '../requestmanage/MemoryCacheProxy'
|
||||
import { DiskCacheProxy } from '../requestmanage/DiskCacheProxy'
|
||||
import { FileTypeUtil } from '../utils/FileTypeUtil'
|
||||
import type { IDataFetch } from '../../imageknife/networkmanage/IDataFetch'
|
||||
import type { IResourceFetch } from '../../imageknife/resourcemanage/IResourceFetch'
|
||||
import { ImageKnifeData, ImageKnifeType } from '../ImageKnifeData'
|
||||
import { AllCacheInfo } from '../../imageknife/interface/IAllCacheInfoCallback'
|
||||
import { ParseImageUtil } from '../utils/ParseImageUtil'
|
||||
import type { IParseImage } from '../interface/IParseImage'
|
||||
import image from '@ohos.multimedia.image'
|
||||
import { SVGParseImpl } from '../utils/svg/SVGParseImpl'
|
||||
import { GIFParseImpl } from '../utils/gif/GIFParseImpl'
|
||||
import { GIFFrame } from '../utils/gif/GIFFrame'
|
||||
import {LogUtil} from '../../imageknife/utils/LogUtil'
|
||||
import { LogUtil } from '../../imageknife/utils/LogUtil'
|
||||
|
||||
export interface AsyncString {
|
||||
(data: string): void;
|
||||
|
@ -113,14 +112,14 @@ export class RequestManager {
|
|||
|
||||
// 变换后缓存
|
||||
allCacheInfo.resourceCacheInfo = {
|
||||
key: Md5.hashStr(this.options.generateResourceKey),
|
||||
path: (this.mDiskCacheProxy.getCachePath() + Md5.hashStr(this.options.generateResourceKey))
|
||||
key: SparkMD5.hash(this.options.generateResourceKey),
|
||||
path: (this.mDiskCacheProxy.getCachePath() + SparkMD5.hash(this.options.generateResourceKey))
|
||||
};
|
||||
|
||||
// 原图缓存
|
||||
allCacheInfo.dataCacheInfo = {
|
||||
key: Md5.hashStr(this.options.generateDataKey),
|
||||
path: this.mDiskCacheProxy.getCachePath() + Md5.hashStr(this.options.generateDataKey)
|
||||
key: SparkMD5.hash(this.options.generateDataKey),
|
||||
path: this.mDiskCacheProxy.getCachePath() + SparkMD5.hash(this.options.generateDataKey)
|
||||
}
|
||||
this.options.allCacheInfoCallback(allCacheInfo)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue