1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-17 12:33:38 +00:00

Remove submodule and use subrepo for ZAPD (#591)

* remove zap

* git subrepo clone https://github.com/zeldaret/ZAPD.git tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "cd4a8760b"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "cd4a8760b"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"

* remove thanks.md

* zap2 -> zapd and spec changes

* remove submodule init
This commit is contained in:
fig02 2021-01-01 23:24:29 -05:00 committed by GitHub
parent ae5a8f2700
commit ba0c6965ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
220 changed files with 85641 additions and 554 deletions

60
tools/ZAPD/ZAPD/File.h Normal file
View file

@ -0,0 +1,60 @@
#pragma once
#include <string>
#include <fstream>
#include <vector>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include "StringHelper.h"
class File
{
public:
static bool Exists(std::string filePath)
{
std::ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate);
return file.good();
}
static std::vector<uint8_t> ReadAllBytes(std::string filePath)
{
std::ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate);
int fileSize = (int)file.tellg();
file.seekg(0);
char* data = new char[fileSize];
file.read(data, fileSize);
return std::vector<uint8_t>(data, data + fileSize);
};
static std::string ReadAllText(std::string filePath)
{
std::ifstream file(filePath, std::ios::in | std::ios::binary | std::ios::ate);
int fileSize = (int)file.tellg();
file.seekg(0);
char* data = new char[fileSize+1];
memset(data, 0, fileSize + 1);
file.read(data, fileSize);
return std::string((const char*)data);
};
static std::vector<std::string> ReadAllLines(std::string filePath)
{
std::string text = ReadAllText(filePath);
std::vector<std::string> lines = StringHelper::Split(text, "\n");
return lines;
};
static void WriteAllBytes(std::string filePath, std::vector<uint8_t> data)
{
std::ofstream file(filePath, std::ios::binary);
file.write((char*)data.data(), data.size());
};
static void WriteAllText(std::string filePath, std::string text)
{
std::ofstream file(filePath, std::ios::out);
file.write(text.c_str(), text.size());
}
};