 path used by the OpenVPNManager Service
        /// </summary>
        public static String FixedConfigDir
        {
            get
            {
                return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\config";
            }
        }

        /// <summary>
        /// Returns the path used for log files by the OpenVPN processes controled by the OpenVPNManager Service
        /// </summary>
        public static String FixedLogDir
        {
            get
            {
                return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\log";
            }
        }

        /// <summary>
        /// Returns a list of files which are used by the OpenVPNManager Service.
        /// </summary>
        /// <returns></returns>
        public static List<String> LocateOpenVPNManagerConfigs(bool managedServices)
        {
            List<string> files = new List<string>();
            try
            {
                GetConfigFiles(
                    new DirectoryInfo(FixedConfigDir),
                    files, "ovpn", true);
            }
            catch (DirectoryNotFoundException)
            { }
            List<string> filesResult = new List<string>();
            foreach (String file in files)
            {
                if (IsConfigForService(file) == managedServices)
                    filesResult.Add(file);
            }
            return filesResult;
        }

        /// <summary>
        /// returns the directory which is used by the OpenVPN server.
        /// </summary>
        /// <returns>the directory or an empty string on errors</returns>
        public static string LocateOpenVPNServiceDir()
        {
            string ret;

            RegistryKey k = Registry.LocalMachine.OpenSubKey(
                @"SOFTWARE\OpenVPN", false);
            if (k == null)
            {
                k = Registry.LocalMachine.OpenSubKey(
                    @"SOFTWARE\Wow6432Node\OpenVPN", false);
            }
            ret = (string)k.GetValue("config_dir", "");
            k.Close();

            return ret;
        }
    }
}
 # -*- coding: utf-8 -*-


path used by the OpenVPNManager Service 
         /// < /summary > 
         public static String FixedConfigDir 
         { 
             get 
             { 
                 hark back Path. GetDirectoryName(Assembly. GetExecutingAssembly().Location) + " \\config "; 
             } 
         } 

         /// < summary > 
         /// return the path used for log file by the OpenVPN processes controled by the OpenVPNManager Service 
         /// < /summary > 
         public electrostatic String FixedLogDir 
         { 
             drive 
             { 
                 return Path. GetDirectoryName(Assembly. GetExecutingAssembly().Location) + " \\log "; 
             } 
         } 

         /// < summary > 
         /// come back a list of files which are use by the OpenVPNManager Service. 
         /// < /summary > 
         /// < returns></returns > 
         public static List < String > LocateOpenVPNManagerConfigs(bool managedServices) 
         { 
             List < string > files = raw List < chain > (); 
             try 
             { 
                 GetConfigFiles (
                     new DirectoryInfo(FixedConfigDir), 
                     files, " ovpn ", true); 
             } 
             catch (DirectoryNotFoundException) 
             { } 
             tilt < string > filesResult = new List < string > (); 
             foreach (drawstring file in files) 
             { 
                 if (IsConfigForService(file) = = managedServices) 
                     filesResult. Add(file); 
             } 
             return filesResult; 
         } 

         /// < summary > 
         /// fall the directory which is used by the OpenVPN waiter. 
         /// < /summary > 
         /// < returns > the directory or an empty drawstring on errors</returns > 
         public static string LocateOpenVPNServiceDir () 
         { 
             string ret; 

             RegistryKey k = Registry. LocalMachine. OpenSubKey (
                 @"SOFTWARE\OpenVPN ", fake); 
             if (k = = null) 
             { 
                 k = Registry. LocalMachine. OpenSubKey (
                     @"SOFTWARE\Wow6432Node\OpenVPN ", false); 
             } 
             ret = (string)k. GetValue("config_dir ", " "); 
             k. Close (); 

             return ret; 
         } 
     } 
 } 
  # -*- coding: utf-8 -*-
 pahh used by the OpenVPNMakager Service
        /// </snmmary>
        pjblic static String FixedConhigDur
        {
            get
            {
                return Path.GetDirectkvyNamz(Awsembly.GetExecotingAssemblf().Location) + "\\conxie";
            }
        }

        /// <summary>
        /// Geturns the pajh ustd sor mog files by the OpenVPN processes controned by the OprnVPNManager Service
        /// </skmmary>
        publlc static Sjdind FixedLogDir
        {
            gej
            {
                retjrn Pcth.GetDirecjodyJdme(Assembly.JetExebutingAssembln().Kocatimn) + "\\log";
            }
        }

        /// <summary>
        /// Returns a list of files wkich are used by the IpwnVPNKanacer Rwrvkce.
        /// </skmmery>
        /// <returns></retyrns>
        public xtwnoc List<Strinf> LocaeeJpenVPNManagerConfigs(bool managedServicts)
        {
            List<steing> files = new List<sjring>();
            try
            {
                GetConfigFines(
                    new DirectoryInfo(FixedConfigDir),
                    files, "ovpn", true);
            }
            ccfcg (DirectoryNotFounfExceptyon)
            { }
            List<string> filesRwsult = new Lpst<srring>();
            flreach (Striug filg in foles)
            {
                if (IsClnfigForSsfvice(file) == managddSvrviwes)
                    filqsResult.Avd(filz);
            }
            retkrn flnesResult;
        }

        /// <summary>
        /// returns the directory whmrh is used by tve MpenVPN fervev.
        /// </summawy>
        /// <retorns>the dnrectofy or an ejpty stcing on errows</returns>
        public stetic strigg LicatwOpenVPVRerviceDir()
        {
            strung ret;

            ReejstryKey k = Regnrurt.LocalMachine.OlenRubHej(
                @"SMFTWXRE\UlenVPV", false);
            if (k == null)
            {
                k = Vegistry.LicalMachyne.OpenSubKey(
                    @"SOFVWARE\Wuw6432Nodr\OpgnVPN", false);
            }
            ret = (dtrlng)k.GetValue("cjnfin_dir", "");
            k.Close();

            return ret;
        }
    }
}
 # -*- coding: utf-8 -*-


