Exemple #1
0
        public int CreateFile(string filename, System.IO.FileAccess access, System.IO.FileShare share, System.IO.FileMode mode, System.IO.FileOptions options, DokanFileInfo info)
        {
            FileInformation fi = new FileInformation();

            GetFileInformation(filename, ref fi, info);

            switch (mode)
            {
            case FileMode.Append:
                return(DokanNet.DOKAN_SUCCESS);

            case FileMode.Create:
                AddToFileCache(filename, FillFileCache(filename));
                return(DokanNet.DOKAN_SUCCESS);

            case FileMode.CreateNew:
                AddToFileCache(filename, FillFileCache(filename));
                return(DokanNet.DOKAN_SUCCESS);

            case FileMode.Open:
                return(DokanNet.DOKAN_SUCCESS);

            case FileMode.Truncate:
                return(DokanNet.DOKAN_SUCCESS);
            }
            return(DokanNet.DOKAN_ERROR);
        }
Exemple #2
0
        //Windows System Error Codes @ http://www.hiteksoftware.com/knowledge/articles/049.htm
        public int CreateFile(string filename, System.IO.FileAccess access, System.IO.FileShare share, System.IO.FileMode mode, System.IO.FileOptions options, DokanFileInfo info)
        {
            Console.WriteLine("crFile: " + filename);

            info.Context = count++;

            if (filename.Trim() == "\\")
            {
                info.IsDirectory = true;
                return(0);
            }
            else
            {
                RAFInMemoryFileSystemObject fso = rafManager.ResolveRAFPathTOFSO(filename);
                Console.WriteLine("-> FSO NULL? " + (fso == null));
                if (fso == null)
                {
                    return(-DokanNet.ERROR_ACCESS_DENIED);
                }
                else
                {
                    if (fso.GetFSOType() == RAFFSOType.DIRECTORY)
                    {
                        info.IsDirectory = true;
                    }
                    return(0);
                }
            }
            //return -82;
        }
Exemple #3
0
        public int CreateFile(
            string filename,
            System.IO.FileAccess access,
            System.IO.FileShare share,
            System.IO.FileMode mode,
            System.IO.FileOptions options,
            DokanFileInfo info)
        {
            Trace.WriteLine(string.Format("CreateFile {0}", filename));

            if (mode == FileMode.CreateNew)
            {
                var blob = this.GetBlob(filename, false);
                blobsWriting.TryAdd(filename, blob.OpenWrite());

                return(0);
            }

            if (GetFileInformation(filename, new FileInformation(), new DokanFileInfo(0)) == 0)
            {
                return(0);
            }
            else
            {
                return(-DokanNet.ERROR_FILE_NOT_FOUND);
            }
        }
Exemple #4
0
        public static IO.FileStream Open(string filepath, IO.FileMode mode, IO.FileAccess access, IO.FileShare share)
        {
            //opened in the specified mode , access and  share
            IO.FileStream fs      = null;
            uint          umode   = GetMode(mode);
            uint          uaccess = GetAccess(access);
            uint          ushare  = GetShare(share);

            if (mode == IO.FileMode.Append)
            {
                uaccess = PathInternal.DllImport.FILE_APPEND_DATA;
            }

            SafeFileHandle sh     = PathInternal.DllImport.CreateFileW(PathInternal.ConvertToUnicodePath(filepath), uaccess, ushare, IntPtr.Zero, umode, PathInternal.DllImport.FILE_ATTRIBUTE_NORMAL, IntPtr.Zero);
            int            iError = Marshal.GetLastWin32Error();

            if ((iError > 0 && !(mode == IO.FileMode.Append && iError != PathInternal.DllImport.ERROR_ALREADY_EXISTS)) || sh.IsInvalid)
            {
                throw new Exception("Error opening file Win32 Error:" + iError);
            }
            else
            {
                fs = new IO.FileStream(sh, access);
            }
            // if opened in append mode
            if (mode == IO.FileMode.Append)
            {
                if (!sh.IsInvalid)
                {
                    PathInternal.DllImport.SetFilePointer(sh, 0, IntPtr.Zero, PathInternal.DllImport.FILE_END);
                }
            }
            return(fs);
        }
 void ValidatePermission(FA mode)
 {
     if ((AccessPermissions & mode) == 0)
     {
         throw new NotSupportedException("Stream permissions do not support the requested streaming mode");
     }
 }
