Click here to Skip to main content
14,457,187 members
   

C#

 
QuestionAsp.net Pin
RajaMohammed.A22-Jan-20 2:35
MemberRajaMohammed.A22-Jan-20 2:35 
AnswerRe: Asp.net Pin
OriginalGriff22-Jan-20 3:29
communityengineerOriginalGriff22-Jan-20 3:29 
AnswerRe: Asp.net Pin
Richard Deeming22-Jan-20 4:11
communityengineerRichard Deeming22-Jan-20 4:11 
AnswerRe: Asp.net Pin
Gerry Schmitz22-Jan-20 8:37
mveGerry Schmitz22-Jan-20 8:37 
QuestionConvert the data intered by the user to integer number Pin
Member 906313820-Jan-20 23:37
MemberMember 906313820-Jan-20 23:37 
AnswerRe: Convert the data intered by the user to integer number Pin
OriginalGriff20-Jan-20 23:47
communityengineerOriginalGriff20-Jan-20 23:47 
AnswerRe: Convert the data intered by the user to integer number Pin
ZurdoDev21-Jan-20 4:09
mveZurdoDev21-Jan-20 4:09 
QuestionClear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 1:49
MemberLupu5R3x18-Jan-20 1:49 
Hi I'm quit new to C#, I moved from Autoit to C# mostly due to most AV-vendors keep flagging Autoit as virus :/

I've been googling for the better part of a week, but haven't found any answer.

What I looking for is an equivalent to Autoit's code stripper.

What the stripper does is, at compile time it strips all comments from the code, and renames all vars and functions to "short code", it also removes all unused functions.

An Autoit example:
If GUICtrlRead($idCb_Edit_Chosen_Lot) = $GUI_CHECKED Then
		
		
		; We updates the database, with the data from the array
		_SQLite_Exec(-1, "UPDATE tbl_data SET date='" & $sDateTime & "', lot='" & $aData[1] & "', packing='" & $aData[2] & _
				"', sort_number='" & $aData[3] & "', sort_name=" & _SQLite_FastEscape($aData[4]) & ", type='" & $aData[5] & "', grower='" & $aData[6] & _
				"', customer=" & _SQLite_FastEscape($aData[7]) & ", comment=" & _SQLite_FastEscape($aData[8]) & " WHERE date='" & $g_SDateTime & "';")
		; Then we update the Listview
		; In the list view we don't have seperate filds for sort number and name, so we need to combine thoes
		$aData[3] &= ' ' & $aData[4] ; Combine sort number and name in to $aData[3]
		_ArrayDelete($aData, 4) ; then we removes (deletes) the 4'th index from the array $aData
		; Now we creates a loop to update the listview with the data from the array we just changed
		For $i = 0 To 7 Step 1 ; Sins we deletede on index from the array, we only run from 0 to 7
			; Insert the data into listview
			_GUICtrlListView_SetItemText($idListView_Overview, $g_iIndex, $aData[$i], $i)
			
		Next
		GUICtrlSetData($idLbl_LotNr, StringFormat("%06d", $g_iLot - 1)) ; Set the last used lot -1 (we add + 1 later in the script)
		$g_iLot = Null ; Clear the global lot value
		GUICtrlSetState($idCb_Edit_Chosen_Lot, $GUI_UNCHECKED) ; Unchecks the Checkbox
		
	Else ; If it's not a lot edit then
		; We Adds the data to the database
		_SQLite_Exec(-1, "INSERT INTO tbl_data VALUES ('" & $aData[0] & "', '" & $aData[1] & "', '" & $aData[2] & _
				"', '" & $aData[3] & "', " & _SQLite_FastEscape($aData[4]) & ", '" & $aData[5] & "', '" & $aData[6] & _
				"', " & _SQLite_FastEscape($aData[7]) & ", " & _SQLite_FastEscape($aData[8]) & ");")
		
		; Creating an array we can use to adde the data to the listview
		Local $aListViewAdd[1][8]
		; Combine the Sort number and name
		$aData[3] &= ' ' & $aData[4]
		; Update the array, by remove/delete the 4'th index (sortname)
		_ArrayDelete($aData, 4)
		
		; Creating a loop to add data to the array
		For $i = 0 To 7 ; We only run from 0 to 7 course we did delete one index in the array
			$aListViewAdd[0][$i] = $aData[$i] ; Add the data to the new array

		Next
		; Add the data to the listview using the new array, we just created
		_GUICtrlListView_AddArray($idListView_Overview, $aListViewAdd)
		
		; If the user have choosen to reuse the previus lotnumber

		If $g_bReuse = True Then
			$g_bReuse = False
			GUICtrlSetState($idCb_Reuse_Pre_Lot, $GUI_UNCHECKED)

		EndIf
	EndIf


