private IProjectFile CreatNewFile(string fileSystemPath, bool included, bool ignoreDecompileErrors)
 {
     string extension = (Path.GetExtension(fileSystemPath) ?? "").ToUpperInvariant();
     IProjectFile file = null;
     switch (extension)
     {
         case ".ODEX":
             return null;
         case ".APK":
             file = new ApkFile(fileSystemPath, included, this);
             ((ApkFile) file).IgnoreDecompileErrors = ignoreDecompileErrors;
             break;
         case ".JAR":
             file = new JarFile(fileSystemPath, included, this);
             string locationsOfDependency = Path.GetDirectoryName(fileSystemPath);
             if (!_locationsOfDependencies.Contains(locationsOfDependency))
             {
                 _locationsOfDependencies.Add(locationsOfDependency);
             }
             break;
         default:
             if (BinaryExtensions.Contains(extension) || FileUtility.IsBinary(fileSystemPath))
             {
                 file = new BinaryFile(fileSystemPath, included, this);
             }
             else
             {
                 file = new TextFile(fileSystemPath, included, this);
             }
             break;
     }
     var compositFile = file as CompositFile;
     if (compositFile != null)
     {
         string name = compositFile.Name.ToUpperInvariant();
         if (_additionalDependencies.ContainsKey(name))
         {
             compositFile.AddAdditionalDependencies(_additionalDependencies[name]);
         }
     }
     return file;
 }
        private void RefreshCompositFileNode(ProjectTreeNode projectTreeNode)
        {
            if (projectTreeNode == null) return;
            if (!Directory.Exists(projectTreeNode.FileSystemPath)) return;
            if (InvokeRequired)
            {
                BeginInvoke(new Action<ProjectTreeNode>(RefreshCompositFileNode), projectTreeNode);
                return;
            }

            ProjectTreeNode childNode;

            string fileSystemPath = projectTreeNode.FolderPath;
            foreach (string subFolder in Directory.GetDirectories(fileSystemPath))
            {
                childNode =
                    projectTreeNode.Nodes.OfType<ProjectTreeNode>().FirstOrDefault(
                        x => x.FileSystemPath.Equals(subFolder, StringComparison.OrdinalIgnoreCase));
                if (childNode == null)
                {
                    childNode =
                        new ProjectTreeNode(new ProjectFolder(subFolder, true, projectTreeNode.ProjectItem.Project),
                                            _iconManager);
                    _nodes.Add(childNode);
                    projectTreeNode.Nodes.Add(childNode);
                }
            }
            foreach (string file in Directory.GetFiles(fileSystemPath))
            {
                childNode =
                    projectTreeNode.Nodes.OfType<ProjectTreeNode>().FirstOrDefault(
                        x => x.FileSystemPath.Equals(file, StringComparison.OrdinalIgnoreCase));

                if (childNode == null)
                {
                    string extension = (Path.GetExtension(file) ?? "").ToUpperInvariant();
                    IProjectFile projectFile;
                    if (CrcsProject.BinaryExtensions.Contains(extension) || FileUtility.IsBinary(file))
                    {
                        projectFile = new BinaryFile(file, true, null);
                    }
                    else
                    {
                        projectFile = new TextFile(file, true, null);
                    }
                    childNode = new ProjectTreeNode(projectFile, _iconManager);
                    _nodes.Add(childNode);
                    projectTreeNode.Nodes.Add(childNode);
                }
            }
        }