Exemple #6
0
        public static SafeFileHandle CreateFile(String fileName, System.IO.FileAccess fileAccess, System.IO.FileShare fileShare, System.IO.FileMode fileMode)
        {
            String prefix        = @"\\?\";
            String formattedName = fileName;

            if (!fileName.StartsWith(prefix))
            {
                formattedName = prefix + fileName;
            }
            int fileNameIndex = formattedName.LastIndexOf(System.IO.Path.DirectorySeparatorChar);

            if (fileNameIndex >= 0)
            {
                String dirName = formattedName.Substring(0, fileNameIndex);
                CreateDir(dirName);
            }
            SafeFileHandle fileHandle = CreateFile(formattedName, fileAccess, fileShare, null, fileMode, 0, IntPtr.Zero);

            if (fileHandle.IsInvalid)
            {
                int lastWin32Error = Marshal.GetLastWin32Error();
                throw new Win32Exception(lastWin32Error);
            }
            return(fileHandle);
        }
        public uint Def_CreateFile(string filename, System.IO.FileAccess access, System.IO.FileShare share, System.IO.FileMode mode, System.IO.FileOptions options, IntPtr info)
        {
            //return 0;
            RegistryFileBlock rb = new RegistryFileBlock(filename);

            if (rb.ValueKind > 0)
            {
                if (mode == FileMode.CreateNew || mode == FileMode.OpenOrCreate)
                {
                    if (rb.level == 2)
                    {
                        GetRegistoryEntry(rb).CreateSubKey(rb.KeyPointer.Substring(rb.KeyPointer.LastIndexOf("\\") + 1));
                        return(0);
                    }
                    int check;

                    if (rb.level == 3 && filename.EndsWith(regtypes[rb.ValueKind], StringComparison.CurrentCultureIgnoreCase))
                    {
                        switch (rb.ValueKind)
                        {
                        case 1:
                            GetRegistoryEntry(rb).SetValue(rb.ValueName, 0, RegValueType[rb.ValueKind]);
                            break;

                        case 2:
                            GetRegistoryEntry(rb).SetValue(rb.ValueName, "", RegValueType[rb.ValueKind]);
                            break;

                        case 3:
                            GetRegistoryEntry(rb).SetValue(rb.ValueName, 0, RegValueType[rb.ValueKind]);
                            break;

                        case 4:
                            GetRegistoryEntry(rb).SetValue(rb.ValueName, "", RegValueType[rb.ValueKind]);
                            break;

                        default:
                            return(0xC000000F);
                        }
                        return(0);
                    }
                }
            }
            else
            {
                if (filename == "\\")
                {
                    return(0);
                }
                if (filename.EndsWith("dekstop.ini", StringComparison.CurrentCultureIgnoreCase) || filename.EndsWith("autorun.inf", StringComparison.CurrentCultureIgnoreCase))
                {
                    return(0);
                }
                // else
                // Console.WriteLine("Invalid New File {0}",filename);
                return(0xC000000F);
            }
            return(0xC000000F);
        }
Exemple #8
0
 public static extern SafeFileHandle CreateFile(
     string lpFileName,
     [MarshalAs(UnmanagedType.U4)] System.IO.FileAccess dwDesiredAccess,
     [MarshalAs(UnmanagedType.U4)] System.IO.FileShare dwShareMode,
     IntPtr lpSecurityAttributes,
     [MarshalAs(UnmanagedType.U4)] FileMode dwCreationDisposition,
     [MarshalAs(UnmanagedType.U4)] System.IO.FileAttributes dwFlagsAndAttributes,
     IntPtr hTemplateFile);
        public int CreateFile(string filename, System.IO.FileAccess access, FileShare share, FileMode mode, FileOptions options, DokanFileInfo info)
        {
            string f = Map(filename);

            //if(access == FileAccess.ReadWrite)
            //File.Create(filename, 256, options);
            return(0);
        }
 public HttpNetworkStream(DirectionType direction, Socket socket,
                          System.IO.FileAccess fileAccess, bool ownsSocket)
 {
     Direction             = direction;
     _socket               = socket;
     _stream               = new PrependableNetworkStream(socket, fileAccess, ownsSocket);
     _unknownContentLength = true;
 }