After stripping:
If GUICtrlRead($idCb_Edit_Chosen_Lot) = 1 Then
_SQLite_Exec(-1, "UPDATE tbl_data SET date='" & $sDateTime & "', lot='" & $aData[1] & "', packing='" & $aData[2] & "', sort_number='" & $aData[3] & "', sort_name=" & _SQLite_FastEscape($aData[4]) & ", type='" & $aData[5] & "', grower='" & $aData[6] & "', customer=" & _SQLite_FastEscape($aData[7]) & ", comment=" & _SQLite_FastEscape($aData[8]) & " WHERE date='" & $g_SDateTime & "';")
$aData[3] &= ' ' & $aData[4]
_ArrayDelete($aData, 4)
For $i = 0 To 7 Step 1
_GUICtrlListView_SetItemText($idListView_Overview, $g_iIndex, $aData[$i], $i)
Next
GUICtrlSetData($idLbl_LotNr, StringFormat("%06d", $g_iLot - 1))
$g_iLot = Null
GUICtrlSetState($idCb_Edit_Chosen_Lot, 4)
Else
_SQLite_Exec(-1, "INSERT INTO tbl_data VALUES ('" & $aData[0] & "', '" & $aData[1] & "', '" & $aData[2] & "', '" & $aData[3] & "', " & _SQLite_FastEscape($aData[4]) & ", '" & $aData[5] & "', '" & $aData[6] & "', " & _SQLite_FastEscape($aData[7]) & ", " & _SQLite_FastEscape($aData[8]) & ");")
Local $aListViewAdd[1][8]
$aData[3] &= ' ' & $aData[4]
_ArrayDelete($aData, 4)
For $i = 0 To 7
$aListViewAdd[0][$i] = $aData[$i]
Next
_GUICtrlListView_AddArray($idListView_Overview, $aListViewAdd)
If $g_bReuse = True Then
$g_bReuse = False
GUICtrlSetState($idCb_Reuse_Pre_Lot, 4)
EndIf


I have tried a lot of obfuscatore, but non worked correctly they did to0 much, leaving my code not working.

Is there some way one could do the same with a C# code, as the code above?
Not exactly obfuscation but more a slim down, and make the code a bit more unreadable.

Cheers
LR
AnswerRe: Clear comments and rename var/method names at compile time Pin
OriginalGriff18-Jan-20 2:45
communityengineerOriginalGriff18-Jan-20 2:45 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 5:17
MemberLupu5R3x18-Jan-20 5:17 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Dave Kreskowiak18-Jan-20 5:43
mveDave Kreskowiak18-Jan-20 5:43 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 7:51
MemberLupu5R3x18-Jan-20 7:51 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Richard MacCutchan18-Jan-20 5:52
communityengineerRichard MacCutchan18-Jan-20 5:52 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 7:53
MemberLupu5R3x18-Jan-20 7:53 
GeneralRe: Clear comments and rename var/method names at compile time Pin
OriginalGriff18-Jan-20 5:52
communityengineerOriginalGriff18-Jan-20 5:52 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 7:57
MemberLupu5R3x18-Jan-20 7:57 
GeneralRe: Clear comments and rename var/method names at compile time Pin
OriginalGriff18-Jan-20 8:01
communityengineerOriginalGriff18-Jan-20 8:01 
AnswerRe: Clear comments and rename var/method names at compile time Pin
Gerry Schmitz18-Jan-20 8:00
mveGerry Schmitz18-Jan-20 8:00 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Lupu5R3x18-Jan-20 8:09
MemberLupu5R3x18-Jan-20 8:09 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Dave Kreskowiak18-Jan-20 17:03
mveDave Kreskowiak18-Jan-20 17:03 
GeneralRe: Clear comments and rename var/method names at compile time Pin
Gerry Schmitz18-Jan-20 18:30
mveGerry Schmitz18-Jan-20 18:30 
Questioncompare two dictionary and display difference Pin
mjbaquiran18-Jan-20 1:01
Membermjbaquiran18-Jan-20 1:01 
QuestionRe: compare two dictionay and display difference Pin
Eddy Vluggen18-Jan-20 1:30
professionalEddy Vluggen18-Jan-20 1:30 
AnswerRe: compare two dictionay and display difference Pin
mjbaquiran18-Jan-20 8:05
Membermjbaquiran18-Jan-20 8:05 
AnswerRe: compare two dictionay and display difference Pin
Gerry Schmitz18-Jan-20 7:40
mveGerry Schmitz18-Jan-20 7:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.