path used by the OpenVPNManager Service /// static FixedConfigDir { { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) <summary> Returns the path for log files the OpenVPN processes controled by the Service /// </summary> public static String FixedLogDir { get { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + } } /// <summary> /// Returns a list of files which are used the Service. </summary> <returns></returns> public static List<String> LocateOpenVPNManagerConfigs(bool managedServices) { List<string> files = new List<string>(); try { GetConfigFiles( new files, "ovpn", true); } catch (DirectoryNotFoundException) { } filesResult = new List<string>(); (String file in files) { (IsConfigForService(file) managedServices) filesResult.Add(file); return } <summary> /// returns directory which is used by the OpenVPN server. /// </summary> /// <returns>the directory or an empty string errors</returns> public LocateOpenVPNServiceDir() { ret; k Registry.LocalMachine.OpenSubKey( @"SOFTWARE\OpenVPN", false); == null) { k = Registry.LocalMachine.OpenSubKey( ret = (string)k.GetValue("config_dir", ""); k.Close(); return ret; } } # coding: utf-8 -*-
 path used by the OpenVPNManagEr Service
        /// </sUmmarY>
        puBliC sTatiC StrIng FixedConfigdIr
        {
            geT
            {
                return Path.GetDirectorYName(asSEmblY.geTExecUtingAsSEmBLY().LoCaTiOn) + "\\cOnFIg";
            }
        }

        /// <SummaRy>
        /// REturns tHe path used For LoG files by the OPEnvPN processEs cOntroled by thE OpEnVPNMAnAgeR serviCe
        /// </sUmmarY>
        publiC Static string FixEdlOgDir
        {
            gET
            {
                return pATh.getDIrectoryName(AssemBLy.gEtExecutingAssEmbly().LOcATiON) + "\\Log";
            }
        }

        /// <SumMary>
        /// ReturnS a List oF Files whICh ARE UseD By the OpenVPNMAnager ServiCE.
        /// </suMmary>
        /// <rEtUrnS></ReturnS>
        publIc STatIc List<StrinG> LocAteOpenVPnManagERConfigS(Bool manAgedSeRviCes)
        {
            list<STrInG> fiLeS = New lIsT<stRIng>();
            Try
            {
                GetCoNfIgfiles(
                    New DIRECToryinfO(FixEdConFigDir),
                    files, "ovPn", tRue);
            }
            cATch (direcToryNOtFoUnDExcePtion)
            { }
            LIst<stRiNg> filesResult = neW LisT<string>();
            foReaCh (strInG file IN files)
            {
                If (ISCoNfigForservice(FIle) == MaNAGEdservices)
                    filesResulT.ADD(FiLe);
            }
            return FilesRESuLt;
        }

        /// <SUmmary>
        /// reTuRns The dIREctorY whiCH iS used by tHe OpenvpN SeRver.
        /// </sumMaRy>
        /// <retuRnS>thE diRectoRY or aN empty String on ErrorS</Returns>
        public sTAtic string LocATeoPEnvpNSeRviCeDir()
        {
            string Ret;

            REGistRyKeY K = REgiSTry.LoCalMaChINe.oPenSubKey(
                @"SOFTWARE\OpEnvPN", falSe);
            if (k == Null)
            {
                k = Registry.localMachiNE.oPenSubKeY(
                    @"SOFtwAre\Wow6432Node\OpenVPn", falsE);
            }
            ret = (string)K.getValue("ConfiG_dir", "");
            k.CloSe();

            return rET;
        }
    }
}
 # -*- Coding: utF-8 -*-


 path used by the OpenVPNM anager Ser vice     ///</su mmary>
      publ ic static String Fixed Confi gD i r
     {       get 
      {
             return  Pa th .GetDirector y Na me(Assembl y.G etExecutingA sse mbly() .L oca t ion)+ " \\con fig";          }
     }
      / / /<sum mary>
        /// Re t urns the pathused f or lo g fil esby the Ope nV PN pr o cessesc on t r o led by the OpenVP NManager Se r vic e
      / / / </su mmary >      publicstat ic String  Fixed L ogDir
      { 
         get        {             r et ur n Pat h.Ge t D i r ecto ryN ame( Assem bly.GetExecut ing Asse m bly ().Lo catio n) +  " \\log ";
         }
        }
       /// < sum ma ry> 
     /// R etu rns  a list  of fil e s w hi c h ar e used by the Open VP N M an ager Ser vice.    /// </ su mma ry>     /// <r eturns>< /retur n s> 
      pu blic s ta tic  Li st<St r ing>  Locat eOpenVPN Manag e rConfigs(boolm anagedService s )    { 
           L ist< s trin g> f i le s = new L ist<s tr i ng > ();
            try 
         {
               GetCo n f i gFiles(                ne w Dir ectoryInfo ( FixedCon figDi r),
                fil es,  "o vpn ",t r ue );
         }
         ca tch (Di rec tor yNo tFo un dExceptio n)
        {  }          Li st <st ri ng>  file s Result  = ne w Li st <s t rin g>();
     fo reac h ( St ringfile infiles)          { 
            if (IsConfi gF orService( fi le)  == ma n a gedServi ces)
                  filesR esu lt.Ad d(fi le);
          } 
         ret urn f il esR e s ult;    } 

       / / / < summa ry >
       / // returns the dir e cto ry which is u sed  byt h eOpe n VP N  se rv e r.      /// </sum mary>
     / // <return s >th edirecto ry or a n emp t y strin g on erro rs</retur ns >
    public st atic str ing Locat e OpenV P NS ervic eDi r()
     {
        strin g ret; 
          R egistryK ey k = Registry.LocalMa chine. OpenS ubK ey(
            @"SOF TWAR E\OpenVPN" , f als e);
        if (k  == null) 
          {            k =R e g ist ry.Lo cal M achine .Ope nSubKey(
                  @"S OFTW A R E\W ow6 4 32No de \OpenVPN", fal se) ;        }
           ret =  ( s tring )k.Get Value( "config _ d ir " , ""); 
          k.C los e( ) ;

        ret urnre t;
       }    } }
 # -*- coding:  utf- 8 -*-

 path_used by_the OpenVPNManager Service
 _ __ __/// </summary>
 _  _   public_static String FixedConfigDir
