Ejemplo n.º 1
0
        public void MarkCurrentVersion(ListView list, string type)
        {
            // Check our current versions version
            if (DosUtils.DirectoryExist(DeploymentDirectory + "\\" + type + "\\" + DeploymentTarget))
            {
                VersionNode current = this.CreateVersionNode(DeploymentTarget, DeploymentDirectory + "\\" + type + "\\" + DeploymentTarget);

                if (current != null)
                {
                    //this.bCheckOverride = true;
                    // Walk all the items of this list and check or bold the items that match
                    foreach (ListViewItem item in list.Items)
                    {
                        // Get our version node from this item
                        VersionNode target = (VersionNode)item.Tag;

                        if (string.Compare(target.Name, current.Name, true) == 0 &&
                            target.MajorVersion == current.MajorVersion &&
                            target.MinorVersion == current.MinorVersion)
                        {
                            item.ForeColor = Color.DarkGreen;
                            item.Font      = new Font(item.Font.FontFamily, item.Font.Size, FontStyle.Bold);
                            item.Checked   = true;
                        }
                    }

                    //this.bCheckOverride = false;
                }
            }
        }
Ejemplo n.º 2
0
        //----------------------------------------------------------
        // returns a list of available client versions
        public ArrayList GetCompatibleBuilds(ListViewItem server)
        {
            try
            {
                VersionNode serverVersion    = (VersionNode)server.Tag;
                ArrayList   compatibleBuilds = new ArrayList();
                foreach (VersionNode version in mClientVersions)                        // go through client list
                {
                    // major versions must match!
                    if (version.MajorVersion == serverVersion.MajorVersion)
                    {
                        //if(version.MinorVersion >= serverVersion.MinorVersion)
                        {
                            compatibleBuilds.Add(version);
                        }
                    }
                }

                return(compatibleBuilds);
            }
            catch (Exception e)
            {
                MOG_Report.ReportMessage("Get Compatible Builds", e.Message, e.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.ERROR);
                return(new ArrayList());
            }
        }
