Пример #1
0
 private CodeLibraryEntry(IFile file, DateTimeOffset editTime, CodeMetadata metadata, string title, string preview)
 {
     File     = file;
     EditTime = editTime;
     Metadata = metadata;
     Title    = title;
     Preview  = preview;
 }
Пример #2
0
 private SourceCode(string content, IFile?file, CodeMetadata metadata)
 {
     Content  = content;
     File     = file;
     Metadata = metadata;
 }
Пример #3
0
        public static async Task <CodeLibraryEntry?> TryLoadFromFileAsync(IFile file, CodeMetadata metadata)
        {
            try
            {
                string preview = await LoadCodePreviewAsync(file);

                (_, DateTimeOffset editTime) = await file.GetPropertiesAsync();

                return(new CodeLibraryEntry(file, editTime, metadata, file.DisplayName, preview));
            }
            catch
            {
                return(null);
            }
        }