コード例 #1
0
ファイル: Project.cs プロジェクト: SignedSnow0/SnowEngine
    public static Project Open(string path, string name)
    {
        var project = Utils.Deserialize <Project>($@"{path}{name}.snow") ?? throw new FileNotFoundException("Failed to deserialize project");

        CachedProject.OpenProject(project);

        return(project);
    }
コード例 #2
0
ファイル: Project.cs プロジェクト: SignedSnow0/SnowEngine
    public static Project Create(string name, string root, string typeRoot)
    {
        typeRoot.CopyDirectoryTo(root);

        foreach (var file in Directory.GetFiles(root, "*", SearchOption.AllDirectories))
        {
            if (Path.GetFileNameWithoutExtension(file) == "_project")
            {
                string newName = file.Replace("_project", name);
                File.Move(file, newName);
            }
        }

        var project = new Project
        {
            Name = name,
            Root = root
        };

        Utils.Serialize(project, project.FullPath);
        CachedProject.AddProject(project);

        return(project);
    }