Ejemplo n.º 3
0
        private void DeployCheckedItems_Worker(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker   worker              = sender as BackgroundWorker;
            List <object>      args                = e.Argument as List <object>;
            List <VersionNode> versionNodes        = args[0] as List <VersionNode>;
            string             deploymentDirectory = args[1] as string;
            string             deploymentTarget    = args[2] as string;

            // We are going to attemp to copy all check clients to their respective deployment directories
            for (int i = 0; i < versionNodes.Count && !worker.CancellationPending; i++)
            {
                VersionNode target = versionNodes[i];

                // Set our current directory in the subDirectory of this versions type
                string deployTarget = target.Type + "\\" + deploymentTarget;

                // Clear out any previous deployment
                if (DosUtils.DirectoryExist(deploymentDirectory + "\\" + deployTarget))
                {
                    worker.ReportProgress(i * 100 / versionNodes.Count, "Removing previous (" + target.Type + ") build");

                    if (!DosUtils.DirectoryDelete(deploymentDirectory + "\\" + deployTarget))
                    {
                        throw new Exception(DosUtils.GetLastError());
                    }
                }

                worker.ReportProgress(i * 100 / versionNodes.Count, "Copying new(" + target.Type + ") build named:" + target.Name);

                // Copy our new deployment
                if (!DosUtils.DirectoryCopyFast(target.SourceDirectory, deploymentDirectory + "\\" + deployTarget, true))
                {
                    throw new Exception(DosUtils.GetLastError());
                }

                worker.ReportProgress(i * 100 / versionNodes.Count, target.Type + " named:" + target.Name + " has been deployed!");
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Get all the versions within the specified directory, and add them to either the server array or the clients array
        /// </summary>
        /// <param name="FullName"></param>
        private void GetAllVersions(string FullName)
        {
            ArrayList fileList = new ArrayList();

            try
            {
                DirectoryInfo updateDir = new DirectoryInfo(FullName);
                // Scan all the folders in this specified directory
                foreach (DirectoryInfo dir in updateDir.GetDirectories())
                {
                    // Ommit the 'current' directory unless that is the only directory
                    if (string.Compare(dir.Name, DeploymentTarget, true) != 0 || updateDir.GetDirectories().Length == 1)
                    {
                        // Create the version node
                        VersionNode node = this.CreateVersionNode(dir.Name, dir.FullName);
                        if (node != null)
                        {
                            // Assign it to the correct arrayList
                            switch (node.Type.ToUpper())
                            {
                            case "SERVER":
                                this.mServerVersions.Add(node);
                                break;

                            default:
                                this.mClientVersions.Add(node);
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MOG_Report.ReportMessage("Build version list", e.Message, e.StackTrace, MOG.PROMPT.MOG_ALERT_LEVEL.ERROR);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Get all the files associated with this version and populate the info windows
        /// </summary>
        /// <param name="version"></param>
        public void GetFileList(VersionNode version)
        {
            try
            {
                mainForm.VersionFilesListView.Items.Clear();
                mainForm.VersionFilesListView.BeginUpdate();

                DirectoryInfo dir = new DirectoryInfo(version.SourceDirectory);
                foreach (FileInfo file in dir.GetFiles())
                {
                    ListViewItem item = new ListViewItem(file.Name);
                    item.SubItems.Add(file.LastWriteTime.ToShortDateString() + " " + file.LastWriteTime.ToShortTimeString());
                    item.SubItems.Add(file.Length.ToString());
                    item.ImageIndex = MogUtil_AssetIcons.GetFileIconIndex(file.FullName);

                    mainForm.VersionFilesListView.Items.Add(item);
                }

                mainForm.VersionFilesListView.EndUpdate();
            }
            catch
            {
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Fromt he given directory, make a versionNode and return it
        /// </summary>
        /// <param name="directoryName"></param>
        /// <param name="directoryFullName"></param>
        /// <returns></returns>
        private VersionNode CreateVersionNode(string directoryName, string directoryFullName)
        {
            // Can we find a valid version descriptor and the target dir is not a 'current' dir
            if (DosUtils.FileExist(directoryFullName + "\\VERSION.INI"))
            {
                MOG_Ini info = new MOG_Ini(directoryFullName + "\\VERSION.INI");

                // get basic info
                string Name     = info.GetString("INFO", "Name").Replace("\"", "").Trim();
                long   MajorVer = Convert.ToInt64(info.GetString("INFO", "MajorVersion"));
                long   MinorVer = 0;

                // Add code to handle new code drops
                if (info.GetString("INFO", "MinorVersion").Contains("."))
                {
                    MinorVer = Convert.ToInt64(info.GetString("INFO", "MinorVersion").Replace(".", ""));
                }
                else
                {
                    MinorVer = Convert.ToInt64(info.GetString("INFO", "MinorVersion"));
                }

                string type = info.GetString("INFO", "Type").Trim();

                VersionNode versionNode = new VersionNode(Name);

                // Create the version node
                versionNode.FolderName      = directoryName;
                versionNode.MajorVersion    = MajorVer;
                versionNode.MinorVersion    = MinorVer;
                versionNode.SourceDirectory = directoryFullName;
                versionNode.Type            = type;

                // Apply some special settings based on type
                switch (type.ToUpper())
                {
                case "SERVER":
                    versionNode.ImageIndex         = SERVER_ICON;
                    versionNode.ServerMajorVersion = 0;
                    versionNode.ServerMinorversion = 0;
                    break;

                case "CLIENT":
                    long SMajorVer = Convert.ToInt64(info.GetString("SERVERCOMPATABILITY", "ServerMajorVersion"));
                    long SMinorVer = 0;

                    // Add code to handle new code drops
                    if (info.GetString("SERVERCOMPATABILITY", "ServerMinorversion").Contains("."))
                    {
                        SMinorVer = Convert.ToInt64(info.GetString("SERVERCOMPATABILITY", "ServerMinorversion").Replace(".", ""));
                    }
                    else
                    {
                        SMinorVer = Convert.ToInt64(info.GetString("SERVERCOMPATABILITY", "ServerMinorversion"));
                    }

                    versionNode.ServerMajorVersion = SMajorVer;
                    versionNode.ServerMinorversion = SMinorVer;
                    versionNode.ImageIndex         = CLIENT_ICON;
                    break;

                case "BRIDGE":
                    long BMajorVer = Convert.ToInt64(info.GetString("SERVERCOMPATABILITY", "ServerMajorVersion"));
                    long BMinorVer = 0;

                    // Add code to handle new code drops
                    if (info.GetString("SERVERCOMPATABILITY", "ServerMinorversion").Contains("."))
                    {
                        BMinorVer = Convert.ToInt64(info.GetString("SERVERCOMPATABILITY", "ServerMinorversion").Replace(".", ""));
                    }
                    else
                    {
                        BMinorVer = Convert.ToInt64(info.GetString("SERVERCOMPATABILITY", "ServerMinorversion"));
                    }

                    versionNode.ServerMajorVersion = BMajorVer;
                    versionNode.ServerMinorversion = BMinorVer;
                    versionNode.ImageIndex         = BRIDGE_ICON;
                    break;

                default:
                    long dMajorVer = Convert.ToInt64(info.GetString("SERVERCOMPATABILITY", "ServerMajorVersion"));
                    long dMinorVer = 0;

                    // Add code to handle new code drops
                    if (info.GetString("SERVERCOMPATABILITY", "ServerMinorversion").Contains("."))
                    {
                        dMinorVer = Convert.ToInt64(info.GetString("SERVERCOMPATABILITY", "ServerMinorversion").Replace(".", ""));
                    }
                    else
                    {
                        dMinorVer = Convert.ToInt64(info.GetString("SERVERCOMPATABILITY", "ServerMinorversion"));
                    }


                    versionNode.ServerMajorVersion = dMajorVer;
                    versionNode.ServerMinorversion = dMinorVer;
                    versionNode.ImageIndex         = BRIDGE_ICON;
                    break;
                }

                return(versionNode);
            }

            return(null);
        }