public StudentFacade( CSVDataReader csvDataReader, IRepository <Student> studentRepository) { this.csvDataReader = csvDataReader; this.studentRepository = studentRepository; }
// サブウィンドウの初期化 public void init() { mapSize = parent.MapSize; gridSize = parent.GridSize; // マップデータを初期化 terramap = new Terra[mapSize, mapSize]; objmap = new MovingObject[mapSize, mapSize]; for (int i = 0; i < mapSize; i++) { for (int j = 0; j < mapSize; j++) { terramap[i, j] = Terra.NONE; objmap[i, j] = MovingObject.NONE; } } // グリッドデータを生成 gridRect = CreateGrid(mapSize); if (parent.LoadTerra != null) { string path = AssetDatabase.GetAssetPath(parent.LoadTerra); path = path.Remove(0, 6); terramap = CSVDataReader.DataToTerra(CSVDataReader.readCSVData(path)); } if (parent.LoadObj != null) { string path = AssetDatabase.GetAssetPath(parent.LoadObj); path = path.Remove(0, 6); objmap = CSVDataReader.DataToObj(CSVDataReader.readCSVData(path)); } }
void generate(int stagenumber) { GameObject tile; Terra[,] terramap = CSVDataReader.DataToTerra(CSVDataReader.readCSVData("/Map/" + mapname + stagenumber + "_terra.csv")); MovingObject[,] objmap = CSVDataReader.DataToObj(CSVDataReader.readCSVData("/Map/" + mapname + stagenumber + "_obj.csv")); Debug.Log(terramap[0, 0]); for (int i = 0; i < terramap.GetLength(0); i++) { for (int j = 0; j < terramap.GetLength(1); j++) { if (terraTile[(int)terramap[i, j]] != null) { tile = (GameObject)Instantiate(terraTile[(int)terramap[i, j]], new Vector3(j, -i, 0), Quaternion.identity); tile.transform.parent = tileParent.transform; } } } for (int i = 0; i < objmap.GetLength(0); i++) { for (int j = 0; j < objmap.GetLength(1); j++) { if (terraTile[(int)objmap[i, j]] != null) { tile = (GameObject)Instantiate(objTile[(int)objmap[i, j]], new Vector3(j, -i, 0), Quaternion.identity); tile.transform.parent = tileParent.transform; } } } }
public CSVDataImporterManager ConfigureLoggers() { var serviceProvider = new ServiceCollection() .AddLogging() .BuildServiceProvider(); var factoryReader = serviceProvider.GetService <ILoggerFactory>(); var factoryConnection = serviceProvider.GetService <ILoggerFactory>(); var factoryImporter = serviceProvider.GetService <ILoggerFactory>(); reader = new CSVDataReader(factoryReader); dataConnection = new AcmeDatabaseConnection(factoryConnection); importer = new CSVDataImporterManager(reader, dataConnection, factoryImporter); return(importer); }
public void ReadLoadsTheExpectedInfoFromACSVFile() { var sut = new CSVDataReader(); var result = sut.Read("./resources/SmallCSVSample.csv"); Assert.Equal(2, result.Count()); var first = result.First().ToList(); Assert.Equal("Kinder", first[0]); Assert.Equal("Leia", first[1]); Assert.Equal("F", first[2]); Assert.Equal("20151231145934", first[3]); var second = result.Skip(1).First().ToList(); Assert.Equal("High", second[0]); Assert.Equal("Luke", second[1]); Assert.Equal("M", second[2]); Assert.Equal("20130129080903", second[3]); }
private void OnExecute() { string outPath = OutputFilePath ?? (Path.GetFileNameWithoutExtension(DataFilePath) + "_output" + Path.GetExtension(DataFilePath)); // load configuration file // YamlConfigReader configFile = new YamlConfigReader(".\\resources\\config.yaml"); YamlConfigReader configFile = new YamlConfigReader(MetadataFilePath); DataProtectionConfig protectionConfig = configFile.Read(); bool sourceIsEncrypted = false; bool targetIsEncrypted = true; string outputFileName = ""; switch (Command.ToLower()) { case "encrypt": sourceIsEncrypted = false; targetIsEncrypted = true; outputFileName = DataFilePath.Split('.')[0] + "-encrypted." + DataFilePath.Split('.')[1]; break; case "decrypt": sourceIsEncrypted = true; targetIsEncrypted = false; outputFileName = DataFilePath.Split('.')[0] + "-decrypted." + DataFilePath.Split('.')[1]; break; default: Console.WriteLine("Not a valid command. Try 'encrypt' or 'decrypt' as a command."); break; } // For encryption operations, we're going to remove output settings // open input and output file streams // Stream inputFile = File.OpenRead (".\\resources\\userdata.parquet"); // Stream outputFile = File.OpenWrite (".\\resources\\userdata.parquet"); Stream outputFile = File.OpenWrite(outputFileName); // Create reader // using ParquetFileReader reader = new ParquetFileReader (inputFile); CSVDataReader reader = new CSVDataReader(new StreamReader(DataFilePath), protectionConfig, TokenCredential, sourceIsEncrypted); // Copy source settings as target settings /* * List<FileEncryptionSettings> writerSettings = reader.FileEncryptionSettings * .Select (s => Copy (s)) * .ToList (); */ // Create and pass the target settings to the writer // using ParquetFileWriter writer = new ParquetFileWriter (outputFile, writerSettings); using CSVDataWriter writer = new CSVDataWriter(new StreamWriter(outputFile), protectionConfig, TokenCredential, reader.Header, targetIsEncrypted); // Process the file ColumnarCryptographer cryptographer = new ColumnarCryptographer(reader, writer); try { cryptographer.Transform(); Console.WriteLine($"File processed successfully. Verify output file contains encrypted data."); } catch (Exception e) { Console.WriteLine(e.Message); } }