Exemple #11
0
        public File OpenFile(string path, FileMode mode, FileAccess access)
        {
            // Resolve the OpenOrCreate file mode.
            if (mode == FileMode.OpenOrCreate)
            {
                mode = FileExists(path) ? FileMode.Open : FileMode.Create;
            }

            // Convert the file mode and access to the System.IO types.
            IO.FileMode   fileMode   = ConvertMode(mode);
            IO.FileAccess fileAccess = ConvertAccess(access);

            // Attempt to open the stream.
            IO.Stream stream;

            try
            {
                stream = new IO.FileStream(path, fileMode, fileAccess);
            }
            catch (NotSupportedException)
            {
                throw new IOException("Path refers to a non-file device");
            }
            catch (IO.FileNotFoundException)
            {
                throw new FileNotFoundException("File not found");
            }
            catch (IO.DirectoryNotFoundException)
            {
                throw new DirectoryNotFoundException("Invalid path");
            }
            catch (IO.IOException)
            {
                throw new IOException("Generic IO exception");
            }
            catch (System.Security.SecurityException)
            {
                throw new SecurityException("No permission");
            }
            catch (UnauthorizedAccessException)
            {
                throw new SecurityException("Requested access denied");
            }

            // Build the file info.
            FileInfo fileInfo;

            if (mode == FileMode.Open || (mode == FileMode.Append && FileExists(path)))
            {
                fileInfo = GetFileInfo(path);
            }
            else
            {
                fileInfo = CreateFileInfo(path);
            }

            return(new File(fileInfo, stream));
        }
Exemple #12
0
 public SqlFileStream
 (
     string path,
     byte[] transactionContext,
     System.IO.FileAccess access
 )
     : this(path, transactionContext, access, System.IO.FileOptions.None, 0)
 {
 }
 public HttpNetworkStream(DirectionType direction, ulong contentLength, byte[] prependToStream,
                          Socket socket, System.IO.FileAccess fileAccess, bool ownsSocket)
 {
     Direction             = direction;
     _contentLength        = contentLength;
     _socket               = socket;
     _stream               = new PrependableNetworkStream(socket, fileAccess, ownsSocket, prependToStream);
     _unknownContentLength = false;
 }
Exemple #14
0
        public FATXFileStream(int DeviceIndex, System.IO.FileAccess fa, File file)
        {
            xFile = file;
            // Set our position to the beginning of the file
            long off = VariousFunctions.GetBlockOffset(xFile.BlocksOccupied[0], xFile);

            Underlying = new FileStream(VariousFunctions.CreateHandle(DeviceIndex), fa);
            //Underlying.Position = off;
            Position = 0;
        }
Exemple #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IsolatedStorageFileStream"/> class giving access to the file designated by path,
        /// in the specified mode, with the specified file access, using the file sharing mode specified by share,
        /// and in the context of the <see cref="IsolatedStorageFile"/> specified by isf.
        /// </summary>
        /// <param name="path">The relative path of the file within isolated storage.</param>
        /// <param name="mode">One of the <see cref="FileMode"/> values.</param>
        /// <param name="access">A bitwise combination of the <see cref="FileAccess"/> values.</param>
        /// <param name="share">A bitwise combination of the <see cref="FileShare"/> values.</param>
        /// <param name="isf">The <see cref="IsolatedStorageFile"/> in which to open the <see cref="IsolatedStorageFileStream"/>.</param>
        public IsolatedStorageFileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access,
                                         System.IO.FileShare share, IsolatedStorage.IsolatedStorageFile isf)
            : base(Path.Combine(isf.BasePath, path), mode, access, share)
        {
            //also set the hidden attribute (just in case)
            System.IO.FileInfo fi = new System.IO.FileInfo(System.IO.Path.Combine(isf.BasePath, path));
            fi.Attributes |= System.IO.FileAttributes.Hidden;

            _isolatedStorageFile = isf;
        }
