WhyNotWin11 icon indicating copy to clipboard operation
WhyNotWin11 copied to clipboard

Improve script structure

Open htcfreek opened this issue 4 years ago • 16 comments

Move general code for better structure

  • [x] Move FileInstall into _ResourceHelper.au3
  • [x] Create _OtherHelpers.au3 for various small functions
    • [x] Move _INIUnicode($sINI)
    • [x] Move _Translate($iMUI, $sString)
    • [x] Move all other small functions like the one before.
  • [ ] Move command line processing into _CommandLineHelper.au3
  • [x] Combine related functions (example: HighContrast + LightTheme => GetColorTheme)

Checks

  • [x] Create a function for every check and place it in _Checks.au3
    • [x] Use this functions for GUI and command line

Gui code

  • [x] #699
    • [ ] Move all Gui related functions including GDI+ function (_GDIPlus_GraphicsGetDPIRatio)
  • [x] Add new function _UpdateScanResult($iScanResultIndex, $iState, $sResultText, $sResultInfo) => $iState = Question, Warning, Okay, Error

Comments and structure

  • [ ] Add a comment to each function like this:
; Description: Function does ...
; Input: param1 = ...; param2 = ...
; Output: ....
; On error: ....
  • [ ] Structure code by adding comment structure (Not only this region thing, which isn't supported by every editor.):
; ========= Init global vars ====
(...)

;  ======== Includes ========
; AutoIT-UDFs
(...)

; Internal Includes
(...)

; ========= Init Gui =========
(...)

; ========== Begin Checks ===============
; Checking CPU
(...)

; Checking GPT
(...)
  • [ ] Improve script order (Main part):
  1. Global vars
  2. Includes
  3. Options
  4. Check OS
  5. Init Gui part or command line part
  6. run checks for command line or gui

Folder/file structure

  • [ ] Align naming: All upper case or all lower case.
  • [ ] Move source code (*.au3, include, lang, assets) into folder /src.
  • [ ] Fix include commands
  • [x] Fix Wrapper_Add_Icon commands path.

@rcmaehl This would help other contributors to fast understanding the code. I would do it. But this makes no sense because this is inkompatibel to other commits.

htcfreek avatar Jul 05 '21 21:07 htcfreek

Could you format points as [ ] ? That way it would be easier to tell progress. I assume that it's unlikely to so such big task all at once.

micwoj92 avatar Jul 05 '21 21:07 micwoj92

@micwoj92 Done!

htcfreek avatar Jul 05 '21 22:07 htcfreek

Should I assign this to you?

micwoj92 avatar Jul 05 '21 22:07 micwoj92

Should I assign this to you?

Me

rcmaehl avatar Jul 05 '21 22:07 rcmaehl

Updated main comment.

htcfreek avatar Jul 05 '21 22:07 htcfreek

@rcmaehl you can assign yourself :P

micwoj92 avatar Jul 05 '21 22:07 micwoj92

@rcmaehl We should use the same naming structure for the same type of include. This means Resources.au3 should be _Resources.au3.

htcfreek avatar Jul 06 '21 05:07 htcfreek

@rcmaehl

  1. Your includes are broken. (See fix here: https://github.com/htcfreek/WhyNotWin11/commit/9a24e7d6a2e446e0e8d5973475a66b20dfa8eeb0)
  2. The lang copy is broken. It crashed my changed lang files. (Don't know why.)

htcfreek avatar Jul 06 '21 22:07 htcfreek

As far as I know you are using this IDE called "ISN AutoIt Studio" while Robert uses Scite4Autoit, could you try with Scite and see if it still is issue?

micwoj92 avatar Jul 06 '21 22:07 micwoj92

As far as I know you are using this IDE called "ISN AutoIt Studio" while Robert uses Scite, could you try with Scite and see if it still is issue?

  1. The includes are working now. The error came from Wrapper and tidy.
  2. The lang files aren't broken. But the doesn't get read.

Let me work tomorrow on this. It's time for sleeping. 😅

htcfreek avatar Jul 06 '21 23:07 htcfreek

@rcmaehl Csn you please stop doing this .\ things while including. This breaks code. You need "Includes\...au3".

See here: https://www.autoitscript.com/autoit3/docs/keywords/include.htm

htcfreek avatar Jul 07 '21 05:07 htcfreek

@rcmaehl I have added a new group "Folder/file structure" to the checklist.

htcfreek avatar Jul 07 '21 05:07 htcfreek

How does that break?

micwoj92 avatar Jul 07 '21 06:07 micwoj92

@micwoj92 The include files/assets aren't found/included. Wrapper and Check saying that files aren't available.

htcfreek avatar Jul 07 '21 07:07 htcfreek

@micwoj92 Can you please add "In-progress" lable.

htcfreek avatar Jul 09 '21 00:07 htcfreek

Has there been any progress on this in ~1 year?

micwoj92 avatar Aug 28 '22 07:08 micwoj92