コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: NewListForm.cs プロジェクト: MOGwareSupport/MOG
        private void TodayRadioButton_CheckedChanged(object sender, System.EventArgs e)
        {
            MOG_Time now = new MOG_Time();

            this.ListStartDateTimePicker.Value = new DateTime(now.mYear, now.mMonth, now.mDay, 0, 0, 0, 0);
            this.ListEndDateTimePicker.Value   = new DateTime(now.mYear, now.mMonth, now.mDay, 23, 59, 59, 59);
        }
コード例 #3
0
        public ListViewItem[] RefreshUsersBox(BackgroundWorker worker, string desiredBox, string contentsFileDirectory)
        {
            MOG_Time now = new MOG_Time();

            ArrayList assets = MOG_DBInboxAPI.InboxGetAssetListWithProperties(desiredBox, MOG_ControllerProject.GetActiveUser().GetUserName(), "", "");

            ListViewItem[] items = new ListViewItem[assets.Count];

            int x = 0;

            foreach (MOG_DBInboxProperties asset in assets)
            {
                // Create the properties for this asset
                MOG_Properties pProperties = new MOG_Properties(asset.mProperties);

                string message = "Refreshing:\n" +
                                 "     " + asset.mAsset.GetAssetClassification() + "\n" +
                                 "     " + asset.mAsset.GetAssetName();
                worker.ReportProgress(x, message);

                // Update the ListViewItem
                ListViewItem item = guiAssetManager.NewListViewItem(asset.mAsset, pProperties.Status, pProperties);
                items[x++] = item;
            }

            return(items);
        }
コード例 #4
0
ファイル: AdminToolsForm.cs プロジェクト: MOGwareSupport/MOG
        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);
        }
コード例 #5
0
ファイル: NewListForm.cs プロジェクト: MOGwareSupport/MOG
        private void YesterdayRadioButton_CheckedChanged(object sender, System.EventArgs e)
        {
            MOG_Time start = new MOG_Time();

            start.SubtractDay(1);

            this.ListStartDateTimePicker.Value = new DateTime(start.mYear, start.mMonth, start.mDay, 0, 0, 0, 0);
            this.ListEndDateTimePicker.Value   = new DateTime(start.mYear, start.mMonth, start.mDay, 23, 59, 59, 59);
        }
コード例 #6
0
 /// <summary>
 /// Write out our changes back to the TaskInfo
 /// </summary>
 public void FinializeTaskInfo()
 {
     mTaskInfo.SetName(this.TaskName);
     mTaskInfo.SetPriority(this.TaskPriority);
     mTaskInfo.SetAssignedTo(this.TaskAssignedTo);
     mTaskInfo.SetPercentComplete(this.TaskPercentage);
     mTaskInfo.SetComment(this.TaskComments);
     mTaskInfo.SetDueDate(MOG_Time.GetVersionTimestamp());
 }
コード例 #7
0
        public void SendSurvey(SurveyForm sfrm)
        {
            //MOG_SURVEY_PRIORITY priority;
            mtime = new MOG_Time();
            mtime.UpdateTime();

            //Controler stuff
            MOG_ControllerSurvey mController = new MOG_ControllerSurvey(mMog);

            mController.SetTitle(sfrm.SurveyNameTextBox.Text);
            mController.SetCategory(sfrm.SurveyCatComboBox.Text);
            mController.SetCreateTime(mtime.GetTimeStamp());
            mController.SetDescription(sfrm.SurveyDescTextBox.Text);

            // Set the priority
            MOG_SURVEY_PRIORITY priority = MOG_SURVEY_PRIORITY.MOG_SURVEY_PRIORITY_None;

            switch (sfrm.SurveyPriorityComboBox.Text)
            {
            case "None":
                priority = MOG_SURVEY_PRIORITY.MOG_SURVEY_PRIORITY_None;
                break;

            case "Low":
                priority = MOG_SURVEY_PRIORITY.MOG_SURVEY_PRIORITY_Low;
                break;

            case "Medium":
                priority = MOG_SURVEY_PRIORITY.MOG_SURVEY_PRIORITY_Medium;
                break;

            case "High":
                priority = MOG_SURVEY_PRIORITY.MOG_SURVEY_PRIORITY_High;
                break;

            case "Urgent":
                priority = MOG_SURVEY_PRIORITY.MOG_SURVEY_PRIORITY_Urgent;
                break;
            }
            mController.SetPriority(priority);

            //Figure out
            string users = "";

            mController.SetSurveyUsers(users);
            mController.SetCreator(mMog.GetUser().GetUserName());
            mController.SetExpireTime(sfrm.SurveyExpireDateTimePicker.Value.ToString());

            mController.Create();
            mController.Send();

            // Update the surveys window
            Update();
        }
コード例 #8
0
        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));
        }
コード例 #9
0
        static public string VersionToString(string version)
        {
            string text = "";

            if (version.Length > 0)
            {
                MOG_Time time = new MOG_Time(version);
                text = time.FormatString("");
            }

            return(text);
        }
コード例 #10
0
        private string GetLocalFileTimestamp(string localFile)
        {
            string localTimeStamp = "";

            FileInfo fileInfo = new FileInfo(localFile);

            if (fileInfo != null && fileInfo.Exists)
            {
                localTimeStamp = MOG_Time.FormatTimestamp(MOG_Time.GetVersionTimestamp(fileInfo.LastWriteTime), "");
            }

            return(localTimeStamp);
        }
コード例 #11
0
ファイル: TaskNode.cs プロジェクト: MOGwareSupport/MOG
//		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);
        }
