public void RunCommand(string server, string vault, string username, string password, string file, string checkinfile, Boolean printerror, string comment)
 {
     SecurityService secSrv = new SecurityService();
     secSrv.SecurityHeaderValue = new VaultSingleFileCheckin.Security.SecurityHeader();
     secSrv.Url = "http://" + server + "/AutodeskDM/Services/SecurityService.asmx";
     try 
     {
         secSrv.SignIn(username, password, vault);
         DocumentService docSrv = new DocumentService();
         docSrv.SecurityHeaderValue = new VaultSingleFileCheckin.Document.SecurityHeader();
         docSrv.SecurityHeaderValue.UserId = secSrv.SecurityHeaderValue.UserId;
         docSrv.SecurityHeaderValue.Ticket = secSrv.SecurityHeaderValue.Ticket;
         docSrv.Url = "http://" + server + "/AutodeskDM/Services/DocumentService.asmx";
         Folder root = docSrv.GetFolderRoot();
         string filepath = System.IO.Path.GetDirectoryName(file);
         filepath = filepath.Replace("\\", "/");
         CreateFolder(docSrv, filepath);
         Folder filefolder = docSrv.GetFolderByPath(filepath);
         int fileflag = IsFileInFolder(filefolder, docSrv, file);
         //Console.WriteLine("File " + fileflag.ToString());
         byte[] bytes;
         switch (fileflag)
         {
             case 0:
                 Console.WriteLine("File is not in vault");
                 bytes = System.IO.File.ReadAllBytes(checkinfile);
                 File addedfile = docSrv.AddFile(filefolder.Id, System.IO.Path.GetFileName(checkinfile), comment,
                     System.IO.File.GetLastWriteTime(checkinfile), null, null, null, null, null,
                     FileClassification.None, false, bytes);
                 if (addedfile == null)
                 {
                     Console.WriteLine("ERROR: File not checked in to vault");
                 }
                 else
                 {
                     Console.WriteLine("File checked in to vault");
                 }
                 break;
             case 1:
                 Console.WriteLine("File is in vault (not checked out)");
                 File[] files = docSrv.GetLatestFilesByFolderId(filefolder.Id, true);
                 foreach (File afile in files)
                 {           
                     if (filefolder.FullName + "/" + afile.Name == file)
                     {
                         //docSrv.CheckoutFile(filefolder.Id, afile.MasterId,
                         //    Environment.MachineName, Environment.GetEnvironmentVariable("TEMP"), comment,
                         //    true, true, out bytes);
                         docSrv.CheckoutFile(filefolder.Id, afile.Id, CheckoutFileOptions.Master,
                                         Environment.MachineName, "c:\\", "Temporary Checkout",
                                         false, true, out bytes);
                         bytes = System.IO.File.ReadAllBytes(checkinfile);
                         File updatedfile = docSrv.CheckinFile(afile.MasterId, comment,
                             false, System.IO.File.GetLastWriteTime(checkinfile), null, null, null, null, null, false,
                             System.IO.Path.GetFileName(checkinfile), afile.FileClass, afile.Hidden, bytes);
                         if (updatedfile.Id  == afile.Id)
                         {
                             Console.WriteLine("ERROR: File not checked in to vault");
                         }
                         else
                         {
                             Console.WriteLine("File checked in to vault");
                         }
                     }
                 }
                 break;
             case 2:
                 Console.WriteLine("File is in vault (checked out to you)");
                 break;
             default:
                 Console.WriteLine("File is in vault (checked out to someone else)");
                 Console.WriteLine("Cannot check in file");
                 break;
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Error retrieving file");
         if (printerror)
         {
             Console.WriteLine(ex.ToString());
         }
         return;
     }
 }