Konwertowanie projektu VS2012 na VB 2010?

0

Witam, czy jest możliwość, by przekonwertować projekt VS 2012 na VB 2010? albo jak "przetłumaczyć" ten kod na VB2010?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Text.RegularExpressions;
using System.IO;
using System.Windows.Forms;

namespace AstroCash
{
    public class Api
    {
        public string Login { get; set; }
        private CookieContainer _ciastka;
        private string _lastSrc;
        public Earnings Zarobki { get; set; }
        public Api(string login)
        {
            _ciastka = new CookieContainer();
            Zarobki = new Earnings();
            Login = login;
            Zarobki.Today = -1;
        }
        public bool Zaloguj(string login, string haslo)
        {
            try
            {
                var request = WebRequest.Create("http://astrocash.org/login") as HttpWebRequest;
                request.Method = "POST";
                request.ContentType = "application/x-www-form-urlencoded";
                request.Referer = "http://astrocash.org/";
                request.UserAgent = "AstroCash App by Miszczu";
                request.CookieContainer = _ciastka;
                using (var sw = request.GetRequestStream())
                {
                    byte[] buffer = Encoding.UTF8.GetBytes(string.Format("login={0}&password={1}", login, haslo));
                    sw.Write(buffer, 0, buffer.Length);
                }
                using (var response = request.GetResponse() as HttpWebResponse)
                {
                    _ciastka.Add(response.Cookies);
                    using (var sr = new StreamReader(response.GetResponseStream()))
                    {
                        _lastSrc = sr.ReadToEnd();
                        return !_lastSrc.Contains("Forgotten password");
                    }
                }
            }
            catch (Exception)
            {
                return false;
            }
        }
        public void AktualizujDane()
        {
            var request = WebRequest.Create("http://astrocash.org/") as HttpWebRequest;
            request.Method = "GET";
            request.CookieContainer = _ciastka;
            using (var response = request.GetResponse() as HttpWebResponse)
            {
                _ciastka.Add(response.Cookies);
                using (var sr = new StreamReader(response.GetResponseStream()))
                    _lastSrc = sr.ReadToEnd();
            }
            var cop = _lastSrc;
            var match = Regex.Match(cop, "<div id=\"earn1\">(.*?)</div>", RegexOptions.IgnoreCase);
            string success = string.Empty;
            if (match.Success)
            {
                double ost = Zarobki.Today;
                Zarobki.Today = Convert.ToDouble(match.Groups[1].Value.Replace("$", ""),
                                                 System.Globalization.CultureInfo.InvariantCulture);
                if (ost != -1)
                {
                    double roz = Zarobki.Today - ost;
                    if (roz > 0)
                        new ToolTip("Zwiększenie salda", string.Format("Stan Twojego konta zwiększył się z ${0:0.00} na ${1:0.00} (${2:0.00})",
                                                          ost, Zarobki.Today, roz)).ShowDialog();
                    
                }
            }
            match = Regex.Match(cop, "<div id=\"earn2\">(.*?)</div>", RegexOptions.IgnoreCase);
            if (match.Success)
                Zarobki.Yesterday = Convert.ToDouble(match.Groups[1].Value.Replace("$", ""), System.Globalization.CultureInfo.InvariantCulture);
            match = Regex.Match(cop, "<div id=\"earn3\">(.*?)</div>", RegexOptions.IgnoreCase);
            if (match.Success)
                Zarobki.Month = Convert.ToDouble(match.Groups[1].Value.Replace("$", ""), System.Globalization.CultureInfo.InvariantCulture);
            match = Regex.Match(cop, "<div id=\"earn4\">(.*?)</div>", RegexOptions.IgnoreCase);
            if (match.Success)
                Zarobki.Total = Convert.ToDouble(match.Groups[1].Value.Replace("$", ""), System.Globalization.CultureInfo.InvariantCulture);
            match = Regex.Match(cop, "<div id=\"earn5\">(.*?)</div>", RegexOptions.IgnoreCase);
            if (match.Success)
                Zarobki.Payout = Convert.ToDouble(match.Groups[1].Value.Replace("$", ""), System.Globalization.CultureInfo.InvariantCulture);
        }
    }
    public class Earnings
    {
        public double Today { get; set; }
        public double Yesterday { get; set; }
        public double Month { get; set; }
        public double Total { get; set; }
        public double Payout { get; set; }
    }
}
0

a co tu tłumaczyć. projektu może ci nie otworzyć, ale zawsze możesz utworzyć nowy, i zaimportować istniejące źródła.

EDIT: a, rozumiem, że chcesz przerobić kod z C# na VB. no chyba musisz zrobić to ręcznie.
albo skompilować a potem zdekompilować jakimś Reflectorem...

0

Właśnie chodzi o to, że na programowanie się nie znam, ale jak wchodze w VB2010 to już to jakoś idzie. Tam jak mam przykłady to wiem co jest czym, a ten kod co podałem totalnie nic mi nie mówi, więc nie wiem jak ręcznie go przerobić na vb...

1

Jeżeli nie masz wystarczającej wiedzy, by skorzystać z powyższej porady z reflectorem to możesz umieścić ofertę w dziale "oferty pracy".

0

Jeśli nie zamierzasz w tym kodzie grzebać, a tylko go użyć, to nie trzeba nawet tłumaczyć – tylko skompilować do DLL i dodać jako referencję do twojego projektu w VB.

1 użytkowników online, w tym zalogowanych: 0, gości: 1