コード例 #12
0
        /// <summary>
        /// Initialize our fields with the data within this task
        /// </summary>
        /// <param name="TaskInfo"></param>
        public void Initialize(MOG_TaskInfo TaskInfo)
        {
            // Make sure we have a valid task
            if (TaskInfo != null)
            {
                // Save the original
                mOriginalTaskInfo = TaskInfo.Clone();

                // Set our task member var
                mTaskInfo = TaskInfo;

                // Populate the priorities
                PopulatePriority();
                // Populate the assigned to
                PopulateAssignTo();

                // Set the name
                this.TaskName       = mTaskInfo.GetName();
                this.TaskPercentage = mTaskInfo.GetPercentComplete();
                this.TaskPriority   = mTaskInfo.GetPriority();
                this.TaskAssignedTo = mTaskInfo.GetAssignedTo();
                this.TaskComments   = mTaskInfo.GetComment();
                GetAssignedAssets();
//				this.TaskAssignedAsset = mTaskInfo.GetAsset();

                // Set the due date
                if (mTaskInfo.GetDueDate() != null)
                {
                    MOG_Time time = new MOG_Time(mTaskInfo.GetDueDate());
                    TaskDueDateTimePicker.Value = time.ToDateTime();
                }

                // Set our importance rating
                TaskImportanceTextBox.Text = mTaskInfo.GetImportanceRating().ToString();
            }
            else
            {
                // Clear out our data
                this.TaskName       = "";
                this.TaskPriority   = "";
                this.TaskAssignedTo = "";
                this.TaskPercentage = -1;
                this.TaskComments   = "";
//
//				TaskPriorityComboBox.Enabled = false;
//				TaskUsersComboBox.Enabled = false;
//				TaskDueDateTimePicker.Enabled = false;
            }
        }
コード例 #13
0
        public bool GetTasksFromBox(string box, string section, Color textColor, System.Windows.Forms.ListView listViewToFill)
        {
            MOG_Ini contents = new MOG_Ini();

            // Get a handle to the inbox\contents.info
            FileInfo file = new FileInfo(String.Concat(mParent.mMog.GetActiveUser().GetUserPath(), "\\", box, "\\Contents.info"));

            // If the .info file exists, open it
            if (file.Exists)
            {
                // Load the file
                contents.Load(file.FullName);

                // Find the items in the INBOX section
                if (contents.SectionExist(section))
                {
                    for (int i = 0; i < contents.CountKeys(section); i++)
                    {
                        ListViewItem node = new ListViewItem();

                        String assetName = contents.GetKeyNameByIndex(section, i);

                        // Set the due date
                        MOG_Time t = new MOG_Time();
                        t.SetTimeStamp(contents.GetString(assetName, "DUEDATE"));
                        DateTime dueDate = t.ToDateTime();

                        node.Text = (contents.GetString(assetName, "TITLE"));                                           // Name
                        node.SubItems.Add(dueDate.ToString());
                        node.SubItems.Add(contents.GetString(assetName, "TIME"));
                        node.SubItems.Add(contents.GetString(assetName, "CREATOR"));
                        node.SubItems.Add(contents.GetString(assetName, "PRIORITY"));
                        node.SubItems.Add(contents.GetString(assetName, "STATUS"));
                        node.SubItems.Add(contents.GetString(assetName, "ASSET"));
                        node.SubItems.Add(String.Concat(file.DirectoryName, "\\", assetName));                          // Fullname
                        node.SubItems.Add(box);                                                                         // Current box
                        node.ForeColor = textColor;

                        node.ImageIndex = 0;                        //SetAssetIcon(String.Concat(mParent.mMog.GetActiveUser().GetUserPath(), "\\", box, "\\", assetName));
                        listViewToFill.Items.Add(node);
                    }
                }

                contents.Close();
            }

            return(true);
        }
コード例 #14
0
        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);
        }
コード例 #15
0
        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);
        }
コード例 #16
0
ファイル: ListForm.cs プロジェクト: MOGwareSupport/MOG
        /// <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(".")));
        }
コード例 #17
0
		/// <summary>
		/// Create Package for each platform in this Project
		/// </summary>
		private MOG_Filename CreatePackageForPlatform(NodeLabelEditEventArgs e, MOG_Filename packageName, TreeNode parent)
		{
			// Initialize our ArrayList for MOG_Property objects
			ArrayList targetSyncPath = null;

			// If our node name already exists, return...
			if (!ValidateNewNodeName(e, packageName))
			{
				return null;
			}

			// If our targetSyncPath is null, even after we try to get a valid one, return...
			if (targetSyncPath == null &&
				(targetSyncPath = GetValidTargetSyncPath(e, packageName)) == null)
			{
				return null;
			}

            MOG_Property syncTargetPathProperty = targetSyncPath[0] as MOG_Property;

            // Create the new package
            MOG_Filename createdPackageFilename = MOG_ControllerProject.CreatePackage(packageName, syncTargetPathProperty.mValue);
			if (createdPackageFilename == null)
			{
				return null;
			}

            RenameNode(e, createdPackageFilename);

			// Post the projects new assets
			string jobLabel = "NewPackageCreated." + MOG_ControllerSystem.GetComputerName() + "." + MOG_Time.GetVersionTimestamp();
			MOG_ControllerProject.PostAssets(MOG_ControllerProject.GetProjectName(), MOG_ControllerProject.GetBranchName(), jobLabel);

			// Return our created package
			return createdPackageFilename;
		}
