Exemple #1
0
        private void CreateLateResolverItem(MOG_DBPackageCommandInfo packageCommand)
        {
            MOG_Filename assetName = new MOG_Filename(packageCommand.mAssetName);

            if (assetName.GetFilenameType() == MOG_FILENAME_TYPE.MOG_FILENAME_Asset)
            {
                ListViewItem item = new ListViewItem();

                // "NAME, CLASSIFICATION, DATE, TARGET PACKAGE, OWNER, FULLNAME, COMMANDID, LABEL, VERSION"

                item.Text = assetName.GetAssetLabel();
                item.SubItems.Add(assetName.GetAssetClassification());                 // Class
                item.SubItems.Add(MogUtils_StringVersion.VersionToString(packageCommand.mAssetVersion));
                item.SubItems.Add(packageCommand.mPackageName);
                item.SubItems.Add((packageCommand.mBlessedBy.Length != 0) ? packageCommand.mBlessedBy : packageCommand.mCreatedBy);
                item.SubItems.Add(packageCommand.mAssetName);
                item.SubItems.Add(packageCommand.mID.ToString());
                item.SubItems.Add(packageCommand.mLabel);
                item.SubItems.Add(packageCommand.mAssetVersion);

                item.ImageIndex = MogUtil_AssetIcons.GetAssetIconIndex(packageCommand.mAssetName, null, false);

                mainForm.ConnectionManagerLateResolversListView.Items.Add(item);
            }
        }
Exemple #2
0
        private ListViewItem AddItemToListView(MOG_Filename mogAsset, MOG_Properties pProperties, string fullPath)
        {
            ListViewItem item = new ListViewItem();

            foreach (ColumnHeader column in ListListView.Columns)
            {
                item.SubItems.Add("");
            }

            SetSubColumnText(item, "Name", mogAsset.GetAssetLabel());
            SetSubColumnText(item, "MOG Classification", mogAsset.GetAssetClassification());
            SetSubColumnText(item, "Platform", mogAsset.GetAssetPlatform());
            SetSubColumnText(item, "Version", mogAsset.GetVersionTimeStampString(""));

            if (pProperties != null)
            {
                SetSubColumnText(item, "Size", guiAssetController.FormatSize(pProperties.Size));
                SetSubColumnText(item, "Package", GetPackages(pProperties));
                SetSubColumnText(item, "Creator", pProperties.Creator);
                SetSubColumnText(item, "Last Bless", pProperties.Owner);
                SetSubColumnText(item, "Computer", pProperties.SourceMachine);
                SetSubColumnText(item, "GamePath", pProperties.SyncTargetPath);
                SetSubColumnText(item, "Last Comment", pProperties.LastComment);
            }

            SetSubColumnText(item, "Fullname", fullPath);

            // Icon
            item.ImageIndex = MogUtil_AssetIcons.GetAssetIconIndex(mogAsset.GetOriginalFilename(), pProperties, false);
            return(ListListView.Items.Add(item));
        }
Exemple #3
0
 private void FindAndUpdateNodeLockStatus(string nodeKey, MOG_Filename assetName, MogControl_BaseTreeView tree)
 {
     // Attempt to find this node in our tree
     TreeNode[] foundNodes = tree.Nodes.Find(nodeKey, true);
     if (foundNodes != null && foundNodes.Length > 0)
     {
         foreach (TreeNode node in foundNodes)
         {
             Mog_BaseTag tag = node.Tag as Mog_BaseTag;
             if (tag != null)
             {
                 // Is this a sync target node
                 if (tag.AttachedSyncTargetInfo != null)
                 {
                     // Update this assets status
                     string assetRepositoryName = tag.FullFilename + "\\Files.Imported\\" + tag.AttachedSyncTargetInfo.FilenameOnly;
                     node.ImageIndex         = MogUtil_AssetIcons.GetBinaryLockedOrUnlockedIcon(assetName.GetAssetFullName(), assetRepositoryName);
                     node.SelectedImageIndex = node.ImageIndex;
                 }
                 else
                 {
                     // Update this assets status
                     node.ImageIndex         = MogUtil_AssetIcons.GetAssetIconIndex(assetName.GetAssetFullName());
                     node.SelectedImageIndex = node.ImageIndex;
                 }
             }
         }
     }
 }
        /// <summary>
        /// Generates the root node for our project
        /// </summary>
        private TreeNode CreateSyncTargetRootNode()
        {
            Nodes.Clear();
            string   projectName = MOG_ControllerProject.GetProjectName();
            TreeNode rootNode    = new TreeNode(projectName, new TreeNode[] { new TreeNode(Blank_Node_Text) });

            rootNode.Tag  = new Mog_BaseTag(rootNode, rootNode.Text);
            rootNode.Name = rootNode.Text;
            Nodes.Add(rootNode);
            rootNode.ImageIndex = MogUtil_AssetIcons.GetAssetIconIndex(rootNode.Text);

            rootNode.Expand();

            return(rootNode);
        }
        public void RefreshLockStatus(MOG_Command LockUpdate)
        {
            Color textColor = Color.Black;

            if (LockUpdate != null)
            {
                ListView currentView = mAssetManager.mainForm.AssetManagerInboxTabControl.SelectedTab.Controls[0] as ListView;

                if (currentView == null)
                {
                    return;
                }

                int index = mAssetManager.ListViewItemFindItem(LockUpdate.GetAssetFilename().GetAssetLabel(), currentView);
                if (index != -1)
                {
                    currentView.Items[index].ImageIndex = MogUtil_AssetIcons.GetAssetIconIndex(LockUpdate.GetAssetFilename().GetOriginalFilename());
                }
            }
        }
