Convert to new Core 3.0 using declarations
This commit is contained in:
parent
b0fec23a51
commit
1b6c577044
@ -117,7 +117,7 @@ namespace AaxDecrypter
|
||||
|
||||
private void saveCover(string aaxFile)
|
||||
{
|
||||
using (var file = TagLib.File.Create(aaxFile, "audio/mp4", TagLib.ReadStyle.Average))
|
||||
using var file = TagLib.File.Create(aaxFile, "audio/mp4", TagLib.ReadStyle.Average);
|
||||
this.coverBytes = file.Tag.Pictures[0].Data.Data;
|
||||
}
|
||||
|
||||
|
||||
@ -25,8 +25,7 @@ namespace AaxDecrypter
|
||||
|
||||
public Tags(string file)
|
||||
{
|
||||
using (TagLib.File tagLibFile = TagLib.File.Create(file, "audio/mp4", ReadStyle.Average))
|
||||
{
|
||||
using TagLib.File tagLibFile = TagLib.File.Create(file, "audio/mp4", ReadStyle.Average);
|
||||
this.title = tagLibFile.Tag.Title.Replace(" (Unabridged)", "");
|
||||
this.album = tagLibFile.Tag.Album.Replace(" (Unabridged)", "");
|
||||
this.author = tagLibFile.Tag.FirstPerformer;
|
||||
@ -41,19 +40,16 @@ namespace AaxDecrypter
|
||||
this.comments = !string.IsNullOrWhiteSpace(tag.LongDescription) ? tag.LongDescription : tag.Description;
|
||||
this.id = tag.AudibleCDEK;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddAppleTags(string file)
|
||||
{
|
||||
using (var file1 = TagLib.File.Create(file, "audio/mp4", ReadStyle.Average))
|
||||
{
|
||||
using var file1 = TagLib.File.Create(file, "audio/mp4", ReadStyle.Average);
|
||||
var tag = (AppleTag)file1.GetTag(TagTypes.Apple, true);
|
||||
tag.Publisher = this.publisher;
|
||||
tag.LongDescription = this.comments;
|
||||
tag.Description = this.comments;
|
||||
file1.Save();
|
||||
}
|
||||
}
|
||||
|
||||
public string GenerateFfmpegTags()
|
||||
{
|
||||
|
||||
@ -110,7 +110,7 @@ var pageSource = new AudiblePageSource(AudiblePageType.Library, html, null);
|
||||
// var postData = $"progType=all&timeFilter=all&itemsPerPage={itemsPerPage}&searchTerm=&searchType=&sortColumn=&sortType=down&page={pageNum}&mode=normal&subId=&subTitle=";
|
||||
// var data = Encoding.UTF8.GetBytes(postData);
|
||||
// webRequest.ContentLength = data.Length;
|
||||
// using (var dataStream = webRequest.GetRequestStream())
|
||||
// using var dataStream = webRequest.GetRequestStream();
|
||||
// dataStream.Write(data, 0, data.Length);
|
||||
#endregion
|
||||
|
||||
|
||||
@ -26,14 +26,12 @@ namespace CookieMonster
|
||||
// eg: this will not work unless the winforms proj adds sqlite to ref.s:
|
||||
// LibationWinForm > AudibleDotComAutomation > CookieMonster
|
||||
//
|
||||
using (var conn = new SQLiteConnection("Data Source=" + strPath + ";pooling=false"))
|
||||
using (var cmd = conn.CreateCommand())
|
||||
{
|
||||
using var conn = new SQLiteConnection("Data Source=" + strPath + ";pooling=false");
|
||||
using var cmd = conn.CreateCommand();
|
||||
cmd.CommandText = "SELECT host_key, name, value, encrypted_value, last_access_utc, expires_utc FROM cookies;";
|
||||
|
||||
conn.Open();
|
||||
using (var reader = await cmd.ExecuteReaderAsync().ConfigureAwait(false))
|
||||
{
|
||||
using var reader = await cmd.ExecuteReaderAsync().ConfigureAwait(false);
|
||||
while (reader.Read())
|
||||
{
|
||||
var host_key = reader.GetString(0);
|
||||
@ -52,8 +50,7 @@ namespace CookieMonster
|
||||
|
||||
col.Add(new CookieValue { Browser = "chrome", Domain = host_key, Name = name, Value = value, LastAccess = chromeTimeToDateTimeUtc(last_access_utc), Expires = chromeTimeToDateTimeUtc(expires_utc) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
@ -29,14 +29,12 @@ namespace CookieMonster
|
||||
File.Copy(strPath, strTemp, true);
|
||||
|
||||
// Now open the temporary cookie jar and extract Value from the cookie if we find it.
|
||||
using (var conn = new SQLiteConnection("Data Source=" + strTemp + ";pooling=false"))
|
||||
using (var cmd = conn.CreateCommand())
|
||||
{
|
||||
using var conn = new SQLiteConnection("Data Source=" + strTemp + ";pooling=false");
|
||||
using var cmd = conn.CreateCommand();
|
||||
cmd.CommandText = "SELECT host, name, value, lastAccessed, expiry FROM moz_cookies; ";
|
||||
|
||||
conn.Open();
|
||||
using (var reader = await cmd.ExecuteReaderAsync().ConfigureAwait(false))
|
||||
{
|
||||
using var reader = await cmd.ExecuteReaderAsync().ConfigureAwait(false);
|
||||
while (reader.Read())
|
||||
{
|
||||
var host_key = reader.GetString(0);
|
||||
@ -47,8 +45,6 @@ namespace CookieMonster
|
||||
|
||||
col.Add(new CookieValue { Browser = "firefox", Domain = host_key, Name = name, Value = value, LastAccess = lastAccessedToDateTime(lastAccessed), Expires = expiryToDateTime(expiry) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (FileUtility.FileExists(strTemp))
|
||||
File.Delete(strTemp);
|
||||
|
||||
@ -10,7 +10,7 @@ namespace DataLayer
|
||||
{
|
||||
public static int BooksWithoutDetailsCount()
|
||||
{
|
||||
using (var context = LibationContext.Create())
|
||||
using var context = LibationContext.Create();
|
||||
return context
|
||||
.Books
|
||||
.Count(b => !b.HasBookDetails);
|
||||
@ -18,7 +18,7 @@ namespace DataLayer
|
||||
|
||||
public static Book GetBook_Flat_NoTracking(string productId)
|
||||
{
|
||||
using (var context = LibationContext.Create())
|
||||
using var context = LibationContext.Create();
|
||||
return context
|
||||
.Books
|
||||
.AsNoTracking()
|
||||
|
||||
@ -8,7 +8,7 @@ namespace DataLayer
|
||||
{
|
||||
public static List<LibraryBook> GetLibrary_Flat_NoTracking()
|
||||
{
|
||||
using (var context = LibationContext.Create())
|
||||
using var context = LibationContext.Create();
|
||||
return context
|
||||
.Library
|
||||
.AsNoTracking()
|
||||
@ -18,7 +18,7 @@ namespace DataLayer
|
||||
|
||||
public static LibraryBook GetLibraryBook_Flat_NoTracking(string productId)
|
||||
{
|
||||
using (var context = LibationContext.Create())
|
||||
using var context = LibationContext.Create();
|
||||
return context
|
||||
.Library
|
||||
.AsNoTracking()
|
||||
|
||||
@ -13,13 +13,11 @@ namespace _scratch_pad
|
||||
// var user = new Student() { Name = "Dinah Cheshire" };
|
||||
// var udi = new UserDef { UserDefId = 1, TagsRaw = "my,tags" };
|
||||
|
||||
// using (var context = new MyTestContextDesignTimeDbContextFactory().Create())
|
||||
// {
|
||||
// using var context = new MyTestContextDesignTimeDbContextFactory().Create();
|
||||
// context.Add(user);
|
||||
// //context.Add(udi);
|
||||
// context.Update(udi);
|
||||
// context.SaveChanges();
|
||||
// }
|
||||
|
||||
// Console.WriteLine($"Student was saved in the database with id: {user.Id}");
|
||||
// }
|
||||
|
||||
@ -43,13 +43,11 @@ namespace DomainServices
|
||||
.Replace("&DownloadType=Now", "")
|
||||
+ "&asin=&source=audible_adm&size=&browser_type=&assemble_url=http://cds.audible.com/download";
|
||||
var uri = new Uri(aaxDownloadLink);
|
||||
using (var webClient = await GetWebClient(tempAaxFilename))
|
||||
{
|
||||
|
||||
using var webClient = await GetWebClient(tempAaxFilename);
|
||||
// for book downloads only: pretend to be the audible download manager. from inAudible:
|
||||
webClient.Headers["User-Agent"] = "Audible ADM 6.6.0.15;Windows Vista Service Pack 1 Build 7601";
|
||||
|
||||
await webClient.DownloadFileTaskAsync(uri, tempAaxFilename);
|
||||
}
|
||||
|
||||
// move
|
||||
var aaxFilename = FileUtility.GetValidFilename(
|
||||
|
||||
@ -43,7 +43,7 @@ namespace DomainServices
|
||||
|
||||
var destinationFilename = Path.Combine(destinationDir, Path.GetFileName(url));
|
||||
|
||||
using (var webClient = await GetWebClient(destinationFilename))
|
||||
using var webClient = await GetWebClient(destinationFilename);
|
||||
await webClient.DownloadFileTaskAsync(url, destinationFilename);
|
||||
|
||||
var statusHandler = new StatusHandler();
|
||||
|
||||
@ -55,9 +55,7 @@ namespace DomainServices
|
||||
|
||||
productItems = filterAndValidate(productItems);
|
||||
|
||||
int newEntries;
|
||||
using (var context = LibationContext.Create())
|
||||
{
|
||||
using var context = LibationContext.Create();
|
||||
var dtoImporter = new DtoImporter(context);
|
||||
|
||||
#region // benchmarks. re-importing a library with 500 books, all with book details json files
|
||||
@ -69,14 +67,13 @@ namespace DomainServices
|
||||
*/
|
||||
#endregion
|
||||
// LONG RUNNING
|
||||
newEntries = await Task.Run(() => dtoImporter.ReplaceLibrary(productItems));
|
||||
var newEntries = await Task.Run(() => dtoImporter.ReplaceLibrary(productItems));
|
||||
await context.SaveChangesAsync();
|
||||
|
||||
// must be broken out. see notes in dtoImporter.ReplaceLibrary()
|
||||
// LONG RUNNING
|
||||
await Task.Run(() => dtoImporter.ReloadBookDetails(productItems));
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
await postIndexActionAsync?.Invoke();
|
||||
|
||||
@ -112,12 +109,9 @@ namespace DomainServices
|
||||
public static int IndexChangedTags(Book book)
|
||||
{
|
||||
// update disconnected entity
|
||||
int qtyChanges;
|
||||
using (var context = LibationContext.Create())
|
||||
{
|
||||
using var context = LibationContext.Create();
|
||||
context.Update(book);
|
||||
qtyChanges = context.SaveChanges();
|
||||
}
|
||||
var qtyChanges = context.SaveChanges();
|
||||
|
||||
// this part is tags-specific
|
||||
if (qtyChanges > 0)
|
||||
@ -151,8 +145,7 @@ namespace DomainServices
|
||||
|
||||
validate(bookDetailDTO);
|
||||
|
||||
using (var context = LibationContext.Create())
|
||||
{
|
||||
using var context = LibationContext.Create();
|
||||
var dtoImporter = new DtoImporter(context);
|
||||
// LONG RUNNING
|
||||
await Task.Run(() => dtoImporter.UpdateBookDetails(bookDetailDTO));
|
||||
@ -160,10 +153,7 @@ namespace DomainServices
|
||||
|
||||
// after saving, delete orphan contributors
|
||||
var count = context.RemoveOrphans();
|
||||
if (count > 0)
|
||||
{
|
||||
}
|
||||
}
|
||||
if (count > 0) { } // don't think there's a to-do here
|
||||
|
||||
await postIndexActionAsync?.Invoke();
|
||||
}
|
||||
|
||||
@ -72,8 +72,7 @@ namespace DomainServices
|
||||
// download htm
|
||||
string source;
|
||||
var url = AudiblePage.Product.GetUrl(productId);
|
||||
using (var webClient = await GetWebClient($"Getting Book Details for {libraryBook.Book.Title}"))
|
||||
{
|
||||
using var webClient = await GetWebClient($"Getting Book Details for {libraryBook.Book.Title}");
|
||||
try
|
||||
{
|
||||
source = await webClient.DownloadStringTaskAsync(url);
|
||||
@ -102,7 +101,6 @@ namespace DomainServices
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DataConverter.Value_2_JsonFile(bookDetailDTO, jsonFileInfo.FullName);
|
||||
}
|
||||
|
||||
@ -39,8 +39,7 @@ namespace FileManager
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var webClient = new System.Net.WebClient())
|
||||
{
|
||||
using var webClient = new System.Net.WebClient();
|
||||
// download any that don't exist
|
||||
{
|
||||
if (!FileUtility.FileExists(path80))
|
||||
@ -71,7 +70,6 @@ namespace FileManager
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch { retry++; }
|
||||
}
|
||||
while (retry < 3);
|
||||
|
||||
@ -178,26 +178,19 @@ namespace LibationSearchEngine
|
||||
log();
|
||||
|
||||
// location of index/create the index
|
||||
using (var index = getIndex())
|
||||
{
|
||||
using var index = getIndex();
|
||||
var exists = IndexReader.IndexExists(index);
|
||||
var createNewIndex = overwrite || !exists;
|
||||
|
||||
// analyzer for tokenizing text. same analyzer should be used for indexing and searching
|
||||
using (var analyzer = new StandardAnalyzer(Version))
|
||||
using (var ixWriter = new IndexWriter(index, analyzer, createNewIndex, IndexWriter.MaxFieldLength.UNLIMITED))
|
||||
{
|
||||
using var analyzer = new StandardAnalyzer(Version);
|
||||
using var ixWriter = new IndexWriter(index, analyzer, createNewIndex, IndexWriter.MaxFieldLength.UNLIMITED);
|
||||
foreach (var libraryBook in library)
|
||||
{
|
||||
var doc = createBookIndexDocument(libraryBook);
|
||||
ixWriter.AddDocument(doc);
|
||||
}
|
||||
|
||||
// don't optimize. deprecated: ixWriter.Optimize();
|
||||
// ixWriter.Commit(); not needed if we're about to dispose of writer anyway. could be needed within the using() block
|
||||
}
|
||||
}
|
||||
|
||||
log();
|
||||
}
|
||||
|
||||
@ -247,33 +240,28 @@ namespace LibationSearchEngine
|
||||
var document = createBookIndexDocument(libraryBook);
|
||||
var createNewIndex = false;
|
||||
|
||||
using (var index = getIndex())
|
||||
using (var analyzer = new StandardAnalyzer(Version))
|
||||
using (var ixWriter = new IndexWriter(index, analyzer, createNewIndex, IndexWriter.MaxFieldLength.UNLIMITED))
|
||||
{
|
||||
using var index = getIndex();
|
||||
using var analyzer = new StandardAnalyzer(Version);
|
||||
using var ixWriter = new IndexWriter(index, analyzer, createNewIndex, IndexWriter.MaxFieldLength.UNLIMITED);
|
||||
ixWriter.DeleteDocuments(term);
|
||||
ixWriter.AddDocument(document);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateTags(string productId, string tags)
|
||||
{
|
||||
var productTerm = new Term(_ID_, productId);
|
||||
|
||||
using (var index = getIndex())
|
||||
{
|
||||
Document document;
|
||||
using var index = getIndex();
|
||||
|
||||
// get existing document
|
||||
using (var searcher = new IndexSearcher(index))
|
||||
{
|
||||
using var searcher = new IndexSearcher(index);
|
||||
var query = new TermQuery(productTerm);
|
||||
var docs = searcher.Search(query, 1);
|
||||
var scoreDoc = docs.ScoreDocs.SingleOrDefault();
|
||||
if (scoreDoc == null)
|
||||
throw new Exception("document not found");
|
||||
document = searcher.Doc(scoreDoc.Doc);
|
||||
}
|
||||
var document = searcher.Doc(scoreDoc.Doc);
|
||||
|
||||
|
||||
// update document entry with new tags
|
||||
// fields are key value pairs and MULTIPLE FIELDS CAN HAVE THE SAME KEY. must remove old before adding new
|
||||
@ -283,11 +271,10 @@ namespace LibationSearchEngine
|
||||
|
||||
// update index
|
||||
var createNewIndex = false;
|
||||
using (var analyzer = new StandardAnalyzer(Version))
|
||||
using (var ixWriter = new IndexWriter(index, analyzer, createNewIndex, IndexWriter.MaxFieldLength.UNLIMITED))
|
||||
using var analyzer = new StandardAnalyzer(Version);
|
||||
using var ixWriter = new IndexWriter(index, analyzer, createNewIndex, IndexWriter.MaxFieldLength.UNLIMITED);
|
||||
ixWriter.UpdateDocument(productTerm, document, analyzer);
|
||||
}
|
||||
}
|
||||
|
||||
public SearchResultSet Search(string searchString)
|
||||
{
|
||||
@ -381,10 +368,9 @@ namespace LibationSearchEngine
|
||||
|
||||
var defaultField = ALL;
|
||||
|
||||
using (var index = getIndex())
|
||||
using (var searcher = new IndexSearcher(index))
|
||||
using (var analyzer = new StandardAnalyzer(Version))
|
||||
{
|
||||
using var index = getIndex();
|
||||
using var searcher = new IndexSearcher(index);
|
||||
using var analyzer = new StandardAnalyzer(Version);
|
||||
var query = analyzer.GetQuery(defaultField, searchString);
|
||||
|
||||
|
||||
@ -409,7 +395,6 @@ namespace LibationSearchEngine
|
||||
.ToList();
|
||||
return new SearchResultSet(query.ToString(), docs);
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<Occur> getOccurs_recurs(BooleanQuery query)
|
||||
{
|
||||
|
||||
@ -11,9 +11,9 @@ namespace LibationWinForm.BookLiberation
|
||||
{
|
||||
async Task BackupBookAsync(string productId)
|
||||
{
|
||||
LibraryBook libraryBook;
|
||||
using (var context = LibationContext.Create())
|
||||
libraryBook = context
|
||||
using var context = LibationContext.Create();
|
||||
|
||||
var libraryBook = context
|
||||
.Library
|
||||
.GetLibrary()
|
||||
.SingleOrDefault(lb => lb.Book.AudibleProductId == productId);
|
||||
|
||||
@ -25,9 +25,8 @@ namespace LibationWinForm
|
||||
|
||||
public async Task DoMainWorkAsync()
|
||||
{
|
||||
List<FileInfo> jsonFilepaths;
|
||||
using (var pageRetriever = websiteProcessorControl1.GetPageRetriever())
|
||||
jsonFilepaths = await DownloadLibrary.DownloadLibraryAsync(pageRetriever).ConfigureAwait(false);
|
||||
using var pageRetriever = websiteProcessorControl1.GetPageRetriever();
|
||||
var jsonFilepaths = await DownloadLibrary.DownloadLibraryAsync(pageRetriever).ConfigureAwait(false);
|
||||
|
||||
successMessages.Add($"Downloaded {"library page".PluralizeWithCount(jsonFilepaths.Count)}");
|
||||
|
||||
|
||||
@ -63,18 +63,16 @@ transaction notes
|
||||
-----------------
|
||||
// https://msdn.microsoft.com/en-us/data/dn456843.aspx
|
||||
// Rollback is called by transaction Dispose(). No need to call it explicitly
|
||||
using (var dbContext = new LibationContext())
|
||||
using (var dbContextTransaction = dbContext.Database.BeginTransaction())
|
||||
{
|
||||
using var dbContext = new LibationContext();
|
||||
using var dbContextTransaction = dbContext.Database.BeginTransaction();
|
||||
refreshAction(dbContext, productItems);
|
||||
dbContext.SaveChanges();
|
||||
dbContextTransaction.Commit();
|
||||
}
|
||||
|
||||
aggregate root is transactional boundary
|
||||
// //context.Database.CurrentTransaction
|
||||
//var dbTransaction = Microsoft.EntityFrameworkCore.Storage.DbContextTransactionExtensions.GetDbTransaction(context.Database.CurrentTransaction);
|
||||
// // test with and without : using (TransactionScope scope = new TransactionScope())
|
||||
// // test with and without : using TransactionScope scope = new TransactionScope();
|
||||
//System.Transactions.Transaction.Current.TransactionCompleted += (sender, e) => { };
|
||||
// also : https://docs.microsoft.com/en-us/dotnet/api/system.transactions.transaction.enlistvolatile
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Logging/Debugging (EF CORE)
|
||||
===========================
|
||||
Once you configure logging on a DbContext instance it will be enabled on all instances of that DbContext type
|
||||
using (var context = new MyContext())
|
||||
using var context = new MyContext();
|
||||
context.ConfigureLogging(s => System.Diagnostics.Debug.WriteLine(s)); // write to Visual Studio "Output" tab
|
||||
//context.ConfigureLogging(s => Console.WriteLine(s));
|
||||
see comments at top of file:
|
||||
|
||||
@ -23,8 +23,7 @@ namespace ffmpeg_decrypt
|
||||
|
||||
private void inpbutton_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var ofd = new OpenFileDialog { Filter = "Audible Audio Files|*.aax", Title = "Select an Audible Audio File", FileName = "" })
|
||||
{
|
||||
using var ofd = new OpenFileDialog { Filter = "Audible Audio Files|*.aax", Title = "Select an Audible Audio File", FileName = "" };
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
inputdisplay.Text = ofd.FileName;
|
||||
@ -32,11 +31,10 @@ namespace ffmpeg_decrypt
|
||||
convertbutton.Enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void outpbutton_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var fbd = new FolderBrowserDialog())
|
||||
using var fbd = new FolderBrowserDialog();
|
||||
if (fbd.ShowDialog() == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
|
||||
outputdisplay.Text = fbd.SelectedPath;
|
||||
}
|
||||
@ -87,18 +85,15 @@ namespace ffmpeg_decrypt
|
||||
WorkingDirectory = Directory.GetCurrentDirectory()
|
||||
};
|
||||
|
||||
string ffprobeStderr;
|
||||
using (var ffp = new Process { StartInfo = startInfo })
|
||||
{
|
||||
using var ffp = new Process { StartInfo = startInfo };
|
||||
ffp.Start();
|
||||
|
||||
// checksum is in the debug info. ffprobe's debug info is written to stderr, not stdout
|
||||
ffprobeStderr = ffp.StandardError.ReadToEnd();
|
||||
var ffprobeStderr = ffp.StandardError.ReadToEnd();
|
||||
|
||||
await Task.Run(() => ffp.WaitForExit());
|
||||
|
||||
ffp.Close();
|
||||
}
|
||||
|
||||
// example checksum line:
|
||||
// ... [aax] file checksum == 0c527840c4f18517157eb0b4f9d6f9317ce60cd1
|
||||
@ -135,16 +130,13 @@ namespace ffmpeg_decrypt
|
||||
WorkingDirectory = Directory.GetCurrentDirectory()
|
||||
};
|
||||
|
||||
string rcrackStdout;
|
||||
using (var rcr = new Process { StartInfo = startInfo })
|
||||
{
|
||||
using var rcr = new Process { StartInfo = startInfo };
|
||||
rcr.Start();
|
||||
|
||||
rcrackStdout = rcr.StandardOutput.ReadToEnd();
|
||||
var rcrackStdout = rcr.StandardOutput.ReadToEnd();
|
||||
|
||||
await Task.Run(() => rcr.WaitForExit());
|
||||
rcr.Close();
|
||||
}
|
||||
|
||||
// example result
|
||||
// 0c527840c4f18517157eb0b4f9d6f9317ce60cd1 \xbd\x89X\x09 hex:bd895809
|
||||
@ -202,8 +194,7 @@ namespace ffmpeg_decrypt
|
||||
WorkingDirectory = Directory.GetCurrentDirectory()
|
||||
};
|
||||
|
||||
using (var ffm = new Process { StartInfo = startInfo, EnableRaisingEvents = true })
|
||||
{
|
||||
using var ffm = new Process { StartInfo = startInfo, EnableRaisingEvents = true };
|
||||
ffm.ErrorDataReceived += (s, ea) => debugWindow.UIThread(() => debugWindow.AppendText($"DEBUG: {ea.Data}\r\n"));
|
||||
|
||||
ffm.Start();
|
||||
@ -211,7 +202,6 @@ namespace ffmpeg_decrypt
|
||||
await Task.Run(() => ffm.WaitForExit());
|
||||
ffm.Close();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>extract embedded resource to file if it doesn't already exist</summary>
|
||||
private static void Extract(string resourceName)
|
||||
@ -224,10 +214,10 @@ namespace ffmpeg_decrypt
|
||||
// this technique works but there are easier ways:
|
||||
// https://stackoverflow.com/questions/13031778/how-can-i-extract-a-file-from-an-embedded-resource-and-save-it-to-disk
|
||||
Directory.CreateDirectory(resdir);
|
||||
using (var resource = System.Reflection.Assembly.GetCallingAssembly().GetManifestResourceStream($"{nameof(ffmpeg_decrypt)}.res." + resourceName))
|
||||
using (var reader = new BinaryReader(resource))
|
||||
using (var file = new FileStream(Path.Combine(resdir, resourceName), FileMode.OpenOrCreate))
|
||||
using (var writer = new BinaryWriter(file))
|
||||
using var resource = System.Reflection.Assembly.GetCallingAssembly().GetManifestResourceStream($"{nameof(ffmpeg_decrypt)}.res." + resourceName);
|
||||
using var reader = new BinaryReader(resource);
|
||||
using var file = new FileStream(Path.Combine(resdir, resourceName), FileMode.OpenOrCreate);
|
||||
using var writer = new BinaryWriter(file);
|
||||
writer.Write(reader.ReadBytes((int)resource.Length));
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ incl episodes. eg: "Bill Bryson's Appliance of Science"
|
||||
replace all scraping with audible api
|
||||
public partial class ScanLibraryDialog : Form, IIndexLibraryDialog
|
||||
public async Task DoMainWorkAsync()
|
||||
using (var pageRetriever = websiteProcessorControl1.GetPageRetriever())
|
||||
using var pageRetriever = websiteProcessorControl1.GetPageRetriever();
|
||||
jsonFilepaths = await DownloadLibrary.DownloadLibraryAsync(pageRetriever).ConfigureAwait(false);
|
||||
|
||||
break out DTOs. currently coupled with scraping
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user