public bool ToolNewerCheck(MOG_Filename mogAsset, string version, MOG_Project pProject, ref string failedString) { MOG_Time assetTime = new MOG_Time(version); MOG_Time correctAssetTime = new MOG_Time(); DirectoryInfo [] dirs = DosUtils.DirectoryGetList(MOG_ControllerRepository.GetAssetBlessedPath(mogAsset).GetEncodedFilename(), "*.*"); if (dirs != null) { foreach (DirectoryInfo dir in dirs) { string checkVersion = dir.Name.Substring(dir.Name.LastIndexOf(".") + 1); MOG_Time dirTime = new MOG_Time(checkVersion); // Is this asset equal or newer than this dir version? if (assetTime.Compare(dirTime) < 0) { failedString = "Out of date," + failedString; return(false); } } } return(true); }
// public Font GetNodeFont(MOG_ColumnTreeView tree) // { // if (GetTaskInfo() != null) // { // if (GetTaskInfo().GetPercentComplete() >= 100) // { // return new System.Drawing.Font(tree.Font.FontFamily, tree.Font.Size, FontStyle.Strikeout, tree.Font.Unit, tree.Font.GdiCharSet, tree.Font.GdiVerticalFont); // } // } // // return new System.Drawing.Font(tree.Font.FontFamily, tree.Font.Size, FontStyle.Regular, tree.Font.Unit, tree.Font.GdiCharSet, tree.Font.GdiVerticalFont); // } public Color GetNodeFontColor(MOG_ColumnTreeView tree) { MOG_Time current = new MOG_Time(); if (GetTaskInfo() != null) { if (current.Compare(new MOG_Time(GetTaskInfo().GetDueDate())) > 0) { return(Color.Red); } } return(SystemColors.ControlText); }
/// <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(); } }