#include <xtd/io/file_info>
#include <xtd/io/directory_info>
#include <xtd/io/path>
#include <xtd/console>
#include <xtd/environment>
#include <xtd/startup>
class program {
private:
public:
static auto main() {
ensure_source_file_exists();
display_file_properties(f_info);
move_file(f_info);
display_file_properties(f_info);
delete_files();
}
private:
try {
display_exception(ex);
}
}
static void ensure_source_file_exists() {
try {
write_file_content(10);
}
display_exception(ex);
}
}
static void write_file_content(int total_element) {
lines.push_back("<?xml version=\"1.0\" standalone=\"yes\"?>");
for (auto index = 0; index < total_element; ++index)
lines.push_back(string::format("<MyElement Index=\"{0}\">\nMyElement at position {0}.", index));
}
static void display_file_properties(
const file_info& f_info) {
try {
display_exception(ex);
}
}
static void delete_files() {
try {
if (d_info.exists()) {
d_info.remove(true);
}
display_exception(ex);
}
}
auto s = string::empty_string;
s +=
"An exception of type \"";
s +=
"\" has occurred.\r\n";
s +=
"\r\nStack trace information:\r\n";
}
};
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:79
static void set_window_size(int32 width, int32 height)
Sets the height and width of the console window to the specified values.
static void write(arg_t &&value)
Writes the text representation of the specified value to the standard output stream.
Definition console.hpp:462
static void clear()
Clears the console buffer and corresponding console window of display information.
static int32 largest_window_height()
Gets the largest possible number of console window rows, based on the current font and screen resolut...
static int32 largest_window_width()
Gets the largest possible number of console window columns, based on the current font and screen reso...
static console_key_info read_key()
Obtains the next character or function key pressed by the user. The pressed key is displayed in the c...
static void set_window_position(int32 left, int32 top)
Sets the position of the console window relative to the screen buffer.
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
@ my_documents
The My Documents folder. This member is equivalent to Personal.
Definition environment.hpp:153
static xtd::string get_folder_path(environment::special_folder folder)
Gets the path to the system special folder that is identified by the specified enumeration.
Definition environment.hpp:613
virtual const xtd::string & message() const noexcept
Gets message associate to the exception.
virtual xtd::string stack_trace() const noexcept
Gets a string representation of the immediate frames on the call stack.
Exposes instance methods for creating, moving, and enumerating through directories and subdirectories...
Definition directory_info.hpp:130
static bool exists(const xtd::string &path)
Determines whether the given path refers to an existing directory on disk.
static xtd::io::directory_info create_directory(const xtd::string &path)
Creates all directories and subdirectories in the specified path unless they already exist.
Provides static methods for the creation, copying, deletion, moving, and opening of files,...
Definition file_info.hpp:41
bool exists() const override
Gets a value indicating whether a file exists.
xtd::io::directory_info directory() const
Gets an instance of the parent directory.
void move_to(const xtd::string &dest_file_name)
Moves a specified file to a new location, providing the option to specify a new file name.
const xtd::date_time & creation_time() const
Gets the creation time of the current file or directory.
xtd::string full_name() const
Gets the full path of the directory or file.
const xtd::date_time & last_write_time() const
Gets the time when the current file or directory was last written to.
static void write_all_lines(const xtd::string &path, type_t contents)
Writes lines to a file, and then closes the file. If the specified file does not exist,...
Definition file.hpp:332
static void remove(const xtd::string &path)
Deletes the specified file.
static bool exists(const xtd::string &path) noexcept
Determines whether the specified file exists.
static xtd::string combine(const xtd::string &path1, const xtd::string &path2)
Combines two path strings.
Implements a xtd::io::text_reader that reads characters from a byte stream.
Definition stream_reader.hpp:28
bool end_of_stream() const
Gets a value that indicates whether the current stream position is at the end of the stream.
virtual xtd::string read_line()
Reads a line of characters from the current stream and returns the data as a string.
The exception that is thrown when a method call is invalid for the object's current state.
Definition system_exception.hpp:18
#define startup_(main_method)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.hpp:167
#define typeof_
Used to obtain the type object of a specified type or object.
Definition typeof.hpp:45
@ s
The S key.
Definition console_key.hpp:124
The xtd::collections::generic namespace contains interfaces and classes that define generic collectio...
Definition comparer.hpp:16
The xtd::io namespace contains types that allow reading and writing to files and data streams,...
Definition binary_reader.hpp:17
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8