elsensee / plf-helper Goto Github PK
View Code? Open in Web Editor NEWThe PLF-Helper is a tool for www.preislistenpfleger.de
Home Page: http://elsensee.github.io/PLF-Helper
The PLF-Helper is a tool for www.preislistenpfleger.de
Home Page: http://elsensee.github.io/PLF-Helper
At the moment they're handled like the other plants. Same array, same way. Everything's the same... Even in the parser.
Better if they would be excluded from the values array and in general handled different.
Would make a lot easier.
This will help A LOT. Because the latest ListFeed is not always the wanted.
Currently the strings in different languages are read from an assembly stream.
This is very lol. 😀
I should better copy them to the output directory if they don't exist at startup so it's easier to debug them.
Further instead of opening the handle everytime I want to access a string, it would be better to hold an array of them in the memory. (This would increase the performance A LOT because there's a regular expression running through everything everytime I access something there.. WHOA)
Since my current regular expressions are a bit hacky I want to rewrite them.
Pros:
Cons:
The decimal mark must depend on the server we're trying to upload - not the system's language.
Have to do that as far as I can. Of course some can't. (Like the ones in the localization manager itself because of some obvious reasons)
Yeah right - in the old version I used goto. (Maybe a reason why I never published the code ^^)
goto is old... damn! goto should never be used! NEVER EVER! Don't use it in your own program!!!!11 Don't even think about it!
It just creates a mess - a HUGE mess...
Using goto is just wrong!
Would be better I guess.
That spreadsheet class wraps itself around the Spreadsheet API by Google.
So I can just call a single function to do the work instead of calling hundreds of them in the Spreadsheet API. (literally)
Again a note to myself:
The Parser class is awesome... I did a great job. 😀
But... the main method provides in fact TWO return values. One is the "real" return value, a boolean which is true if something's changed in the values array.
And the other one is the changed values array which is given by reference.
And if parameters are given by reference it is not good code because that method does too much!
So instead I should better just introduce a public boolean value in the class which is set to true by the parse function(s) and can then be looked up by the calling function.
And everythings ok again. :) ❤️
Zwischenablage:
Willkommen auf dem großen Marktplatz!
Sieh dich in Ruhe um oder verkaufe etwas an deinem Stand.
Aktuelle Angebote
Anzahl Produkt Verkäufer Preis/Stk. Gesamt Filter löschen - alle Angebote zeigen
8 Coins Der Gute Mensch 19.700,00 wT 157.600,00 wT kaufen
10 Coins Silbersee 19.899,00 wT 198.990,00 wT kaufen
9 Coins papasacker 19.925,00 wT 179.325,00 wT kaufen
10 Coins paradies-chen 19.950,00 wT 199.500,00 wT kaufen
7 Coins bibisgarten 20.300,00 wT 142.100,00 wT kaufen
6 Coins Gruenehoelle2 20.490,00 wT 122.940,00 wT kaufen
4 Coins papasacker 20.500,00 wT 82.000,00 wT kaufen
19 Coins Der Gute Mensch 21.000,00 wT 399.000,00 wT kaufen
1 Coins Hibiskus 30.000,00 wT 30.000,00 wT kaufen
2 Coins waldeshoe 43.000,00 wT 86.000,00 wT kaufen
5 Coins Blumenloge 65.000,88 wT 325.004,40 wT kaufen
4 Coins Blumenloge 99.884,86 wT 399.539,44 wT kaufen
1 Coins GroW 120.000,00 wT 120.000,00 wT kaufen
2 Coins waldeshoe 650.000,00 wT 1.300.000,00 wT kaufen
Dein Marktstand Produkt Übersicht
Fehler:
************** Ausnahmetext **************
System.FormatException: Die Eingabezeichenfolge hat das falsche Format.
bei System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
bei System.Number.ParseSingle(String value, NumberStyles options, NumberFormatInfo numfmt)
bei System.Single.Parse(String s, NumberStyles style, NumberFormatInfo info)
bei Parser.Parser.ParseMarket(Match match, Single[]& preise, String[] pflanzenNamen)
bei PreislistenpflegerHelper.formPLF.clipboardTimer_Tick(Object sender, EventArgs e)
bei System.Windows.Forms.Timer.OnTick(EventArgs e)
bei System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Geladene Assemblys **************
mscorlib
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5477 (Win7SP1GDR.050727-5400).
Preislistenpfleger Helper
Assembly-Version: 0.9.1.1.
Win32-Version: 0.9.1.1.
System
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400).
System.Windows.Forms
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5468 (Win7SP1GDR.050727-5400).
System.Drawing
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400).
System.Configuration
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5476 (Win7SP1GDR.050727-5400).
System.Xml
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5476 (Win7SP1GDR.050727-5400).
Google.GData.Spreadsheets
Assembly-Version: 1.8.0.0.
Win32-Version: 1.8.0.0.
Google.GData.Client
Assembly-Version: 1.8.0.0.
Win32-Version: 1.8.0.0.
System.Core
Assembly-Version: 3.5.0.0.
Win32-Version: 3.5.30729.5420 built by: Win7SP1.
Preislistenpfleger Helper.resources
Assembly-Version: 0.9.1.1.
Win32-Version: 0.9.1.1.
mscorlib.resources
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5477 (Win7SP1GDR.050727-5400).
System.resources
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5420 (Win7SP1.050727-5400).
Parser
Assembly-Version: 1.0.0.0.
Win32-Version: 1.0.0.0.
Enums
Assembly-Version: 1.0.0.0.
Win32-Version: 1.0.0.0.
System.Windows.Forms.resources
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5420 (Win7SP1.050727-5400).
If I display the currently selected server in the title I should write a function for that. Makes the code more readable.
Replace System.Security with Mono.Security for platform independence.
Might be helpful...
Yeah right - in the old version I used goto. (Maybe a reason why I never published the code ^^)
goto is old... damn! goto should never be used! NEVER EVER! Don't use it in your own program!!!!11 Don't even think about it!
It just creates a mess - a HUGE mess...
Using goto is just wrong!
Currently I'm building with .NET Framework 3.5 but that one is now already 6 and a half years old. Everyone should now have at least .NET Framework 4.0 which offers me as a developer a few advantages but gives users the opportunity to stay at Windows XP if they want to use this program since it's the last version which supports Windows XP.
Some advantages would be:
And I guess there are more changes. (4 is greater than 3 for example)
Hopefully the Mono-Project does support that as well. Have to check that.
Array.Resize() is just an ugly and slow way to resize an array. I should try to avoid this.
To something like that PLFHelper.Localization.
"Okay, tell us, Oliver. Are you messing with us?"
No, I'm not. The thing is: This spreadsheet class is great. It saves myself a bit work, since I now know just how to use what and can easily extend this. Everything's ordered! ❤️
BUT... I need another class because I don't want to parse the spreadsheet in my main class. And I don't want to handle the other stuff with the spreadsheet in the main class.
So I just write another class (which may inherit from the Spreadsheet class) and then it should be easy and... that...
While Application.DoEvents() was a pretty cool method back in VB6 it isn't in C# (or .NET).
There's a great explanation on Stack Overflow: http://stackoverflow.com/a/5183623/2925449
It is very important that exceptions are catched by myself. That's makes a good program.
I'm not sure if I just "copy" the old design or do a complete new one.
The old one was a bit... well... It was not modern.
If I do tabs again there should be an easier way in code to do that.. The old way is bad - very bad!
Old code:
if (eingeloggt != true)
{
MessageBox.Show(Resources.pleaseLogin, Resources.error, MessageBoxButtons.OK, MessageBoxIcon.Stop);
e.Cancel = true;
}
else
{
if (((e.TabPage.Name != "tabPageAccount") && (e.TabPage.Name != "tabPageServerList")) && (listBoxSelectServer.SelectedItem == null))
{
MessageBox.Show(Resources.selectServer, Resources.error, MessageBoxButtons.OK, MessageBoxIcon.Stop);
e.Cancel = true;
}
else if (((e.TabPage.Name != "tabPageAccount") && (e.TabPage.Name != "tabPageServerList")) && (listBoxSelectServerLevels.SelectedItem == null))
{
MessageBox.Show(Resources.selectLevel, Resources.error, MessageBoxButtons.OK, MessageBoxIcon.Stop);
e.Cancel = true;
}
else if ((e.TabPage.Name != "tabPageAccount") && (e.TabPage.Name != "tabPageServerList"))
{
int vorher = this.aktuellerServer;
this.aktuellerServer = serverSpreadsheetNames.WhichElementInArray(listBoxSelectServer.SelectedItem.ToString());
this.currentLevel = level[level.WhichElementInArray(aktuellerServer)].Level;
this.toolStripProgressBar.Value = 0;
this.toolStripProgressBar.Maximum = level[level.WhichElementInArray(aktuellerServer)].Level * 2 + 5;
if (aktuellerServer != -1)
{
if (vorher != aktuellerServer)
{
this.preise = new float[preise.Length];
this.products = (languageServer[aktuellerServer] == "de") ? productsInGerman : (languageServer[aktuellerServer] == "nl") ? productsInDutch : productsInEnglish;
this.parser = new Parser.Parser(Game.Wurzelimperium, languageServer[aktuellerServer], productsInGerman.WhichElementInArray("Mitspieler"), productsInGerman.WhichElementInArray("Spieler mit 1+ Punkten"));
switch (languageServer[aktuellerServer])
{
case "de":
aktuelleWährung = währungen[0];
break;
case "en":
aktuelleWährung = währungen[1];
break;
case "nl":
aktuelleWährung = währungen[2];
break;
}
this.parser.Parse(textBoxPricesAuto.Text, ref preise, products, währungen);
ReloadProducts();
}
}
else
{
MessageBox.Show(Resources.selectServer, Resources.error, MessageBoxButtons.OK, MessageBoxIcon.Stop);
e.Cancel = true;
}
}
}
You see.. very bad.. I don't even know anymore WHAT the fuck I was doing there...
Originally they were no methods but I think that'll make sense. So put such methods into the Settings class to keep them easy.
Okay... I don't know why but why didn't I do that? Did I think I would be cooler?
Well... I'm not.
However it would be make maintenance of LocalizationManager easier.
But move the parser classes not to the main namespace but to someting like PLFHelper.Parser or.. so...
Important!
I have to add some documentation to code.
For example what does the functions do and what does a single line do. Will do it asap to the old code and then do it for everything new if necessary.
So actually there will only be searched for a xxxxx_en.txt if nothing else was found. But it would make sense if it searches for xxxxx.txt too.
************** Ausnahmetext **************
Google.GData.Client.GDataRequestException: Execution of request failed: https://spreadsheets.google.com/feeds/cells/ttl1nSgEmcdni6asTITXXiA/ocg/private/full/R3C27/6xsnpc ---> System.Net.WebException: Der Remoteserver hat einen Fehler zurückgegeben: (403) Unzulässig.
bei System.Net.HttpWebRequest.GetResponse()
bei Google.GData.Client.GDataRequest.Execute()
--- Ende der internen Ausnahmestapelüberwachung ---
bei Google.GData.Client.GDataRequest.Execute()
bei Google.GData.Client.GDataGAuthRequest.Execute(Int32 retryCounter)
bei Google.GData.Client.Service.EntrySend(Uri feedUri, AtomBase baseEntry, GDataRequestType type, AsyncSendData data)
bei Google.GData.Client.Service.Update(AtomEntry entry, AsyncSendData data)
bei Google.GData.Client.AtomEntry.Update()
bei PreislistenpflegerHelper.formPLF.SubmitPrices()
bei PreislistenpflegerHelper.formPLF.buttonSubmitSubmit_Click(Object sender, EventArgs e)
bei System.Windows.Forms.Control.OnClick(EventArgs e)
bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
bei System.Windows.Forms.Control.WndProc(Message& m)
bei System.Windows.Forms.ButtonBase.WndProc(Message& m)
bei System.Windows.Forms.Button.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Geladene Assemblys **************
mscorlib
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5477 (Win7SP1GDR.050727-5400).
Preislistenpfleger Helper
Assembly-Version: 0.9.1.1.
Win32-Version: 0.9.1.1.
System
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400).
System.Windows.Forms
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5468 (Win7SP1GDR.050727-5400).
System.Drawing
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400).
System.Configuration
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5476 (Win7SP1GDR.050727-5400).
System.Xml
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5476 (Win7SP1GDR.050727-5400).
Google.GData.Spreadsheets
Assembly-Version: 1.8.0.0.
Win32-Version: 1.8.0.0.
Google.GData.Client
Assembly-Version: 1.8.0.0.
Win32-Version: 1.8.0.0.
System.Core
Assembly-Version: 3.5.0.0.
Win32-Version: 3.5.30729.5420 built by: Win7SP1.
Preislistenpfleger Helper.resources
Assembly-Version: 0.9.1.1.
Win32-Version: 0.9.1.1.
mscorlib.resources
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5477 (Win7SP1GDR.050727-5400).
System.resources
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5420 (Win7SP1.050727-5400).
Parser
Assembly-Version: 1.0.0.0.
Win32-Version: 1.0.0.0.
Enums
Assembly-Version: 1.0.0.0.
Win32-Version: 1.0.0.0.
Accessibility
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.4927 (NetFXspW7.050727-4900).
System.Windows.Forms.resources
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5420 (Win7SP1.050727-5400).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.