public static bool TryGetItem(this SciterArchive archive, Uri uri, Action <ArchiveGetItemResult> onGetResult)
        {
            byte[] data   = null;
            var    result = archive?.TryGetItemInternal(uri: uri, data: out data) == true;

            onGetResult?.Invoke(new ArchiveGetItemResult(data, uri.GetComponents(UriComponents.Path, UriFormat.SafeUnescaped), result && data != null));
            return(result);
        }
Example #2
0
        public SciterArchiveHost()
            : base()
        {
            var archiveAttribute = GetType().GetCustomAttributes <SciterHostArchiveAttribute>(inherit: true).FirstOrDefault();

            Archive = new SciterArchive(archiveAttribute?.BaseUrl ?? SciterArchive.DEFAULT_ARCHIVE_URI)
                      .Open();
        }
        public static bool TryGetItem(this SciterArchive archive, string uriString, Action <ArchiveGetItemResult> onGetResult)
        {
            var actualUri = new Uri(uriString, UriKind.RelativeOrAbsolute);

            return(TryGetItem(archive: archive, uri: actualUri, onGetResult: onGetResult));
        }
 public static bool TryGetItem(this SciterArchive archive, Uri uri, out byte[] data)
 {
     data = null;
     return(archive?.TryGetItemInternal(uri: uri, data: out data) == true);
 }
 public static byte[] GetItem(this SciterArchive archive, string uriString)
 {
     return(archive?.GetItemInternal(uriString: uriString));
 }
 public static byte[] GetItem(this SciterArchive archive, Uri uri)
 {
     return(archive?.GetItemInternal(uri: uri));
 }
 public static SciterArchive GetItem(this SciterArchive archive, string uriString, Action <ArchiveGetItemResult> onGetResult)
 {
     archive?.GetItemInternal(uriString: uriString, onGetResult: onGetResult);
     return(archive);
 }
 public static SciterArchive GetItem(this SciterArchive archive, Uri uri, Action <ArchiveGetItemResult> onGetResult)
 {
     archive?.GetItemInternal(uri: uri, onGetResult: onGetResult);
     return(archive);
 }
 public static void Close(this SciterArchive archive)
 {
     archive?.CloseInternal();
 }
 public static bool TryOpen(this SciterArchive archive, byte[] buffer)
 {
     return(archive?.TryOpenInternal(buffer: buffer) == true);
 }
 public static SciterArchive Open(this SciterArchive archive, byte[] buffer)
 {
     archive?.OpenInternal(buffer: buffer);
     return(archive);
 }
        public static async Task <SciterArchive> OpenAsync(this SciterArchive archive, Assembly assembly, string resourceName = "SciterResource")
        {
            await archive.OpenInternalAsync(assembly : assembly, resourceName : resourceName).ConfigureAwait(false);

            return(archive);
        }
        public static async Task <SciterArchive> OpenAsync(this SciterArchive archive, string resourceName = "SciterResource", StringComparison comparisonType = StringComparison.OrdinalIgnoreCase)
        {
            await archive.OpenInternalAsync(resourceName : resourceName, comparisonType : comparisonType);

            return(archive);
        }
 public static SciterArchive Open(this SciterArchive archive, Assembly assembly, string resourceName = "SciterResource")
 {
     archive?.OpenInternal(assembly: assembly, resourceName: resourceName);
     return(archive);
 }
Example #15
0
 public SciterArchiveHost(string baseUri = SciterArchive.DEFAULT_ARCHIVE_URI)
     : base()
 {
     Archive = new SciterArchive(baseUri ?? SciterArchive.DEFAULT_ARCHIVE_URI)
               .Open();
 }