static private DialogResult LockMessage(string message, MOG_Command desiredLockInfo, MOG_Command currentLockHolderInfo) { MOG_Time desiredLockTime = new MOG_Time(); desiredLockTime.SetTimeStamp(desiredLockInfo.GetCommand().GetCommandTimeStamp()); string desiredLockName = desiredLockInfo.GetAssetFilename().GetAssetFullName(); // Check if this asset is a classification if (desiredLockName.Length == 0) { desiredLockName = desiredLockInfo.GetAssetFilename().GetOriginalFilename(); } string desiredUser = desiredLockInfo.GetCommand().GetUserName().Length != 0 ? desiredLockInfo.GetCommand().GetUserName() : desiredLockInfo.GetCommand().GetComputerName(); string desiredMachine = desiredLockInfo.GetCommand().GetComputerName(); string desiredDescription = desiredLockInfo.GetCommand().GetDescription().Trim(); // Current lock holder MOG_Time currentLockTime = new MOG_Time(); currentLockTime.SetTimeStamp(currentLockHolderInfo.GetCommandTimeStamp()); string currentLockName = currentLockHolderInfo.GetAssetFilename().GetAssetFullName(); // Check if this asset is a classification if (currentLockName.Length == 0) { currentLockName = currentLockHolderInfo.GetAssetFilename().GetOriginalFilename(); } string currentLockUser = currentLockHolderInfo.GetUserName().Length != 0 ? currentLockHolderInfo.GetUserName() : currentLockHolderInfo.GetComputerName(); string currentLockMachine = currentLockHolderInfo.GetComputerName(); string currentLockDescription = currentLockHolderInfo.GetDescription().Trim(); return(MessageBox.Show(message + "\n\n" + desiredLockName + "\n" + " USER: "******"\n" + " MACHINE: " + desiredMachine + "\n" + " DESCRIPTION: " + desiredDescription + "\n" + " TIME: " + desiredLockTime.FormatString("") + "\n\n Colliding Lock:\n\n" + currentLockName + "\n" + " USER: "******"\n" + " MACHINE: " + currentLockMachine + "\n" + " DESCRIPTION: " + currentLockDescription + "\n" + " TIME: " + currentLockTime.FormatString(""), "Asset Locked!", MessageBoxButtons.RetryCancel, MessageBoxIcon.Question)); }
static public string VersionToString(string version) { string text = ""; if (version.Length > 0) { MOG_Time time = new MOG_Time(version); text = time.FormatString(""); } return(text); }
private ListViewItem InitNewRequestItem(MOG_Command command) { 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()); item.Text = command.ToString(); item.SubItems.Add(command.GetAssetFilename().GetOriginalFilename()); item.SubItems.Add(command.GetComputerIP()); item.SubItems.Add(time.FormatString("")); item.SubItems.Add(command.GetComputerName()); item.SubItems.Add(command.GetUserName()); item.SubItems.Add(Convert.ToString(command.GetNetworkID())); item.SubItems.Add(command.GetDescription()); item.SubItems.Add(command.ToString()); switch (command.GetCommandType()) { case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRequest: item.Text = "Read Lock"; item.ForeColor = Color.Green; item.ImageIndex = 0; break; case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRequest: item.Text = "Write Lock"; item.ForeColor = Color.Red; item.ImageIndex = 0; break; } return(item); } return(null); }
/// <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(); } }
/// <summary> /// Get a unique auto generated filename for this reportFile /// </summary> /// <param name="path"></param> /// <param name="name"></param> /// <returns></returns> private string CreateUniqueFilename(string path, string name) { MOG_Time time = new MOG_Time(); return(path + "\\" + name.Substring(0, name.LastIndexOf(".")) + " " + time.FormatString("{Month.2}-{Day.2}-{Year.2} {Hour.2} {Minute.2} {Second.2} {AMPM}") + name.Substring(name.LastIndexOf("."))); }
private void PostWhatsNew(string targetFolder) { string versionFilename = mSourceBinaries + "\\" + targetFolder + "\\" + mArchiveVersion + "\\WhatsNew.txt"; WhatsNewLogForm log = new WhatsNewLogForm(); MOG_Time now = new MOG_Time(); log.WhatsNewRichTextBox.RichTextBox.Text = "------------------------------------------------\n" + now.FormatString("") + "\n------------------------------------------------\n"; log.WhatsNewRichTextBox.RichTextBox.Select(log.WhatsNewRichTextBox.RichTextBox.Text.Length, 1); log.TopMost = true; log.ShowDialog(); DosUtils.AppendTextToFile(versionFilename, log.WhatsNewRichTextBox.RichTextBox.Text.Replace("\n", "\r\n")); log.WhatsNewRichTextBox.RichTextBox.SaveFile(mSourceBinaries + "\\" + targetFolder + "\\" + mArchiveVersion + "\\WhatsNew.rtf", System.Windows.Forms.RichTextBoxStreamType.RichText); }
static void Main(string[] args) { Control.CheckForIllegalCrossThreadCalls = false; MOG_Post poster = new MOG_Post(); poster.PopulateVersions(); MOG_Time current = new MOG_Time(); poster.mArchiveVersion = current.FormatString("{month.2}.{day.2}.{year.2} {hour.2}.{minute.2}.{second.2} {AMPM}"); string selection = ""; while (selection != "0") { selection = poster.DisplayMenu(); switch (selection) { case "1": // Client poster.PostClient(); break; case "2": // Server poster.PostServer(); break; case "3": // Bridge poster.PostBridge(); break; case "4": // All poster.PostClient(); poster.PostBridge(); poster.PostServer(); break; case "5": // Toggle type if (poster.mBuildType == "Release") { poster.mBuildType = "Debug"; } else { poster.mBuildType = "Release"; } break; case "6": poster.PostToMOGTools(); break; case "7": break; case "0": break; } } return; }
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); }
public static bool Init_Server(string configFilename, string name) { MOG_Main.SetName(name); // Make sure we have a valid config filename? if (configFilename.Length == 0) { configFilename = MOG_Main.BuildDefaultConfigFile(); } // Check our bootup precautions if (MOG_Main.CheckInitPrecautions(configFilename)) { // Initialize MOG_REPORT for the server MOG_Time time = new MOG_Time(); // MOG is really stable now so I am shutting off the log files so things will run faster // MOG_Prompt.SetMode(MOG_PROMPT_MODE_TYPE.MOG_PROMPT_FILE); MOG_Report.SetLogFileName(String.Concat(Application.StartupPath, "\\Logs\\Server\\Server.", time.FormatString(String.Concat("{Day.2}", "-", "{Month.2}", "-", "{Year.2}", " ", "{Hour.2}", ".", "{Minute.2}", "{ampm}")), ".log")); // Create a new system MOG_CommandServerCS server = new MOG_CommandServerCS(); return(MOG_ControllerSystemCS.InitializeServer(configFilename, server)); } return(false); }