import pygame
from pygame.locals import *
import time
import random
import pyganim
import sys
import os
rects = [(0, 154, 94, 77),
(94, 154, 94, 77),
(188, 154, 94, 77),
(282, 154, 94, 77),
(376, 154, 94, 77),
(470, 154, 94, 77),
(564, 154, 94, 77),
(658, 154, 94, 77),]
file_name = ('explosion1.png')
images = pyganim.getImagesFromSpriteSheet(file_name, rects = rects)
frames = list (zip(images, [100] * len(images)))
animObj = pyganim.PygAnimation(frames)
animObj.play()
white = (255, 255, 255)
black = (0, 0, 0)
pygame.init()
display_width = 800
display_height = 600
gameDisplay = pygame.display.set_mode((display_width, display_height))
pygame.display.set_caption('sprite animations')
clock = pygame.time.Clock()
def game_loop():
gameDisplay.fill(black)
gameExit = False
while not gameExit:
for event in pygame.event.get():
if event.type == pygame.QUIT:
gameExit = True
animObj.blit(gameDisplay,(100, 50))
pygame.display.update()
clock.tick(15)
game_loop()
pygame.quit()
quit()
我无法理解如何知道文件是否隐藏在路上
答案 0 :(得分:9)
您可以使用FileInfo类的Attributes
属性..
var fInfo = new FileInfo(..);
if (fInfo.Attributes.HasFlag(FileAttributes.Hidden))
{
}
答案 1 :(得分:4)
这就是你需要的:
bool isHidden = (File.GetAttributes(fileName) & FileAttributes.Hidden) == FileAttributes.Hidden;
答案 2 :(得分:4)
对于单个文件操作,首选System.IO.File
静态方法(对于同一文件System.IO.FileInfo
上的多个操作):
bool isHidden1 = File.GetAttributes(path).HasFlag(FileAttributes.Hidden);
//bool isHidden2 = (File.GetAttributes(path) & FileAttributes.Hidden) > 0;
//bool isHidden3 = ((int)File.GetAttributes(path) & 2) > 0;
答案 3 :(得分:1)
file.Attributes.HasFlag(FileAttributes.Hidden)
返回true/false