alexander-pick / MKMTool

MKMTool ist a helper application I wrote for tinkering around with optimization of sale processes on magiccardmarket.eu and the idea of automisation of some tasks most people wouldn’t be able to get done by pure manpower.
GNU Affero General Public License v3.0
65 stars 15 forks source link

Problem with starting/error #18

Closed Bluelight1997 closed 4 years ago

Bluelight1997 commented 4 years ago

Hello, I have a problem to open the programm. image I hope it helps others aswell.

Bluelight1997 commented 4 years ago
  1. Aug. 2019 17:30:04, version: 0.7.0.2 Error with initializing product list and account info: Ungültiges Zeichen in der angegebenen Codierung. Zeile 20, Position 38.
tomasjanak commented 4 years ago

Are you compiling it yourself? If so, what version of visual studio are you using? I had a guy from Iceland contacting me with the same error on visual studio 2019 and then it worked for older version, but there must be some better solution, I've been running it on VS15, 17 and now 19 myself and never had this problem....

Bluelight1997 commented 4 years ago

i try using VS 15 now i give feedback if the problem has solved.

Bluelight1997 commented 4 years ago

Soooo I have VS15, startet it and....yeah when i start the projekt i become this image any idea?

tomasjanak commented 4 years ago

Not really to be honest. If you understand programming you can run it in the debug mode and try to find what is wrong yourself, the problem occurs in the MainView.cs in the initialize method (line 128+). My guess is there is some problem with encoding, but I am not sure what exactly. You are clearly using a german version of VS so I'm guessing it is defaulting to some encoding that do not mesh well with what Cardmarket is returning....but it is strange because everything should be UTF8 and have no problems processing german characters (like letters with umlaut etc.). Maybe using german VS actually switches something to use a non-UTF8 encoding? That seems unlikely, but don't know what else can be going on.

The "line 20" referenced in the first error message is coming from parsing your account info send from MKM. Line 20 contains the first name (I think...maybe could also be surname), if your name (or surname) contains something non-english (most likely umlaut) that would confirm my guess...but doesn't really offer solution.

