Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Code Converter For All VB and C# Programmers

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
jdm
Advanced Cheater
Reputation: 0

Joined: 19 Sep 2008
Posts: 88

PostPosted: Wed Feb 18, 2009 12:40 am    Post subject: Code Converter For All VB and C# Programmers Reply with quote

Hello all I thought this may be useful for all of those VB and C# programmers out their.

http://www.codechanger.com/
Back to top
View user's profile Send private message
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Wed Feb 18, 2009 5:45 am    Post subject: Re: Code Converter For All VB and C# Programmers Reply with quote

jdm wrote:
Hello all I thought this may be useful for all of those VB and C# programmers out their.

http://www.codechanger.com/

I'm sorry but that it will work 100% without u haveing to change anything...

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
jdm
Advanced Cheater
Reputation: 0

Joined: 19 Sep 2008
Posts: 88

PostPosted: Wed Feb 18, 2009 5:50 am    Post subject: Re: Code Converter For All VB and C# Programmers Reply with quote

Naablet wrote:
jdm wrote:
Hello all I thought this may be useful for all of those VB and C# programmers out their.

http://www.codechanger.com/

I'm sorry but that it will work 100% without u haveing to change anything...


May you please re-word that as I could not understand what you are trying to say.

And all this is, is for people either learning C# or VB. For example:
If you found a program that had many features one may like and they obtained the source, all the have to do is copy & paste and their ya go.
Back to top
View user's profile Send private message
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Wed Feb 18, 2009 5:58 am    Post subject: Reply with quote

Sure thing pup.
You see i doubt that it can convert code into the other language that will fully work.

for instance
Code:

List<char> lower = "abcdef".ToCharArray().ToList<char>();

was converted to
Code:

Dim lower As List(Of Char) = "abcdef".ToCharArray().ToList(Of Char)()


tho it's much better than i excepted Wink

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
jdm
Advanced Cheater
Reputation: 0

Joined: 19 Sep 2008
Posts: 88

PostPosted: Wed Feb 18, 2009 2:31 pm    Post subject: Reply with quote

And to be honest I wouldn't know how well it converts from C# to VB simply because I use C#. But you are also right. It doesn't convert 100% but for one, to be a programmer you have to be somewhat intelligent. All you would have to do is think about what the errors are and just change it to make it work.

For example:
Here is a simple C# program that I got from a C# for dummies book(cd).
Code:

using System;
namespace DecimalBankAccount
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("Create a bank account object");
            BankAccount ba = new BankAccount();
            ba.InitBankAccount();

            double dDeposit = 123.454;
            Console.WriteLine("Depositing {0:C}", dDeposit);
            ba.Deposit(dDeposit);
            Console.WriteLine("Account = {0}", ba.GetString());
            double dAddition = 0.002;
            Console.WriteLine("Adding {0:C}", dAddition);
            ba.Deposit(dAddition);
            Console.WriteLine("Resulting account= {0}", ba.GetString());
            Console.WriteLine("Press Enter to terminate...");
        }
    }
    public class BankAccount
    {
        private static int nNextAccountNumber = 1000;
        private int nAccountNumber;
        private decimal mBalance;

        // Create - Bank Account
        public void InitBankAccount()
        {
            nAccountNumber = ++nNextAccountNumber;
            mBalance = 0;
        }

        // Create - Get Balance
        public double GetBalance()
        {
            return (double)mBalance;
        }

        // Create - Get/Set Account Number
        public int GetAccountNumber()
        {
            return nAccountNumber;
        }
        public void SetAccountNumber(int nAccountNumber)
        {
            this.nAccountNumber = nAccountNumber;
        }

        // Create - Deposit/Withdrawal
        public void Deposit(double dAmount)
        {
            if (dAmount > 0.0)
            {
                decimal mTemp = (decimal)dAmount;
                mTemp = Decimal.Round(mTemp, 2);
                mBalance += mTemp;
            }


        }
        public decimal Withdraw(decimal dWithdrawal)
        {
            if (mBalance <= dWithdrawal)
            {
                dWithdrawal = mBalance;
            }
            mBalance -= dWithdrawal;
            return dWithdrawal;
        }

        // Create - Get String
        public string GetString()
        {
            string s = String.Format("#{0} = {1:C}", GetAccountNumber(), GetBalance());
            return s;
        }
    }
}


and when you convert it you get this:
Code:

Imports System
Namespace DecimalBankAccount
   Public Class Program
      Public Shared Sub Main(args As String())
         Console.WriteLine("Create a bank account object")
         Dim ba As New BankAccount()
         ba.InitBankAccount()

         Dim dDeposit As Double = 123.454
         Console.WriteLine("Depositing {0:C}", dDeposit)
         ba.Deposit(dDeposit)
         Console.WriteLine("Account = {0}", ba.GetString())
         Dim dAddition As Double = 0.002
         Console.WriteLine("Adding {0:C}", dAddition)
         ba.Deposit(dAddition)
         Console.WriteLine("Resulting account= {0}", ba.GetString())
         Console.WriteLine("Press Enter to terminate...")
      End Sub
   End Class
   Public Class BankAccount
      Private Shared nNextAccountNumber As Integer = 1000
      Private nAccountNumber As Integer
      Private mBalance As Decimal

      ' Create - Bank Account
      Public Sub InitBankAccount()
         nAccountNumber = System.Threading.Interlocked.Increment(nNextAccountNumber)
         mBalance = 0
      End Sub

      ' Create - Get Balance
      Public Function GetBalance() As Double
         Return DirectCast(mBalance, Double)
      End Function

      ' Create - Get/Set Account Number
      Public Function GetAccountNumber() As Integer
         Return nAccountNumber
      End Function
      Public Sub SetAccountNumber(nAccountNumber As Integer)
         Me.nAccountNumber = nAccountNumber
      End Sub

      ' Create - Deposit/Withdrawal
      Public Sub Deposit(dAmount As Double)
         If dAmount > 0 Then
            Dim mTemp As Decimal = DirectCast(dAmount, Decimal)
            mTemp = [Decimal].Round(mTemp, 2)
            mBalance += mTemp
         End If


      End Sub
      Public Function Withdraw(dWithdrawal As Decimal) As Decimal
         If mBalance <= dWithdrawal Then
            dWithdrawal = mBalance
         End If
         mBalance -= dWithdrawal
         Return dWithdrawal
      End Function

      ' Create - Get String
      Public Function GetString() As String
         Dim s As String = [String].Format("#{0} = {1:C}", GetAccountNumber(), GetBalance())
         Return s
      End Function
   End Class
End Namespace


And I get these two errors when trying to compile:
Code:

Error   1   Value of type 'Decimal' cannot be converted to 'Double'.   

Code:

Error   2   Value of type 'Double' cannot be converted to 'Decimal'.   


Now what do you think is that a decent conversion or a crappy one?
Back to top
View user's profile Send private message
&Vage
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Wed Feb 18, 2009 3:15 pm    Post subject: Reply with quote

This is really neat.
Back to top
View user's profile Send private message
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Wed Feb 18, 2009 4:13 pm    Post subject: Reply with quote

What will happen if u try to convert a inputbox to c#?
_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
rapion124
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Mar 2007
Posts: 1095

PostPosted: Wed Feb 18, 2009 5:55 pm    Post subject: Reply with quote

If you're a good programmer who's fluent in two languages, you should be able to convert the code between the two languages manually.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites