当前位置: 首页>>代码示例>>Java>>正文


Java Helpers.generateSaveFileName方法代码示例

本文整理汇总了Java中com.google.android.vending.expansion.downloader.Helpers.generateSaveFileName方法的典型用法代码示例。如果您正苦于以下问题:Java Helpers.generateSaveFileName方法的具体用法?Java Helpers.generateSaveFileName怎么用?Java Helpers.generateSaveFileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.vending.expansion.downloader.Helpers的用法示例。


在下文中一共展示了Helpers.generateSaveFileName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: RemoveOBBFile

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
static private void RemoveOBBFile(int OBBToDelete) {
	
	for (OBBData.XAPKFile xf : OBBData.xAPKS) {
	    String fileName = Helpers.getExpansionAPKFileName(DownloaderActivity._download, xf.mIsMain, xf.mFileVersion);
		switch(OBBToDelete)
		{
		case 0:
			String fileForNewFile = Helpers.generateSaveFileName(DownloaderActivity._download, fileName);
			File srcFile = new File(fileForNewFile);
			srcFile.delete();
			break;
		case 1:
			String fileForDevFile = Helpers.generateSaveFileNameDevelopment(DownloaderActivity._download, fileName);
			File srcDevFile = new File(fileForDevFile);
			srcDevFile.delete();
			break;
		}
	}		
}
 
开发者ID:FallingUpGame,项目名称:FallingUp,代码行数:20,代码来源:DownloaderActivity.java

示例2: finalizeDestinationFile

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
/**
 * Called after a successful completion to take any necessary action on the
 * downloaded file.
 */
private void finalizeDestinationFile(State state) throws StopRequest {
    syncDestination(state);
    String tempFilename = state.mFilename;
    String finalFilename = Helpers.generateSaveFileName(mService, mInfo.mFileName);
    if (!state.mFilename.equals(finalFilename)) {
        File startFile = new File(tempFilename);
        File destFile = new File(finalFilename);
        if (mInfo.mTotalBytes != -1 && mInfo.mCurrentBytes == mInfo.mTotalBytes) {
            if (!startFile.renameTo(destFile)) {
                throw new StopRequest(DownloaderService.STATUS_FILE_ERROR,
                        "unable to finalize destination file");
            }
        } else {
            throw new StopRequest(DownloaderService.STATUS_FILE_DELIVERED_INCORRECTLY,
                    "file delivered with incorrect size. probably due to network not browser configured");
        }
    }
}
 
开发者ID:snoozinsquatch,项目名称:unity-obb-downloader,代码行数:23,代码来源:DownloadThread.java

示例3: handleFileUpdated

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
/**
 * The APK has been updated and a filename has been sent down from the
 * Market call. If the file has the same name as the previous file, we do
 * nothing as the file is guaranteed to be the same. If the file does not
 * have the same name, we download it if it hasn't already been delivered by
 * Market.
 *
 * @param index the index of the file from market (0 = main, 1 = patch)
 * @param filename the name of the new file
 * @param fileSize the size of the new file
 * @return
 */
public boolean handleFileUpdated(DownloadsDB db, int index,
        String filename, long fileSize) {
    DownloadInfo di = db.getDownloadInfoByFileName(filename);
    if (null != di) {
        String oldFile = di.mFileName;
        // cleanup
        if (null != oldFile) {
            if (filename.equals(oldFile)) {
                return false;
            }

            // remove partially downloaded file if it is there
            String deleteFile = Helpers.generateSaveFileName(this, oldFile);
            File f = new File(deleteFile);
            if (f.exists())
                f.delete();
        }
    }
    return !Helpers.doesFileExist(this, filename, fileSize, true);
}
 
开发者ID:snoozinsquatch,项目名称:unity-obb-downloader,代码行数:33,代码来源:DownloaderService.java

