Exemple #1
0
        public static bool CheckFile(string filename)
        {
#if IN_MEMORY
            if (InMemoryFile.Exists(filename) == false)
#else
            if (File.Exists(filename) == false)
#endif
            {
                Console.WriteLine($"Impossible to find file '{filename}'");
                return(false);
            }
            return(true);
        }
Exemple #2
0
        public InMemoryFileStream(string path, FileMode mode, FileAccess access)
        {
            this.path   = InMemoryFile.PathToKey(path);
            this.mode   = mode;
            this.access = access;

            if (mode == FileMode.Create)
            {
                fs[this.path] = new MemoryStream();
            }
            else
            {
                if (fs.TryGetValue(this.path, out MemoryStream ms))
                {
                    ms.Position = 0;
                }
            }
        }