Beispiel #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static void main(String[] args) throws Exception
        public static void Main(string[] args)
        {
            if (args.Length < 2)
            {
                Console.Error.WriteLine("Usage: IndexSplitter <srcDir> -l (list the segments and their sizes)");
                Console.Error.WriteLine("IndexSplitter <srcDir> <destDir> <segments>+");
                Console.Error.WriteLine("IndexSplitter <srcDir> -d (delete the following segments)");
                return;
            }
            File          srcDir = new File(args[0]);
            IndexSplitter @is    = new IndexSplitter(srcDir);

            if (!srcDir.exists())
            {
                throw new Exception("srcdir:" + srcDir.AbsolutePath + " doesn't exist");
            }
            if (args[1].Equals("-l"))
            {
                @is.listSegments();
            }
            else if (args[1].Equals("-d"))
            {
                IList <string> segs = new List <string>();
                for (int x = 2; x < args.Length; x++)
                {
                    segs.Add(args[x]);
                }
                @is.remove(segs.ToArray());
            }
            else
            {
                File           targetDir = new File(args[1]);
                IList <string> segs      = new List <string>();
                for (int x = 2; x < args.Length; x++)
                {
                    segs.Add(args[x]);
                }
                @is.Split(targetDir, segs.ToArray());
            }
        }
Beispiel #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static void main(String[] args) throws Exception
	  public static void Main(string[] args)
	  {
		if (args.Length < 2)
		{
		  Console.Error.WriteLine("Usage: IndexSplitter <srcDir> -l (list the segments and their sizes)");
		  Console.Error.WriteLine("IndexSplitter <srcDir> <destDir> <segments>+");
		  Console.Error.WriteLine("IndexSplitter <srcDir> -d (delete the following segments)");
		  return;
		}
		File srcDir = new File(args[0]);
		IndexSplitter @is = new IndexSplitter(srcDir);
		if (!srcDir.exists())
		{
		  throw new Exception("srcdir:" + srcDir.AbsolutePath + " doesn't exist");
		}
		if (args[1].Equals("-l"))
		{
		  @is.listSegments();
		}
		else if (args[1].Equals("-d"))
		{
		  IList<string> segs = new List<string>();
		  for (int x = 2; x < args.Length; x++)
		  {
			segs.Add(args[x]);
		  }
		  @is.remove(segs.ToArray());
		}
		else
		{
		  File targetDir = new File(args[1]);
		  IList<string> segs = new List<string>();
		  for (int x = 2; x < args.Length; x++)
		  {
			segs.Add(args[x]);
		  }
		  @is.Split(targetDir, segs.ToArray());
		}
	  }