unity C#设置文件为不可见

unity C#设置文件为不可见

csharp 复制代码
///
///设置文件为隐藏//
///
using UnityEngine;
using System.IO;

public class SetFolderInvisible : MonoBehaviour
{
    private void Start()
    {
        string folderPath = "Qi/Video";

        // 将文件夹属性设置为隐藏和系统
        SetFolderAttributes(folderPath, FileAttributes.Hidden | FileAttributes.System);
    }

    private void SetFolderAttributes(string folderPath, FileAttributes attributes)
    {
        if (Directory.Exists(folderPath))
        {
            // 获取文件夹下的所有文件和子文件夹
            string[] files = Directory.GetFiles(folderPath, "*", SearchOption.AllDirectories);

            // 将文件夹的属性设置为隐藏和系统
            foreach (var file in files)
            {
                File.SetAttributes(file, attributes);
            }
        }
    }
}
相关推荐
ysn111111 天前
搭建状态同步框架的实践心得
unity·架构
一线灵1 天前
Axmol:小众引擎的硬核逆袭
游戏引擎
z落落1 天前
C# 多接口实现、重名成员、显式实现、接口继承+抽象类和接口区别
java·开发语言·c#
weixin_441940011 天前
【Unity教程】使用vuforia创建简单的AR实例
unity·游戏引擎·ar
郝学胜-神的一滴1 天前
[简化版 GAMES 101] 计算机图形学 12:可见性与 Z‑Buffer 深度缓存
unity·godot·图形渲染·three.js·opengl·unreal
咸鱼翻身小阿橙1 天前
高斯模糊降噪/磨皮算法降噪图像
前端·opencv·算法·webpack·c#
归真仙人2 天前
【UE】LineTraceByProfile
ue5·游戏引擎·ue4·unreal engine
Song_da_da_2 天前
C#与VisionPro联合编程实战:机器视觉二次开发完整指南
开发语言·microsoft·c#
加号32 天前
【C#】 Web API 自定义配置函数请求路径:从路由本质到灵活架构设计
开发语言·c#
happyprince2 天前
11-Hugging Face Transformers 分布式与并行系统深度分析
分布式·c#·wpf