示例4: handleFileUpdated

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
/**
 * The APK has been updated and a filename has been sent down from the
 * Market call. If the file has the same name as the previous file, we do
 * nothing as the file is guaranteed to be the same. If the file does not
 * have the same name, we download it if it hasn't already been delivered by
 * Market.
 * 
 * @param index the index of the file from market (0 = main, 1 = patch)
 * @param filename the name of the new file
 * @param fileSize the size of the new file
 * @return
 */
public boolean handleFileUpdated(DownloadsDB db, int index,
        String filename, long fileSize) {
    DownloadInfo di = db.getDownloadInfoByFileName(filename);
    if (null != di) {
        String oldFile = di.mFileName;
        // cleanup
        if (null != oldFile) {
            if (filename.equals(oldFile)) {
                return false;
            }

            // remove partially downloaded file if it is there
            String deleteFile = Helpers.generateSaveFileName(this, oldFile);
            File f = new File(deleteFile);
            if (f.exists())
                f.delete();
        }
    }
    return !Helpers.doesFileExist(this, filename, fileSize, true);
}
 
开发者ID:SlotNSlot,项目名称:SlotNSlot_Android,代码行数:33,代码来源:DownloaderService.java

示例5: doInBackground

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
@Override
protected Boolean doInBackground(Void... params) {
    try {
        for (XAPKFile xFile : mXFiles) {
            String fileName = Helpers.getExpansionAPKFileName(mContext, xFile.mIsMain, xFile.mFileVersion);
            String srcFileName = Helpers.generateSaveFileName(mContext, fileName);
            File srcFile = new File(srcFileName);
            if (!unzip(srcFile, mDestFolder)) {
                return false;
            }
        }
        return true;
    } catch (Exception e) {
        return false;
    }
}
 
开发者ID:cclink,项目名称:ObbDownloadHelper,代码行数:17,代码来源:ObbUnzipHelper.java

示例6: doInBackground

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
@Override
protected Boolean doInBackground(Void... params) {
    try {
        for (XAPKFile xFile : mXFiles) {
            String fileName = Helpers.getExpansionAPKFileName(mContext, xFile.mIsMain, xFile.mFileVersion);
            String srcFileName = Helpers.generateSaveFileName(mContext, fileName);
            File srcFile = new File(srcFileName);
            if (!copy(srcFile, mDestFolder)) {
                return false;
            }
        }
        return true;
    } catch (Exception e) {
        return false;
    }
}
 
开发者ID:cclink,项目名称:ObbDownloadHelper,代码行数:17,代码来源:ObbCopyHelper.java

示例7: expansionFilesDelivered

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
/**
  * Go through each of the APK Expansion files defined in the structure above
  * and determine if the files are present and match the required size. Free
  * applications should definitely consider doing this, as this allows the
  * application to be launched for the first time without having a network
  * connection present. Paid applications that use LVL should probably do at
  * least one LVL check that requires the network to be present, so this is
  * not as necessary.
  * 
  * @return true if they are present.
  */
 boolean expansionFilesDelivered() {
		
     for (OBBData.XAPKFile xf : OBBData.xAPKS) {
         String fileName = Helpers.getExpansionAPKFileName(this, xf.mIsMain, xf.mFileVersion);
GameActivity.Log.debug("Checking for file : " + fileName);
String fileForNewFile = Helpers.generateSaveFileName(this, fileName);
String fileForDevFile = Helpers.generateSaveFileNameDevelopment(this, fileName);
GameActivity.Log.debug("which is really being resolved to : " + fileForNewFile + "\n Or : " + fileForDevFile);
         if (!Helpers.doesFileExist(this, fileName, xf.mFileSize, false) &&
	!Helpers.doesFileExistDev(this, fileName, xf.mFileSize, false))
             return false;
     }
     return true;
 }
 
开发者ID:FallingUpGame,项目名称:FallingUp,代码行数:26,代码来源:DownloaderActivity.java

