Code Monkey home page Code Monkey logo

plf-helper's People

Contributors

elsensee avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

2wayne

plf-helper's Issues

Handle non-plants different

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.

Copy strings to directory

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)

Rewrite all regular expressions

Since my current regular expressions are a bit hacky I want to rewrite them.

Pros:

  • More readable
  • Maybe faster

Cons:

  • Time-consuming 😀

DO NOT USE GOTO!!!!!1111!!!!

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!

Write Spreadsheet class

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)

Parser improvements

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. :) ❤️

Copy 'n' Paste Error

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).

CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll.

Preislistenpfleger Helper
Assembly-Version: 0.9.1.1.
Win32-Version: 0.9.1.1.

CodeBase: file:///C:/PreislistenpflegerHelper/Preislistenpfleger%20Helper.exe.

System
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400).

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll.

System.Windows.Forms
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5468 (Win7SP1GDR.050727-5400).

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll.

System.Drawing
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400).

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll.

System.Configuration
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5476 (Win7SP1GDR.050727-5400).

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll.

System.Xml
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5476 (Win7SP1GDR.050727-5400).

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll.

Google.GData.Spreadsheets
Assembly-Version: 1.8.0.0.
Win32-Version: 1.8.0.0.

CodeBase: file:///C:/PreislistenpflegerHelper/Google.GData.Spreadsheets.DLL.

Google.GData.Client
Assembly-Version: 1.8.0.0.
Win32-Version: 1.8.0.0.

CodeBase: file:///C:/PreislistenpflegerHelper/Google.GData.Client.DLL.

System.Core
Assembly-Version: 3.5.0.0.
Win32-Version: 3.5.30729.5420 built by: Win7SP1.

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll.

Preislistenpfleger Helper.resources
Assembly-Version: 0.9.1.1.
Win32-Version: 0.9.1.1.

CodeBase: file:///C:/PreislistenpflegerHelper/de/Preislistenpfleger%20Helper.resources.DLL.

mscorlib.resources
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5477 (Win7SP1GDR.050727-5400).

CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll.

System.resources
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5420 (Win7SP1.050727-5400).

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.resources/2.0.0.0_de_b77a5c561934e089/System.resources.dll.

Parser
Assembly-Version: 1.0.0.0.
Win32-Version: 1.0.0.0.

CodeBase: file:///C:/PreislistenpflegerHelper/Parser.DLL.

Enums
Assembly-Version: 1.0.0.0.
Win32-Version: 1.0.0.0.

CodeBase: file:///C:/PreislistenpflegerHelper/Enums.DLL.

System.Windows.Forms.resources
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5420 (Win7SP1.050727-5400).

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms.resources/2.0.0.0_de_b77a5c561934e089/System.Windows.Forms.resources.dll.

DO NOT USE GOTO!!!!!1111!!!!

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!

Update to .NET Framework 4.0

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:

  • Some new very helpful functions
  • Some better options to program things like multi-threading
  • Better Garbage Collection
  • Improvements in implementation

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.

Write wrapper around Spreadsheet class

"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...

Easier tab selecting

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...

Move Parser class to main program

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...

Add documentation

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.

Fehler beim Upload #0

************** 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).

CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll.

Preislistenpfleger Helper
Assembly-Version: 0.9.1.1.
Win32-Version: 0.9.1.1.

CodeBase: file:///C:/PreislistenpflegerHelper/Preislistenpfleger%20Helper.exe.

System
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400).

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll.

System.Windows.Forms
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5468 (Win7SP1GDR.050727-5400).

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll.

System.Drawing
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5467 (Win7SP1GDR.050727-5400).

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll.

System.Configuration
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5476 (Win7SP1GDR.050727-5400).

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll.

System.Xml
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5476 (Win7SP1GDR.050727-5400).

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll.

Google.GData.Spreadsheets
Assembly-Version: 1.8.0.0.
Win32-Version: 1.8.0.0.

CodeBase: file:///C:/PreislistenpflegerHelper/Google.GData.Spreadsheets.DLL.

Google.GData.Client
Assembly-Version: 1.8.0.0.
Win32-Version: 1.8.0.0.

CodeBase: file:///C:/PreislistenpflegerHelper/Google.GData.Client.DLL.

System.Core
Assembly-Version: 3.5.0.0.
Win32-Version: 3.5.30729.5420 built by: Win7SP1.

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll.

Preislistenpfleger Helper.resources
Assembly-Version: 0.9.1.1.
Win32-Version: 0.9.1.1.

CodeBase: file:///C:/PreislistenpflegerHelper/de/Preislistenpfleger%20Helper.resources.DLL.

mscorlib.resources
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5477 (Win7SP1GDR.050727-5400).

CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll.

System.resources
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5420 (Win7SP1.050727-5400).

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.resources/2.0.0.0_de_b77a5c561934e089/System.resources.dll.

Parser
Assembly-Version: 1.0.0.0.
Win32-Version: 1.0.0.0.

CodeBase: file:///C:/PreislistenpflegerHelper/Parser.DLL.

Enums
Assembly-Version: 1.0.0.0.
Win32-Version: 1.0.0.0.

CodeBase: file:///C:/PreislistenpflegerHelper/Enums.DLL.

Accessibility
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.4927 (NetFXspW7.050727-4900).

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll.

System.Windows.Forms.resources
Assembly-Version: 2.0.0.0.
Win32-Version: 2.0.50727.5420 (Win7SP1.050727-5400).

CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms.resources/2.0.0.0_de_b77a5c561934e089/System.Windows.Forms.resources.dll.

image_20140325_1617

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.