コード例 #18
0
        public void UpdateCommands(MOG_Command command)
        {
            ListViewItem item;
            MOG_Command  action = command.GetCommand();

            if (action != null)
            {
                bool bAdd    = false;
                bool bRemove = false;

                switch (action.GetCommandType())
                {
                case MOG_COMMAND_TYPE.MOG_COMMAND_None:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionKill:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionLost:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ConnectionNew:
                case MOG_COMMAND_TYPE.MOG_COMMAND_InstantMessage:
                case MOG_COMMAND_TYPE.MOG_COMMAND_LaunchSlave:
                case MOG_COMMAND_TYPE.MOG_COMMAND_LockCopy:
                case MOG_COMMAND_TYPE.MOG_COMMAND_LockMove:
                case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRelease:
                case MOG_COMMAND_TYPE.MOG_COMMAND_LockReadRequest:
                case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRelease:
                case MOG_COMMAND_TYPE.MOG_COMMAND_LockWriteRequest:
                case MOG_COMMAND_TYPE.MOG_COMMAND_LoginProject:
                case MOG_COMMAND_TYPE.MOG_COMMAND_LoginUser:
                case MOG_COMMAND_TYPE.MOG_COMMAND_NetworkBroadcast:
                case MOG_COMMAND_TYPE.MOG_COMMAND_NewBranch:
                case MOG_COMMAND_TYPE.MOG_COMMAND_NotifyActiveCommand:
                case MOG_COMMAND_TYPE.MOG_COMMAND_NotifyActiveConnection:
                case MOG_COMMAND_TYPE.MOG_COMMAND_NotifyActiveLock:
                case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemAlert:
                case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemError:
                case MOG_COMMAND_TYPE.MOG_COMMAND_NotifySystemException:
                case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterClient:
                case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterCommandLine:
                case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterEditor:
                case MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave:
                case MOG_COMMAND_TYPE.MOG_COMMAND_RequestActiveCommands:
                case MOG_COMMAND_TYPE.MOG_COMMAND_RequestActiveConnections:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownClient:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownCommandLine:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownEditor:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ShutdownSlave:
                case MOG_COMMAND_TYPE.MOG_COMMAND_RefreshApplication:
                case MOG_COMMAND_TYPE.MOG_COMMAND_RefreshTools:
                case MOG_COMMAND_TYPE.MOG_COMMAND_RefreshProject:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ViewConnection:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ViewLock:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ActiveViews:
                case MOG_COMMAND_TYPE.MOG_COMMAND_ViewUpdate:
                    // Eat these commands, we don't need to show them in this window
                    break;

                case MOG_COMMAND_TYPE.MOG_COMMAND_Complete:
                    // Drill one more level into this Complete command
                    action  = action.GetCommand();
                    bRemove = true;
                    break;

                // All other commands can simply be added
                default:
                    bAdd = true;
                    break;
                }

                // Check if we are removing the command?
                if (bRemove)
                {
                    // Strip out any matching commands
                    do
                    {
                        // Find it using specific information
//						item = LocateItem((int)CommandsColumns.COMMANDID, action.GetCommandID().ToString(), mainForm.ConnectionManagerCommandsListView);
                        item = LocateCommandItem(action);
                        if (item != null)
                        {
                            item.Remove();
                        }
                    } while(item != null);
                }

                // Check if we are adding the command?
                if (bAdd)
                {
                    // Find it using a generic approach
                    item = LocateCommandItem(action);
                    if (item != null)
                    {
                        // Check if this could replace an existing command?
                        if (action.IsRemoveDuplicateCommands())
                        {
                            // Remove the duplicate
                            item.Remove();
                            item = null;
                        }
                    }

                    // Check if the item already exists
                    if (item == null)
                    {
                        //It doesn't already exist, so let's make a new one
                        item = new ListViewItem();
                        MOG_Time time = new MOG_Time();
                        time.SetTimeStamp(command.GetCommandTimeStamp());
                        string assetFullName = "PROJECT: " + action.GetProject() + "     ASSET: " + action.GetAssetFilename().GetAssetOriginalFullName();
                        if (string.Compare(action.GetProject(), MOG_ControllerProject.GetProjectName(), true) == 0)
                        {
                            assetFullName = action.GetAssetFilename().GetAssetFullName();
                        }

                        item.Text = action.ToString();
                        item.SubItems.Add(assetFullName);
                        item.SubItems.Add(action.GetPlatform());
                        item.SubItems.Add(action.IsCompleted() ? "Working" : "");
                        item.SubItems.Add(action.GetJobLabel());
                        item.SubItems.Add(action.GetComputerName().ToString());
                        item.SubItems.Add(action.GetComputerIP().ToString());
                        item.SubItems.Add(action.GetNetworkID().ToString());
                        item.SubItems.Add(action.GetCommandID().ToString());
                        item.Tag = action;

                        item.ImageIndex = GetImageIndex(action.GetCommandType());

                        mainForm.ConnectionManagerCommandsListView.Items.Add(item);
                    }
                }
            }
        }