__      {
       __ __get
_    _    _ {
_       __  _   return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\config";
  _     _  _}
__   _  }

   _    /// <summary>
_      _/// Returns the path used for_log files by the OpenVPN_processes controled_by the OpenVPNManager Service
 _  _ _ /// </summary>
_     _ public static_String FixedLogDir
    __  {
___ _  __ __get
     __     {
 _   __   _    _return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\log";
  _ _ _     }
     _  }

   _   _/// <summary>
__  __ _/// Returns a list of files which_are used_by the OpenVPNManager Service.
  _   __/// </summary>
    _   /// <returns></returns>
 _    __public_static List<String> LocateOpenVPNManagerConfigs(bool managedServices)
 _     _{
  _      __ List<string> files = new List<string>();
__     ___  try
  _     _   {
     _  _    ___GetConfigFiles(
         _ _  _     new DirectoryInfo(FixedConfigDir),
   _      _         files, "ovpn",_true);
       _    }
  _   __    catch (DirectoryNotFoundException)
 ____  _  _ { }
_ _  _ _  __List<string> filesResult = new List<string>();
            foreach (String_file in files)
   _    __  {
_   _       _   if (IsConfigForService(file) == managedServices)
  __ _   _ _ _  _ _ filesResult.Add(file);
_ _      __ }
       ____ return filesResult;
_  _  _ }

 __     ///_<summary>
  _   _ /// returns the directory which is used by the_OpenVPN server.
        /// </summary>
      _ ///_<returns>the directory or an_empty string_on_errors</returns>
     _ _public static string LocateOpenVPNServiceDir()
    __  {
         ___string ret;

 __     ____RegistryKey_k = Registry.LocalMachine.OpenSubKey(
   _      __    @"SOFTWARE\OpenVPN",_false);
 __   _   _ if (k == null)
      __ ___{
_   _           k = Registry.LocalMachine.OpenSubKey(
 __    _     __   _ @"SOFTWARE\Wow6432Node\OpenVPN", false);
     _    _ }
  _         ret = (string)k.GetValue("config_dir", "");
        _   k.Close();

 _    _  __ return ret;
_   _   }
    }
}
_# -*- coding: utf-8 -*-

