Example #1
0
        private void CopyAllFiles(string arrayObjectName, string destination)
        {
            string          destinationPath;
            ArrayObject     arrayObject     = new ArrayObject(varObjectStructList);
            VarObjectStruct varObjectStruct = arrayObject.GetObjectFromName(arrayObjectName);
            Array           fileList        = varObjectStruct.ToArray();

            Common.MakeAllSubFolders(destination);
            destination = Common.SetSlashOnEndOfDirectory(destination);

            for (int i = 0; i < fileList.Length; i++)
            {
                if (!File.Exists(fileList.GetValue(i).ToString()))
                {
                    ModuleLog.Write(string.Format("File dont exists\r\n{0}", fileList.GetValue(i).ToString()), this, "CopyAllFiles", ModuleLog.LogType.WARNING);
                }
                else
                {
                    destinationPath = destination + Common.ExtractFileFromPath(fileList.GetValue(i).ToString());
                    ModuleLog.Write(new string[] { "Source: " + fileList.GetValue(i).ToString(), "Destination: " + destinationPath }, this, "CopyAllFiles", ModuleLog.LogType.DEBUG);

                    File.Copy(fileList.GetValue(i).ToString(), destinationPath, true);
                }
            }
        }
Example #2
0
        private void CopyAllFiles(string arrayObjectName, string destination)
        {
            string destinationPath;
            ArrayObject arrayObject = new ArrayObject(varObjectStructList);
            VarObjectStruct varObjectStruct = arrayObject.GetObjectFromName(arrayObjectName);
            Array fileList = varObjectStruct.ToArray();

            Common.MakeAllSubFolders(destination);
            destination = Common.SetSlashOnEndOfDirectory(destination);

            for (int i = 0; i < fileList.Length; i++)
            {
                if (!File.Exists(fileList.GetValue(i).ToString()))
                {
                    ModuleLog.Write(string.Format("File dont exists\r\n{0}", fileList.GetValue(i).ToString()), this, "CopyAllFiles", ModuleLog.LogType.WARNING);
                }
                else
                {
                    destinationPath = destination + Common.ExtractFileFromPath(fileList.GetValue(i).ToString());
                    ModuleLog.Write(new string[] { "Source: " + fileList.GetValue(i).ToString(), "Destination: " + destinationPath }, this, "CopyAllFiles", ModuleLog.LogType.DEBUG);

                    File.Copy(fileList.GetValue(i).ToString(), destinationPath, true);
                }
            }
        }