Exemple #6
0
        private void CreatePostItem(MOG_DBPostInfo post)
        {
            MOG_Filename assetName = new MOG_Filename(post.mAssetName);

            if (assetName.GetFilenameType() == MOG_FILENAME_TYPE.MOG_FILENAME_Asset)
            {
                ListViewItem item = new ListViewItem();

                // "NAME, CLASSIFICATION, DATE, OWNER, FULLNAME, COMMANDID"

                item.Text = assetName.GetAssetLabel();
                //item.SubItems.Add(assetName.GetAssetLabel());
                item.SubItems.Add(assetName.GetAssetClassification());
                item.SubItems.Add(MogUtils_StringVersion.VersionToString(post.mAssetVersion));
                item.SubItems.Add(post.mBlessedBy);
                item.SubItems.Add(post.mAssetName);
                item.SubItems.Add(post.mID.ToString());
                item.SubItems.Add(post.mLabel);
                item.SubItems.Add(post.mAssetVersion);
                item.ImageIndex = MogUtil_AssetIcons.GetAssetIconIndex(post.mAssetName, null, false);

                mainForm.ConnectionManagerPostingListView.Items.Add(item);
            }
        }
Exemple #7
0
        /// <summary>
        /// Load a report form from a file and populate it
        /// </summary>
        /// <param name="filename"></param>
        public void LoadReportList(string filename)
        {
            MOG_Ini report = new MOG_Ini(filename);

            // Set the form title
            Text = Path.GetFileName(filename);

            if (report.SectionExist("ASSETS"))
            {
                ListListView.Items.Clear();

                ListListView.BeginUpdate();

                ProgressMax(report.CountKeys("ASSETS"));

                for (int x = 0; x < report.CountKeys("ASSETS"); x++)
                {
                    MOG_Filename mogAsset  = new MOG_Filename(report.GetKeyNameByIndexSLOW("ASSETS", x));
                    string       extraInfo = report.GetKeyByIndexSLOW("ASSETS", x);

                    MOG_Properties pProperties = new MOG_Properties(mogAsset);

                    string version        = mogAsset.GetVersionTimeStamp();
                    string currentVersion = MOG_DBAssetAPI.GetAssetVersion(mogAsset);                    //mCurrentInfo.GetString("ASSETS", mogAsset.GetAssetName());

                    MOG_Time assetTime        = new MOG_Time(version);
                    MOG_Time currentAssetTime = new MOG_Time(currentVersion);

                    ListViewItem item = new ListViewItem();

                    // We have support for the old lists as well as the new ones that have extra information stored.
                    if (string.Compare(extraInfo, "ReportList", true) != 0)
                    {
                        string [] extraItems = extraInfo.Split(",".ToCharArray());
                        foreach (string extra in extraItems)
                        {
                            if (item.Text.Length == 0)
                            {
                                item.Text = extra;
                            }
                            else
                            {
                                item.SubItems.Add(extra);
                            }
                        }

                        // Update the version
                        if (assetTime.Compare(currentAssetTime) != 0)
                        {
                            item.SubItems[FindColumn("Version")].Text      = currentAssetTime.FormatString("");
                            item.SubItems[FindColumn("Version")].ForeColor = Color.Red;
                        }
                    }
                    else
                    {
                        item = AddItemToListView(mogAsset, pProperties, MOG_ControllerRepository.GetAssetBlessedVersionPath(mogAsset, version).GetEncodedFilename());

                        // Get version
                        if (assetTime.Compare(currentAssetTime) != 0)                                                                                           // Version
                        {
                            item.SubItems[FindColumn("Version")].Text      = currentAssetTime.FormatString("");
                            item.SubItems[FindColumn("Version")].ForeColor = Color.Red;
                            version = currentVersion;
                        }
                        else
                        {
                            item.SubItems[FindColumn("Version")].Text = assetTime.FormatString("");
                        }
                    }

                    // Icon
                    item.ImageIndex = MogUtil_AssetIcons.GetAssetIconIndex(mogAsset.GetAssetFullName());

                    ListListView.Items.Add(item);

                    ProgressStep();
                }

                UpdateAssetTotals();
                ListListView.EndUpdate();
                ProgressReset();
            }
        }
