DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
File.h
Go to the documentation of this file.
1
3
4#pragma once
5
6#include "Common.h"
7#include "System/Object.h"
8#include "System/String.h"
10#include "System/Array.h"
11
12namespace DotNetDupe {
13 namespace System {
14 namespace IO {
16 enum class FileAttributes {
17 Normal = 0,
19 Hidden = 2,
20 System = 4,
22 Archive = 32,
23 Device = 64,
24 Temporary = 128,
27 Compressed = 1024,
28 Offline = 2048,
30 Encrypted = 8192,
33 };
34
42 class File : public Object {
43 public:
47 DOTNETDUPE_API static bool Exists(const String& sPath);
48
53 DOTNETDUPE_API static String ReadAllText(const String& sPath);
54
58 DOTNETDUPE_API static void WriteAllText(const String& sPath, const String& sContents);
59
64 DOTNETDUPE_API static void Copy(const String& sSourceFileName, const String& sDestFileName, bool bOverwrite);
65
69 DOTNETDUPE_API static void Move(const String& sSourceFileName, const String& sDestFileName);
70
73 DOTNETDUPE_API static void Delete(const String& sPath);
74 DOTNETDUPE_API static void AppendAllText(const String& sPath, const String& sContents);
75 DOTNETDUPE_API static void AppendAllLines(const String& sPath, const Array<String>& sContents);
77 DOTNETDUPE_API static void WriteAllLines(const String& sPath, const Array<String>& sContents);
78 DOTNETDUPE_API static void Create(const String& sPath);
79 DOTNETDUPE_API static bool GetAttributes(const String& sPath, FileAttributes& attrAttributes);
80 DOTNETDUPE_API static bool SetAttributes(const String& sPath, FileAttributes attrAttributes);
81 };
82 }
83 }
84}
Provides methods for creating, manipulating, searching, and sorting arrays.
Defines common cross-platform macros, export decorators, and fundamental types.
#define DOTNETDUPE_API
Platform-specific linkage decoration for exporting or importing library symbols.
Definition Common.h:20
Base object class for DotNetDupe mirroring .NET System.Object.
High-performance UTF-8 / UTF-16 string manipulation class mirroring .NET System.String.
Represents character encodings and code page conversions.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition Array.h:29
Exposes static methods for creating, moving, and enumerating through directories and subdirectories.
Definition Directory.h:23
Provides static methods for the creation, copying, deletion, moving, and opening of files.
Definition File.h:42
static bool GetAttributes(const String &sPath, FileAttributes &attrAttributes)
Definition File.cpp:167
static void Copy(const String &sSourceFileName, const String &sDestFileName, bool bOverwrite)
Copies an existing file to a new file, allowing overwriting of an existing file.
Definition File.cpp:63
static bool SetAttributes(const String &sPath, FileAttributes attrAttributes)
Definition File.cpp:184
static void WriteAllText(const String &sPath, const String &sContents)
Creates a new file, writes the specified string to the file, and then closes the file.
Definition File.cpp:53
static bool Exists(const String &sPath)
Determines whether the specified file exists.
Definition File.cpp:31
static void AppendAllText(const String &sPath, const String &sContents)
Definition File.cpp:90
static String ReadAllText(const String &sPath)
Opens a text file, reads all the text in the file, and then closes the file.
Definition File.cpp:36
static void AppendAllLines(const String &sPath, const Array< String > &sContents)
Definition File.cpp:99
static void WriteAllLines(const String &sPath, const Array< String > &sContents)
Definition File.cpp:130
static void Delete(const String &sPath)
Deletes the specified file.
Definition File.cpp:82
static void Create(const String &sPath)
Definition File.cpp:143
static void Move(const String &sSourceFileName, const String &sDestFileName)
Moves a specified file to a new location.
Definition File.cpp:74
static Array< String > ReadAllLines(const String &sPath)
Definition File.cpp:112
Supports all classes in the DotNetDupe class hierarchy.
Definition Object.h:18
Represents text as a sequence of UTF-8 code units with culture-invariant operations.
Definition String.h:74
FileAttributes
Provides attributes for files and directories.
Definition File.h:16