コード例 #1
0
 static void Main(String[] Dir)
 {
     if (Dir.Length == 3)
     {
         // Copy from the current directory, include subdirectories.
         DirectoryCopy(Dir[0], Dir[1], Convert.ToBoolean(Dir[2]));
     }
     else if (Dir.Length == 1)
     {
         //Cartelle App = CaricaImpostazioniDaXml("test");
         Cartelle App = CaricaImpostazioniDaXml(Dir[0]);
         DirectoryCopy(App.DirIniziale, App.DirDestinazione, Convert.ToBoolean(App.SyncSubDirs));
     }
 }
コード例 #2
0
        public static Cartelle CaricaImpostazioniDaXml(String Profilo)
        {
            Cartelle Impostazioni = new Cartelle();

            #region Load File

            XmlDocument xmlProfili = new XmlDocument();
            xmlProfili.Load("Profili.xml");

            #endregion

            #region Search Id button father of the Page

            var nodeP = xmlProfili.SelectNodes(@"//Profile[@Name='" + Profilo + "']").Cast <XmlNode>().FirstOrDefault();
            Impostazioni.DirIniziale     = (nodeP.ChildNodes.Cast <XmlLinkedNode>().Where(node => node.Name == "DirIniziale").FirstOrDefault().InnerText);
            Impostazioni.DirDestinazione = (nodeP.ChildNodes.Cast <XmlLinkedNode>().Where(node => node.Name == "DirDestinazione").FirstOrDefault().InnerText);
            Impostazioni.SyncSubDirs     = (nodeP.ChildNodes.Cast <XmlLinkedNode>().Where(node => node.Name == "SyncSubDirs").FirstOrDefault().InnerText);

            #endregion

            return(Impostazioni);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: Giamma94/ToolBackup
        public static Cartelle CaricaImpostazioniDaXml(String Profilo)
        {
            Cartelle Impostazioni = new Cartelle();

                #region Load File

                XmlDocument xmlProfili = new XmlDocument();
                xmlProfili.Load("Profili.xml");

                #endregion

                #region Search Id button father of the Page

                var nodeP = xmlProfili.SelectNodes(@"//Profile[@Name='" + Profilo + "']").Cast<XmlNode>().FirstOrDefault();
                Impostazioni.DirIniziale = (nodeP.ChildNodes.Cast<XmlLinkedNode>().Where(node => node.Name == "DirIniziale").FirstOrDefault().InnerText);
                Impostazioni.DirDestinazione = (nodeP.ChildNodes.Cast<XmlLinkedNode>().Where(node => node.Name == "DirDestinazione").FirstOrDefault().InnerText);
                Impostazioni.SyncSubDirs = (nodeP.ChildNodes.Cast<XmlLinkedNode>().Where(node => node.Name == "SyncSubDirs").FirstOrDefault().InnerText);

                #endregion

                return Impostazioni;
        }