コード例 #19
0
        public void RefreshBox(MOG_Filename add, MOG_Filename del, MOG_Command command)
        {
            Color textColorAdd = Color.Black;
            Color textColorDel = Color.Black;

            // Dont add if we dont have a valid box
            if (add.GetBoxName().Length == 0 && del.GetBoxName().Length == 0)
            {
                return;
            }

            ListView currentViewAdd = mParent.IsolateListView(add.GetBoxName(), add.GetType(), add.GetUserName(), ref textColorAdd);
            ListView currentViewDel = mParent.IsolateListView(del.GetBoxName(), del.GetType(), del.GetUserName(), ref textColorDel);

            if (currentViewAdd == currentViewDel)
            {
                // Check to see if this item already exists?
                int index = mParent.ListViewItemFindItem(add.GetFilename(), currentViewAdd);
                if (index != -1)
                {
                    currentViewAdd.Items[index].SubItems[(int)guiAssetManager.TaskBoxColumns.STATUS].Text   = command.GetDescription();
                    currentViewAdd.Items[index].SubItems[(int)guiAssetManager.TaskBoxColumns.FULLNAME].Text = add.GetFullFilename();
                    currentViewAdd.Items[index].ForeColor = textColorAdd;
                    for (int x = 0; x < currentViewAdd.Items[index].SubItems.Count; x++)
                    {
                        currentViewAdd.Items[index].SubItems[x].ForeColor = textColorAdd;
                    }
                }
            }
            else
            {
                if (currentViewDel != null)
                {
                    int index = mParent.ListViewItemFindItem(del.GetFilename(), currentViewDel);
                    if (index != -1)
                    {
                        currentViewDel.Items[index].Remove();
                    }
                }

                if (currentViewAdd != null)
                {
                    // Check to see if this item already exists?
                    int index = mParent.ListViewItemFindItem(add.GetFilename(), currentViewAdd);
                    if (index != -1)
                    {
                        currentViewAdd.Items[index].SubItems[(int)guiAssetManager.TaskBoxColumns.STATUS].Text   = command.GetDescription();
                        currentViewAdd.Items[index].SubItems[(int)guiAssetManager.TaskBoxColumns.FULLNAME].Text = add.GetFullFilename();
                        currentViewAdd.Items[index].ForeColor = textColorAdd;
                        for (int x = 0; x < currentViewAdd.Items[index].SubItems.Count; x++)
                        {
                            currentViewAdd.Items[index].SubItems[x].ForeColor = textColorAdd;
                        }
                    }
                    else
                    {
                        MOG_ControllerTask assetController = new MOG_ControllerTask(mParent.mMog);
                        if (!assetController.Open(add.GetFullFilename()))
                        {
                            return;
                        }

                        ListViewItem item = new ListViewItem();

                        item.Text = assetController.GetTitle();

                        MOG_Time t = new MOG_Time();
                        t.SetTimeStamp(assetController.GetDueDate());
                        item.SubItems.Add(t.ToDateTime().ToString());

                        item.SubItems.Add(assetController.GetFileInfo().LastWriteTime.ToString());
                        item.SubItems.Add(assetController.GetCreator());
                        item.SubItems.Add(assetController.GetPriority());
                        item.SubItems.Add(assetController.GetStatus());
                        item.SubItems.Add(assetController.GetAsset());
                        item.SubItems.Add(assetController.GetAssetFilename().GetFullFilename());
                        item.SubItems.Add(assetController.GetAssetFilename().GetBoxName());
                        item.ForeColor = Color.Black;
                        for (int x = 0; x < item.SubItems.Count; x++)
                        {
                            item.SubItems[x].ForeColor = textColorAdd;
                        }

                        item.ImageIndex = 0;                        //SetAssetIcon(String.Concat(mParent.mMog.GetActiveUser().GetUserPath(), "\\", box, "\\", assetName));
                        currentViewAdd.Items.Add(item);

                        assetController.Close();
                    }
                }
            }

            // Update the tab
            RefreshTab(command);
        }
コード例 #20
0
        /// <summary>
        /// Open an explorer window in the target of the selected asset(s)
        /// </summary>
        /// <param name="sender"> Must be a ListView and have a string[] in its Tag describing the columns</param>
        /// <param name="e"></param>
        private void RemoveMenuItem_Click(object sender, System.EventArgs e)
        {
            ArrayList selectedItems = ControlGetSelectedItems();

            string message = "";

            foreach (guiAssetTreeTag tag in selectedItems)
            {
                if (tag.Execute)
                {
                    message = message + tag.FullFilename + "\n";
                }
            }

            if (MOG_Prompt.PromptResponse("Are you sure you want to remove all of these assets from the project?", message, MOGPromptButtons.OKCancel) == MOGPromptResult.OK)
            {
                // Obtain a unique bless label
                string jobLabel = "RemoveAsset." + MOG_ControllerSystem.GetComputerName() + "." + MOG_Time.GetVersionTimestamp();

                foreach (guiAssetTreeTag tag in selectedItems)
                {
                    if (tag.Execute)
                    {
                        MOG_Filename filename = new MOG_Filename(tag.FullFilename);

                        // Make sure we are an asset before showing log
                        if (filename.GetFilenameType() == MOG_FILENAME_TYPE.MOG_FILENAME_Asset)
                        {
                            if (guiAssetController.RemoveBlessed(filename, jobLabel))
                            {
                                tag.ItemRemove();
                            }
                        }
                    }
                }

                // Start the job
                MOG_ControllerProject.StartJob(jobLabel);
            }
        }
