All pastes #573801 Raw Edit

Something

public text v1 · immutable
·published 2007-06-18 08:12 UTC
rendered paste body
// project created on 15/06/2007 at 11:57
using System;
using System.Text.RegularExpressions;

namespace LongIP
{
	class MainClass
	{
		public static void Main(string[] args)
		{
			bool LongToDot;
		    string ip=string.Join("",args);
		    Console.WriteLine("{0}",ip);
			Regex r= new Regex("[.]");
		    if(r.IsMatch(ip))
		    {
		    Console.WriteLine("From Dotted To Decimal");
		    LongToDot=false;
		    }
		    else
		    {
		    Console.WriteLine("From Decimal To Dotted");
		    LongToDot=true;
		    }
		    switch(LongToDot)
		    {
		    case true:
		    {
		    int a1,a2,a3,a4;
		    int ipd=Convert.ToInt32(ip);
		    a1=ipd/(int)Math.Pow(256,3);
		    Console.WriteLine(""+a1);
		    a2=(ipd-((int)Math.Pow(256,3)*a1))/(int)Math.Pow(256,2);
		    Console.WriteLine(""+a2);
		    a3=((ipd-((int)Math.Pow(256,3)*a1))-((int)Math.Pow(256,2)*a2))/256;
		    Console.WriteLine(""+a3);
		    a4=((ipd-((int)Math.Pow(256,3)*a1))-((int)Math.Pow(256,2)*a2)-(256*a3));
		    Console.WriteLine(""+a4);
		    Console.WriteLine(" "+a1+"."+a2+"."+a3+"."+a4);
		    
		    break;
		    }
		    case false:
		    {
		    int x=3;
		    char[] dot=new Char[4]{'.','.','.','.'};
		    string[] f1=ip.Split(dot,0);
		    string[]	f2 = ip.Split(dot,1);
		    Console.WriteLine("{0} ,",f1[0]);
		    break;
		    }
		    }
		}
	}
}

#############Error##########################
./LongIP.exe 4294967295
4294967295
From Decimal To Dotted

Unhandled Exception: System.OverflowException: Number overflow.
  at System.Int32.Parse (System.String s, Boolean tryParse, System.Int32& result, System.Exception& exc) [0x00000]