<commit_before>package org.chrisle.netbeans.plugins.csharp4netbeans.solution;

import java.io.IOException;
import org.netbeans.api.project.Project;
import org.netbeans.spi.project.ProjectFactory;
import org.netbeans.spi.project.ProjectState;
import org.openide.filesystems.FileObject;
import org.openide.util.lookup.ServiceProvider;

/**
 *
 * @author ChrisLE
 */
@ServiceProvider(service=ProjectFactory.class)
public class CSharpSolutionFactory implements ProjectFactory {

    public static final String PROJECT_FILE_EXT = ".sln";

    //Specifies when a project is a project, i.e.,
    //if "*.sln" is present in a folder:
    @Override
    public boolean isProject(FileObject projectDirectory) {
        return projectDirectory.getFileObject(projectDirectory.getName() + PROJECT_FILE_EXT) != null;
    }

    //Specifies when the project will be opened, i.e., if the project exists:
    @Override
    public Project loadProject(FileObject dir, ProjectState state) throws IOException {
        return isProject(dir) ? new CSharpSolution(dir, state) : null;
    }

    @Override
    public void saveProject(final Project project) throws IOException, ClassCastException {
        // leave unimplemented for the moment
    }
}<commit_msg>Fixed problem with sln name and folder name not equal.<commit_after>package org.chrisle.netbeans.plugins.csharp4netbeans.solution;

import java.io.IOException;
import java.util.Enumeration;
import org.netbeans.api.project.Project;
import org.netbeans.spi.project.ProjectFactory;
import org.netbeans.spi.project.ProjectState;
import org.openide.filesystems.FileObject;
import org.openide.util.lookup.ServiceProvider;

/**
 *
 * @author ChrisLE
 */
@ServiceProvider(service = ProjectFactory.class)
public class CSharpSolutionFactory implements ProjectFactory {

    public static final String PROJECT_FILE_EXT = "sln";
    public String _slnFileName = "";

    //Specifies when a project is a project, i.e.,
    //if "*.sln" is present in a folder:
    @Override
    public boolean isProject(FileObject projectDirectory) {
        Enumeration<? extends FileObject> data = projectDirectory.getData(true);
        
        while (data.hasMoreElements()) {
            FileObject nextElement = data.nextElement();
            
            if (nextElement.hasExt(PROJECT_FILE_EXT)) {
                _slnFileName = nextElement.getName().replace(".sln$", "");
                
                return projectDirectory.getFileObject(_slnFileName) != null;
            }
        }

        return false;
    }

    //Specifies when the project will be opened, i.e., if the project exists:
    @Override
    public Project loadProject(FileObject dir, ProjectState state) throws IOException {
        return isProject(dir) ? new CSharpSolution(dir, state, _slnFileName) : null;
    }

    @Override
    public void saveProject(final Project project) throws IOException, ClassCastException {
        // leave unimplemented for the moment
    }
}

{'fraction_non_alphanumeric': 0.09081836327345309, 'fraction_numerical': 0.0006653359946773121, 'mean_word_length': 3.2834757834757835, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '263088', 'n_tokens_mistral': 839, 'n_tokens_neox': 806, 'n_words': 217}