コード例 #21
0
        private void CreateAssetConfigs_Worker(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = sender as BackgroundWorker;

            MOG_ControllerProject.LoginUser("Admin");

            // Construct a new common timestamp for all of these assets
            string timestamp = MOG_Time.GetVersionTimestamp();

            // Activate the properties cache to help save time during the importation process
            MOG_Properties.ActivatePropertiesCache(true);

            for (int nodeIndex = 0; nodeIndex < assetFilenameNodes.Count; nodeIndex++)
            {
                classTreeNode tn = assetFilenameNodes[nodeIndex] as classTreeNode;

                string fullAssetName = tn.FullPath;                //tn.Parent.FullPath + tn.Text;
                string fileList      = Utils.ArrayListToString(tn.importFiles, "");

                // Check if this is a library asset?
                bool bIsInLibrary = false;
                if (tn.TreeView != null)
                {
                    string fullPath = tn.FullPath + tn.TreeView.PathSeparator;
                    string testPath = tn.TreeView.PathSeparator + "Library" + tn.TreeView.PathSeparator;
                    if (fullPath.IndexOf(testPath, 0, StringComparison.CurrentCultureIgnoreCase) != -1)
                    {
                        bIsInLibrary = true;
                    }
                }

                MOG_Filename repositoryName = null;
                if (bIsInLibrary && tn.importFiles.Count > 0)
                {
                    // Use the timestamp of the file (Needed for out-of-date checks with library assets)
                    String   libraryTimestamp = "";
                    FileInfo file             = new FileInfo(tn.importFiles[0] as string);
                    if (file != null && file.Exists)
                    {
                        libraryTimestamp = MOG_Time.GetVersionTimestamp(file.LastWriteTime);
                    }
                    repositoryName = MOG_ControllerRepository.GetAssetBlessedVersionPath(new MOG_Filename(fullAssetName), libraryTimestamp);
                }
                else
                {
                    // Use the common timestamp for all the assets
                    repositoryName = MOG_ControllerRepository.GetAssetBlessedVersionPath(new MOG_Filename(fullAssetName), timestamp);
                }

                MOG_Filename createdAssetFilename = null;

                string message = "Importing:\n" +
                                 "     " + repositoryName.GetAssetClassification() + "\n" +
                                 "     " + repositoryName.GetAssetName();
                worker.ReportProgress(nodeIndex * 100 / assetFilenameNodes.Count, message);

                if (worker.CancellationPending)
                {
                    if (Utils.ShowMessageBoxConfirmation("Are you sure you want to cancel asset importation?", "Cancel Asset Importation?") == MOGPromptResult.Yes)
                    {
                        return;
                    }
                }

                try
                {
                    string dirScope = MOG_ControllerAsset.GetCommonDirectoryPath(this.projectRootPath, tn.importFiles);

                    // Construct our list non-inherited asset assuming none
                    ArrayList props = null;
                    if (tn.props != null)
                    {
                        // Ask the tn.props for the list of non-inherited properties
                        props = tn.props.GetNonInheritedProperties();
                    }
                    else
                    {
                        props = new ArrayList();

                        // Setup SyncTargetPath Property
                        string assetDirectoryScope = MOG_ControllerAsset.GetCommonDirectoryPath(this.projectRootPath, tn.importFiles);
                        if (assetDirectoryScope.Length > this.projectRootPath.Length)
                        {
                            string syncTargetPath = assetDirectoryScope.Substring(this.projectRootPath.Length + 1);
                            props.Add(MOG.MOG_PropertyFactory.MOG_Sync_OptionsProperties.New_SyncTargetPath(syncTargetPath));
                        }
                    }

                    // Proceed to import the asset
                    createdAssetFilename = MOG_ControllerAsset.CreateAsset(repositoryName, dirScope, tn.importFiles, null, props, false, false);
                    if (createdAssetFilename == null)
                    {
                        // it's probably a network problem (TODO: Check for sure)

                        // build a list of files for error message
                        string files = "\n\nFiles contained in " + tn.Text + "\n";
                        foreach (string fname in tn.importFiles)
                        {
                            files += "\t" + fname + "\n";
                        }

                        MOGPromptResult r = MOG_Prompt.PromptResponse("Import Error", "Importation of " + tn.FullPath + " failed.  Please ensure that the file is accessible and click Retry." + files, MOGPromptButtons.AbortRetryIgnore);
                        if (r == MOGPromptResult.Retry)
                        {
                            --nodeIndex;                                        // stay on the same node (continue auto-increments)
                            continue;
                        }
                        else if (r == MOGPromptResult.Abort)
                        {
                            RaiseAssetImport_Finish();
                            MOG_Prompt.PromptResponse("Cancelled", "Importation Cancelled", Environment.StackTrace, MOGPromptButtons.OK, MOG_ALERT_LEVEL.MESSAGE);
                            return;
                        }
                        else if (r == MOGPromptResult.Ignore)
                        {
                            continue;
                        }
                    }

                    // Schedule this asset for posting under this project name
                    MOG_ControllerProject.AddAssetForPosting(createdAssetFilename, MOG_ControllerProject.GetProjectName());
                }
                catch (Exception ex)
                {
                    MOG_Report.ReportMessage("Create Asset", "Could not correctly create asset.\nMessage=" + ex.Message, ex.StackTrace, MOG_ALERT_LEVEL.CRITICAL);
                    continue;
                }
            }

            // Shut off the properties cache
            MOG_Properties.ActivatePropertiesCache(false);
        }
