Add project files.

This commit is contained in:
Blade / SCOPEDD
2026-02-22 11:31:35 -05:00
parent 3612bf40db
commit c1a425a7ad
84 changed files with 2323 additions and 0 deletions

57
ClipForge/ClipFile.cs Normal file
View File

@@ -0,0 +1,57 @@
using System;
using System.IO;
namespace ClipForge
{
public class ClipFile : System.ComponentModel.INotifyPropertyChanged
{
public event System.ComponentModel.PropertyChangedEventHandler? PropertyChanged;
private string _thumbnailPath = "";
public string Path { get; set; } = "";
public string Title { get; set; } = "";
public string Duration { get; set; } = "";
public string FileSize { get; set; } = "";
public DateTime CreatedAt { get; set; }
public string CreatedAtDisplay => CreatedAt.ToString("MMM d, yyyy h:mm tt");
public string ThumbnailPath
{
get => _thumbnailPath;
set
{
_thumbnailPath = value;
PropertyChanged?.Invoke(this,
new System.ComponentModel.PropertyChangedEventArgs(
nameof(ThumbnailPath)));
}
}
public bool HasThumbnail => File.Exists(_thumbnailPath);
public static ClipFile FromPath(string path)
{
var info = new FileInfo(path);
var thumbPath = System.IO.Path.ChangeExtension(path, ".thumb.png");
return new ClipFile
{
Path = path,
Title = System.IO.Path.GetFileNameWithoutExtension(path),
FileSize = FormatFileSize(info.Length),
CreatedAt = info.CreationTime,
Duration = "0:30",
ThumbnailPath = thumbPath
};
}
private static string FormatFileSize(long bytes)
{
if (bytes >= 1_073_741_824)
return $"{bytes / 1_073_741_824.0:F1} GB";
if (bytes >= 1_048_576)
return $"{bytes / 1_048_576.0:F0} MB";
return $"{bytes / 1024.0:F0} KB";
}
}
}