Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. using System; using System.Collections.Generic;
  2. using w;namespace w{public class m{public static void Main(String[] a){try{ var o=new Dictionary<String,Func<String, String>>{
  3.  
  4.         { "",(filename) => {
  5.             if(filename.StartsWith("-"))throw new Exception("Unknown Option : " + filename);else{Console.WriteLine("Uploading...");
  6.            
  7.             var result = l.getFileHash(filename);
  8.            
  9.             return "Wise folder {" + filename + "} uploaded to wid : " + result; }}},
  10.  
  11.  
  12.         { "-get",(wid) => {
  13.             Console.WriteLine("Downloading...");
  14.            
  15.             l.downloadFileOrFolder(wid);
  16.            
  17.             return "Wise id {"+wid+"} download ok." ; }}};
  18.        
  19.        
  20.         if (a.Length<1){
  21.             throw new Exception("Nothing to do.");}
  22.  
  23.  
  24.         //Porshe 911 Carrera
  25.         if (o.ContainsKey(a[0]))Console.WriteLine(o[a[0]](a.Length>1 ? a[1] : ""));
  26.         else Console.WriteLine(o[""](a[0]));}
  27.  
  28.  
  29.         catch(Exception ex){
  30.             Console.WriteLine(ex + usage());}}
  31.  
  32.  
  33. public static string
  34.     usage(){return "\n\n usage : xfold C:\\myfolder\n         xfold -get MYF7C8";}}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement