//
//  dNetBase.h
//  keyiDownload
//
//  Created by moyanjwb on 14-1-13.
//  Copyright (c) 2014年 moyanjwb. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "commonInterface.h"

//
@interface dNetController : NSObject
{
    NSString*       _cacheDir;
    long            _maxHttpNum;
    NSMutableArray*  _tasks;
    id<dNetNotify>  _notify;
    NSTimer*        _timer;
    BOOL            _isStop;
}
+(dNetController*)sharedObject;
//设置想干
-(void)init:(NSString*)cacheDir maxHttpNum:(long)maxHttpNum notify:(id<dNetNotify>)notify;
-(void)setNotify:(id<dNetNotify>)notify;
-(long)getMaxHttpNum;
-(NSString*)getCacheDir;
-(enum EVideoType)getDefaultVideoType;
-(void)setDefaultVideoType:(enum EVideoType)vType;
-(BOOL)getRemindWhenDelete;
-(void)setRemindWhenDelete:(BOOL)remind;
-(BOOL)getDeleteSourceWhenDelete;
-(void)setDeleteSourceWhenDelete:(BOOL)del;
-(BOOL)getRemindWhenCanDownload;
-(void)setRemindWhenCanDownload:(BOOL)remind;
-(BOOL)getAddRemind;
-(void)setAddRemind:(BOOL)remind;
-(BOOL)getDispBackImage;
-(void)setDispBackImage:(BOOL)disp;
-(NSString*)firstRunDate;
-(BOOL)getDispViewSwtichTip;
-(void)setDispViewSwtichTip:(BOOL)disp;
-(void)setCustomUserAgent:(NSString*)ua;
-(NSString*)getCustomUserAgent;
-(NSString*)getDefaultUserAgent;
-(void)setDefaultUserAgent:(NSString*)ua;
//
-(BOOL)isTesting;
//
-(BOOL)getShowDisclaimer;
//
-(void)setKeyValue:(NSString*)key value:(id)value;
-(id)getKeyValue:(NSString*)key;
//
-(BOOL)getTopMost;
-(void)setTopMost:(BOOL)top;
//
-(BOOL)getMute;
-(void)setMute:(BOOL)mute;
//
-(float)getSound;
-(void)setSound:(float)sound;
//
-(long)getPlayTime:(NSString*)file;
-(void)setPlayTime:(NSString*)file time:(long)time;
-(void)deletePlayRecord:(NSString*)file;
//缓存记录
-(NSArray*)loadTasks;
//操作相关
//是否支持该URL下载
+(BOOL)canDownload:(NSString*)url html:(NSString*)html webView:(sh_webview*)webView;
-(id<dNetBase>)createTask:(NSString*)url vType:(enum EVideoType) vType;
-(void)destroyTask:(id<dNetBase>)task;
//删除记录时调用
-(void)deleteTask:(id<dNetBase>)task;
//批量操作
//全部开始
-(void)startAll;
//全部停止
-(void)stopAll;
//删除全部已完成项
-(void)deleteAllCompleted;
//删除全部未完成项
-(void)deleteAllUnCompleted;
//
-(void)saveConfig;
//
-(NSArray*)allTask;
-(BOOL)isStop;
//
-(void)unInit;
//
@end