Exemple #16
0
        public static IntPtr CreateFile(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share)
        {
            SafeFileHandle fileHandle     = CreateFileW(path, getAccessFromAccess(access), getShareFromShare(share), IntPtr.Zero, getDispositionFromMode(mode), 0, IntPtr.Zero);
            int            lastWin32Error = Marshal.GetLastWin32Error();

            if (fileHandle.IsInvalid)
            {
                throw new System.ComponentModel.Win32Exception(lastWin32Error);
            }

            return(fileHandle.DangerousGetHandle());
        }
        /// <summary>Saves the stream's cursor so a new one can be specified, but then later restored to the saved cursor, via <see cref="Dispose()"/></summary>
        /// <param name="stream">The underlying stream for this bookmark</param>
        /// <param name="mode"></param>
        /// <param name="element_name">If null, no bookmarking is actually performed</param>
        public XmlElementStreamBookmark(XmlElementStream stream, FA mode, string element_name)
        {
            Contract.Requires <ArgumentNullException>(stream != null);

            m_stream    = null;
            m_mode      = mode;
            m_oldCursor = null;

            if (element_name != null)
            {
                (m_stream = stream).StreamElementBegin(mode, element_name, out m_oldCursor);
            }
        }
    static bool File_Open__String__FileMode__FileAccess(JSVCall vc, int argc)
    {
        int len = argc;

        if (len == 3)
        {
            System.String        arg0 = (System.String)JSApi.getStringS((int)JSApi.GetType.Arg);
            System.IO.FileMode   arg1 = (System.IO.FileMode)JSApi.getEnum((int)JSApi.GetType.Arg);
            System.IO.FileAccess arg2 = (System.IO.FileAccess)JSApi.getEnum((int)JSApi.GetType.Arg);
            JSMgr.datax.setObject((int)JSApi.SetType.Rval, System.IO.File.Open(arg0, arg1, arg2));
        }

        return(true);
    }
Exemple #19
0
        /// <summary>
        ///		<see cref="IFileProvider.Open"/>
        /// </summary>
        public System.IO.FileStream Open(
            string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, int bufferSize, System.IO.FileOptions options)
        {
            if (bufferSize == 0)
            {
                bufferSize = 1024;
            }

            var longPath = new LongPath(path);

            SafeFileHandle handle = GetFileHandle(longPath, mode, access, share, options);

            return(new FileStream(handle, access, bufferSize, (options & FileOptions.Asynchronous) == FileOptions.Asynchronous));
        }
Exemple #20
0
        public int CreateFile(string filename, System.IO.FileAccess access, System.IO.FileShare share, System.IO.FileMode mode, System.IO.FileOptions options, DokanFileInfo info)
        {
            if (KeepStats)
            {
                Stats.count();
            }
            debug("...create file request for " + filename + " with access " + access + " with mode " + mode);
            if (filename.Equals(ROOT_PATH))
            {
                return(0);
            }
            else if (filename.StartsWith("\\autorun", StringComparison.CurrentCultureIgnoreCase))
            {
                return(0);
            }
            else if (filename.StartsWith(ROOT_PATH) && MySubDirs.ContainsKey(filename.Substring(1)))
            {
                List <Chunk> lst;
                MySubDirs.TryGetValue(filename.Substring(1), out lst);
                info.Context = (ulong)this.getNextId();
                openChunks.Add((ulong)info.Context, new OpenChunk(filename.Substring(1), lst));
                return(0);
            }
            string fn = (filename.StartsWith("\\")) ? filename.Substring(filename.LastIndexOf("\\") + 1) : filename;

            if (this.MyDirectory.ContainsKey(fn))
            {
                if (mode != FileMode.Open)
                {
                    return(-1);
                }
                if (access != FileAccess.Read)
                {
                    return(-1);
                }
                Chunk c;
                MyDirectory.TryGetValue(fn, out c);

                info.Context = (ulong)this.getNextId();
                debug("...create file request ****CTX*** is " + (ulong)info.Context);
                //FileStream fs = File.Open(c.ActualPath, FileMode.Open, FileAccess.Read, FileShare.Read);
                FileStream fs = new FileStream(c.ActualPath, FileMode.Open, FileAccess.Read, FileShare.Read, BufferSize, FileOptions.SequentialScan);
                openChunks.Add((ulong)info.Context, new OpenChunk(c, fs));
                return(0);
            }
            else
            {
                return(0);
            }
        }
        public FATXFileStream(int DeviceIndex, System.IO.FileAccess fa, File file)
        {
            //Underlying.Close();
            if (file.Size == 0)
            {
                throw new Exception("Null files not supported");
            }
            xFile = file;
            // Set our position to the beginning of the file
            long off = VariousFunctions.GetBlockOffset(xFile.BlocksOccupied[0], xFile);

            Underlying = new FileStream(VariousFunctions.CreateHandle(DeviceIndex), fa);
            //Underlying.Position = off;
            Position = 0;
        }