示例8: onlySingleExpansionFileFound

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
boolean onlySingleExpansionFileFound() {
	for (OBBData.XAPKFile xf : OBBData.xAPKS) {
           String fileName = Helpers.getExpansionAPKFileName(this, xf.mIsMain, xf.mFileVersion);
		GameActivity.Log.debug("Checking for file : " + fileName);
		String fileForNewFile = Helpers.generateSaveFileName(this, fileName);
		String fileForDevFile = Helpers.generateSaveFileNameDevelopment(this, fileName);
		
		if (Helpers.doesFileExist(this, fileName, xf.mFileSize, false) &&
			Helpers.doesFileExistDev(this, fileName, xf.mFileSize, false))
               return false;
	}
	
	return true;		
}
 
开发者ID:FallingUpGame,项目名称:FallingUp,代码行数:15,代码来源:DownloaderActivity.java

示例9: expansionFilesUptoData

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
boolean expansionFilesUptoData() {

	File cacheFile = getFileDetailsCacheFile();
	// Read data into an array or something...
	Map<String, Long> fileDetailsMap = new HashMap<String, Long>();
	
	if(cacheFile.exists()) {
		try {
			FileReader fileCache = new FileReader(cacheFile);
			BufferedReader bufferedFileCache = new BufferedReader(fileCache);
			List<String> lines = new ArrayList<String>();
			String line = null;
			while ((line = bufferedFileCache.readLine()) != null) {
				lines.add(line);
			}
			bufferedFileCache.close();
			
			for(String dataLine : lines)
			{
				GameActivity.Log.debug("Splitting dataLine => " + dataLine);
				String[] parts = dataLine.split(",");
				fileDetailsMap.put(parts[0], Long.parseLong(parts[1]));
			}
		}
		catch(Exception e)
		{
			GameActivity.Log.debug("Exception thrown during file details reading.");
			e.printStackTrace();
			fileDetailsMap.clear();
		}	
	}
	
	for (OBBData.XAPKFile xf : OBBData.xAPKS) {
           String fileName = Helpers.getExpansionAPKFileName(this, xf.mIsMain, xf.mFileVersion);
		String fileForNewFile = Helpers.generateSaveFileName(this, fileName);
		String fileForDevFile = Helpers.generateSaveFileNameDevelopment(this, fileName);
		// check to see if time/data on files match cached version
		// if not return false
		File srcFile = new File(fileForNewFile);
		File srcDevFile = new File(fileForDevFile);
		long lastModified = srcFile.lastModified();
		long lastModifiedDev = srcDevFile.lastModified();
		if(!(srcFile.exists() && fileDetailsMap.containsKey(fileName) && lastModified == fileDetailsMap.get(fileName)) 
			&&
		   !(srcDevFile.exists() && fileDetailsMap.containsKey(fileName) && lastModifiedDev == fileDetailsMap.get(fileName)))
			return false;
	}
	return true;
}
 
开发者ID:FallingUpGame,项目名称:FallingUp,代码行数:50,代码来源:DownloaderActivity.java

示例10: expansionFilesDelivered

import com.google.android.vending.expansion.downloader.Helpers; //导入方法依赖的package包/类
private boolean expansionFilesDelivered() {
       File oldObb = new File(Environment.getExternalStorageDirectory() + "/Android/obb/de.phbouillon.android.games.alite/main.2170.de.phbouillon.android.games.alite.obb");
       if (oldObb.exists()) {
       	oldObb.delete();
       }
    String fileName = Helpers.getExpansionAPKFileName(this, true, AliteConfig.EXTENSION_FILE_VERSION);
    File fileForNewFile = new File(Helpers.generateSaveFileName(this, fileName));
    AliteLog.e("Check for OBB", "OBB exists? " + fileForNewFile.getAbsolutePath());
    return Helpers.doesFileExist(this, fileName, AliteConfig.EXTENSION_FILE_LENGTH, false);
}
 
开发者ID:CmdrStardust,项目名称:Alite,代码行数:11,代码来源:AliteStartManager.java


注:本文中的com.google.android.vending.expansion.downloader.Helpers.generateSaveFileName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。