コード例 #22
0
        /// <summary>
        /// Update an existing ListView node for the asset manager inboxes
        /// </summary>
        /// <param name="pProperties"></param>
        /// <param name="nodeColor"></param>
        /// <returns></returns>
        public static void UpdateListViewItem(ListViewItem item, MOG_Filename asset, string status, MOG_Properties pProperties)
        {
            string date    = "";
            string size    = "";
            string creator = "";
            string owner   = "";
            string group   = "";
            string target  = "";

            // Check if we have a properties?
            if (pProperties != null)
            {
                // If we have a valid gameDataController, set our platform scope
                if (MOG_ControllerProject.GetCurrentSyncDataController() != null)
                {
                    // Set our current platform
                    pProperties.SetScope(MOG_ControllerProject.GetCurrentSyncDataController().GetPlatformName());
                }

                // Gather the following info from our properties
                date    = MOG_Time.FormatTimestamp(pProperties.CreatedTime, "");
                size    = guiAssetController.FormatSize(pProperties.Size);
                creator = pProperties.Creator;
                owner   = pProperties.Owner;
                group   = pProperties.Group;

                // Check if this is a packaged asset?
                if (pProperties.IsPackagedAsset)
                {
                    // Check if we have have any package assignments in our propeerties?
                    ArrayList packages = pProperties.GetPackages();
                    if (packages.Count == 0)
                    {
                        // Indicate this is a packaged asset w/o any package assignments
                        target = "Missing package assignment...";
                    }
                    else if (packages.Count == 1)
                    {
                        MOG_Property package          = packages[0] as MOG_Property;
                        MOG_Filename packageName      = new MOG_Filename(MOG_ControllerPackage.GetPackageName(package.mPropertyKey));
                        string       packageGroupPath = MOG_ControllerPackage.GetPackageGroups(package.mPropertyKey);
                        string       displayString    = MOG_ControllerPackage.CombinePackageAssignment(packageName.GetAssetLabel(), packageGroupPath, "");
                        target = "{Package} " + displayString + "  in  " + MOG_Filename.GetAdamlessClassification(packageName.GetAssetClassification());
                    }
                    else
                    {
                        target = "{Package} " + packages.Count + " Assignments...";
                    }
                }
                else if (pProperties.SyncFiles)
                {
                    // Get the formatted SyncTarget of this asset
                    target = MOG_Tokens.GetFormattedString("{Workspace}\\" + pProperties.SyncTargetPath, asset, pProperties.GetPropertyList());
                }
            }

            item.Text = asset.GetAssetLabel();

            // Populate the item's SubItems
            // I tried for a long time to be smart here and use ColumnNameFind(thisListView.Columns, "Name") but
            // I kept running into walls because this function is used by a lot of workers outside of the ListView's thread.
            // So, I gave up and am just going to do it the ugly brute force way!  YUCK!!
            item.SubItems[(int)AssetBoxColumns.NAME].Text       = asset.GetAssetLabel();
            item.SubItems[(int)AssetBoxColumns.CLASS].Text      = asset.GetAssetClassification();
            item.SubItems[(int)AssetBoxColumns.TARGETPATH].Text = target;
            item.SubItems[(int)AssetBoxColumns.DATE].Text       = date;
            item.SubItems[(int)AssetBoxColumns.SIZE].Text       = size;
            item.SubItems[(int)AssetBoxColumns.PLATFORM].Text   = asset.GetAssetPlatform();
            item.SubItems[(int)AssetBoxColumns.STATE].Text      = status;
            item.SubItems[(int)AssetBoxColumns.CREATOR].Text    = creator;
            item.SubItems[(int)AssetBoxColumns.RESPPARTY].Text  = owner;
            item.SubItems[(int)AssetBoxColumns.OPTIONS].Text    = "";
            item.SubItems[(int)AssetBoxColumns.FULLNAME].Text   = asset.GetEncodedFilename();
            item.SubItems[(int)AssetBoxColumns.BOX].Text        = asset.GetBoxName();
            item.SubItems[(int)AssetBoxColumns.GROUP].Text      = group;

            // Set the item's Icons
            item.ImageIndex = MogUtil_AssetIcons.GetFileIconIndex(asset.GetEncodedFilename(), pProperties);

            if (MogMainForm.MainApp != null &&
                MogMainForm.MainApp.mAssetManager != null)
            {
                // mAssetStatus.GetStatusInfo() is sort of a black sheep and should maybe become static
                item.StateImageIndex = MogMainForm.MainApp.mAssetManager.mAssetStatus.GetStatusInfo(status).IconIndex;
            }

            // Set the item's color
            item.ForeColor = MOG_AssetStatus.GetColor(status);
            // Check if this is a local item that has been blessed?
            if (asset.IsLocal() &&
                string.Compare(status, MOG_AssetStatus.GetText(MOG_AssetStatusType.Blessed), true) == 0)
            {
                // Mark local blessed items with light gray
                item.ForeColor = Color.LightGray;
            }
        }
