Beispiel #1
0
 public void FileExists(string fileName, FolderLocations folderLocation, StreamExistsCallbackMethod callback)
 {
     if (callback != null)
     {
         callback(false);
     }
 }
		public void FileExists(string fileName, FolderLocations folderLocation, StreamExistsCallbackMethod callback)
		{
			if (callback == null) return;
			if (folderLocation != FolderLocations.Storage)
			{
				Debug.LogError("FileExists Error: Only Storage folder location is currently supported.");
				callback(false);
				return;
			}

			fileExistsAsync(fileName, callback);
		}
        public void FileExists(string fileName, FolderLocations folderLocation, StreamExistsCallbackMethod callback)
        {
            if (callback == null)
            {
                return;
            }
            if (folderLocation != FolderLocations.Storage)
            {
                Debug.LogError("FileExists Error: Only Storage folder location is currently supported.");
                callback(false);
                return;
            }

            fileExistsAsync(fileName, callback);
        }
Beispiel #4
0
        /// <summary>
        /// Use to check if a file exists.
        /// </summary>
        /// <param name="fileName">FileName to check.</param>
        /// <param name="folderLocation">Folder location to load file from.</param>
        /// <param name="streamExistsCallback">The callback that fires when done.</param>
        public static void FileExists(string fileName, FolderLocations folderLocation, StreamExistsCallbackMethod streamExistsCallback)
        {
            if (checkingIfFileExists)
            {
                var que = new StreamManagerQue(StreamManagerQueTypes.FileExists);
                que.streamExistsCallback = streamExistsCallback;
                que.FileName             = fileName;
                que.FolderLocation       = folderLocation;
                ques.Add(que);
                return;
            }

            checkingIfFileExists = true;
            StreamManager.streamExistsCallback = streamExistsCallback;
            plugin.FileExists(getCorrectUnityPath(fileName, folderLocation), folderLocation, async_streamExistsCallback);
        }
		private async void fileExistsAsync(string fileName, StreamExistsCallbackMethod callback)
		{
			try
			{
				var storageFolder = ApplicationData.Current.LocalFolder;
				var file = await storageFolder.GetFileAsync(fileName);
			}
			catch (FileNotFoundException)
			{
				callback(false);
				return;
			}
			catch (Exception e)
			{
				Debug.LogError("FileExists Error: " + e.Message);
				callback(false);
				return;
			}

			callback(true);
		}
        private async void fileExistsAsync(string fileName, StreamExistsCallbackMethod callback)
        {
            try
            {
                var storageFolder = ApplicationData.Current.LocalFolder;
                var file          = await storageFolder.GetFileAsync(fileName);
            }
            catch (FileNotFoundException)
            {
                callback(false);
                return;
            }
            catch (Exception e)
            {
                Debug.LogError("FileExists Error: " + e.Message);
                callback(false);
                return;
            }

            callback(true);
        }
		public void FileExists(string fileName, FolderLocations folderLocation, StreamExistsCallbackMethod callback)
		{
			Native.FileExists(fileName, folderLocation, callback);
		}
			public void FileExists(string fileName, FolderLocations folderLocation, StreamExistsCallbackMethod callback)
			{
				if (callback != null) callback(false);
			}
		/// <summary>
		/// Use to check if a file exists.
		/// </summary>
		/// <param name="fileName">FileName to check.</param>
		/// <param name="folderLocation">Folder location to load file from.</param>
		/// <param name="streamExistsCallback">The callback that fires when done.</param>
		public static void FileExists(string fileName, FolderLocations folderLocation, StreamExistsCallbackMethod streamExistsCallback)
		{
			if (checkingIfFileExists)
			{
				var que = new StreamManagerQue(StreamManagerQueTypes.FileExists);
				que.streamExistsCallback = streamExistsCallback;
				que.FileName = fileName;
				que.FolderLocation = folderLocation;
				ques.Add(que);
				return;
			}

			checkingIfFileExists = true;
			StreamManager.streamExistsCallback = streamExistsCallback;
			plugin.FileExists(getCorrectUnityPath(fileName, folderLocation), folderLocation, async_streamExistsCallback);
		}