예제 #1
0
        private IFileInfo GetCoreDumpFile(string inputFile)
        {
            IFileInfo file = filesystem.GetFile(inputFile);

            if (file.Exists)
            {
                if (file.Extension == ".core")
                {
                    return(file);
                }
                else if (file.Extension == ".tar" || file.Extension == ".gz" || file.Extension == ".tgz" || file.Extension == ".tar" || file.Extension == ".zip")
                {
                    IDirectoryInfo directory = file.Directory;
                    Console.WriteLine($"Extracting archives in directory {directory.FullName}");
                    ExtractArchivesInDir(directory);
                    return(FindCoredumpOrNull(directory));
                }
                else
                {
                    Console.WriteLine($"Could not identify input file {inputFile}. Assuming it is a core dump.");
                    return(file);
                }
            }
            else
            {
                IDirectoryInfo directory = filesystem.GetDirectory(inputFile);
                if (directory.Exists)
                {
                    Console.WriteLine($"Extracting archives in directory {directory.FullName}");
                    ExtractArchivesInDir(directory);
                    return(FindCoredumpOrNull(directory));
                }
                else
                {
                    Console.WriteLine("Input file does not exist!");
                    return(null);
                }
            }
        }