Exemple #8
0
        private ListViewItem InitNewLockItem(MOG_Command command)
        {
            if (command != null)
            {
                if ((command.GetCommandType() == MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRequest) || (command.GetCommandType() == MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRequest))
                {
                    ListViewItem item = new ListViewItem();
                    MOG_Time     time = new MOG_Time();
                    time.SetTimeStamp(command.GetCommandTimeStamp());

                    // Gather appropriate lock info from the command's MOG_Filename
                    string label          = "";
                    string classification = "";

                    // Check if this is an asset?
                    if (command.GetAssetFilename().GetFilenameType() == MOG_FILENAME_TYPE.MOG_FILENAME_Asset)
                    {
                        // Get the label and classifciation of the asset
                        label          = command.GetAssetFilename().GetAssetLabel();
                        classification = command.GetAssetFilename().GetAssetClassification();

                        // Obtain the proper icon
                        item.ImageIndex = MogUtil_AssetIcons.GetAssetIconIndex(command.GetAssetFilename().GetOriginalFilename());
                    }
                    // Check if this is a classification-level by seeing if it ends with a '*'?
                    else if (command.GetAssetFilename().GetOriginalFilename().EndsWith("*"))
                    {
                        // Do our best to illustrate a classification-level lock
                        label          = "*";
                        classification = command.GetAssetFilename().GetOriginalFilename().Trim("*".ToCharArray());

                        // Obtain the proper icon
                        item.ImageIndex = MogUtil_AssetIcons.GetClassIconIndex(classification);
                    }

                    //LOCK_COLUMNS {LABEL, CLASSIFICATION, USER, DESCRIPTION, MACHINE, IP, ID, TIME, FULLNAME, TYPE};
                    item.Text = label;
                    item.SubItems.Add(classification);
                    item.SubItems.Add(command.GetUserName());
                    item.SubItems.Add(command.GetDescription());
                    item.SubItems.Add(command.GetComputerName());
                    item.SubItems.Add(command.GetComputerIP());
                    item.SubItems.Add(Convert.ToString(command.GetNetworkID()));
                    item.SubItems.Add(time.FormatString(""));
                    item.SubItems.Add(command.GetAssetFilename().GetOriginalFilename());

                    switch (command.GetCommandType())
                    {
                    case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRequest:
                        item.SubItems.Add("Read Lock");
                        item.ForeColor = Color.Green;
                        break;

                    case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRequest:
                        item.SubItems.Add("Write Lock");
                        item.ForeColor = Color.Red;
                        break;
                    }

                    return(item);
                }
            }
            return(null);
        }
        /// <summary>
        /// Mother of all ImageIndex getting, not meant to be used outside this class
        /// </summary>
        private int GetImageIndex(string filename, bool searchFileSystem, bool isClassification)
        {
            // If we are a Classification, return our GetClassIconIndex
            if (isClassification)
            {
                return(MogUtil_AssetIcons.GetClassIconIndex(filename));
            }

            int iconIndex = 0;

            // If we need to search the FileSystem, do so...
            if (searchFileSystem)
            {
                iconIndex = MogUtil_AssetIcons.GetFileIconIndex(filename);
                // If we got an iconIndex other than 0, return our value...
                if (iconIndex != 0)
                {
                    return(iconIndex);
                }
                // Else, continue processing
            }

            // Try getting our index through GetAssetIconIndex
            iconIndex = MogUtil_AssetIcons.GetAssetIconIndex(filename);
            // If we got an iconIndex other than 0, return...
            if (iconIndex != 0)
            {
                return(iconIndex);
            }

            // Look for our index using our MOG_Filename and MOG_Properties
            MOG_Filename   realFile   = new MOG_Filename(filename);
            MOG_Properties properties = null;

            // If we have an Asset, get its properties
            if (realFile.GetFilenameType() == MOG_FILENAME_TYPE.MOG_FILENAME_Asset)
            {
                properties = new MOG_Properties(realFile);

                // So long as we got a properties...
                if (properties != null)
                {
                    iconIndex = MogUtil_AssetIcons.GetAssetIconIndex(properties.AssetIcon);
                    // If we have a valid iconIndex, return it
                    if (iconIndex != 0)
                    {
                        return(iconIndex);
                    }
                    // Else if Package, return our default Package icon
                    else if (properties.IsPackage)
                    {
                        return(MogUtil_AssetIcons.GetClassIconIndex(Package_ImageText));
                    }
                    // Else, return our default Asset icon
                    else
                    {
                        return(MogUtil_AssetIcons.GetClassIconIndex(Asset_ImageText));
                    }
                }
            }

            // If after all our work, we still didn't find an icon (and we know we're not a
            //  Classification) throw an exception to the programmer
            if (iconIndex == 0)
            {
                // KLK - There is no need to thow if the icon could not be located.  Just return a bogus icon
                //throw new Exception(ToString() + ": Error with TreeNode.ImageIndex on a non-Classification.\r\n"
                //	+ "ImageIndex should not be 0 for a non-Classification");
            }

            return(iconIndex);
        }