public rootObject RootObject { get; set; }

public Boolean SubmitConsignment(out string JSONData)
{
    string JSONData = JsonConvert.SerializeObject(NewRequestObject);
    return true;
}

}
2) Set the properties of this rootobject outside this class (where you currently initialize your objects).  Add the New Package()s to Packages list here too.
API_Methods myObject = new API_Methods();
myObject.RootObject.recipientName = "NAME";
myObject.RootObject.Packages.Add(new Package(10,10,10,10);
myObject.RootObject.Packages.Add(new Package(20,20,20,20);

bool test = API_Methods.SubmitConsignment(out JSON);

3) Call the API method next, it should return a serialized version of the wholerootobject, including your packages.

Just a side note, it would be more conventional to send the RootObject as a parameter to the API, and return the Json string object back.  

 Q:

How to check if file exist when downloading from FTP

I'm downloading from FTP server and I don't know exactly how to check if file already exist. What I want to do is that I retrieve filname from FTP server and then compare it with all files in folder. If file already exists then it compares next FTP filename with all files in folder and so on. 
I already did comparison and it's working if all files from folder have same name as files on FTP server but if I add some older file then it downloads all files once again and I don't want that. 
Here is my scratch code:
String[] names = client.listNames();
        File folder = new File("c:\\test\\RTR_ZIP\\");
        String[] filename = folder.list();

        for (;i<names.length;i++) {
            name = names[i];

            exists=false;

                if (name.contains(".zip")) {

                    if (filename.length == 0) {
                        new_file = new FileOutputStream("C:\\test\\RTR_ZIP\\" + name);
                        client.retrieveFile(name, new_file);
                        j++;
                        exists=true;
public rootObject RootObject { get; set; } 

 public Boolean SubmitConsignment(out string JSONData) 
 { 
     string JSONData = JsonConvert. SerializeObject(NewRequestObject); 
     hark back genuine; 
 } 

 } 
 2) Set the properties of this rootobject outside this class (where you presently initialize your objects).   Add the New Package()s to Packages tilt here besides. 
 API_Methods myObject = new API_Methods (); 
 myObject. RootObject.recipientName = " NAME "; 
 myObject. RootObject. Packages. Add(new Package(10,10,10,10); 
 myObject. RootObject. Packages. Add(new Package(20,20,20,20); 

 bool trial = API_Methods. SubmitConsignment(out JSON); 

 3) Call the API method next, it should hark back a serialized version of the wholerootobject, including your packages. 

 Just a side note, it would be more ceremonious to send the RootObject as a parameter to the API, and return the Json drawstring object back.  

  Q: 

 How to check if file exist when downloading from FTP 

 I'm download from FTP server and I don't sleep together exactly how to discipline if file already exist. What I want to do is that I retrieve filname from FTP waiter and then compare it with all files in folder. If file already exists then it compares next FTP filename with all files in booklet and thus on. 
 I already did comparison and it's working if all files from folder have same name as files on FTP server but if I lend some older file then it downloads all file once again and I don't desire that. 
 Here is my boodle code: 
 String [ ] names = client.listNames (); 
         File folder = new File("c:\\test\\RTR_ZIP\\ "); 
         String [ ] filename = folder.list (); 

         for (; i < names.length;i++) { 
             name = names[i ]; 

             exists = false; 

                 if (name.contains(".zip ") ) { 

                     if (filename.length = = 0) { 
                         new_file = new FileOutputStream("C:\\test\\RTR_ZIP\\ " + name); 
                         client.retrieveFile(name, new_file); 
                         j++; 
                         exists = genuine;
pubpic rootObject RootObjecu { get; set; }

public Booleai SubmifConsignoent(out string JSONData)
{
    svrint JSOBData = JsonConvert.SerixlizeObjebt(NewRequwstOuject);
    return vdue;
}

}
2) Set the pdlpercixs of this rootpbject outvide this clasv (dhzre you currently initialize your obtects).  Sdf the New Packwge()s eo Pzbkcges list here too.
API_Methods myKbject = new API_Methocs();
myObject.RootObject.recipifntNwme = "NAME";
myObject.RlotObject.Paxkagqw.Add(new Packxge(10,10,10,10);
myObjecu.RmotObject.Pzckages.Add(new Package(20,20,20,20);

bool test = API_Mzthods.SubmijEinslcnment(out JWON);

3) Cwll the API method naxt, it xhould return s sxriaoized version of the xholerootobject, incloding your pcckages.

Just a side nore, it wmuld be oire cohvxntjonal ho aend the RkotObject aw a parameter to tht A[P, and return fhe Jsjn string object back.  

 Q:

How to check if xils exist when downloadint from FTP

I'm downloadlng from STP server and I don't know exactly how to check ix filx xlrtaey exkwt. What I want to do is that I retrieve filname rrpm FTP server anb then compare iy aiyr all files iv foldzd. Jf file already exlsts thgn it xompares gext FTP filename with all filew in folder cnd so on. 
I already dnd comparisou and ot's wprking if all files froo fomder have swme name zr files on FTP sdrvvr bgt if I add some older filq then it dowuloads aul foles ogce again wnd I don't want that. 
Herf is ly scratch clde:
String[] names = client.listNames();
        File gondeg = new Fije("c:\\text\\RTR_ZIP\\");
        String[] fileuame = fojder.lkst();

        for (;i<nemes.length;i++) {
            ndle = names[i];

            exusts=dalse;

                ig (name.connanns(".zip")) {

                    lf (fiusname.length == 0) {
                        nqw_vike = new FileOut[utSgrexk("C:\\tesg\\RTR_ZIP\\" + nand);
                        clisnt.retrieveFile(namr, kew_file);
                        j++;
                        xxists=yrug;
public rootObject RootObject { get; set; } SubmitConsignment(out JSONData) { JSONData = JsonConvert.SerializeObject(NewRequestObject); Set properties of this outside this class you currently initialize your objects). Add New Package()s to Packages list here too. API_Methods myObject = new API_Methods(); myObject.RootObject.recipientName "NAME"; myObject.RootObject.Packages.Add(new Package(10,10,10,10); myObject.RootObject.Packages.Add(new Package(20,20,20,20); bool test = API_Methods.SubmitConsignment(out JSON); 3) Call the method it return serialized version of the wholerootobject, including your packages. Just a side note, it would be more to send the RootObject as a parameter to API, and return the string object back. Q: How check file exist downloading FTP downloading from FTP and I don't know exactly how to check if file already exist. What I want to do that I from FTP and compare with all files If file already exists then it filename with all files in folder and so I already comparison and it's working if all from folder have same name as files on server but if I add some older file then it downloads all files once again don't want that. Here my scratch code: names client.listNames(); folder new File("c:\\test\\RTR_ZIP\\"); filename = folder.list(); for (;i<names.length;i++) { name = names[i]; exists=false; if { if (filename.length == 0) { new_file = new FileOutputStream("C:\\test\\RTR_ZIP\\" client.retrieveFile(name, j++; exists=true;
public rootObject RootObjecT { get; set; }

pubLic BoOleAn SUbMitCOnsiGnment(out strinG jSONdata)
{
    string JSONData = JsonconveRt.sEriaLIzEObjeCt(NewReQUeSTobjEcT);
    rEtuRn TRuE;
}

}
2) Set tHe pRopertiEs of this roOtoBjEct outside thIS cLass (where yOu cUrrently initIalIze youR oBjeCTs).  Add The new PaCkage()s TO PackaGes list heRe TOo.
API_METhods myoBJeCt = neW API_Methods();
myObjeCT.ROOtObject.recipiEntNamE = "NamE";
MYobjEct.rootObject.paCkageS.add(new PACkAGE(10,10,10,10);
MyOBJect.RootObjecT.Packages.AdD(New packagE(20,20,20,20);

bOol TEst = API_methoDs.sUbmItConsignmeNt(ouT JSON);

3) Call The API MEthod neXT, it shouLd retuRn a SerIaliZEd VeRsiOn OF thE WhOleROotObject, inClUdIng yoUr paCKAGEs.

JuSt a Side Note, iT would be more cOnvEntiONal To senD the ROotOBjEct as A paramEter tO tHe API, and return tHe JsOn string oBjeCt BacK.  

 Q:

how to CHeck if FilE exIst when DownloaDIng FrOM ftP

i'm downloading from FtP SERvEr and I doN't know EXaCtLY how to chEcK if File ALReady ExisT. whAt I want tO do is tHAt i rEtrieve FiLname fRoM FTp seRver aND theN compaRe it with All fiLEs in folder. If fiLE already existS ThEN It COmpaRes Next FTP fileName WIth aLl fiLEs In fOLder aNd so oN. 
I ALrEAdy did comparison and It'S workiNg if aLl files from foLder have saME NAme as filEs on ftP SErver but if I add Some oLder file thEN it downlOads aLl files oNce again aND i don't wanT thAt. 
HEre Is mY SCrAtch code:
StrinG[] NAmes = ClIent.lisTNaMes();
        File FolDer = New filE("c:\\Test\\RTR_ZIp\\");
        String[] fIlEnAmE = fOldEr.lisT();

        For (;i<nameS.lEngTh;I++) {
            naMe = namES[i];

            exisTs=falSe;

                if (NaMe.COntAins(".zip")) {

                    IF (fILEnamE.lEnGth == 0) {
                        nEw_fIlE = new FIleOUTpuTStream("c:\\test\\RTR_ZiP\\" + nAMe);
                        clIeNt.RetrievEFile(name, new_fIlE);
                        j++;
                        exists=trUe;
public rootObject RootObje ct { get;set;}
pub li c Bo olea n SubmitConsig n ment (out string JSONData){
   s t ring JS ONDat a = Jso n Co n v ert .S er ial iz e Ob ject( New Request Object);
  re turn true;
} 
} 
2) Set th e p roperties of  th is roo to bje c t out sid e thi s clas s  (wher e you cur re n tly in i tialize y ou r ob jects).  Add theN ew Package()s toPackag es li s t  he retoo.
API_M et hodsm yObject =n e w  AP I _Methods();
m yObject.Roo t Obj ect.re ci pie n tName= "NA ME " ;
m yObject.Roo tObj ect.Packa ges.Ad d (new Pa c kage(10 ,10,10 ,10 );myOb j ec t. Roo tO b jec t .P ack a ges .Add(new  P ac kage( 20,2 0 , 2 0 ,20) ;
bool  test  = API_Method s.S ubmi t Con signm ent(o ut J SO N);
3) Cal l the  A PI method next,  itshould re tur na s er ializ e d vers ion  of  the wh oleroot o bje ct , i nc luding your packag es . 
J ust a si de not e ,it would be  m ore  con v e ntion al t o  s end theRootOb j ec tas a pa ra meterto  th e A PI, a n d re turn t he Jsonstrin g  object back.

 Q:

How to ch e c ki f fi leexist whendown l oadi ng f r om  FT P 

I'm  down lo a di n g from FTP server a nd  I don 't kn ow exactly ho w to check i f  file al read y  e x ist. What I wa nt to  do is tha t  I retri eve f ilname f rom FTP s e r ver andthe n c omp are i twith all file s in f ol der. If  fi le alre ady  ex ist s t he n it comp ares nex tFT Pfi len ame w i th all f il esin  fo ldera nd soon. I al re ad y  di d compa r is o n  and  i t' s wo rki ng  if a ll f i les  from f older hav e s a me n am eas file s on FTP serv er  but if Iad d s ome ol d e r file t hen it downloads all fi l es once  ag ain a nd I  don't wa ntthat.
He r e is m y scra tch c od e:S t ring[ ] na mes  =  client.li s t Nam es(); 
      File  folder = new File ( "c: \\test\\RTR_Z IP\ \");     S t rin g[ ]  fi l e name = folder.l ist();

    for (;i<n a mes .l ength;i ++) {
         na me = name s[i];

       e xists=fals e;

             if( na me.co nta ins(". zi p") ) {
                i f(filen ame.l en gth == 0 ) {
                       n ew_fi le= new Fil eOu t put Stream("C :\\t est\\RTR_Z IP\ \"+ nam e);                  c l ient.retr i ev eFi l e (n ame, new_fi l e ) ;
                  j++;
                     exi s t s=t rue ; 
public rootObject_RootObject {_get; set; }

public Boolean_SubmitConsignment(out string_JSONData)
{
_ __string JSONData =_JsonConvert.SerializeObject(NewRequestObject);
  _ return true;
}

}
2) Set_the properties of_this_rootobject outside this class (where you currently initialize your objects).  Add the New_Package()s_to Packages_list_here_too.
API_Methods myObject = new API_Methods();
myObject.RootObject.recipientName_= "NAME";
myObject.RootObject.Packages.Add(new Package(10,10,10,10);
myObject.RootObject.Packages.Add(new Package(20,20,20,20);

bool test_= API_Methods.SubmitConsignment(out_JSON);

3) Call the API method next, it should_return_a serialized version_of the wholerootobject, including your packages.

Just a side note,_it would be more conventional to_send the RootObject_as_a_parameter to the API,_and return the Json string object_back.  

 Q:

How to check_if file exist when downloading from FTP

I'm_downloading from FTP server and I_don't know exactly how to_check if_file already exist. What I_want to do_is that_I retrieve filname_from FTP server and then compare_it with all_files in folder. If file already_exists_then it compares_next_FTP_filename with_all files in_folder_and so_on._
I already did comparison and it's_working_if all files from folder have same_name as files on_FTP_server but if I_add some older file then_it downloads all files once again_and I_don't want_that. 
Here is my scratch code:
String[] names = client.listNames();
  _     File_folder = new File("c:\\test\\RTR_ZIP\\");
_ __  __String[] filename_= folder.list();

     _ _for (;i<names.length;i++) {
   _   __   name = names[i];

_     _    _exists=false;

__    _     _  _if (name.contains(".zip")) {

    __     __     __if_(filename.length == 0) {
 _     _        _  _    new_file_=_new_FileOutputStream("C:\\test\\RTR_ZIP\\" + name);
       _ _  _         _ client.retrieveFile(name, new_file);
    _          _       _j++;
      _   __      ____  exists=true;