diff --git a/.vs/Crunchyroll Downloader/v15/.suo b/.vs/Crunchyroll Downloader/v15/.suo index b1f7fa8..e848182 100644 Binary files a/.vs/Crunchyroll Downloader/v15/.suo and b/.vs/Crunchyroll Downloader/v15/.suo differ diff --git a/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide b/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide index 742a6d3..60d3c39 100644 Binary files a/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide and b/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide differ diff --git a/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide-shm b/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide-shm index c08b206..5459713 100644 Binary files a/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide-shm and b/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide-shm differ diff --git a/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide-wal b/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide-wal index ed36f36..058a656 100644 Binary files a/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide-wal and b/.vs/Crunchyroll Downloader/v15/Server/sqlite3/storage.ide-wal differ diff --git a/CRD-addon - Chrome/icons/icon-128.png b/CRD-addon - Chrome/icons/icon-128.png deleted file mode 100644 index 7e9eb88..0000000 Binary files a/CRD-addon - Chrome/icons/icon-128.png and /dev/null differ diff --git a/CRD-addon - Chrome/icons/icon-20.png b/CRD-addon - Chrome/icons/icon-20.png deleted file mode 100644 index 012e057..0000000 Binary files a/CRD-addon - Chrome/icons/icon-20.png and /dev/null differ diff --git a/CRD-addon - Chrome/icons/icon-48.png b/CRD-addon - Chrome/icons/icon-48.png deleted file mode 100644 index 323edbf..0000000 Binary files a/CRD-addon - Chrome/icons/icon-48.png and /dev/null differ diff --git a/CRD-addon - Chrome/images/submit.png b/CRD-addon - Chrome/images/submit.png deleted file mode 100644 index 0c6adb8..0000000 Binary files a/CRD-addon - Chrome/images/submit.png and /dev/null differ diff --git a/CRD-addon - Chrome/inject.js b/CRD-addon - Chrome/inject.js deleted file mode 100644 index 3b16d99..0000000 --- a/CRD-addon - Chrome/inject.js +++ /dev/null @@ -1,34 +0,0 @@ -var episodeCount = document.getElementsByClassName("episode").length; -var i; -for (i = 0; i < episodeCount; i++) { - document.getElementsByClassName("episode")[i].setAttribute('href', "javascript:" + document.getElementsByClassName("episode")[i].href); - document.getElementsByClassName("episode")[i].setAttribute('onclick', 'deselect(this.id)') - //document.getElementsByClassName("episode")[i].style.background = "#f78c25"; - document.getElementsByClassName("episode")[i].setAttribute('id', makeid(8)) - //document.getElementsByClassName("episode")[i].classList.add('CRD-Selected') -} - -function deselect(clicked_id) { - var seleceted = document.getElementById(clicked_id).classList.contains('CRD-Selected') - - if (seleceted == true) { - document.getElementById(clicked_id).classList.remove('CRD-Selected') - document.getElementById(clicked_id).style.background = "#ffffff"; - - } else { - document.getElementById(clicked_id).classList.add('CRD-Selected') - document.getElementById(clicked_id).style.background = "#f78c25"; - - } - -} - -function makeid(length) { - var result = ''; - var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; - var charactersLength = characters.length; - for (var i = 0; i < length; i++) { - result += characters.charAt(Math.floor(Math.random() * charactersLength)); - } - return result; -} diff --git a/CRD-addon - Chrome/inject_funimation.js b/CRD-addon - Chrome/inject_funimation.js deleted file mode 100644 index 3b16d99..0000000 --- a/CRD-addon - Chrome/inject_funimation.js +++ /dev/null @@ -1,34 +0,0 @@ -var episodeCount = document.getElementsByClassName("episode").length; -var i; -for (i = 0; i < episodeCount; i++) { - document.getElementsByClassName("episode")[i].setAttribute('href', "javascript:" + document.getElementsByClassName("episode")[i].href); - document.getElementsByClassName("episode")[i].setAttribute('onclick', 'deselect(this.id)') - //document.getElementsByClassName("episode")[i].style.background = "#f78c25"; - document.getElementsByClassName("episode")[i].setAttribute('id', makeid(8)) - //document.getElementsByClassName("episode")[i].classList.add('CRD-Selected') -} - -function deselect(clicked_id) { - var seleceted = document.getElementById(clicked_id).classList.contains('CRD-Selected') - - if (seleceted == true) { - document.getElementById(clicked_id).classList.remove('CRD-Selected') - document.getElementById(clicked_id).style.background = "#ffffff"; - - } else { - document.getElementById(clicked_id).classList.add('CRD-Selected') - document.getElementById(clicked_id).style.background = "#f78c25"; - - } - -} - -function makeid(length) { - var result = ''; - var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; - var charactersLength = characters.length; - for (var i = 0; i < length; i++) { - result += characters.charAt(Math.floor(Math.random() * charactersLength)); - } - return result; -} diff --git a/CRD-addon - Chrome/manifest.json b/CRD-addon - Chrome/manifest.json deleted file mode 100644 index d454a69..0000000 --- a/CRD-addon - Chrome/manifest.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "manifest_version": 2, - "name": "Crunchyroll Downloader Addon", - "version": "0.2.0", - - "description": "A Chrome Addon for my Crunchyroll Downloader", - - "icons": { - "48": "icons/icon-48.png" - }, - "permissions": [ - "activeTab", - "tabs" - ], - - "browser_action": { - "default_icon": { - "128": "icons/icon-128.png", - "48": "icons/icon-48.png", - "20": "icons/icon-20.png" - }, - "default_title": "CR-Downloader", - "default_popup": "popup.html" - } - -} \ No newline at end of file diff --git a/CRD-addon - Chrome/popup.css b/CRD-addon - Chrome/popup.css deleted file mode 100644 index 1839d7f..0000000 --- a/CRD-addon - Chrome/popup.css +++ /dev/null @@ -1,15 +0,0 @@ -.btn_class { - background-color: #ff8000; - border: none; - color: white; - padding: 10px; - text-align: center; - text-decoration: none; - font-size: 16px; - margin-left:12px; - margin-right:12px; - margin-Top:12px; - margin-Bottom:12px; - border-radius: 12px; - cursor:pointer; -} \ No newline at end of file diff --git a/CRD-addon - Chrome/popup.html b/CRD-addon - Chrome/popup.html deleted file mode 100644 index 1c6e88a..0000000 --- a/CRD-addon - Chrome/popup.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - CR Unblocker plugin popup - - - - -
- -
- - - - - - - - - - - -
- -
- - - diff --git a/CRD-addon - Chrome/popup.js b/CRD-addon - Chrome/popup.js deleted file mode 100644 index b2065e6..0000000 --- a/CRD-addon - Chrome/popup.js +++ /dev/null @@ -1,352 +0,0 @@ -chrome.tabs.query({ - active: true, - currentWindow: true -}, - function (tabs) { - console.log(tabs.length); - let tab = tabs[0]; // Safe to assume there will only be one resultconsole.log(tab.url); - console.log(tab.url); - if (tab.url.includes('crunchyroll.com')) { - //var crunchyroll = chrome.tabs.executeScript({ - // code: 'document.getElementsByClassName("episode")[0].href;' - //}); - - //crunchyroll.then(onExecuted, onError); - - chrome.tabs.executeScript(null, { - //code: 'document.getElementsByClassName("episode")[0].href;' - code: 'document.getElementsByClassName("episode").length;' - }, - function (results) { - - if (results > 0) { - - onExecuted(results); - } else { - onError("error") - } - - }); - - } else if (tab.url.includes('funimation.com')) { - chrome.tabs.executeScript(null, { - //code: 'document.getElementsByClassName("trackVideo")[0].href' - code: 'document.getElementsByClassName("trackVideo").length;' - }, - function (results) { - - if (results > 0) { - FunimationSuccess(results); - - } else { - FunimationError(results); - - } - - }); - - } else { - - document.getElementById("btn_add").hidden = true; - document.getElementById("btn_enable_select").hidden = true; - document.getElementById("btn_add_mass").hidden = true; - document.getElementById("btn_select_all").hidden = true; - document.getElementById("btn_select_none").hidden = true; - document.getElementById("btn_enable_funimation_select").hidden = true; - document.getElementById("btn_add_funimation").hidden = true; - } -}); - -document.getElementById('btn_enable_select').addEventListener('click', () => { - - chrome.tabs.executeScript(null, { - code: 'var script=document.createElement("script");script.type="text/javascript",script.src="http://127.0.0.1/inject.js",document.head.appendChild(script);' - }); - - //browser.tabs.executeScript({ - // code: 'var script=document.createElement("script");script.type="text/javascript",script.src="http://127.0.0.1/inject.js",document.head.appendChild(script);' - //}); //load script from local CRD Server included in https://github.com/hama3254/Crunchyroll-Downloader-v3.0 - - document.getElementById("btn_add_mass").hidden = false; - document.getElementById("btn_select_all").hidden = false; - document.getElementById("btn_select_none").hidden = false; - document.getElementById("btn_enable_select").hidden = true; - document.getElementById("btn_add").hidden = true; - document.getElementById("btn_enable_funimation_select").hidden = true; - document.getElementById("btn_add_funimation").hidden = true; -}); - -document.getElementById('btn_select_all').addEventListener('click', () => { - chrome.tabs.query({ - active: true, - currentWindow: true - }, - function (tabs) { - console.log(tabs.length); - let tab = tabs[0]; // Safe to assume there will only be one resultconsole.log(tab.url); - console.log(tab.url); - if (tab.url.includes('crunchyroll.com')) { - - chrome.tabs.executeScript(null, { - code: 'var i,episodeCount=document.getElementsByClassName("episode").length;for(i=0;i { - - chrome.tabs.query({ - active: true, - currentWindow: true - }, - function (tabs) { - console.log(tabs.length); - let tab = tabs[0]; // Safe to assume there will only be one resultconsole.log(tab.url); - console.log(tab.url); - if (tab.url.includes('crunchyroll.com')) { - - chrome.tabs.executeScript(null, { - code: 'var i,episodeCount=document.getElementsByClassName("episode").length;for(i=0;i { - chrome.tabs.executeScript(null, { - code: "document.getElementsByClassName('no-js')[0].innerHTML;" - }, - function (results) { - - if (results !== null) { - - document.getElementById("btn_add").disabled = true; - document.getElementById("btn_add").style.background = "#c9c9c9" - const form = document.createElement('form'); - form.method = 'post'; - form.action = "http://127.0.0.1/post"; - const hiddenField = document.createElement('input'); - hiddenField.type = 'hidden'; - hiddenField.name = "HTMLSingle"; - hiddenField.value = results; - form.appendChild(hiddenField); - - document.body.appendChild(form); - form.submit(); - - setTimeout(function () { - document.getElementById("btn_add").style.background = "#ff8000" - }, 10000); - setTimeout(function () { - document.getElementById("btn_add").disabled = false; - }, 10000); - - } else { - add_one_error(results); - - } - - }); - -}); - -document.getElementById('btn_add_funimation').addEventListener('click', () => { - - chrome.tabs.query({ - active: true, - currentWindow: true - }, - function (tabs) { - document.getElementById("btn_add_funimation").disabled = true; - document.getElementById("btn_add_funimation").style.background = "#c9c9c9" - - console.log(tabs.length); - let tab = tabs[0]; // Safe to assume there will only be one resultconsole.log(tab.url); - console.log(tab.url); - const form = document.createElement('form'); - form.method = 'post'; - form.action = "http://127.0.0.1/post"; - - const hiddenField2 = document.createElement('input'); - hiddenField2.type = 'hidden'; - hiddenField2.name = "FunimationURL"; - hiddenField2.value = tab.url; - form.appendChild(hiddenField2); - - document.body.appendChild(form); - form.submit(); - setTimeout(function () { - document.getElementById("btn_add_funimation").style.background = "#ff8000" - }, 10000); - setTimeout(function () { - document.getElementById("btn_add_funimation").disabled = false; - }, 10000); - }); -}); - -document.getElementById('btn_add_mass').addEventListener('click', () => { - - chrome.tabs.executeScript(null, { - code: 'var i,URLList="";for(i=0;i { - - // browser.tabs.executeScript({ - // code: 'var script=document.createElement("script");script.type="text/javascript",script.src="http://127.0.0.1/inject_funimation.js",document.head.appendChild(script);' - // }); //load script from local CRD Server included in https://github.com/hama3254/Crunchyroll-Downloader-v3.0 - chrome.tabs.executeScript(null, { - code: 'var script=document.createElement("script");script.type="text/javascript",script.src="http://127.0.0.1/inject_funimation.js",document.head.appendChild(script);' - }); - - document.getElementById("btn_add_mass").hidden = false; - document.getElementById("btn_select_all").hidden = false; - document.getElementById("btn_select_none").hidden = false; - document.getElementById("btn_enable_select").hidden = true; - document.getElementById("btn_add").hidden = true; - document.getElementById("btn_add_funimation").hidden = true; - -}); - -function FunimationSuccess(result) { - chrome.tabs.executeScript(null, { - code: "document.getElementsByClassName('trackVideo')[0].href.includes('javascript:');" - }, - function (result) { - if (result == 'true') { - document.getElementById("btn_add").hidden = true; - document.getElementById("btn_add_mass").hidden = false; - document.getElementById("btn_select_all").hidden = false; - document.getElementById("btn_select_none").hidden = false; - document.getElementById("btn_enable_select").hidden = true; - - document.getElementById("btn_enable_funimation_select").hidden = true; - document.getElementById("btn_add_funimation").hidden = true; - console.log(true); - } else { - document.getElementById("btn_add").hidden = true; - document.getElementById("btn_add_funimation").hidden = true; - document.getElementById("btn_enable_select").hidden = true; - document.getElementById("btn_add_mass").hidden = true; - document.getElementById("btn_select_all").hidden = true; - document.getElementById("btn_select_none").hidden = true; - document.getElementById("btn_enable_funimation_select").hidden = false; - - console.log(false); - } - }); -} - -function FunimationError(error) { - console.log(`Error: ${error}`); - - document.getElementById("btn_add").hidden = true; - document.getElementById("btn_add_mass").hidden = true; - document.getElementById("btn_select_all").hidden = true; - document.getElementById("btn_select_none").hidden = true; - document.getElementById("btn_enable_select").hidden = true; - document.getElementById("btn_add_funimation").hidden = false; - document.getElementById("btn_enable_funimation_select").hidden = true; - -} diff --git a/CRD-addon/background.js b/CRD-addon/background.js new file mode 100644 index 0000000..7a0f36c --- /dev/null +++ b/CRD-addon/background.js @@ -0,0 +1,32 @@ +browser.webRequest.onHeadersReceived.addListener( + details => { + browser.test.log(`onHeadersReceived ${JSON.stringify(details)}\n`); + if (!details.fromCache) { + //console.log("not cached"); + browser.test.sendMessage("statusCode", details.statusCode); + const mime = details.responseHeaders.find(header => { + return header.value && header.name === "Server"; + }); + if (mime) { + //console.log(mime.value); + browser.runtime.sendMessage({ + Server: mime.value + }); + + } else { + details.responseHeaders.push({ + name: "Content-Security-Policy", + value: "upgrade-insecure-requests", + }); + } + + return { + responseHeaders: details.responseHeaders, + }; + } else { + console.log("cached"); + } +}, { + urls: ["http://127.0.0.1/*"], +}, + ["blocking", "responseHeaders"]); diff --git a/CRD-addon/manifest.json b/CRD-addon/manifest.json index de4f46c..799fa08 100644 --- a/CRD-addon/manifest.json +++ b/CRD-addon/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Crunchyroll Downloader Addon", - "version": "0.4.0", + "version": "0.4.2", "description": "A Firefox Addon for my Crunchyroll Downloader", @@ -11,7 +11,9 @@ "permissions": [ "storage", "activeTab", - "cookies", + "webRequest", + "webRequestBlocking", + "http://127.0.0.1/*", "tabs" ], @@ -23,6 +25,10 @@ }, "default_title": "CR-Downloader", "default_popup": "popup.html" + }, + + "background": { + "scripts": ["background.js"] } } \ No newline at end of file diff --git a/CRD-addon/popup.html b/CRD-addon/popup.html index 78f7d73..c08b76e 100644 --- a/CRD-addon/popup.html +++ b/CRD-addon/popup.html @@ -7,7 +7,8 @@ @@ -24,10 +25,11 @@ + Enter the port or start the Desktop application - - + + diff --git a/CRD-addon/popup.js b/CRD-addon/popup.js index 1b72495..bd0b9d4 100644 --- a/CRD-addon/popup.js +++ b/CRD-addon/popup.js @@ -7,9 +7,64 @@ document.getElementById("btn_select_none").hidden = true; document.getElementById("btn_enable_funimation_select").hidden = true; document.getElementById("btn_add_funimation").hidden = true; document.getElementById("btn_add_AoD").hidden = true; -document.getElementById("CRD-Webserver").hidden = true; +browser.storage.local.get("CRD_Port") +.then(gotPort, NoPort); +function getServerValue(request, sender, sendResponse) { + if (request.Server == "CRD 1.0") { + document.getElementById("CRD-Webserver").hidden = false; + document.getElementById("txtOutput").remove(); + document.getElementById("txtInput").hidden = true; + document.getElementById("btn_set_port").hidden = true; + browser.tabs.query({ + currentWindow: true, + active: true + }).then((tabs) => { + + let tab = tabs[0]; // Safe to assume there will only be one resultconsole.log(tab.url); + console.log(tab.url); + if (tab.url.includes('crunchyroll.com')) { + var crunchyroll = browser.tabs.executeScript({ + code: 'document.getElementsByClassName("episode")[0].href;' + }); + + crunchyroll.then(onExecuted, onError); + + } else if (tab.url.includes('funimation.com')) { + + var funimation = browser.tabs.executeScript({ + + code: 'document.getElementsByClassName("trackVideo")[0].href' + }); + funimation.then(FunimationSuccess, FunimationError); + } else if (tab.url.includes('anime-on-demand.de/anime/')) { + + document.getElementById("btn_add").hidden = true; + document.getElementById("btn_enable_select").hidden = true; + document.getElementById("btn_add_mass").hidden = true; + document.getElementById("btn_select_all").hidden = true; + document.getElementById("btn_select_none").hidden = true; + document.getElementById("btn_enable_funimation_select").hidden = true; + document.getElementById("btn_add_funimation").hidden = true; + document.getElementById("btn_add_AoD").hidden = true; //false if implemented + + } else { + + document.getElementById("btn_add").hidden = true; + document.getElementById("btn_enable_select").hidden = true; + document.getElementById("btn_add_mass").hidden = true; + document.getElementById("btn_select_all").hidden = true; + document.getElementById("btn_select_none").hidden = true; + document.getElementById("btn_enable_funimation_select").hidden = true; + document.getElementById("btn_add_funimation").hidden = true; + document.getElementById("btn_add_AoD").hidden = true; + } + }, console.error) + } else {} + +} +browser.runtime.onMessage.addListener(getServerValue); function setItem() { console.log("OK"); @@ -18,9 +73,6 @@ function notsetItem() { console.log("Not OK"); } -browser.storage.local.get("CRD_Port") -.then(gotPort, NoPort); - function gotPort(result) { try { onStartup(result.CRD_Port.value); @@ -33,98 +85,36 @@ function gotPort(result) { } function NoPort(result) { - //onStartup(80); + onStartup(80); console.log("no port") } function onStartup(result) { - console.log(result); Port = result; - const xhr = new XMLHttpRequest(), - method = "GET", - url = "http://localhost:" + Port + "/CRD_Handshake"; - xhr.open(method, url, true); - xhr.onreadystatechange = function () { - // In local files, status is 0 upon success in Mozilla Firefox - if (xhr.readyState === XMLHttpRequest.DONE) { - //var status = xhr.status; - //status === 0 || (status >= 200 && status < 400) - console.log(xhr.responseText); - if (xhr.responseText == "CRD_Handshake_Confirm") { - document.getElementById("txtInput").hidden = true; - document.getElementById("btn_set_port").hidden = true; - document.getElementById("CRD-Webserver").hidden = false - document.getElementById("CRD-Webserver").src = "http://localhost:" + Port; - // The request has been completed successfully + var ifrm = document.createElement("iframe"); + ifrm.src = "http://127.0.0.1:" + Port; + ifrm.style = "border:0px solid black;"; + ifrm.style.width = "760px"; + ifrm.style.height = "320px"; + ifrm.id = "CRD-Webserver"; + ifrm.hidden = true; + document.body.appendChild(ifrm); - browser.tabs.query({ - currentWindow: true, - active: true - }).then((tabs) => { - - let tab = tabs[0]; // Safe to assume there will only be one resultconsole.log(tab.url); - console.log(tab.url); - if (tab.url.includes('crunchyroll.com')) { - var crunchyroll = browser.tabs.executeScript({ - code: 'document.getElementsByClassName("episode")[0].href;' - }); - - crunchyroll.then(onExecuted, onError); - - } else if (tab.url.includes('funimation.com')) { - - var funimation = browser.tabs.executeScript({ - - code: 'document.getElementsByClassName("trackVideo")[0].href' - }); - funimation.then(FunimationSuccess, FunimationError); - } else if (tab.url.includes('anime-on-demand.de/anime/')) { - - document.getElementById("btn_add").hidden = true; - document.getElementById("btn_enable_select").hidden = true; - document.getElementById("btn_add_mass").hidden = true; - document.getElementById("btn_select_all").hidden = true; - document.getElementById("btn_select_none").hidden = true; - document.getElementById("btn_enable_funimation_select").hidden = true; - document.getElementById("btn_add_funimation").hidden = true; - document.getElementById("btn_add_AoD").hidden = true; //false if implemented - - } else { - - document.getElementById("btn_add").hidden = true; - document.getElementById("btn_enable_select").hidden = true; - document.getElementById("btn_add_mass").hidden = true; - document.getElementById("btn_select_all").hidden = true; - document.getElementById("btn_select_none").hidden = true; - document.getElementById("btn_enable_funimation_select").hidden = true; - document.getElementById("btn_add_funimation").hidden = true; - document.getElementById("btn_add_AoD").hidden = true; - } - }, console.error) - i = 91; - } else { - console.log("No CRD found"); - // Oh no! There has been an error with the request! - } - } - }; - xhr.send(); } document.getElementById('btn_set_port').addEventListener('click', () => { -let CRD_Port = { - value: document.getElementById('txtInput').value -} + let CRD_Port = { + value: document.getElementById('txtInput').value + } -browser.storage.local.set({ - CRD_Port -}) -.then(setItem, notsetItem); + browser.storage.local.set({ + CRD_Port + }) + .then(setItem, notsetItem); -window.close(); + window.close(); }); - document.getElementById('btn_add_AoD').addEventListener('click', () => { //browser.cookies.getAllCookieStores().then((cookie) => { // browser.cookies.getAll({ @@ -145,7 +135,7 @@ document.getElementById('btn_add_AoD').addEventListener('click', () => { document.getElementById('btn_enable_select').addEventListener('click', () => { browser.tabs.executeScript({ - code: 'var script=document.createElement("script");script.type="text/javascript",script.src="http://127.0.0.1:'+Port+'/inject.js",document.head.appendChild(script);' + code: 'var script=document.createElement("script");script.type="text/javascript",script.src="http://127.0.0.1:' + Port + '/inject.js",document.head.appendChild(script);' }); //load script from local CRD Server included in https://github.com/hama3254/Crunchyroll-Downloader-v3.0 document.getElementById("btn_add_mass").hidden = false; @@ -283,7 +273,7 @@ function add_fun_ok(result) { document.getElementById("btn_add_funimation").style.background = "#c9c9c9" var xhttp = new XMLHttpRequest(); - xhttp.open("POST", "http://127.0.0.1:"+Port+"/post", true); + xhttp.open("POST", "http://127.0.0.1:" + Port + "/post", true); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.send("FunimationURL=" + tab.url); @@ -303,7 +293,7 @@ function add_one_ok(result) { document.getElementById("btn_add").style.background = "#c9c9c9" var xhttp = new XMLHttpRequest(); - xhttp.open("POST", "http://127.0.0.1:"+Port+"/post", true); + xhttp.open("POST", "http://127.0.0.1:" + Port + "/post", true); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.send("HTMLSingle=" + result); @@ -325,7 +315,7 @@ function add_mass_ok(result) { document.getElementById("btn_add_mass").style.background = "#c9c9c9" var xhttp = new XMLHttpRequest(); - xhttp.open("POST", "http://127.0.0.1:"+Port+"/post", true); + xhttp.open("POST", "http://127.0.0.1:" + Port + "/post", true); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.send("HTMLMass=" + result); @@ -346,7 +336,7 @@ function add_mass_error(error) { document.getElementById('btn_enable_funimation_select').addEventListener('click', () => { browser.tabs.executeScript({ - code: 'var script=document.createElement("script");script.type="text/javascript",script.src="http://127.0.0.1:'+Port+'/inject_funimation.js",document.head.appendChild(script);' + code: 'var script=document.createElement("script");script.type="text/javascript",script.src="http://127.0.0.1:' + Port + '/inject_funimation.js",document.head.appendChild(script);' }); //load script from local CRD Server included in https://github.com/hama3254/Crunchyroll-Downloader-v3.0 document.getElementById("btn_add_mass").hidden = false; diff --git a/Crunchyroll Downloader/Anime_Add.vb b/Crunchyroll Downloader/Anime_Add.vb index 8e67305..128c311 100644 --- a/Crunchyroll Downloader/Anime_Add.vb +++ b/Crunchyroll Downloader/Anime_Add.vb @@ -1190,6 +1190,7 @@ Public Class Anime_Add Dim ResoSplit() As String = AoDTempReso.Split(New String() {"x"}, System.StringSplitOptions.RemoveEmptyEntries) DisplayReso = ResoSplit(1) + "p" End If + Dim L1Name As String = "anime-on-demand.de" 'L1Name_Split(1).Replace("www.", "") + " | Dub : " + FunimationDub Me.Invoke(New Action(Function() Main.ListItemAdd(Pfad2, L1Name, AoDTitle, DisplayReso, "Unknown", "None", AoDThumbnail, AoDm3u8Final, DownloadPfad, "AoD") diff --git a/Crunchyroll Downloader/CRD_List_Item.vb b/Crunchyroll Downloader/CRD_List_Item.vb index a3d1048..269824e 100644 --- a/Crunchyroll Downloader/CRD_List_Item.vb +++ b/Crunchyroll Downloader/CRD_List_Item.vb @@ -641,8 +641,15 @@ Public Class CRD_List_Item 'Dim archive As Zipfi = New ZipArchive(ms) 'Dim m3u8String As String = client.DownloadString(TextBox1.Text) - Dim m3u8 As String = DecompressString(client.DownloadData(m3u8_url(1))) - Text = m3u8 + + Try + Dim m3u8 As String = DecompressString(client.DownloadData(m3u8_url(1))) + text = m3u8 + Catch ex As Exception + Dim m3u8 As String = client.DownloadString(m3u8_url(1)) + text = m3u8 + End Try + 'MsgBox(m3u8) End Using Catch ex As Exception @@ -1091,7 +1098,11 @@ Public Class CRD_List_Item If CBool(InStr(ResoSearch(2), " [")) = True Then Dim ResoSearch2() As String = ResoSearch(2).Split(New String() {" ["}, System.StringSplitOptions.RemoveEmptyEntries) Me.Invoke(New Action(Function() - Label_Reso.Text = ResoSearch2(0) + "p" + If Label_Reso.Text = "1080p+" Then + Else + Label_Reso.Text = ResoSearch2(0) + "p" + End If + Return Nothing End Function)) End If diff --git a/Crunchyroll Downloader/Main.vb b/Crunchyroll Downloader/Main.vb index b7d08e6..08816a1 100644 --- a/Crunchyroll Downloader/Main.vb +++ b/Crunchyroll Downloader/Main.vb @@ -10,10 +10,13 @@ Imports MetroFramework.Forms Imports MetroFramework Imports MetroFramework.Components Imports System.Globalization +Imports System.ComponentModel Public Class Main Inherits MetroForm + Dim HTML As String = Nothing + Public Manager As New MetroStyleManager Public DarkModeValue As Boolean = False @@ -102,6 +105,8 @@ Public Class Main Public Funimation_dfxp As Boolean = False Public SubFunimationString As String = "en" Public SubFunimation As New List(Of String) + Public DefaultSubFunimation As String = "Disabled" + Public DefaultSubCR As String = "Disabled" #Region "Sprachen Vairablen" Public URL_Invaild As String = "something is wrong here..." @@ -385,6 +390,18 @@ Public Class Main Catch ex As Exception End Try + Try + Dim rkg As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\CRDownloader") + DefaultSubFunimation = rkg.GetValue("DefaultSubFunimation").ToString + Catch ex As Exception + End Try + + Try + Dim rkg As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\CRDownloader") + DefaultSubCR = rkg.GetValue("DefaultSubCR").ToString + Catch ex As Exception + End Try + Try Dim rkg As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\CRDownloader") Startseite = rkg.GetValue("Startseite").ToString @@ -1421,6 +1438,8 @@ Public Class Main CR_Anime_Folge_int = CR_Anime_Folge_int.Replace(",", ".") End If End If + ElseIf Integer.Parse(CR_Anime_Folge_int) < 10 Then + CR_Anime_Folge_int = "0" + CR_Anime_Folge_int End If End If @@ -1649,7 +1668,12 @@ Public Class Main If SoftSubs2.Count > 0 Then If MergeSubstoMP4 = True Then + Dim DispositionIndex As Integer For i As Integer = 0 To SoftSubs2.Count - 1 + Debug.WriteLine(SoftSubs2(i)) + If SoftSubs2(i) = DefaultSubCR Then + DispositionIndex = i + End If Dim SoftSub As String() = WebbrowserText.Split(New String() {Chr(34) + "language" + Chr(34) + ":" + Chr(34) + SoftSubs2(i) + Chr(34) + "," + Chr(34) + "url" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries) Dim SoftSub_2 As String() = SoftSub(1).Split(New [Char]() {Chr(34)}) Dim SoftSub_3 As String = SoftSub_2(0).Replace("\/", "/") @@ -1666,7 +1690,10 @@ Public Class Main End If Next - + If DispositionIndex = Nothing Then + Else + SoftSubMergeMetatata = SoftSubMergeMetatata + " -disposition:s:" + DispositionIndex + " default" + End If Else For i As Integer = 0 To SoftSubs2.Count - 1 LabelUpdate = "Status: downloading subtitle file" @@ -1691,7 +1718,7 @@ Public Class Main Next End If - 'SoftSubMergeMetatata = SoftSubMergeMetatata + " -disposition:s:0 default" + End If #End Region @@ -1919,23 +1946,29 @@ Public Class Main ItemList(i).KillRunningTask() Next - Try - tcpListener.Stop() - Catch ex As Exception - End Try + 'Try + ' tcpListener.Stop() + + 'Catch ex As Exception + 'End Try RemoveTempFiles() Me.Close() End If Else - Try - tcpListener.Stop() - Catch ex As Exception - End Try + + 'Try + + ' tcpListener.Stop() + 'Catch ex As Exception + ' MsgBox(ex.ToString) + 'End Try Timer3.Enabled = False RemoveTempFiles() + Me.Close() + End If End Sub Private Sub RemoveTempFiles() @@ -2749,8 +2782,14 @@ Public Class Main If UsedSubs.Count > 0 Then If MergeSubstoMP4 = True Then + Dim DispositionIndex As Integer For i As Integer = 0 To UsedSubs.Count - 1 Dim SoftSub As String() = UsedSubs.Item(i).Split(New String() {" , "}, System.StringSplitOptions.RemoveEmptyEntries) + Debug.WriteLine(SoftSub(1)) + If DefaultSubFunimation = SoftSub(1) Then + Debug.WriteLine(SoftSub(1)) + DispositionIndex = i + End If If SoftSubMergeURLs = Nothing Then SoftSubMergeURLs = " -headers " + My.Resources.ffmpeg_user_agend + " -i " + Chr(34) + SoftSub(0) + Chr(34) Else @@ -2768,7 +2807,10 @@ Public Class Main End If Next - + If DispositionIndex = Nothing Then + Else + SoftSubMergeMetatata = SoftSubMergeMetatata + " -disposition:s:" + DispositionIndex + " default" + End If Else For i As Integer = 0 To UsedSubs.Count - 1 LabelUpdate = "Status: downloading subtitle file" @@ -2897,83 +2939,150 @@ Public Class Main c = c.Replace("balken1.png", Balken) Dim CC As String = "cc.png" c = c.Replace("cc1.png", CC) - My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\WebInterface\index.html", c, False) - + 'My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\WebInterface\index.html", c, False) + HTML = c Catch ex As Exception 'Debug.WriteLine(ex.ToString) 'MsgBox(ex.ToString) End Try End Sub #Region "server" - Dim tcpListener As TcpListener - Public Sub ServerStart() + 'Dim tcpListener As TcpListener + 'Public Sub ServerStart() + ' Try + ' Dim hostName As String = "localhost" 'Dns.GetHostName() + ' Dim Adresscount As Integer + ' For i As Integer = 0 To Dns.GetHostEntry(hostName).AddressList.Count - 1 + ' If Dns.GetHostEntry(hostName).AddressList(i).ToString = "127.0.0.1" Then + ' Adresscount = i + ' End If + ' Next + ' If Adresscount = Nothing Then + ' MsgBox("http server start failed") + ' Exit Sub + ' End If + ' Dim serverIP As IPAddress = Dns.GetHostEntry(hostName).AddressList(Adresscount) 'Dns.Resolve(hostName).AddressList(0) 'New IPAddress("localhost") ' + + ' Dim Port As String = StartServer + ' tcpListener = New TcpListener(serverIP, Int32.Parse(Port)) + ' tcpListener.Start() + ' Debug.WriteLine("Web server started at: " & serverIP.ToString() & ":" & Port) + ' ProcessThread() + + + ' Catch abort As ThreadAbortException + ' Exit Sub + ' MsgBox(abort.ToString()) + ' Catch ex As Exception + + ' MsgBox(ex.ToString()) + ' End Try + 'End Sub + + + 'Public Sub ProcessThread() + ' Dim ServerRunning = True + ' Dim clientSocket As Socket + ' While ServerRunning = True + + + ' Try + ' clientSocket = tcpListener.AcceptSocket + ' clientSocket.ReceiveBufferSize = 1048576 + ' ' Socket Information + ' 'Dim clientInfo As IPEndPoint = CType(clientSocket.RemoteEndPoint, IPEndPoint) + ' 'Debug.WriteLine("Client: " + clientInfo.Address.ToString() + ":" + clientInfo.Port.ToString()) + ' ' Set Thread for each Web Browser Connection + ' Dim clientThread As New Thread(Sub() Me.ProcessRequest(clientSocket)) + ' clientThread.Start() + + ' Catch ex As Exception + + ' Debug.WriteLine(ex.ToString()) + + ' Try + ' clientSocket.Close() + ' Catch ex2 As Exception + + ' End Try + ' ServerRunning = False + ' Exit Sub + ' End Try + ' End While + + ' 'New AsyncCallback(AddressOf DoAcceptSocketCallback), listener + 'End Sub + + Dim ListOfThread As New List(Of Thread) + + Sub ServerStart() + Dim server As TcpListener + server = Nothing Try - Dim hostName As String = "localhost" 'Dns.GetHostName() - Dim Adresscount As Integer - For i As Integer = 0 To Dns.GetHostEntry(hostName).AddressList.Count - 1 - If Dns.GetHostEntry(hostName).AddressList(i).ToString = "127.0.0.1" Then - Adresscount = i - End If - Next - If Adresscount = Nothing Then - MsgBox("http server start failed") - Exit Sub - End If - Dim serverIP As IPAddress = Dns.GetHostEntry(hostName).AddressList(Adresscount) 'Dns.Resolve(hostName).AddressList(0) 'New IPAddress("localhost") ' + Dim Port As String = StartServer - tcpListener = New TcpListener(serverIP, Int32.Parse(Port)) - tcpListener.Start() - Debug.WriteLine("Web server started at: " & serverIP.ToString() & ":" & Port) - ProcessThread() + Dim localAddr As IPAddress = IPAddress.Parse("127.0.0.1") + server = New TcpListener(localAddr, Int32.Parse(port)) - Catch abort As ThreadAbortException + ' Start listening for client requests. + server.Start() - Exit Sub - Catch ex As Exception + Debug.WriteLine("Web server started at: " & localAddr.ToString() & ":" & port) - MsgBox(ex.ToString()) - End Try - End Sub + While True - - Public Sub ProcessThread() - While (True) - - Dim clientSocket As Socket - Try - clientSocket = tcpListener.AcceptSocket() - clientSocket.ReceiveBufferSize = 1048576 - ' Socket Information - Dim clientInfo As IPEndPoint = CType(clientSocket.RemoteEndPoint, IPEndPoint) - 'Debug.WriteLine("Client: " + clientInfo.Address.ToString() + ":" + clientInfo.Port.ToString()) - ' Set Thread for each Web Browser Connection - Dim clientThread As New Thread(Sub() Me.ProcessRequest(clientSocket)) + Dim client As TcpClient = server.AcceptTcpClient() + Dim clientThread As New Thread(Sub() Me.ManageConnections(client)) clientThread.Start() - Catch abort As ThreadAbortException - Exit Sub - Catch ex As Exception - Debug.WriteLine(ex.ToString()) - 'If clientSocket.Connected Then - ' clientSocket.Close() - 'End If - End Try - End While + + End While + + Catch ex As SocketException + Debug.WriteLine("SocketException: " + ex.ToString) + + + Finally + Debug.WriteLine(Date.Now + " " + "End server") + server.Stop() + End Try + Debug.WriteLine(ControlChars.Cr + "Hit enter to continue....") End Sub - Protected Sub ProcessRequest(ByVal clientSocket As Socket) - Dim recvBytes(1048576) As Byte - Dim htmlReq As String = Nothing - Dim bytes As Long - Try - ' Receive HTTP Request from Web Browser - bytes = clientSocket.Receive(recvBytes, 0, clientSocket.Available, SocketFlags.None) + Sub ManageConnections(ByVal client As TcpClient) + Dim bytes(1048576) As Byte - htmlReq = Encoding.UTF8.GetString(recvBytes, 0, bytes) - 'MsgBox(htmlReq) - 'My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\log.txt", htmlReq + vbNewLine, True) + Dim stream As NetworkStream = client.GetStream() + + ' Debug.WriteLine(Date.Now + " " + "stream opend") + + Dim numberOfBytesRead As Integer = 0 + Dim myCompleteMessage As StringBuilder = New StringBuilder() + + Dim stopWatch As New Stopwatch() + stopWatch.Start() + + Do While stopWatch.Elapsed.TotalSeconds < 4 And stream.DataAvailable + + 'Debug.WriteLine(Date.Now + " " + numberOfBytesRead.ToString + " " + stopWatch.Elapsed.TotalSeconds.ToString) + numberOfBytesRead = stream.Read(bytes, 0, bytes.Length) + myCompleteMessage.AppendFormat("{0}", Encoding.UTF8.GetString(bytes, 0, numberOfBytesRead)) + + Loop + stopWatch.Stop() + + ProcessRequest(stream, myCompleteMessage.ToString()) + + client.Close() + End Sub + + + Sub ProcessRequest(ByVal stream As NetworkStream, ByVal htmlReq As String) + Dim recvBytes(1048576) As Byte + + Try Dim rootPath As String = Directory.GetCurrentDirectory() & "\WebInterface\" ' Set default page Dim defaultPage As String = "index.html" @@ -2986,8 +3095,8 @@ Public Class Main If strArray(0).Trim().ToUpper.Equals("POST") Then 'Debug.WriteLine("receiving data from the add-on") - 'Debug.WriteLine(UrlDecode(htmlReq)) - + 'Debug.WriteLine(htmlReq) + 'UrlDecode Me.Invoke(New Action(Function() Me.Text = "Status: receiving data from the add-on" Me.Invalidate() @@ -3039,7 +3148,7 @@ Public Class Main End If End If strRequest = rootPath & "Post_Single_Sucess.html" 'PostPage - SendHTMLResponse(strRequest, clientSocket) + SendHTMLResponse(strRequest, stream) Else Me.Invoke(New Action(Function() Me.Text = "Status: no video found" @@ -3049,7 +3158,7 @@ Public Class Main Dim ErrorPage As String = My.Resources.Post_error_Top + "no video found" + My.Resources.Post_error_Bottom My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\WebInterface\error_Page.html", ErrorPage, False) strRequest = rootPath & "error_Page.html" 'PostPage - SendHTMLResponse(strRequest, clientSocket) + SendHTMLResponse(strRequest, stream) End If Catch abort As ThreadAbortException Exit Sub @@ -3057,7 +3166,7 @@ Public Class Main Dim ErrorPage As String = My.Resources.Post_error_Top + ex.ToString + My.Resources.Post_error_Bottom My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\WebInterface\error_Page.html", ErrorPage, False) strRequest = rootPath & "error_Page.html" 'PostPage - SendHTMLResponse(strRequest, clientSocket) + SendHTMLResponse(strRequest, stream) End Try #End Region #Region "mass-dl" @@ -3096,14 +3205,14 @@ Public Class Main End Function)) End If strRequest = rootPath & "Post_Mass_Sucess.html" 'PostPage - SendHTMLResponse(strRequest, clientSocket) + SendHTMLResponse(strRequest, stream) Catch abort As ThreadAbortException Exit Sub Catch ex As Exception Dim ErrorPage As String = My.Resources.Post_error_Top + ex.ToString + My.Resources.Post_error_Bottom My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\WebInterface\error_Page.html", ErrorPage, False) strRequest = rootPath & "error_Page.html" 'PostPage - SendHTMLResponse(strRequest, clientSocket) + SendHTMLResponse(strRequest, stream) End Try #End Region #Region "funimation Einzeln" @@ -3203,69 +3312,105 @@ Public Class Main End If End If strRequest = rootPath & "Post_Single_Sucess.html" 'PostPage - SendHTMLResponse(strRequest, clientSocket) + SendHTMLResponse(strRequest, stream) Catch abort As ThreadAbortException Exit Sub Catch ex As Exception Dim ErrorPage As String = My.Resources.Post_error_Top + ex.ToString + My.Resources.Post_error_Bottom My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\WebInterface\error_Page.html", ErrorPage, False) strRequest = rootPath & "error_Page.html" 'PostPage - SendHTMLResponse(strRequest, clientSocket) + SendHTMLResponse(strRequest, stream) End Try #End Region Else strRequest = rootPath & "error_Page_default.html" 'PostPage - SendHTMLResponse(strRequest, clientSocket) + SendHTMLResponse(strRequest, stream) End If ElseIf strArray(0).Trim().ToUpper.Equals("GET") Then + 'Debug.WriteLine(Date.Now + " " + "found GET while procesing") - If InStr(htmlReq, "CRD_Handshake") Then - SendHTMLResponse("Handshake_Confirm", clientSocket) - Exit Sub - End If - + 'Debug.WriteLine(Date.Now + " " + strArray(1)) strRequest = strArray(1).Trim If strRequest.StartsWith("/") Then strRequest = strRequest.Substring(1) - End If - If strRequest.EndsWith("/") Or strRequest.Equals("") Then - strRequest = strRequest & defaultPage '"HTMLString" 'strRequest & defaultPage + End If + If strRequest.EndsWith("/") Or strRequest.Equals("") Then + 'Debug.WriteLine(Date.Now + " " + "it's index.html") + strRequest = strRequest & defaultPage '"HTMLString" 'strRequest & defaultPage + + End If + + 'If InStr(htmlReq, "CRD_Handshake") Then + ' 'Debug.WriteLine(Date.Now + " " + "it's a handshake") + ' SendHTMLResponse("Handshake_Confirm", stream) + 'Else + ' + 'End If strRequest = rootPath & strRequest - SendHTMLResponse(strRequest, clientSocket) + SendHTMLResponse(strRequest, stream) Else ' Not HTTP GET method + 'Debug.WriteLine(Date.Now + " " + "empty request, returning index.html") + 'Debug.WriteLine(Date.Now + " " + strArray(0)) strRequest = rootPath & defaultPage - SendHTMLResponse(strRequest, clientSocket) + SendHTMLResponse(strRequest, stream) End If - Catch abort As ThreadAbortException - Exit Sub + Catch ex As Exception Debug.WriteLine(ex.ToString()) Dim ErrorPage As String = My.Resources.Post_error_Top + ex.ToString + My.Resources.Post_error_Bottom My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\WebInterface\error_Page.html", ErrorPage, False) 'strRequest = rootPath & "error_Page.html" 'PostPage - SendHTMLResponse(Application.StartupPath + "\WebInterface\error_Page.html", clientSocket) - 'If clientSocket.Connected Then - ' clientSocket.Close() - 'End If + SendHTMLResponse(Application.StartupPath + "\WebInterface\error_Page.html", stream) + End Try End Sub ' Send HTTP Response - Private Sub SendHTMLResponse(ByVal httpRequest As String, ByVal clientSocket As Socket) + + + Private Sub SendHTMLResponse(ByVal httpRequest As String, ByVal stream As NetworkStream) Try Dim respByte() As Byte - If File.Exists(httpRequest) Then + If InStr(httpRequest, "index.html") Then + Debug.WriteLine(httpRequest) + respByte = System.Text.Encoding.UTF8.GetBytes(HTML) 'File.ReadAllBytes("") ' + + + ' Set HTML Header + Dim htmlHeader As String = + "HTTP/1.0 200 OK" & ControlChars.CrLf & + "Server: CRD 1.0" & ControlChars.CrLf & + "Content-Length: " & respByte.Length & ControlChars.CrLf & + "Content-Type: " & GetContentType(httpRequest) & + ControlChars.CrLf & ControlChars.CrLf + ' The content Length of HTML Header + Dim headerByte() As Byte = Encoding.UTF8.GetBytes(htmlHeader) + 'Debug.WriteLine("HTML Header: " & ControlChars.CrLf & htmlHeader) + ' Send HTML Header back to Web Browser + 'Dim response() As Byte = headerByte.Concat(respByte).ToArray() + + ' stream.Write(response, 0, response.Length) + 'Debug.WriteLine("sending headers") + stream.Write(headerByte, 0, headerByte.Length) + 'Debug.WriteLine("headers send") + 'Debug.WriteLine("sending content") + ' Send HTML Content back to Web Browser + stream.Write(respByte, 0, respByte.Length) + 'clientSocket.Send(respByte, 0, respByte.Length, SocketFlags.None) + ' Close HTTP Socket connection + 'Debug.WriteLine("content send") + ElseIf File.Exists(httpRequest) Then Debug.WriteLine(httpRequest) respByte = File.ReadAllBytes(httpRequest) @@ -3273,34 +3418,32 @@ Public Class Main Dim htmlHeader As String = "HTTP/1.0 200 OK" & ControlChars.CrLf & "Server: CRD 1.0" & ControlChars.CrLf & - "Content-Length: " & respByte.Length & ControlChars.CrLf & + "Content-Length: " & respByte.Length & ControlChars.CrLf & "Content-Type: " & GetContentType(httpRequest) & + "Connection: close" & ControlChars.CrLf & ControlChars.CrLf ' The content Length of HTML Header Dim headerByte() As Byte = Encoding.UTF8.GetBytes(htmlHeader) - 'Debug.WriteLine("HTML Header: " & ControlChars.CrLf & htmlHeader) ' Send HTML Header back to Web Browser - clientSocket.Send(headerByte, 0, headerByte.Length, SocketFlags.None) + stream.Write(headerByte, 0, headerByte.Length) ' Send HTML Content back to Web Browser - clientSocket.Send(respByte, 0, respByte.Length, SocketFlags.None) - ' Close HTTP Socket connection - clientSocket.Shutdown(SocketShutdown.Both) - clientSocket.Close() + stream.Write(respByte, 0, respByte.Length) ElseIf httpRequest = "Handshake_Confirm" Then respByte = System.Text.Encoding.UTF8.GetBytes("CRD_Handshake_Confirm") 'File.ReadAllBytes("") ' - Dim htmlHeader As String = "HTTP/1.0 200 OK" & ControlChars.CrLf & "Server: CRD 1.0" & ControlChars.CrLf & "Access-Control-Allow-Origin: *" & ControlChars.CrLf & "Content-Length: " & respByte.Length & ControlChars.CrLf & "Content-Type: text/plain" & - ControlChars.CrLf & ControlChars.CrLf + "Connection: close" & + ControlChars.CrLf & ControlChars.CrLf Dim headerByte() As Byte = Encoding.UTF8.GetBytes(htmlHeader) - clientSocket.Send(headerByte, 0, headerByte.Length, SocketFlags.None) - clientSocket.Send(respByte, 0, respByte.Length, SocketFlags.None) - clientSocket.Shutdown(SocketShutdown.Both) - clientSocket.Close() + stream.Write(headerByte, 0, headerByte.Length) + ' Send HTML Content back to Web Browser + stream.Write(respByte, 0, respByte.Length) + + Debug.WriteLine("content send") Else respByte = Encoding.UTF8.GetBytes(My.Resources.Error_404) 'File.ReadAllBytes(httpRequest) @@ -3309,29 +3452,27 @@ Public Class Main Dim htmlHeader As String = "HTTP/1.0 404 Not Found" & ControlChars.CrLf & "Server: WebServer 1.0" & ControlChars.CrLf & + "Connection: close" & ControlChars.CrLf & ControlChars.CrLf ' The content Length of HTML Header Dim headerByte() As Byte = Encoding.UTF8.GetBytes(htmlHeader) ' Send HTML Header back to Web Browser - clientSocket.Send(headerByte, 0, headerByte.Length, SocketFlags.None) + stream.Write(headerByte, 0, headerByte.Length) + + 'stream.Write(headerByte, 0, headerByte.Length, SocketFlags.None) ' Send HTML Content back to Web Browser - clientSocket.Send(respByte, 0, respByte.Length, SocketFlags.None) - ' Close HTTP Socket connection - clientSocket.Shutdown(SocketShutdown.Both) - clientSocket.Close() + stream.Write(respByte, 0, respByte.Length) End If - Catch abort As ThreadAbortException - Exit Sub Catch ex As Exception - 'Debug.WriteLine(ex.ToString()) - If clientSocket.Connected Then - clientSocket.Close() - End If + Debug.WriteLine(ex.ToString()) + End Try End Sub + + ' Get Content Type Private Function GetContentType(ByVal httpRequest As String) As String If (httpRequest.EndsWith("html")) Then @@ -3389,9 +3530,6 @@ Public Class Main network_scan.Show() End Sub - - - #End Region diff --git a/Crunchyroll Downloader/My Project/AssemblyInfo.vb b/Crunchyroll Downloader/My Project/AssemblyInfo.vb index 6a067ee..111423f 100644 --- a/Crunchyroll Downloader/My Project/AssemblyInfo.vb +++ b/Crunchyroll Downloader/My Project/AssemblyInfo.vb @@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/Crunchyroll Downloader/ProcessSleep.vb b/Crunchyroll Downloader/ProcessSleep.vb index c09acf2..24e352a 100644 --- a/Crunchyroll Downloader/ProcessSleep.vb +++ b/Crunchyroll Downloader/ProcessSleep.vb @@ -30,5 +30,17 @@ End Sub + Public Sub Pause_ms(ByVal ms As Integer) + + 'Programmausführung verzögern ******************************************************* + Dim stopWatch As New Stopwatch() + stopWatch.Start() + + Do Until stopWatch.Elapsed.TotalMilliseconds > ms + Application.DoEvents() + Loop + + stopWatch.Stop() + End Sub End Module diff --git a/Crunchyroll Downloader/bin/x86/Debug/Crunchyroll Downloader.exe b/Crunchyroll Downloader/bin/x86/Debug/Crunchyroll Downloader.exe index 7407eea..5a7db40 100644 Binary files a/Crunchyroll Downloader/bin/x86/Debug/Crunchyroll Downloader.exe and b/Crunchyroll Downloader/bin/x86/Debug/Crunchyroll Downloader.exe differ diff --git a/Crunchyroll Downloader/bin/x86/Debug/Crunchyroll Downloader.pdb b/Crunchyroll Downloader/bin/x86/Debug/Crunchyroll Downloader.pdb index 004dcaa..90ea40b 100644 Binary files a/Crunchyroll Downloader/bin/x86/Debug/Crunchyroll Downloader.pdb and b/Crunchyroll Downloader/bin/x86/Debug/Crunchyroll Downloader.pdb differ diff --git a/Crunchyroll Downloader/bin/x86/Debug/WebInterface/error_Page.html b/Crunchyroll Downloader/bin/x86/Debug/WebInterface/error_Page.html index 048e6d9..ec3c0c2 100644 --- a/Crunchyroll Downloader/bin/x86/Debug/WebInterface/error_Page.html +++ b/Crunchyroll Downloader/bin/x86/Debug/WebInterface/error_Page.html @@ -43,7 +43,7 @@

Failed!

System.IndexOutOfRangeException: Der Index war außerhalb des Arraybereichs. - bei Crunchyroll_Downloader.Main.ProcessRequest(Socket clientSocket) in D:\Projecte\Crunchyroll Downloader - v3.0-final\Crunchyroll-Downloader-v3.0\Crunchyroll Downloader\Main.vb:Zeile 2906.

+ bei Crunchyroll_Downloader.Main.ProcessRequest(NetworkStream stream, String htmlReq) in D:\Projecte\Crunchyroll Downloader - v3.0-final\Crunchyroll-Downloader-v3.0\Crunchyroll Downloader\Main.vb:Zeile 3178.

\ No newline at end of file diff --git a/Crunchyroll Downloader/einstellungen.Designer.vb b/Crunchyroll Downloader/einstellungen.Designer.vb index 7929ca2..4260192 100644 --- a/Crunchyroll Downloader/einstellungen.Designer.vb +++ b/Crunchyroll Downloader/einstellungen.Designer.vb @@ -30,6 +30,8 @@ Partial Class Einstellungen Me.TabPage4 = New System.Windows.Forms.TabPage() Me.TabControl2 = New MetroFramework.Controls.MetroTabControl() Me.TabPage5 = New MetroFramework.Controls.MetroTabPage() + Me.GroupBox14 = New System.Windows.Forms.GroupBox() + Me.CR_SoftSubDefault = New MetroFramework.Controls.MetroComboBox() Me.PictureBox2 = New System.Windows.Forms.PictureBox() Me.SoftSubs = New System.Windows.Forms.GroupBox() Me.CBesES = New MetroFramework.Controls.MetroCheckBox() @@ -108,6 +110,8 @@ Partial Class Einstellungen Me.NumericUpDown1 = New System.Windows.Forms.NumericUpDown() Me.TabControl1 = New MetroFramework.Controls.MetroTabControl() Me.TabPage6 = New MetroFramework.Controls.MetroTabPage() + Me.GroupBox13 = New System.Windows.Forms.GroupBox() + Me.FunSubDef = New MetroFramework.Controls.MetroComboBox() Me.GroupBox11 = New System.Windows.Forms.GroupBox() Me.CB_srt = New MetroFramework.Controls.MetroCheckBox() Me.CB_vtt = New MetroFramework.Controls.MetroCheckBox() @@ -141,6 +145,7 @@ Partial Class Einstellungen Me.TabPage4.SuspendLayout() Me.TabControl2.SuspendLayout() Me.TabPage5.SuspendLayout() + Me.GroupBox14.SuspendLayout() CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).BeginInit() Me.SoftSubs.SuspendLayout() Me.GB_SubLanguage.SuspendLayout() @@ -165,6 +170,7 @@ Partial Class Einstellungen CType(Me.NumericUpDown1, System.ComponentModel.ISupportInitialize).BeginInit() Me.TabControl1.SuspendLayout() Me.TabPage6.SuspendLayout() + Me.GroupBox13.SuspendLayout() Me.GroupBox11.SuspendLayout() Me.GroupBox10.SuspendLayout() Me.GroupBox7.SuspendLayout() @@ -209,10 +215,10 @@ Partial Class Einstellungen ' Me.TabPage4.BackColor = System.Drawing.Color.FromArgb(CType(CType(243, Byte), Integer), CType(CType(243, Byte), Integer), CType(CType(243, Byte), Integer)) Me.TabPage4.Controls.Add(Me.TabControl2) - Me.TabPage4.Location = New System.Drawing.Point(4, 35) + Me.TabPage4.Location = New System.Drawing.Point(4, 44) Me.TabPage4.Name = "TabPage4" Me.TabPage4.Padding = New System.Windows.Forms.Padding(3) - Me.TabPage4.Size = New System.Drawing.Size(493, 461) + Me.TabPage4.Size = New System.Drawing.Size(493, 452) Me.TabPage4.TabIndex = 3 Me.TabPage4.Text = "Crunchyroll" ' @@ -227,13 +233,14 @@ Partial Class Einstellungen Me.TabControl2.Margin = New System.Windows.Forms.Padding(0) Me.TabControl2.Name = "TabControl2" Me.TabControl2.SelectedIndex = 0 - Me.TabControl2.Size = New System.Drawing.Size(487, 455) + Me.TabControl2.Size = New System.Drawing.Size(487, 446) Me.TabControl2.TabIndex = 0 Me.TabControl2.UseSelectable = True ' 'TabPage5 ' Me.TabPage5.BackColor = System.Drawing.Color.FromArgb(CType(CType(243, Byte), Integer), CType(CType(243, Byte), Integer), CType(CType(243, Byte), Integer)) + Me.TabPage5.Controls.Add(Me.GroupBox14) Me.TabPage5.Controls.Add(Me.PictureBox2) Me.TabPage5.Controls.Add(Me.SoftSubs) Me.TabPage5.Controls.Add(Me.GB_SubLanguage) @@ -244,7 +251,7 @@ Partial Class Einstellungen Me.TabPage5.Location = New System.Drawing.Point(4, 44) Me.TabPage5.Name = "TabPage5" Me.TabPage5.Padding = New System.Windows.Forms.Padding(3) - Me.TabPage5.Size = New System.Drawing.Size(479, 407) + Me.TabPage5.Size = New System.Drawing.Size(479, 398) Me.TabPage5.TabIndex = 0 Me.TabPage5.Text = "Main" Me.TabPage5.VerticalScrollbarBarColor = True @@ -252,12 +259,40 @@ Partial Class Einstellungen Me.TabPage5.VerticalScrollbarSize = 10 Me.TabPage5.Visible = False ' + 'GroupBox14 + ' + Me.GroupBox14.BackColor = System.Drawing.Color.Transparent + Me.GroupBox14.Controls.Add(Me.CR_SoftSubDefault) + Me.GroupBox14.Font = New System.Drawing.Font("Arial", 9.75!) + Me.GroupBox14.ForeColor = System.Drawing.Color.Black + Me.GroupBox14.Location = New System.Drawing.Point(6, 242) + Me.GroupBox14.Name = "GroupBox14" + Me.GroupBox14.Size = New System.Drawing.Size(467, 69) + Me.GroupBox14.TabIndex = 57 + Me.GroupBox14.TabStop = False + Me.GroupBox14.Text = "default subtitle" + ' + 'CR_SoftSubDefault + ' + Me.CR_SoftSubDefault.DropDownHeight = 250 + Me.CR_SoftSubDefault.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.CR_SoftSubDefault.FormattingEnabled = True + Me.CR_SoftSubDefault.IntegralHeight = False + Me.CR_SoftSubDefault.ItemHeight = 23 + Me.CR_SoftSubDefault.Items.AddRange(New Object() {"[Disabled]"}) + Me.CR_SoftSubDefault.Location = New System.Drawing.Point(69, 30) + Me.CR_SoftSubDefault.Name = "CR_SoftSubDefault" + Me.CR_SoftSubDefault.Size = New System.Drawing.Size(326, 29) + Me.CR_SoftSubDefault.Sorted = True + Me.CR_SoftSubDefault.TabIndex = 33 + Me.CR_SoftSubDefault.UseSelectable = True + ' 'PictureBox2 ' Me.PictureBox2.BackColor = System.Drawing.Color.Transparent Me.PictureBox2.Cursor = System.Windows.Forms.Cursors.Hand Me.PictureBox2.Image = Global.Crunchyroll_Downloader.My.Resources.Resources.crdsettings_setUScookie_button - Me.PictureBox2.Location = New System.Drawing.Point(152, 253) + Me.PictureBox2.Location = New System.Drawing.Point(162, 351) Me.PictureBox2.Name = "PictureBox2" Me.PictureBox2.Size = New System.Drawing.Size(150, 30) Me.PictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize @@ -431,7 +466,7 @@ Partial Class Einstellungen Me.TabPage3.Location = New System.Drawing.Point(4, 35) Me.TabPage3.Name = "TabPage3" Me.TabPage3.Padding = New System.Windows.Forms.Padding(3) - Me.TabPage3.Size = New System.Drawing.Size(479, 416) + Me.TabPage3.Size = New System.Drawing.Size(479, 407) Me.TabPage3.TabIndex = 3 Me.TabPage3.Text = "Subtile Download" Me.TabPage3.VerticalScrollbarBarColor = True @@ -970,10 +1005,10 @@ Partial Class Einstellungen Me.TabPage1.HorizontalScrollbarBarColor = True Me.TabPage1.HorizontalScrollbarHighlightOnWheel = False Me.TabPage1.HorizontalScrollbarSize = 10 - Me.TabPage1.Location = New System.Drawing.Point(4, 44) + Me.TabPage1.Location = New System.Drawing.Point(4, 35) Me.TabPage1.Name = "TabPage1" Me.TabPage1.Padding = New System.Windows.Forms.Padding(3) - Me.TabPage1.Size = New System.Drawing.Size(493, 452) + Me.TabPage1.Size = New System.Drawing.Size(493, 461) Me.TabPage1.TabIndex = 0 Me.TabPage1.Text = " Main" Me.TabPage1.VerticalScrollbar = True @@ -1190,7 +1225,7 @@ Partial Class Einstellungen Me.TabControl1.FontWeight = MetroFramework.MetroTabControlWeight.Regular Me.TabControl1.Location = New System.Drawing.Point(22, 60) Me.TabControl1.Name = "TabControl1" - Me.TabControl1.SelectedIndex = 0 + Me.TabControl1.SelectedIndex = 3 Me.TabControl1.Size = New System.Drawing.Size(501, 500) Me.TabControl1.TabIndex = 38 Me.TabControl1.UseSelectable = True @@ -1198,6 +1233,7 @@ Partial Class Einstellungen 'TabPage6 ' Me.TabPage6.BackColor = System.Drawing.Color.FromArgb(CType(CType(243, Byte), Integer), CType(CType(243, Byte), Integer), CType(CType(243, Byte), Integer)) + Me.TabPage6.Controls.Add(Me.GroupBox13) Me.TabPage6.Controls.Add(Me.GroupBox11) Me.TabPage6.Controls.Add(Me.GroupBox10) Me.TabPage6.Controls.Add(Me.GroupBox7) @@ -1205,10 +1241,10 @@ Partial Class Einstellungen Me.TabPage6.HorizontalScrollbarBarColor = True Me.TabPage6.HorizontalScrollbarHighlightOnWheel = False Me.TabPage6.HorizontalScrollbarSize = 10 - Me.TabPage6.Location = New System.Drawing.Point(4, 35) + Me.TabPage6.Location = New System.Drawing.Point(4, 44) Me.TabPage6.Name = "TabPage6" Me.TabPage6.Padding = New System.Windows.Forms.Padding(3) - Me.TabPage6.Size = New System.Drawing.Size(493, 461) + Me.TabPage6.Size = New System.Drawing.Size(493, 452) Me.TabPage6.TabIndex = 4 Me.TabPage6.Text = "Funimation" Me.TabPage6.VerticalScrollbarBarColor = True @@ -1216,6 +1252,34 @@ Partial Class Einstellungen Me.TabPage6.VerticalScrollbarSize = 10 Me.TabPage6.Visible = False ' + 'GroupBox13 + ' + Me.GroupBox13.BackColor = System.Drawing.Color.Transparent + Me.GroupBox13.Controls.Add(Me.FunSubDef) + Me.GroupBox13.Font = New System.Drawing.Font("Arial", 9.75!) + Me.GroupBox13.ForeColor = System.Drawing.Color.Black + Me.GroupBox13.Location = New System.Drawing.Point(6, 270) + Me.GroupBox13.Name = "GroupBox13" + Me.GroupBox13.Size = New System.Drawing.Size(475, 69) + Me.GroupBox13.TabIndex = 56 + Me.GroupBox13.TabStop = False + Me.GroupBox13.Text = "default subtitle" + ' + 'FunSubDef + ' + Me.FunSubDef.DropDownHeight = 250 + Me.FunSubDef.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.FunSubDef.FormattingEnabled = True + Me.FunSubDef.IntegralHeight = False + Me.FunSubDef.ItemHeight = 23 + Me.FunSubDef.Items.AddRange(New Object() {"[Disabled]"}) + Me.FunSubDef.Location = New System.Drawing.Point(69, 30) + Me.FunSubDef.Name = "FunSubDef" + Me.FunSubDef.Size = New System.Drawing.Size(326, 29) + Me.FunSubDef.Sorted = True + Me.FunSubDef.TabIndex = 33 + Me.FunSubDef.UseSelectable = True + ' 'GroupBox11 ' Me.GroupBox11.BackColor = System.Drawing.Color.Transparent @@ -1272,7 +1336,7 @@ Partial Class Einstellungen Me.GroupBox10.Controls.Add(Me.Fun_Dub_Over) Me.GroupBox10.Font = New System.Drawing.Font("Arial", 9.75!) Me.GroupBox10.ForeColor = System.Drawing.Color.Black - Me.GroupBox10.Location = New System.Drawing.Point(6, 270) + Me.GroupBox10.Location = New System.Drawing.Point(6, 345) Me.GroupBox10.Name = "GroupBox10" Me.GroupBox10.Size = New System.Drawing.Size(475, 69) Me.GroupBox10.TabIndex = 55 @@ -1590,6 +1654,7 @@ Partial Class Einstellungen Me.TabControl2.ResumeLayout(False) Me.TabPage5.ResumeLayout(False) Me.TabPage5.PerformLayout() + Me.GroupBox14.ResumeLayout(False) CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).EndInit() Me.SoftSubs.ResumeLayout(False) Me.SoftSubs.PerformLayout() @@ -1622,6 +1687,7 @@ Partial Class Einstellungen CType(Me.NumericUpDown1, System.ComponentModel.ISupportInitialize).EndInit() Me.TabControl1.ResumeLayout(False) Me.TabPage6.ResumeLayout(False) + Me.GroupBox13.ResumeLayout(False) Me.GroupBox11.ResumeLayout(False) Me.GroupBox11.PerformLayout() Me.GroupBox10.ResumeLayout(False) @@ -1751,4 +1817,8 @@ Partial Class Einstellungen Friend WithEvents DD_Episode_Prefix As MetroFramework.Controls.MetroComboBox Friend WithEvents DD_Season_Prefix As MetroFramework.Controls.MetroComboBox Friend WithEvents http_support As MetroFramework.Controls.MetroComboBox + Friend WithEvents GroupBox13 As GroupBox + Friend WithEvents FunSubDef As MetroFramework.Controls.MetroComboBox + Friend WithEvents GroupBox14 As GroupBox + Friend WithEvents CR_SoftSubDefault As MetroFramework.Controls.MetroComboBox End Class diff --git a/Crunchyroll Downloader/einstellungen.resx b/Crunchyroll Downloader/einstellungen.resx index e809bf5..f49b9b4 100644 --- a/Crunchyroll Downloader/einstellungen.resx +++ b/Crunchyroll Downloader/einstellungen.resx @@ -126,6 +126,9 @@ 118, 20 + + 118, 20 + 332, 20 diff --git a/Crunchyroll Downloader/einstellungen.vb b/Crunchyroll Downloader/einstellungen.vb index 3e79d77..dfb087e 100644 --- a/Crunchyroll Downloader/einstellungen.vb +++ b/Crunchyroll Downloader/einstellungen.vb @@ -251,6 +251,42 @@ Public Class Einstellungen Catch ex As Exception End Try + + If Main.DefaultSubFunimation = "en" Then + FunSubDef.SelectedItem = "English" + ElseIf Main.DefaultSubFunimation = "pt" Then + FunSubDef.SelectedItem = "Português (Brasil)" + ElseIf Main.DefaultSubFunimation = "es" Then + FunSubDef.SelectedItem = "Español (LA)" + Else + FunSubDef.SelectedItem = "[Disabled]" + 'FunimationHardsub.Checked = True + End If + + + + If Main.DefaultSubCR = "deDE" Then + CR_SoftSubDefault.SelectedItem = "Deutsch" + ElseIf Main.DefaultSubCR = "enUS" Then + CR_SoftSubDefault.SelectedItem = "English" + ElseIf Main.DefaultSubCR = "ptBR" Then + CR_SoftSubDefault.SelectedItem = "Português (Brasil)" + ElseIf Main.DefaultSubCR = "esLA" Then + CR_SoftSubDefault.SelectedItem = "Español (LA)" + ElseIf Main.DefaultSubCR = "frFR" Then + CR_SoftSubDefault.SelectedItem = "Français (France)" + ElseIf Main.DefaultSubCR = "arME" Then + CR_SoftSubDefault.SelectedItem = "العربية (Arabic)" + ElseIf Main.DefaultSubCR = "ruRU" Then + CR_SoftSubDefault.SelectedItem = "Русский (Russian)" + ElseIf Main.DefaultSubCR = "itIT" Then + CR_SoftSubDefault.SelectedItem = "Italiano (Italian)" + ElseIf Main.DefaultSubCR = "esES" Then + CR_SoftSubDefault.SelectedItem = "Español (España)" + Else + CR_SoftSubDefault.SelectedItem = "[Disabled]" + End If + End Sub Private Sub PictureBox4_Click(sender As Object, e As EventArgs) Handles pictureBox4.Click @@ -369,6 +405,48 @@ Public Class Einstellungen End If + If CR_SoftSubDefault.SelectedItem.ToString = "English" Then + Main.DefaultSubCR = "enUS" + rk.SetValue("DefaultSubCR", "enUS", RegistryValueKind.String) + + ElseIf CR_SoftSubDefault.SelectedItem.ToString = "Deutsch" Then + Main.DefaultSubCR = "deDE" + rk.SetValue("DefaultSubCR", "deDE", RegistryValueKind.String) + + ElseIf CR_SoftSubDefault.SelectedItem.ToString = "Português (Brasil)" Then + Main.DefaultSubCR = "ptBR" + rk.SetValue("DefaultSubCR", "ptBR", RegistryValueKind.String) + + ElseIf CR_SoftSubDefault.SelectedItem.ToString = "Español (LA)" Then + Main.DefaultSubCR = "esLA" + rk.SetValue("DefaultSubCR", "esLA", RegistryValueKind.String) + + ElseIf CR_SoftSubDefault.SelectedItem.ToString = "Français (France)" Then + Main.DefaultSubCR = "frFR" + rk.SetValue("DefaultSubCR", "frFR", RegistryValueKind.String) + + ElseIf CR_SoftSubDefault.SelectedItem.ToString = "العربية (Arabic)" Then + Main.DefaultSubCR = "arME" + rk.SetValue("DefaultSubCR", "arME", RegistryValueKind.String) + + ElseIf CR_SoftSubDefault.SelectedItem.ToString = "Русский (Russian)" Then + Main.DefaultSubCR = "ruRU" + rk.SetValue("DefaultSubCR", "ruRU", RegistryValueKind.String) + + ElseIf CR_SoftSubDefault.SelectedItem.ToString = "Italiano (Italian)" Then + Main.DefaultSubCR = "itIT" + rk.SetValue("DefaultSubCR", "itIT", RegistryValueKind.String) + + ElseIf CR_SoftSubDefault.SelectedItem.ToString = "Español (España)" Then + Main.DefaultSubCR = "esES" + rk.SetValue("DefaultSubCR", "esES", RegistryValueKind.String) + + ElseIf CR_SoftSubDefault.SelectedItem.ToString = "[Disabled]" Then + Main.DefaultSubCR = "None" + rk.SetValue("DefaultSubCR", "Disabled", RegistryValueKind.String) + + End If + If CR_Filename.Text = "[episode number]" Then Main.CR_NameMethode = 0 rk.SetValue("CR_NameMethode", 0, RegistryValueKind.String) @@ -445,6 +523,24 @@ Public Class Einstellungen End If + If FunSubDef.SelectedItem.ToString = "[Disabled]" Then + Main.DefaultSubFunimation = "Disabled" + rk.SetValue("DefaultSubFunimation", "Disabled", RegistryValueKind.String) + + ElseIf FunSubDef.SelectedItem.ToString = "English" Then + Main.DefaultSubFunimation = "en" + rk.SetValue("DefaultSubFunimation", "en", RegistryValueKind.String) + + ElseIf FunSubDef.SelectedItem.ToString = "Português (Brasil)" Then + Main.DefaultSubFunimation = "pt" + rk.SetValue("DefaultSubFunimation", "pt", RegistryValueKind.String) + + ElseIf FunSubDef.SelectedItem.ToString = "Español (LA)" Then + Main.DefaultSubFunimation = "es" + rk.SetValue("DefaultSubFunimation", "es", RegistryValueKind.String) + + End If + Main.SubFunimation.Clear() If CB_fun_eng.Checked = True Then Main.SubFunimation.Add("en") @@ -959,6 +1055,143 @@ Public Class Einstellungen End Sub + Private Sub CB_fun_eng_CheckedChanged(sender As Object, e As EventArgs) Handles CB_fun_eng.CheckedChanged + If CB_fun_eng.Checked = True Then + FunSubDef.Items.Add("English") + Else + FunSubDef.Items.Remove("English") + If FunSubDef.Text = "English" Then + FunSubDef.SelectedItem = "[Disabled]" + End If + End If + End Sub + + Private Sub CB_fun_es_CheckedChanged(sender As Object, e As EventArgs) Handles CB_fun_es.CheckedChanged + If CB_fun_es.Checked = True Then + FunSubDef.Items.Add("Español (LA)") + Else + FunSubDef.Items.Remove("Español (LA)") + If FunSubDef.Text = "Español (LA)" Then + FunSubDef.SelectedItem = "[Disabled]" + End If + End If + End Sub + + Private Sub CB_fun_ptbr_CheckedChanged(sender As Object, e As EventArgs) Handles CB_fun_ptbr.CheckedChanged + If CB_fun_ptbr.Checked = True Then + FunSubDef.Items.Add("Português (Brasil)") + Else + FunSubDef.Items.Remove("Português (Brasil)") + If FunSubDef.Text = "Português (Brasil)" Then + FunSubDef.SelectedItem = "[Disabled]" + End If + End If + End Sub + +#Region "CR_default soft sub" + + + Private Sub CBesES_CheckedChanged(sender As Object, e As EventArgs) Handles CBesES.CheckedChanged + If CBesES.Checked = True Then + CR_SoftSubDefault.Items.Add(CBesES.Text) + Else + CR_SoftSubDefault.Items.Remove(CBesES.Text) + If CR_SoftSubDefault.Text = CBesES.Text Then + CR_SoftSubDefault.SelectedItem = "[Disabled]" + End If + End If + End Sub + + Private Sub CBitIT_CheckedChanged(sender As Object, e As EventArgs) Handles CBitIT.CheckedChanged + If CBitIT.Checked = True Then + CR_SoftSubDefault.Items.Add(CBitIT.Text) + Else + CR_SoftSubDefault.Items.Remove(CBitIT.Text) + If CR_SoftSubDefault.Text = CBitIT.Text Then + CR_SoftSubDefault.SelectedItem = "[Disabled]" + End If + End If + End Sub + + Private Sub CBruRU_CheckedChanged(sender As Object, e As EventArgs) Handles CBruRU.CheckedChanged + If CBruRU.Checked = True Then + CR_SoftSubDefault.Items.Add(CBruRU.Text) + Else + CR_SoftSubDefault.Items.Remove(CBruRU.Text) + If CR_SoftSubDefault.Text = CBruRU.Text Then + CR_SoftSubDefault.SelectedItem = "[Disabled]" + End If + End If + End Sub + + Private Sub CBarME_CheckedChanged(sender As Object, e As EventArgs) Handles CBarME.CheckedChanged + If CBarME.Checked = True Then + CR_SoftSubDefault.Items.Add(CBarME.Text) + Else + CR_SoftSubDefault.Items.Remove(CBarME.Text) + If CR_SoftSubDefault.Text = CBarME.Text Then + CR_SoftSubDefault.SelectedItem = "[Disabled]" + End If + End If + End Sub + + Private Sub CBfrFR_CheckedChanged(sender As Object, e As EventArgs) Handles CBfrFR.CheckedChanged + If CBfrFR.Checked = True Then + CR_SoftSubDefault.Items.Add(CBfrFR.Text) + Else + CR_SoftSubDefault.Items.Remove(CBfrFR.Text) + If CR_SoftSubDefault.Text = CBfrFR.Text Then + CR_SoftSubDefault.SelectedItem = "[Disabled]" + End If + End If + End Sub + + Private Sub CBesLA_CheckedChanged(sender As Object, e As EventArgs) Handles CBesLA.CheckedChanged + If CBesLA.Checked = True Then + CR_SoftSubDefault.Items.Add(CBesLA.Text) + Else + CR_SoftSubDefault.Items.Remove(CBesLA.Text) + If CR_SoftSubDefault.Text = CBesLA.Text Then + CR_SoftSubDefault.SelectedItem = "[Disabled]" + End If + End If + End Sub + + Private Sub CBptBR_CheckedChanged(sender As Object, e As EventArgs) Handles CBptBR.CheckedChanged + If CBptBR.Checked = True Then + CR_SoftSubDefault.Items.Add(CBptBR.Text) + Else + CR_SoftSubDefault.Items.Remove(CBptBR.Text) + If CR_SoftSubDefault.Text = CBptBR.Text Then + CR_SoftSubDefault.SelectedItem = "[Disabled]" + End If + End If + End Sub + + Private Sub CBdeDE_CheckedChanged(sender As Object, e As EventArgs) Handles CBdeDE.CheckedChanged + If CBdeDE.Checked = True Then + CR_SoftSubDefault.Items.Add(CBdeDE.Text) + Else + CR_SoftSubDefault.Items.Remove(CBdeDE.Text) + If CR_SoftSubDefault.Text = CBdeDE.Text Then + CR_SoftSubDefault.SelectedItem = "[Disabled]" + End If + End If + End Sub + + Private Sub CBenUS_CheckedChanged(sender As Object, e As EventArgs) Handles CBenUS.CheckedChanged + If CBenUS.Checked = True Then + CR_SoftSubDefault.Items.Add(CBenUS.Text) + Else + CR_SoftSubDefault.Items.Remove(CBenUS.Text) + If CR_SoftSubDefault.Text = CBenUS.Text Then + CR_SoftSubDefault.SelectedItem = "[Disabled]" + End If + End If + End Sub + +#End Region + diff --git a/Crunchyroll Downloader/obj/x86/Debug/Crunchyroll Downloader.exe b/Crunchyroll Downloader/obj/x86/Debug/Crunchyroll Downloader.exe index 7407eea..5a7db40 100644 Binary files a/Crunchyroll Downloader/obj/x86/Debug/Crunchyroll Downloader.exe and b/Crunchyroll Downloader/obj/x86/Debug/Crunchyroll Downloader.exe differ diff --git a/Crunchyroll Downloader/obj/x86/Debug/Crunchyroll Downloader.pdb b/Crunchyroll Downloader/obj/x86/Debug/Crunchyroll Downloader.pdb index 004dcaa..90ea40b 100644 Binary files a/Crunchyroll Downloader/obj/x86/Debug/Crunchyroll Downloader.pdb and b/Crunchyroll Downloader/obj/x86/Debug/Crunchyroll Downloader.pdb differ diff --git a/Crunchyroll Downloader/obj/x86/Debug/Crunchyroll Downloader.vbproj.GenerateResource.cache b/Crunchyroll Downloader/obj/x86/Debug/Crunchyroll Downloader.vbproj.GenerateResource.cache index b81c01d..523b4c5 100644 Binary files a/Crunchyroll Downloader/obj/x86/Debug/Crunchyroll Downloader.vbproj.GenerateResource.cache and b/Crunchyroll Downloader/obj/x86/Debug/Crunchyroll Downloader.vbproj.GenerateResource.cache differ