private static void AddFileToList(AssemblyData oAssemblyData, int FileNumber, VB6File oFile)
 {
     if (oFile == null)
     {
         throw ExceptionUtils.VbMakeException(0x33);
     }
     oFile.OpenFile();
     oAssemblyData.SetChannelObj(FileNumber, oFile);
 }
 internal AssemblyData GetAssemblyData(Assembly assem)
 {
     if ((assem == Utils.VBRuntimeAssembly) || (assem == this.m_CachedMSCoreLibAssembly))
     {
         throw new SecurityException(Utils.GetResourceString("Security_LateBoundCallsNotPermitted"));
     }
     AssemblyData data = (AssemblyData) this.m_AssemblyData[assem];
     if (data == null)
     {
         data = new AssemblyData();
         this.m_AssemblyData[assem] = data;
     }
     return data;
 }
Exemplo n.º 3
0
        internal AssemblyData GetAssemblyData(Assembly assem)
        {
            if ((assem == Utils.VBRuntimeAssembly) || (assem == this.m_CachedMSCoreLibAssembly))
            {
                throw new SecurityException(Utils.GetResourceString("Security_LateBoundCallsNotPermitted"));
            }
            AssemblyData data = (AssemblyData)this.m_AssemblyData[assem];

            if (data == null)
            {
                data = new AssemblyData();
                this.m_AssemblyData[assem] = data;
            }
            return(data);
        }
 private static string FindFileFilter(AssemblyData oAssemblyData)
 {
     FileSystemInfo[] dirFiles = oAssemblyData.m_DirFiles;
     int dirNextFileIndex = oAssemblyData.m_DirNextFileIndex;
     while (true)
     {
         if (dirNextFileIndex > dirFiles.GetUpperBound(0))
         {
             oAssemblyData.m_DirFiles = null;
             oAssemblyData.m_DirNextFileIndex = 0;
             return null;
         }
         FileSystemInfo info = dirFiles[dirNextFileIndex];
         if (((info.Attributes & (FileAttributes.Directory | FileAttributes.System | FileAttributes.Hidden)) == 0) || ((info.Attributes & oAssemblyData.m_DirAttributes) != 0))
         {
             oAssemblyData.m_DirNextFileIndex = dirNextFileIndex + 1;
             return dirFiles[dirNextFileIndex].Name;
         }
         dirNextFileIndex++;
     }
 }
        private static string FindFileFilter(AssemblyData oAssemblyData)
        {
            FileSystemInfo[] dirFiles = oAssemblyData.m_DirFiles;
            int dirNextFileIndex      = oAssemblyData.m_DirNextFileIndex;

            while (true)
            {
                if (dirNextFileIndex > dirFiles.GetUpperBound(0))
                {
                    oAssemblyData.m_DirFiles         = null;
                    oAssemblyData.m_DirNextFileIndex = 0;
                    return(null);
                }
                FileSystemInfo info = dirFiles[dirNextFileIndex];
                if (((info.Attributes & (FileAttributes.Directory | FileAttributes.System | FileAttributes.Hidden)) == 0) || ((info.Attributes & oAssemblyData.m_DirAttributes) != 0))
                {
                    oAssemblyData.m_DirNextFileIndex = dirNextFileIndex + 1;
                    return(dirFiles[dirNextFileIndex].Name);
                }
                dirNextFileIndex++;
            }
        }
 private static void InternalCloseFile(AssemblyData oAssemblyData, int FileNumber)
 {
     if (FileNumber == 0)
     {
         CloseAllFiles(oAssemblyData);
     }
     else
     {
         VB6File channelOrNull = GetChannelOrNull(oAssemblyData, FileNumber);
         if (channelOrNull != null)
         {
             oAssemblyData.SetChannelObj(FileNumber, null);
             if (channelOrNull != null)
             {
                 channelOrNull.CloseFile();
             }
         }
     }
 }
 internal static bool CheckFileOpen(AssemblyData oAssemblyData, string sPath, OpenModeTypes NewFileMode)
 {
     int num3 = 0xff;
     for (int i = 1; i <= num3; i++)
     {
         VB6File channelOrNull = GetChannelOrNull(oAssemblyData, i);
         if (channelOrNull != null)
         {
             OpenMode mode = channelOrNull.GetMode();
             if (string.Compare(sPath, channelOrNull.GetAbsolutePath(), StringComparison.OrdinalIgnoreCase) == 0)
             {
                 if (NewFileMode == OpenModeTypes.Any)
                 {
                     return true;
                 }
                 if (((NewFileMode | ((OpenModeTypes) ((int) mode))) != OpenModeTypes.Input) && ((((NewFileMode | ((OpenModeTypes) ((int) mode))) | OpenModeTypes.Binary) | OpenModeTypes.Random) != (OpenModeTypes.Binary | OpenModeTypes.Random)))
                 {
                     return true;
                 }
             }
         }
     }
     return false;
 }
 private static VB6File GetChannelOrNull(AssemblyData oAssemblyData, int FileNumber)
 {
     return oAssemblyData.GetChannelObj(FileNumber);
 }
 internal static string VB6CheckPathname(AssemblyData oAssemblyData, string sPath, OpenMode mode)
 {
     if ((sPath.IndexOf('?') != -1) || (sPath.IndexOf('*') != -1))
     {
         throw new ArgumentException(Utils.GetResourceString("Argument_InvalidPathChars1", new string[] { sPath }));
     }
     string fullName = new FileInfo(sPath).FullName;
     if (CheckFileOpen(oAssemblyData, fullName, OpenModeTypesFromOpenMode(mode)))
     {
         throw ExceptionUtils.VbMakeException(0x37);
     }
     return fullName;
 }
 internal static void CloseAllFiles(AssemblyData oAssemblyData)
 {
     int fileNumber = 1;
     do
     {
         InternalCloseFile(oAssemblyData, fileNumber);
         fileNumber++;
     }
     while (fileNumber <= 0xff);
 }