コード例 #23
0
        public static void BlessAssets_Worker(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker    worker     = sender as BackgroundWorker;
            List <object>       parameters = e.Argument as List <object>;
            List <MOG_Filename> filenames  = parameters[0] as List <MOG_Filename>;
            string comment      = parameters[1] as string;
            bool   maintainLock = (bool)parameters[2];

            bool   bUserAltered = false;
            string loginUser    = MOG_ControllerProject.GetUser().GetUserName();
            string activeUser   = MOG_ControllerProject.GetActiveUser().GetUserName();

            // Make sure the inbox that we are in matches the logged in user
            if (string.Compare(MOG_ControllerProject.GetUser().GetUserName(), MOG_ControllerProject.GetActiveUser().GetUserName(), true) != 0)
            {
                // Login as this user so that his bless targets will be respected during this bless!
                MOG_ControllerProject.LoginUser(MOG_ControllerProject.GetActiveUser().GetUserName());
                bUserAltered = true;
            }

            // Obtain a unique bless jobLabel
            string timestamp = MOG_Time.GetVersionTimestamp();
            string jobLabel  = "Bless." + MOG_ControllerSystem.GetComputerName() + "." + timestamp;

            // Changed to a for-loop to facilitate the loop breakout box on bless failure below
            for (int assetIndex = 0; assetIndex < filenames.Count; assetIndex++)
            {
                MOG_Filename asset = filenames[assetIndex] as MOG_Filename;
                if (asset != null)
                {
                    string message = "Blessing:\n" +
                                     "     " + asset.GetAssetClassification() + "\n" +
                                     "     " + asset.GetAssetName();
                    worker.ReportProgress(assetIndex * 100 / filenames.Count, message);

                    // Try to bless each asset and report if there is a failure
                    try
                    {
                        if (MOG_ControllerInbox.BlessAsset(asset, comment, maintainLock, jobLabel, worker))
                        {
                            WorkspaceManager.MarkLocalAssetBlessed(asset, timestamp);
                        }
                        else
                        {
                            // If there are more assets to bless, ask the user how to proceed
                            if (assetIndex < filenames.Count - 1)
                            {
                                MOGPromptResult result = MOG_Prompt.PromptResponse("Bless Error", "An error has occurred while blessing " + asset.GetAssetFullName() + "\nWould you like to continue blessing assets?", MOGPromptButtons.YesNo);
                                if (result == MOGPromptResult.Yes)
                                {
                                    // continue with the next asset
                                    continue;
                                }
                                else if (result == MOGPromptResult.No)
                                {
                                    // bail
                                    return;
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        // Send this Exception back to the server
                        MOG_Report.ReportMessage("Bless", ex.Message, ex.StackTrace, MOG_ALERT_LEVEL.CRITICAL);

                        // Check if we are logged in an anyone?
                        if (MOG_ControllerProject.IsUser())
                        {
                            // Send a notification to the ofending user
                            MOG_Report.ReportMessage("Bless", ex.Message, ex.StackTrace, MOG_ALERT_LEVEL.CRITICAL);
                        }
                    }
                }
            }

            // Start the job
            MOG_ControllerProject.StartJob(jobLabel);

            // Restore user if changed
            if (bUserAltered)
            {
                MOG_ControllerProject.LoginUser(loginUser);
                MOG_ControllerProject.SetActiveUserName(activeUser);
            }
        }
コード例 #24
0
 private string GetAutoVersion()
 {
     return(MOG_Time.GetVersionTimestamp());
 }
コード例 #25
0
        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;
        }
コード例 #26
0
ファイル: PackageCreator.cs プロジェクト: MOGwareSupport/MOG
        private void btnCreate_Click(object sender, EventArgs e)
        {
            if (IsInformationValid())
            {
                string[] platforms = Platform.Split(",".ToCharArray());
                // Make sure there was something specified before we do anything
                if (platforms.Length > 0)
                {
                    bool bPromptUser     = true;
                    bool bCreatePackage  = true;
                    bool bRebuildPackage = false;

                    foreach (string platform in platforms)
                    {
                        // Create the new package name
                        MOG_Filename assetName = MOG_Filename.CreateAssetName(Classification, platform.Trim(), PackageName);

                        // Check if we should prompt the user?
                        if (bPromptUser)
                        {
                            // Don't bother the user again
                            bPromptUser = false;

                            // Check if this was a platform specific package?
                            if (assetName.IsPlatformSpecific())
                            {
                                // Check if there are ANY assiciated assets with this new platform-specific package?
                                if (MOG_ControllerPackage.GetAssociatedAssetsForPackage(assetName).Count > 0)
                                {
                                    // Prompt the user if they wish to automatically populate this new platform-specific packages?
                                    string message = "Whenever new platform-specific packages are created, they sometimes need to be populated if existing package assignments exist.\n\n" +
                                                     "MOG has detected this to be the case and recommends you to automatically populated this package.";
                                    MOGPromptResult result = MOG_Prompt.PromptResponse("Automatically populate this new platform-specific package?", message, MOGPromptButtons.YesNo);
                                    switch (result)
                                    {
                                    case MOGPromptResult.Yes:
                                        bCreatePackage  = true;
                                        bRebuildPackage = true;
                                        break;

                                    case MOGPromptResult.No:
                                        bCreatePackage  = true;
                                        bRebuildPackage = false;
                                        break;

                                    case MOGPromptResult.Cancel:
                                        bCreatePackage  = false;
                                        bRebuildPackage = false;
                                        break;
                                    }
                                }
                            }
                        }

                        // Check if we should create the package?
                        if (bCreatePackage)
                        {
                            MOG_Filename newPackage = MOG_ControllerProject.CreatePackage(assetName, SyncTarget);
                            if (newPackage != null)
                            {
                                // Post the new package into the project
                                mAssetName = newPackage;
                                string jobLabel = "NewPackageCreated." + MOG_ControllerSystem.GetComputerName() + "." + MOG_Time.GetVersionTimestamp();
                                MOG_ControllerProject.PostAssets(MOG_ControllerProject.GetProjectName(), MOG_ControllerProject.GetBranchName(), jobLabel);

                                // Check if we should rebuild the package?
                                if (bRebuildPackage)
                                {
                                    jobLabel = "PopulateNewPackage." + MOG_ControllerSystem.GetComputerName() + "." + MOG_Time.GetVersionTimestamp();
                                    // Schedule the rebuild command
                                    MOG_ControllerPackage.RebuildPackage(assetName, jobLabel);
                                    // Start the job
                                    MOG_ControllerProject.StartJob(jobLabel);
                                }

                                // Well, this is a bit of a hack but was the easiest and safest way to ensure unique JobIDs...
                                // JobIDs are only accurate to the microsecond so lets sleep for a very short time.
                                Thread.Sleep(10);

                                // Setting the dialog's result will automatically close the dialog since we proceeded to create the package
                                DialogResult = DialogResult.OK;
                            }
                        }
                    }
                }
            }
        }
コード例 #27
0
ファイル: MOG_License.cs プロジェクト: MOGwareSupport/MOG
        bool CanObtainLicense(MOG_Command pCommand)
        {
            bool bLicense = false;

            // Get our server command manager?
            MOG_CommandServerCS commandServer = (MOG_CommandServerCS)(MOG_ControllerSystem.GetCommandManager());

            if (commandServer != null)
            {
                // This client is not accounted for, check the license file to see if he can fit into the current situation
                if (EnsureValidLicense())
                {
                    // We have a license file
                    if (!mTimeBomb.IsValidMacAddress())
                    {
                        //The Mac address is bad
                        String message = String.Concat("This MOG Server's machine hasn't been properly licensed.\n",
                                                       "You will be limited to 2 client connections.\n",
                                                       "Contact Mogware to transfer this license.");

                        MOG_Command pBroadcast = MOG_CommandFactory.Setup_NetworkBroadcast("", message);
                        commandServer.SendToConnection(pCommand.GetNetworkID(), pBroadcast);
                    }
                    else
                    {
                        // Since the Mac address is ok, what about the expiration?
                        DateTime commandDate = MOG_Time.GetDateTimeFromTimeStamp(pCommand.GetCommandTimeStamp());
                        if (mTimeBomb.HasExpired() ||
                            mTimeBomb.HasExpired(commandDate))
                        {
                            //Oh man this license file is expired
                            String message = String.Concat("The MOG Server has been unable to renew the MOG License.\n",
                                                           "You will be limited to 2 client connections.\n",
                                                           "Please make sure the MOG Server machine has internet access.");

                            MOG_Command pBroadcast = MOG_CommandFactory.Setup_NetworkBroadcast("", message);
                            commandServer.SendToConnection(pCommand.GetNetworkID(), pBroadcast);
                        }
                        // Check if we are going to expire soon?
                        else if (mTimeBomb.WillExpireSoon())
                        {
                            // Inform the user of our impending doom
                            String message = String.Concat("The MOG Server has been unable to renew the MOG License.\n",
                                                           "EXPIRATION DATE: ", mTimeBomb.GetExpireDate().ToString(), "\n",
                                                           "Please make sure the MOG Server machine has internet access.");
                            MOG_Command pBroadcast = MOG_CommandFactory.Setup_NetworkBroadcast("", message);
                            commandServer.SendToConnection(pCommand.GetNetworkID(), pBroadcast);
                        }
                    }
                }
                else
                {
                    // There is no license file at all
                    String message = String.Concat("You're using an unlicensed server.\n",
                                                   "You will be limited to 2 client connections.\n",
                                                   "Licensing can be performed in the ServerManager.");

                    MOG_Command pBroadcast = MOG_CommandFactory.Setup_NetworkBroadcast("", message);
                    commandServer.SendToConnection(pCommand.GetNetworkID(), pBroadcast);
                }

                // Call this to see if any more clients can be licensed
                if (IsLicenseAvailable())
                {
                    bLicense = true;
                }
                else
                {
                    // Notify client of failed command request
                    string message = String.Concat("No more available licenses on the server.\n\n",
                                                   "This client cannot be launched until another client is closed.\n",
                                                   "Additional seats can be licensed in the ServerManager.");
                    MOG_Command pBroadcast = MOG_CommandFactory.Setup_NetworkBroadcast("", message);
                    commandServer.SendToConnection(pCommand.GetNetworkID(), pBroadcast);
                }
            }

            return(bLicense);
        }
コード例 #28
0
ファイル: ListForm.cs プロジェクト: MOGwareSupport/MOG
        /// <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();
            }
        }
