Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 Copyright 2013 Google Inc | |
3 | |
4 Licensed under the Apache License, Version 2.0 (the "License"); | |
5 you may not use this file except in compliance with the License. | |
6 You may obtain a copy of the License at | |
7 | |
8 http://www.apache.org/licenses/LICENSE-2.0 | |
9 | |
10 Unless required by applicable law or agreed to in writing, software | |
11 distributed under the License is distributed on an "AS IS" BASIS, | |
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 See the License for the specific language governing permissions and | |
14 limitations under the License. | |
15 */ | |
16 | |
17 using System.Diagnostics; | |
18 using System.IO; | |
19 using System.Threading; | |
20 | |
21 namespace Google.Apis.NuGet.Publisher | |
22 { | |
23 /// <summary>A helper utility class.</summary> | |
24 internal static class Utils | |
25 { | |
David waters
2013/08/16 10:18:36
This class appears to have been copied and pasted
peleyal
2013/08/16 13:57:43
I already changed it completely, but I'll go furth
| |
26 /// <summary>Copies a directory recursively to a new one.</summary> | |
27 /// <param name="sourceDir">Source directory</param> | |
28 /// <param name="destDir">Destination directory</param> | |
29 internal static void CopyDirectory(string sourceDir, string destDir) | |
30 { | |
31 DirectoryInfo dir = new DirectoryInfo(sourceDir); | |
32 if (!dir.Exists) | |
33 { | |
34 throw new DirectoryNotFoundException("Source directory does not exist: " + sourceDir); | |
35 } | |
36 | |
37 // If the destination directory doesn't exist, create it.· | |
38 if (!Directory.Exists(destDir)) | |
39 { | |
40 Directory.CreateDirectory(destDir); | |
41 } | |
42 | |
43 // Get all files in the source directory and copy them to the destin ation directory. | |
44 foreach (var file in dir.GetFiles()) | |
45 { | |
46 file.CopyTo(Path.Combine(destDir, file.Name), false); | |
47 } | |
48 | |
49 // copy all inner directories | |
50 foreach (var subdir in dir.GetDirectories()) | |
51 { | |
52 CopyDirectory(subdir.FullName, Path.Combine(destDir, subdir.Name )); | |
53 } | |
54 } | |
55 | |
56 /// <summary>Traces the event using the current thread id.</summary> | |
57 internal static void TraceEvent(this TraceSource trace, TraceEventType t ype, string message, | |
58 params object[] args) | |
59 { | |
60 trace.TraceEvent(type, Thread.CurrentThread.ManagedThreadId, message , args); | |
61 } | |
62 } | |
63 } | |
OLD | NEW |