Пример #1
0
 private static void openObjFile(String file_name, out ObjectFile obj_file)
 {
     if (ElfFile.IsElfFile(file_name))
         obj_file = new ElfFile(file_name);
     else if (CoffFile.IsCoffFile(file_name))
         obj_file = new CoffFile(file_name);
     else
         throw new Exception("File " + file_name + " is not a valid object file.");
 }
Пример #2
0
        public virtual retType InsertAISObjectFile( String fileName )
        {
            Debug.DebugMSG("Inserting Object File, fileName = " + fileName);
              // Since no load address is provided, we can assume ObjectFile is ElfFile or CoffFile
              if (File.Exists(fileName))
              {
            // Parse the object file
            ObjectFile file;
            if (ElfFile.IsElfFile(fileName))
            {
              file = new ElfFile(fileName);
            }
            else if (CoffFile.IsCoffFile(fileName))
            {
              file = new CoffFile(fileName);
            }
            else
            {
              Console.WriteLine("ERROR: Not a valid object file.");
              return retType.FAIL;
            }

            if (file != null)
            {
              // Load the object file contents
              AISObjectFileLoad(this,file);
              file.Close();
            }
            else
            {
              Console.WriteLine("ERROR: Parsing the input file {0} failed!",fileName);
            }
              }
              else
              {
            Console.WriteLine("WARNING: File {0} does not exist. Ignoring insert command.",fileName);
              }

              return retType.SUCCESS;
        }