Beispiel #1
0
 public async Task SendSettingsToCloud(string gameId, string pathToSettingsFile)
 {
     var hid       = _hidGenerator.GetHid();
     var fileName  = _fileHandler.GetFileName(pathToSettingsFile);
     var fileBytes = _fileHandler.GetFileBytes(pathToSettingsFile);
     await _crowdsourcingService.Upload(hid, gameId, fileName, fileBytes);
 }
Beispiel #2
0
        public void DeleteFile(string fileName, string currentDirectory)
        {
            var folderPath    = _fileHandler.GetAbsolutePath(currentDirectory);
            var fileFullPaths = _fileHandler.EnumerateFiles(folderPath, "*", false);

            foreach (var fullPath in fileFullPaths)
            {
                if (_fileHandler.GetFileName(fullPath) == fileName)
                {
                    _fileHandler.DeleteFile(fullPath);
                }
            }
        }
Beispiel #3
0
        public override void Execute(Dispatcher service)
        {
            IFileHandler fromHandler = service.GetHandler(FromPath, true);
            IFileHandler toHandler   = service.GetHandler(ToPath);

            byte[] file     = fromHandler.GetFile();
            string fileName = fromHandler.GetFileName();

            Console.Write("Copying " + fileName);
            if (!toHandler.SaveFile(fileName, file, out string message))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Write("\tFailed : " + message);
                Console.ForegroundColor = ConsoleColor.Gray;
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.DarkGreen;
                Console.Write("\tSuccess");
                Console.ForegroundColor = ConsoleColor.Gray;
            }
            Console.WriteLine();
        }