Programming C# 2nd Edition phần 6 potx

59 330 1
Programming C# 2nd Edition phần 6 potx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

[...]... Clicking the Application Folder shows the file you've already added (the primary output), as shown in Figure 13- 16 Figure 13- 16 The Application Folder You are free to add or delete files Right-clicking in the detail window brings up a context menu, as shown in Figure 13-17 320 Programming C#, 2nd Edition Figure 13-17 Context menu within the File Detail window You can see there is great flexibility here... f1, object f2) { FileInfo file1 = (FileInfo) f1; FileInfo file2 = (FileInfo) f2; if (file1.Length > file2.Length) { return -1; } if (file1.Length < file2.Length) { return 1; } return 0; } } 3 06 Programming C#, 2nd Edition public Form1( ) { // // Required for Windows Form Designer support // InitializeComponent( ); } // fill the source and target directory trees FillDirectoryTree(tvwSource, true); FillDirectoryTree(tvwTargetDir,... would it be easier to have an empty value? fileList.Add(file); } 313 Programming C#, 2nd Edition // Create an instance of the IComparer interface IComparer comparer = (IComparer) new FileComparer( ); // pass the comparer to the sort method so that the list // is sorted by the compare method of comparer 13.3 XML Documentation Comments C# supports a new Documentation Comment style, with three slash marks... exception classes A detailed discussion of XML Documentation Comments is beyond the scope of this book, but a complete listing of available tags can be found in the C# Programmers Reference that is included with Visual Studio 315 Programming C#, 2nd Edition 13.4 Deploying an Application Now that the application works, how do you deploy it? The good news is that in NET there is no Registry to fuss with; you... choices include: Cab Project Much like a ZIP file, this compresses a number of small files into an easy-to-use (and easy-to-transport) package This option can be combined with the others 3 16 Programming C#, 2nd Edition Merge Module If you have more than one project that use files in common, this option helps you make intermediate merge modules You can then integrate these modules into the other deployment... Figure 13-14 If you do not have WinZip, you can use the expand utility (-D lists the contents of a cab file): 318 Programming C#, 2nd Edition Figure 13-14 The Cab file contents C:\ \FileCopierCabProject\Debug>expand -D FileCopierCabProject.CAB Microsoft (R) File Expansion Utility Version 5.1. 260 0.0 Copyright (C) Microsoft Corp 1990-1999 All rights reserved filecopiercabproject.cab: OSDBF.OSD filecopiercabproject.cab:... the only ternary operator in C# (a ternary operator takes three terms) The logic is "test whether node.Nodes.Count is zero; if so return the value before the colon (in this case an empty string) Otherwise return the value after the colon (in this case a backslash)." The recursion stops when there is no parent; that is, when you hit the root directory 300 Programming C#, 2nd Edition 13.2.3.3 Handling the... If the workflow does not provide sufficient control, you can choose the Custom Options choice from the View menu You can also specify Launch conditions for the Setup process itself 324 Programming C#, 2nd Edition 13.4 .6 Building the Setup Project Once you've made all your choices and set all the options, choose Configuration Manager from the Build menu and make sure your Setup Project is included in... DirectoryInfo dir = new DirectoryInfo(rootDirectoryName); dir.GetDirectories( ); TreeNode ndRoot = new TreeNode(rootDirectoryName); // Add a node for each root directory tvw.Nodes.Add(ndRoot); 307 Programming C#, 2nd Edition // Add subdirectory nodes // If Treeview is the source, // then also get the filenames if (isSource) { GetSubDirectoryNodes( ndRoot, ndRoot.Text, true); } else { GetSubDirectoryNodes(... in the tree /// Need to double the backslash since it /// is normally /// an escape character /// TreeNode subNode = new TreeNode(dirSub.Name); parentNode.Nodes.Add(subNode); 308 Programming C#, 2nd Edition // Call GetSubDirectoryNodes recursively GetSubDirectoryNodes( subNode,dirSub.FullName,getFileNames); } if (getFileNames) { // Get any files for this node FileInfo[] files = dir.GetFiles(

Ngày đăng: 12/08/2014, 23:22

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan