コード例 #1
0
ファイル: Copy.cs プロジェクト: marcinpawlakagh/ocr_reader
        public void CopyWZ()
        {
            conf Config = new conf();

            try
            {
                File.Copy(pdfName, Config.outPath + "Rok_20" + year + "\\" + docName + ".pdf");
                StreamWriter WZ;
                WZ = File.AppendText(fileLog);
                WZ.WriteLine(Config.outPath + "Rok_20" + year + "\\" + docName + ".pdf");
                WZ.Close();
            }
            catch (IOException)
            {
                FileInfo infoFirst  = new FileInfo(Config.outPath + "Rok_20" + year + "\\" + docName + ".pdf");
                long     byteFirst  = infoFirst.Length;
                FileInfo infoSecond = new FileInfo(pdfName);
                long     byteSecond = infoSecond.Length;
                if (byteFirst != byteSecond)
                {
                    File.Copy(pdfName, Config.outPath + "Rok_20" + year + "\\duplikaty\\" + docName + ".pdf");
                    StreamWriter WZ2;
                    WZ2 = File.AppendText(fileLog);
                    WZ2.WriteLine("!! DUPLIKAT !!    " + Config.outPath + "Rok_20" + year + "\\duplikaty\\" + docName + ".pdf" + "    !! DUPLIKAT !!");
                    WZ2.Close();
                }
                else
                {
                    StreamWriter WZ3;
                    WZ3 = File.AppendText(fileLog);
                    WZ3.WriteLine("!! Identyczny plik istnieje !!    " + Config.outPath + "Rok_20" + year + "\\" + docName + ".pdf" + "    !! Identyczny plik istnieje !!");
                    WZ3.Close();
                }
            }
        }