private static string PathType = "FTP";
public static string CombinePath(params string[] paths)
char separatorChar = Path.DirectorySeparatorChar;
if (PathType != "NP" && PathType != "DIR")
separatorChar = Path.AltDirectorySeparatorChar;
string resultPath = string.Empty;
foreach (string path in paths)
if (string.IsNullOrEmpty(resultPath))
resultPath = path.Trim(separatorChar);
resultPath = Path.Combine(resultPath + separatorChar, path.Trim(separatorChar));
public static void Main(string[] args){
Console.WriteLine(Path.DirectorySeparatorChar);
Console.WriteLine(Path.AltDirectorySeparatorChar);
Console.WriteLine(CombinePath("prova/", "/pippo/", "pluto\\", "File.txt"));
string input = "FTP.ARCHIVAGROUP.IT:2411/DB/008939_13171830154/";
string[] stringSeparators = new string[] { "/" };
string[] temp = input.Split(stringSeparators, 2, StringSplitOptions.None);
for (int i = 0; i<temp.Length; i++)
Console.WriteLine(string.Format("temp[{0}] = {1}", i.ToString(), temp[i]));
string[] indirizzo = temp[0].Split(':');
for (int i = 0; i<indirizzo.Length; i++)
Console.WriteLine(string.Format("indirizzo[{0}] = {1}", i.ToString(), indirizzo[i]));