コード例 #1
0
        private ListViewItem CreateListViewItemForFile(string localFile)
        {
            ListViewItem item = null;

            // Only put the asset in the list if it is actually a library asset
            if (MOG_ControllerLibrary.IsPathWithinLibrary(localFile))
            {
                item = new ListViewItem(Path.GetFileName(localFile));

                string classification = MOG_ControllerLibrary.ConstructLibraryClassificationFromPath(localFile);
                string localTimestamp = GetLocalFileTimestamp(localFile);
                string fullname       = localFile;
                string status         = "Unknown";
                string extension      = DosUtils.PathGetExtension(localFile);

                // Populate the item
                item.ImageIndex = MogUtil_AssetIcons.GetFileIconIndex(localFile);
                item.SubItems.Add(extension);               // Extension
                item.SubItems.Add(classification);          // Classification
                item.SubItems.Add("");                      // User
                item.SubItems.Add("");                      // Comment
                item.SubItems.Add(localTimestamp);          // Local TimeStamp
                item.SubItems.Add("");                      // Server Timestamp
                item.SubItems.Add(status);                  // Status
                item.SubItems.Add(fullname);                // Fullname
                item.SubItems.Add(localFile);               // LocalFile
                item.SubItems.Add("");                      // RepositoryFile

                UpdateListViewItemColors(item, status);
            }

            return(item);
        }
コード例 #2
0
        private void LibraryListView_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            if (e.Label != null)
            {
                // Rename the asset
                ListViewItem renamedAsset = LibraryListView.Items[e.Item];
                string       fullName     = GetItemFullName(renamedAsset);
                string       label        = renamedAsset.SubItems[FindColumn("Name")].Text;
                string       extension    = DosUtils.PathGetExtension(fullName);

                string rename = fullName.Replace(label, e.Label);

                if (DosUtils.FileExistFast(rename))
                {
                    MOG_Prompt.PromptMessage("Rename Error", "Cannot rename (" + label + ") to (" + e.Label + ") because this asset already exists!");
                    e.CancelEdit = true;
                }
                else
                {
                    if (!DosUtils.RenameFast(fullName, rename, false))
                    {
                        MOG_Prompt.PromptMessage("Rename Error", DosUtils.GetLastError());
                        e.CancelEdit = true;
                    }
                    else
                    {
                        // Update the full filename
                        renamedAsset.SubItems[FindColumn("Fullname")].Text  = rename;
                        renamedAsset.SubItems[FindColumn("Extension")].Text = extension;
                    }
                }
            }
        }
コード例 #3
0
        private ListViewItem CreateListViewItemForAsset(MOG_Filename asset)
        {
            ListViewItem item = null;

            // Only put the asset in the list if it is actually a library asset
            if (asset.IsLibrary())
            {
                // Make sure we have something valid in our Filename
                if (asset.GetAssetLabel().Length > 0)
                {
                    item = new ListViewItem(asset.GetAssetLabel());

                    // Get the source imported file
                    MOG_Filename repositoryAssetFilename = MOG_ControllerRepository.GetAssetBlessedVersionPath(asset, asset.GetVersionTimeStamp());
                    string       repositoryFile          = MOG_ControllerLibrary.ConstructBlessedFilenameFromAssetName(repositoryAssetFilename);
                    string       localFile = MOG_ControllerLibrary.ConstructLocalFilenameFromAssetName(repositoryAssetFilename);
                    string       extension = DosUtils.PathGetExtension(localFile);

                    // Populate the item
                    item.SubItems.Add(extension);                                   // Extension
                    item.SubItems.Add(asset.GetAssetClassification());              // Classification
                    item.SubItems.Add("");                                          // User
                    item.SubItems.Add("");                                          // Comment
                    item.SubItems.Add("");                                          // Local TimeStamp
                    item.SubItems.Add(asset.GetVersionTimeStampString(""));         // Server Timestamp
                    item.SubItems.Add("New");                                       // Status
                    item.SubItems.Add(asset.GetAssetFullName());                    // Fullname
                    item.SubItems.Add(localFile);                                   // LocalFile
                    item.SubItems.Add(repositoryFile);                              // RepositoryFile

                    // Update the item
                    UpdateItem(item);
                }
            }

            return(item);
        }