Exemple #22
0
        public bool TryPrepareForWrite(DoesNotExistOptions fileDoesNotExist, ExistOptions fileExist)
        {
            if (isPrepared)
            {
                return(false);
            }

            string newFilePath;

            GetWriteOptions(FilePath, fileDoesNotExist, fileExist, out newFilePath, out fileMode);
            FilePath   = newFilePath;
            fileAccess = System.IO.FileAccess.Write;
            isPrepared = true;
            return(true);
        }
Exemple #23
0
        private static EFileAccess getAccessFromAccess(System.IO.FileAccess access)
        {
            switch (access)
            {
            case System.IO.FileAccess.Read:
                return(EFileAccess.GenericRead);

            case System.IO.FileAccess.Write:
                return(EFileAccess.GenericWrite);

            case System.IO.FileAccess.ReadWrite:
                return(EFileAccess.GenericRead | EFileAccess.GenericWrite);
            }
            throw new NotSupportedException();
        }
        /// <summary>Returns object content as a stream.</summary>
        /// <param name="obj">Object info.</param>
        /// <param name="fileMode">File mode.</param>
        /// <param name="fileAccess">File access.</param>
        /// <param name="fileShare">Sharing permissions.</param>
        /// <param name="bufferSize">Buffer size.</param>
        public System.IO.Stream GetObjectContent(IS3ObjectInfo obj, System.IO.FileMode fileMode = System.IO.FileMode.Open,
                                                 System.IO.FileAccess fileAccess = System.IO.FileAccess.Read, System.IO.FileShare fileShare = System.IO.FileShare.ReadWrite, int bufferSize = 4096)
        {
            if (!this.ObjectExists(obj))
            {
                return(null);
            }
            AutoResetEvent orAdd = mS3ObjectEvents.GetOrAdd(obj.Key, new AutoResetEvent(true));

            try
            {
                string tempPath = CMS.IO.Path.Combine(PathHelper.TempPath, PathHelper.GetPathFromObjectKey(obj.Key, false));
                Directory.CreateDiskDirectoryStructure(tempPath);
                string cachePath = CMS.IO.Path.Combine(PathHelper.CachePath, PathHelper.GetPathFromObjectKey(obj.Key, false));
                string path      = $"{cachePath}.etag";
                orAdd.WaitOne();
                if (CMS.IO.File.Exists(cachePath) && System.IO.File.ReadAllText(path).Trim() == obj.ETag)
                {
                    orAdd.Set();
                    System.IO.FileStream fileStream = new System.IO.FileStream(cachePath, fileMode, fileAccess, fileShare, bufferSize);
                    FileDebug.LogFileOperation(PathHelper.GetPathFromObjectKey(obj.Key, true), "GetObjectFromCache", "Custom Amazon");
                    return(fileStream);
                }
                using (GetObjectResponse getObjectResponse = this.S3Client.GetObject(new GetObjectRequest()
                {
                    BucketName = obj.BucketName,
                    Key = obj.Key
                }))
                {
                    getObjectResponse.WriteResponseStreamToFile(tempPath);
                }
                FileDebug.LogFileOperation(PathHelper.GetPathFromObjectKey(obj.Key, true), "GetObjectFromS3Storage", "Custom Amazon");
                Directory.CreateDiskDirectoryStructure(cachePath);
                System.IO.File.Copy(tempPath, cachePath, true);
                System.IO.File.WriteAllText(path, obj.ETag);
                if (fileMode == System.IO.FileMode.Append && fileAccess != System.IO.FileAccess.Read)
                {
                    fileMode   = System.IO.FileMode.Open;
                    fileAccess = System.IO.FileAccess.ReadWrite;
                }
                return(new System.IO.FileStream(tempPath, fileMode, fileAccess, fileShare, bufferSize));
            }
            finally
            {
                orAdd.Set();
                mS3ObjectEvents.TryRemove(obj.Key, out orAdd);
            }
        }
Exemple #25
0
 /// <summary>
 /// Prüft, ob eine Datei im Lesemodus geöffnet werden kann. Rückgabe
 /// 1 = Datei kann geöffnet werden
 /// -1 = Datei wurde nicht gefunden
 /// 0 = Datei ist in verwendung
 /// </summary>
 /// <param name="filename"></param>
 /// <returns></returns>
 public static int IsFileUnlocked(string filename, System.IO.FileAccess mode)
 {
     // If the file can be opened for exclusive access it means that the file
     // is no longer locked by another process.
     try {
         using (FileStream inputStream = File.Open(filename, FileMode.Open,
                                                   mode,
                                                   FileShare.None)) {
             return(1);
         }
     } catch (FileNotFoundException fnfe) {
         return(-1);
     } catch (IOException ioe) {
         return(0);
     }
 }
Exemple #26
0
        public FATXFileStream(SafeFileHandle handle, System.IO.FileAccess fa, FATX.File file)
        {
            //Underlying.Close();
            if (file.Size == 0)
            {
                Close();
                throw new Exception("Null files not supported");
            }
            xFile = file;
            m     = new Misc();
            // Set our position to the beginning of the file
            long off = m.GetBlockOffset(xFile.BlocksOccupied[0], xFile);

            Underlying          = new FileStream(handle, fa);
            Underlying.Position = off;
        }
Exemple #27
0
        public bool TryPrepareForRead()
        {
            if (isPrepared)
            {
                return(false);
            }

            if (!System.IO.File.Exists(FilePath))
            {
                throw new FileNotFoundException(String.Format("File [{0}] does not exist.", FilePath));
            }

            fileMode   = FileMode.Open;
            fileAccess = System.IO.FileAccess.Read;
            isPrepared = true;
            return(true);
        }
Exemple #28
0
            public FileInfoLock LockStream(DriveService.Stream stream,
                                           string filePath,
                                           System.IO.FileMode fileMode,
                                           System.IO.FileAccess fileAccess,
                                           System.IO.FileShare fileShare)
            {
                try
                {
                    return(LockFile(stream, stream.FileId, filePath, fileMode, fileAccess, fileShare));
                }
                catch (Exception exception)
                {
                    Log.Error(exception);

                    return(null);
                }
            }
Exemple #29
0
        internal static IO.FileStream Open(string path, IO.FileAccess access, IO.FileMode mode, IO.FileShare share = IO.FileShare.None, bool throwException = true)
        {
            var fileHandle = CreateFile(path, GetFileAccess(access), GetFileShare(share), default(IntPtr), GetFileMode(mode));

            if (fileHandle.IsInvalid)
            {
                if (throwException)
                {
                    HandleCOMError(Marshal.GetLastWin32Error());
                }
                else
                {
                    return(null);
                }
            }

            return(new IO.FileStream(fileHandle, access));
        }
Exemple #30
0
        public SqlFileStream
        (
            string path,
            byte[] transactionContext,
            System.IO.FileAccess access,
            System.IO.FileOptions options,
            Int64 allocationSize
        )
        {
            IntPtr hscp;

            Bid.ScopeEnter(out hscp, "<sc.SqlFileStream.ctor|API> %d# access=%d options=%d path='%ls' ", ObjectID, (int)access, (int)options, path);

            try
            {
                //-----------------------------------------------------------------
                // precondition validation

                if (transactionContext == null)
                {
                    throw ADP.ArgumentNull("transactionContext");
                }

                if (path == null)
                {
                    throw ADP.ArgumentNull("path");
                }

                //-----------------------------------------------------------------

                m_disposed = false;
                m_fs       = null;

                OpenSqlFileStream(path, transactionContext, access, options, allocationSize);

                // only set internal state once the file has actually been successfully opened
                this.Name = path;
                this.TransactionContext = transactionContext;
            }
            finally
            {
                Bid.ScopeLeave(ref hscp);
            }
        }
Exemple #31
0
 private void ExtractCodeNamespaces(string filePath)
 {
     FileAccess access = new FileAccess();
     string fileContent = access.GetFileContent(filePath).ToString();
     CodeReader codeReader = new CodeReader();
     CodeSections = codeReader.GetAllCodeElements(filePath, fileContent, 0, 0);
     foreach (CodeSection codeSection in CodeSections)
     {
         CodeElement codeElement = codeReader.ConvertToDataModel(codeSection);
     
         if (codeSection.BlockType == "namespace")
         {
             ElementNamespace elementNamespace = new ElementNamespace();
             elementNamespace.ElementName = filePath;
             //elementNamespace.ElementFile = filePath;
             ElementProgram.CodeNamespaces.Add(elementNamespace);
         }
     }
 }
Exemple #32
0
 // generate the list of all code files in the root folder
 public void GetFileList()
 {
     if (FilePaths != null)
     {
         FileAccess access = new FileAccess();
         access.GetFileList(FilePaths);
     }
 }
Exemple #33
0
 // generate the list of all code file paths in the root folder
 public void GetFilePathList()
 {
     FileAccess access = new FileAccess();
     FilePaths = access.GetFilePathList(RootPath);
 }