You can try installing VS in english and see if it behaves the same (or download the version of MKMTool I compiled on my system https://tomasjanak.github.io/MKMTool0.7.0.2.zip, if you trust me :) ). Otherwise I am out of ideas, sorry. I can't even easily replicate the problem, because it's the part that processes your personal data, so I can't really replicate it on my part (I can't change the name on my MKM account). If you can confirm that it works on english version of VS and not on german one, I can maybe one day switch my VS to german and see if I can replicate it.

alexander-pick commented 4 years ago

Do you have the API key and stuff set?

Bluelight1997 commented 4 years ago

yeah i have i load a video to youtube to show you https://www.youtube.com/watch?v=s9qswUYi5KQ&feature=youtu.be

alexander-pick commented 4 years ago

Looks like the entire communitcation with the server goes bad. You need to try to debug the HTTP requests to see what is wrong. You can use either Charles (paid) or Fiddler (free) to do that. Set the Proxy as proxy for windows, install the CA cert and check what is wrong.

tomasjanak commented 4 years ago

Try adding the following line to MKMInteract.cs after line 97 (which is StreamReader s = new StreamReader(response.GetResponseStream());):

using (StreamWriter sw = new StreamWriter("out.xml")) sw.Write(s.ReadToEnd());

Then compile MKMTool again, run it and let it crash. It should save a file called out.xml next to the .exe file. If you open it, it should look like this:

<?xml version="1.0" encoding="utf-8"?>
<response>
  <account>
    <idUser>SOMENUMBER</idUser>
    <username>YOUR_MKM_USERNAME</username>
    <country>YOUR_COUNTRYCODE</country>
    <isCommercial>SOMENUMBER</isCommercial>
    <maySell>true</maySell>
    <sellerActivation>SOMENUMBER</sellerActivation>
    <riskGroup>SOMENUMBER</riskGroup>
    <lossPercentage>0 - 2%</lossPercentage>
    <reputation>SOMENUMBER</reputation>
    <shipsFast>SOMENUMBER</shipsFast>
    <sellCount>SOMENUMBER</sellCount>
    <soldItems>SOMENUMBER</soldItems>
    <avgShippingTime>SOMENUMBER</avgShippingTime>
    <onVacation>false</onVacation>
    <idDisplayLanguage>SOMENUMBER</idDisplayLanguage>
    <name>
      <firstName>YOUR_NAME</firstName>
      <lastName>YOUR_SURNAME</lastName>
    </name>
    <homeAddress>
      <name>YOUR_NAME_AND_SURNAME</name>
      <extra></extra>
      <street>STREET</street>
      <zip>ZIPCODE</zip>
      <city>YOURCITY</city>
      <country>YOUR_COUNTRY</country>
    </homeAddress>
    <email>YOUREMAIL</email>
    <phoneNumber>YOUR_PHONENUMBER</phoneNumber>
    <vat></vat>
    <legalInformation></legalInformation>
    <registerDate>DATE</registerDate>
    <isActivated>true</isActivated>
    <moneyDetails>
      <totalBalance>SOMENUMBER</totalBalance>
      <moneyBalance>SOMENUMBER</moneyBalance>
      <bonusBalance>SOMENUMBER</bonusBalance>
      <unpaidAmount>SOMENUMBER</unpaidAmount>
      <providerRechargeAmount>SOMENUMBER</providerRechargeAmount>
    </moneyDetails>
    <bankAccount>
      <accountOwner>YOURNAME</accountOwner>
      <iban>YOUR_IBAN</iban>
      <bic>YOUR_BANKS_BIC</bic>
      <bankName>YOUR_BANKS_NAME</bankName>
    </bankAccount>
    <articlesInShoppingCart>SOMENUMBER</articlesInShoppingCart>
    <unreadMessages>SOMENUMBER</unreadMessages>
  </account>
  <links>
    <rel>self</rel>
    <href>/account</href>
    <method>GET</method>
  </links>
  <links>
    <rel>vacation</rel>
    <href>/account/vacation</href>
    <method>PUT</method>
  </links>
  <links>
    <rel>language</rel>
    <href>/account/language</href>
    <method>PUT</method>
  </links>
  <links>
    <rel>list_message_threads</rel>
    <href>/account/messages</href>
    <method>GET</method>
  </links>
  <links>
    <rel>redeem_coupon</rel>
    <href>/account/coupon</href>
    <method>POST</method>
  </links>
</response>

I replaced all the personal data with things like SOMENUMBER, YOUR_NAME etc. - in place of that should be your actual name and other data.

This should be the data it is complaining about with those errors about line 20 and as I said, the line 20 is your name. Check (don't post it here, it's your personal data) if it is all correct or if you see something strange, like your name containing some wrong characters. Maybe we can see something from that.

Bluelight1997 commented 4 years ago

nope i still have the error and no file is created. I upload a video again. https://www.youtube.com/watch?v=R278QWOnqzA&feature=youtu.be I post here my mail adress to contact me privatly. maybe we figured out. Down4Care@gmail.com ( Dont worry is a Spam adress )

tomasjanak commented 4 years ago

The video is unavailable...but anyway, if the file is not created, than it really must be failing with the authorization...so are you sure you have entered the correct values in the confix.xml file? All the four entries? And on MKM, does it say the token is for "dedicated app"?

Bluelight1997 commented 4 years ago

image yes all on the right place image and in the MKMInteract.cs too

Bluelight1997 commented 4 years ago

and the out.xml have i created i experimented/try

tomasjanak commented 4 years ago

There's the problem - the values in the xml files are inserted in between the tags, not over them. So like this (replace 123456798 with the actual values):

<config>
  <appToken>123456798</appToken>
  <appSecret>123456798</appSecret>
  <accessToken>123456798</accessToken>
  <accessSecret>123456789</accessSecret>
</config>
Bluelight1997 commented 4 years ago

im such an idiot... sorry for the interuption im so so sorry it worked ^^ thanks