|
static string | Create (string extension) |
| Creates a temporary file in the BrawlManagerLib subdirectory of the system temporary folder. This function can be used for image files. For files that can be opened as a ResourceNode, consider using the MakeTempNode function instead. More...
|
|
static void | DeleteAll () |
| Deletes all files created by the Create function (but not those created by MakeTempNode.) More...
|
|
static ResourceNode | MakeTempNode (string path) |
| Creates a ResourceNode from a temporary file using FileMap.FromTempFile. The file will be deleted when the underlying FileMap's stream is closed. More...
|
|
|
static readonly string | SUBDIR = "BrawlManagerLib-" + Guid.NewGuid() |
|
◆ Create()
static string BrawlLib.BrawlManagerLib.TempFiles.Create |
( |
string |
extension | ) |
|
|
inlinestatic |
Creates a temporary file in the BrawlManagerLib subdirectory of the system temporary folder. This function can be used for image files. For files that can be opened as a ResourceNode, consider using the MakeTempNode function instead.
46 {
47 if (!extension.StartsWith("."))
48 {
49 extension = "." + extension;
50 }
51
52 return Path.Combine(Path.GetTempPath(),
SUBDIR, Guid.NewGuid() + extension);
53 }
static readonly string SUBDIR
Definition: TempFiles.cs:21
◆ DeleteAll()
static void BrawlLib.BrawlManagerLib.TempFiles.DeleteAll |
( |
| ) |
|
|
inlinestatic |
Deletes all files created by the Create function (but not those created by MakeTempNode.)
59 {
60 List<Exception> exceptions = new List<Exception>();
61 try
62 {
63 foreach (
string s
in Directory.EnumerateFiles(Path.Combine(Path.GetTempPath(),
SUBDIR)))
64 {
65 try
66 {
67 File.Delete(s);
68 }
69 catch (Exception e)
70 {
71 exceptions.Add(e);
72 }
73 }
74 }
75 catch (Exception e)
76 {
77 exceptions.Add(e);
78 }
79
80 if (exceptions.Count == 0)
81 {
82 try
83 {
84 Directory.Delete(Path.Combine(Path.GetTempPath(),
SUBDIR));
85 }
86 catch (Exception e)
87 {
88 exceptions.Add(e);
89 }
90 }
91
92
93
94
95
96 }
◆ MakeTempNode()
static ResourceNode BrawlLib.BrawlManagerLib.TempFiles.MakeTempNode |
( |
string |
path | ) |
|
|
inlinestatic |
Creates a ResourceNode from a temporary file using FileMap.FromTempFile. The file will be deleted when the underlying FileMap's stream is closed.
102 {
103 byte[] data = File.ReadAllBytes(path);
104
106 Console.WriteLine(path +
" -> FromTempFile -> " + map.
FilePath);
107 Marshal.Copy(data, 0, map.
Address, data.Length);
109 }
Definition: FileMap.cs:10
static FileMap FromTempFile(int length)
Definition: FileMap.cs:96
string FilePath
Definition: FileMap.cs:24
VoidPtr Address
Definition: FileMap.cs:16
Definition: NodeFactory.cs:18
static ResourceNode FromSource(ResourceNode parent, DataSource source)
Definition: NodeFactory.cs:140
Definition: ResourceNode.cs:28
◆ SUBDIR
readonly string BrawlLib.BrawlManagerLib.TempFiles.SUBDIR = "BrawlManagerLib-" + Guid.NewGuid() |
|
static |
The documentation for this class was generated from the following file:
- BrawlLib/BrawlManagerLib/TempFiles.cs