コード例 #29
0
        private void UpdateItem(ListViewItem item)
        {
            string status         = "";
            string username       = "";
            string comment        = "";
            string localTimestamp = "";

            // Find our desired columns
            int statusIdx          = FindColumn("Status");
            int userIdx            = FindColumn("User");
            int commentIdx         = FindColumn("Comment");
            int localTimestampIdx  = FindColumn("Local Timestamp");
            int serverTimestampIdx = FindColumn("Server Timestamp");
            int localFileIdx       = FindColumn("LocalFile");
            int repositoryFileIdx  = FindColumn("RepositoryFile");

            string       repositoryFile          = item.SubItems[repositoryFileIdx].Text;
            MOG_Filename repositoryAssetFilename = new MOG_Filename(repositoryFile);

            // Check if this file exist locally?
            string localFile = item.SubItems[localFileIdx].Text;

            if (localFile.Length != 0)
            {
                // Obtain the localFile info
                FileInfo fileInfo = new FileInfo(localFile);
                // Does this local file exist?
                if (fileInfo != null && fileInfo.Exists)
                {
                    // Compare our local file's timestamp to the server's revision
                    localTimestamp = MOG_Time.GetVersionTimestamp(fileInfo.LastWriteTime);
                    if (localTimestamp == repositoryAssetFilename.GetVersionTimeStamp())
                    {
                        // Indicate this item is synced and up-to-date
                        status = "Up-to-date";
                    }
                    else
                    {
                        // Indicate this item is synced
                        status = "Out-of-date";
                    }
                }
                else
                {
                    // Indicate this item is not synced
                    status = "unSynced";
                }
            }
            else
            {
                // Indicate this item is not synced
                status = "unSynced";
            }

            // Check if this file exists in the repository?
            if (repositoryFile.Length != 0)
            {
                // Check the lock statusIdx of the asset
                MOG_Command sourceLock = MOG_ControllerProject.PersistentLock_Query(repositoryAssetFilename.GetAssetFullName());
                if (sourceLock.IsCompleted() && sourceLock.GetCommand() != null)
                {
                    MOG_Command lockHolder = sourceLock.GetCommand();

                    // Obtain the lock info
                    item.ImageIndex = MogUtil_AssetIcons.GetLockedBinaryIcon(repositoryFile);
                    username        = lockHolder.GetUserName();
                    comment         = lockHolder.GetDescription();

                    // Check if this is locked by me?
                    if (username == MOG_ControllerProject.GetUserName())
                    {
                        status = "CheckedOut";
                    }
                    else
                    {
                        status = "Locked";
                    }
                }
                else
                {
                    // Update this file's icon
                    item.ImageIndex = MogUtil_AssetIcons.GetFileIconIndex(repositoryFile);
                }
            }

            // Update the item with the new information
            item.SubItems[statusIdx].Text          = status;
            item.SubItems[userIdx].Text            = username;
            item.SubItems[commentIdx].Text         = comment;
            item.SubItems[localTimestampIdx].Text  = MogUtils_StringVersion.VersionToString(localTimestamp);
            item.SubItems[serverTimestampIdx].Text = MogUtils_StringVersion.VersionToString(repositoryAssetFilename.GetVersionTimeStamp());

            // Update the color for this locked item
            UpdateListViewItemColors(item, status);
        }
コード例 #30
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);
        }