Ejemplo n.º 1
0
    public static void MarkBuildVersion(params string[] sourceFiles)
    {
        if (!IsCheckMd5)
        {
            return;
        }

        if (sourceFiles == null || sourceFiles.Length == 0)
        {
            return;
        }

        foreach (string file in sourceFiles)
        {
            //BuildVersion[file] = GetAssetVersion(file);
            BuildRecord theRecord;
            var         nowMd5 = CTool.MD5_File(file);
            if (!BuildVersion.TryGetValue(file, out theRecord))
            {
                theRecord = BuildVersion[file] = new BuildRecord();
                theRecord.Mark(nowMd5);
            }
            else
            {
                if (nowMd5 != theRecord.MD5)
                {
                    theRecord.Mark(nowMd5);
                }
            }


            string metaFile = file + ".meta";
            if (File.Exists(metaFile))
            {
                BuildRecord theMetaRecord;
                var         nowMetaMd5 = CTool.MD5_File(metaFile);
                if (!BuildVersion.TryGetValue(metaFile, out theMetaRecord))
                {
                    theMetaRecord = BuildVersion[metaFile] = new BuildRecord();
                    theMetaRecord.Mark(nowMetaMd5);
                }
                else
                {
                    if (nowMetaMd5 != theMetaRecord.MD5)
                    {
                        theMetaRecord.Mark(nowMetaMd5);
                    }
                }
            }
        }
    }
Ejemplo n.º 2
0
        /// <summary>
        /// 标记一个路径为打包
        /// </summary>
        public void MarkBuildVersion(params string[] sourceFiles)
        {
            if (sourceFiles == null || sourceFiles.Length == 0)
            {
                return;
            }

            foreach (string file in sourceFiles)
            {
                //StoreBuildVersion[file] = GetAssetVersion(file);
                BuildRecord theRecord;
                var         nowMd5 = KTool.MD5_File(file);
                if (!StoreBuildVersion.TryGetValue(file, out theRecord))
                {
                    theRecord = new BuildRecord();
                    theRecord.Mark(nowMd5);
                }
                else
                {
                    if (nowMd5 != theRecord.MD5) // 只有改变时才会mark,所以可能会出现情况,rebuild时,change count不改变
                    {
                        theRecord.Mark(nowMd5);
                    }
                }
                StoreBuildVersion[file] = InstanceBuildVersion[file] = theRecord; // ensure in dict

                string metaFile = file + ".meta";
                if (File.Exists(metaFile))
                {
                    BuildRecord theMetaRecord;
                    var         nowMetaMd5 = KTool.MD5_File(metaFile);
                    if (!StoreBuildVersion.TryGetValue(metaFile, out theMetaRecord))
                    {
                        theMetaRecord = new BuildRecord();
                        theMetaRecord.Mark(nowMetaMd5);
                    }
                    else
                    {
                        if (nowMetaMd5 != theMetaRecord.MD5)
                        {
                            theMetaRecord.Mark(nowMetaMd5);
                        }
                    }

                    StoreBuildVersion[metaFile] = InstanceBuildVersion[metaFile] = theMetaRecord; // ensure in dict
                }
                // meta不记录
                Current.BuildedList.Add(file);
            }
        }
Ejemplo n.º 3
0
        private void viewRemoteServiceExecutableLogFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.SourceControl is DataGridView)
            {
                DataGridView dgvServerStatus = (DataGridView)this.SourceControl;
                if (dgvServerStatus.SelectedCells.Count == 0)
                {
                    return;
                }

                this.Cursor = Cursors.WaitCursor;
                //this.statGeneral.Text = "Retrieving Remote Service Executable log file...";
                //this.statProgBar.Style = ProgressBarStyle.Marquee;
                try
                {
                    string serverName     = string.Empty;
                    string remoteEndpoint = string.Empty;
                    string text           = string.Empty;
                    if (dgvServerStatus.Rows[dgvServerStatus.SelectedCells[0].RowIndex].DataBoundItem is ServerConfigData)
                    {
                        ServerConfigData server = (ServerConfigData)dgvServerStatus.Rows[dgvServerStatus.SelectedCells[0].RowIndex].DataBoundItem;
                        remoteEndpoint = server.ActiveServiceEndpoint;
                        serverName     = server.ServerName;
                    }
                    else if (dgvServerStatus.Rows[dgvServerStatus.SelectedCells[0].RowIndex].DataBoundItem is BuildRecord)
                    {
                        BuildRecord buildRec = (BuildRecord)dgvServerStatus.Rows[dgvServerStatus.SelectedCells[0].RowIndex].DataBoundItem;
                        remoteEndpoint = buildRec.RemoteEndPoint;
                        serverName     = buildRec.RemoteServerName;
                    }

                    text = buildManager.GetServiceLog(remoteEndpoint);
                    SqlSync.ScriptDisplayForm frmScript = new ScriptDisplayForm(text, serverName, "Service Executable Log from " + serverName, SqlSync.Highlighting.SyntaxHightlightType.LogFile);
                    frmScript.Show();
                }
                catch (Exception exe)
                {
                    MessageBox.Show("Sorry... There was an error attempting to retrieve the log file.\r\n " + exe.Message, "Problem!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                    //this.statGeneral.Text = "Ready.";
                    //this.statProgBar.Style = ProgressBarStyle.Blocks;
                }
            }
        }
Ejemplo n.º 4
0
        private void viewExecutionCommitsLogToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.SourceControl is DataGridView)
            {
                DataGridView dgvServerStatus = (DataGridView)this.SourceControl;
                if (dgvServerStatus.SelectedCells.Count == 0)
                {
                    return;
                }

                try
                {
                    string serverName     = string.Empty;
                    string text           = string.Empty;
                    string remoteEndpoint = string.Empty;
                    if (dgvServerStatus.Rows[dgvServerStatus.SelectedCells[0].RowIndex].DataBoundItem is ServerConfigData)
                    {
                        ServerConfigData server = (ServerConfigData)dgvServerStatus.Rows[dgvServerStatus.SelectedCells[0].RowIndex].DataBoundItem;
                        remoteEndpoint = server.ActiveServiceEndpoint;
                        text           = buildManager.GetCommitsLog(server.ActiveServiceEndpoint);
                        serverName     = server.ServerName;
                    }
                    else if (dgvServerStatus.Rows[dgvServerStatus.SelectedCells[0].RowIndex].DataBoundItem is BuildRecord)
                    {
                        BuildRecord buildRec = (BuildRecord)dgvServerStatus.Rows[dgvServerStatus.SelectedCells[0].RowIndex].DataBoundItem;
                        remoteEndpoint = buildRec.RemoteEndPoint;
                        text           = buildManager.GetSpecificSummaryLogFile(buildRec.RemoteEndPoint, SummaryLogType.Commits, buildRec.submissionDate);
                        serverName     = buildRec.RemoteServerName;
                    }

                    SqlSync.ScriptDisplayForm frmScript = new ScriptDisplayForm(text, serverName, "Commits Log from " + serverName, SqlSync.Highlighting.SyntaxHightlightType.RemoteServiceLog, remoteEndpoint);
                    frmScript.LoggingLinkClicked += new LoggingLinkClickedEventHandler(frmScript_LoggingLinkClicked);
                    frmScript.Show();
                }
                catch (System.ServiceModel.CommunicationObjectFaultedException comExe)
                {
                    MessageBox.Show("There was a communication issue retrieving the log file.\r\nTo try to clear the communication error, try closing this page and reopening. If that does not work, you may need to restart the service on the target remote execution server.\r\n\r\nError Message:\r\n" + comExe.Message, "Whoops!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (Exception exe)
                {
                    MessageBox.Show("There was an issue retrieving the log file.\r\n" + exe.Message, "Whoops!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Ejemplo n.º 5
0
        //private void viewBuildRequestHistoryForThisRemoteServiceToolStripMenuItem_Click(object sender, EventArgs e)
        //{
        //    if (this.SourceControl is DataGridView)
        //    {
        //        DataGridView dgvServerStatus = (DataGridView)this.SourceControl;
        //        if (dgvServerStatus.SelectedCells.Count == 0)
        //            return;

        //        ServerConfigData server = (ServerConfigData)dgvServerStatus.Rows[dgvServerStatus.SelectedCells[0].RowIndex].DataBoundItem;
        //        string message;
        //        IList<BuildRecord> history = buildManager.GetBuildServiceHistory(server.TcpServiceEndpoint, out message);
        //        if (history.Count == 0 && message.Length > 0)
        //        {
        //            MessageBox.Show(message, "Can't get the history", MessageBoxButtons.OK, MessageBoxIcon.Warning);
        //            return;
        //        }

        //        BuildHistoryForm frmHist = new BuildHistoryForm(history, server.ServerName, server.TcpServiceEndpoint);
        //        frmHist.ShowDialog();

        //    }
        //}

        private void retrieveAllApplicableErrorLogsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.SourceControl is DataGridView)
            {
                DataGridView dgvServerStatus = (DataGridView)this.SourceControl;
                if (dgvServerStatus.SelectedCells.Count == 0)
                {
                    return;
                }

                string   serverName     = string.Empty;
                string   text           = string.Empty;
                string   remoteEndpoint = string.Empty;
                DateTime submissionDate = DateTime.MaxValue;
                if (dgvServerStatus.Rows[dgvServerStatus.SelectedCells[0].RowIndex].DataBoundItem is ServerConfigData)
                {
                    ServerConfigData server = (ServerConfigData)dgvServerStatus.Rows[dgvServerStatus.SelectedCells[0].RowIndex].DataBoundItem;
                    remoteEndpoint = server.ActiveServiceEndpoint;
                    serverName     = server.ServerName;
                }
                else if (dgvServerStatus.Rows[dgvServerStatus.SelectedCells[0].RowIndex].DataBoundItem is BuildRecord)
                {
                    BuildRecord buildRec = (BuildRecord)dgvServerStatus.Rows[dgvServerStatus.SelectedCells[0].RowIndex].DataBoundItem;
                    remoteEndpoint = buildRec.RemoteEndPoint;
                    serverName     = buildRec.RemoteServerName;
                    submissionDate = buildRec.submissionDate;
                }

                if (DialogResult.OK == saveFileDialog1.ShowDialog())
                {
                    if (buildManager.GetConsolidatedErrorLogs(remoteEndpoint, submissionDate, saveFileDialog1.FileName))
                    {
                        if (DialogResult.Yes == MessageBox.Show("Successfully retrieved error logs. Do you want to open the zip file now?", "Open", MessageBoxButtons.YesNo))
                        {
                            System.Diagnostics.Process.Start(saveFileDialog1.FileName);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Sorry, there was an error retrieving the error logs. Please check the application log and try again", "Whoops. Something didn't work!", MessageBoxButtons.OK);
                    }
                }
            }
        }
Ejemplo n.º 6
0
        BuildRecord GetBuildRecord(object sender)
        {
            BuildRecord r;
            // FIXME: our Microsoft.Build.Engine shouldn't give different "sender" object for each event
            // during the same build run. But it actually does.
            // It is problematic for parallel build because it is impossible to determine right "ongoing build"
            // record for the event without correct sender object.
            // Hence we expect sender as a valid object only if it is IBuildEngine4 -
            // only Microsoft.Build.Internal.BuildEngine4 implements it so far.
            // (Used IBuildEngine3 because it needs to build for NET_4_0).
            var key = sender as IBuildEngine3 ?? dummy_key;

            if (!build_records.TryGetValue(key, out r))
            {
                r = new BuildRecord(this);
                build_records.Add(key, r);
            }
            return(r);
        }
Ejemplo n.º 7
0
        private void txtDetailedLogTarget_KeyDown(object sender, KeyEventArgs e)
        {
            if (this.SourceControl is DataGridView)
            {
                DataGridView dgvServerStatus = (DataGridView)this.SourceControl;

                if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Enter)
                {
                    if (dgvServerStatus.SelectedCells.Count == 0 || txtDetailedLogTarget.Text.Length == 0)
                    {
                        return;
                    }
                    try
                    {
                        string serverName = string.Empty;
                        string text       = string.Empty;
                        if (dgvServerStatus.Rows[dgvServerStatus.SelectedCells[0].RowIndex].DataBoundItem is ServerConfigData)
                        {
                            ServerConfigData server = (ServerConfigData)dgvServerStatus.Rows[dgvServerStatus.SelectedCells[0].RowIndex].DataBoundItem;
                            text       = buildManager.GetDetailedDatabaseLog(server.ActiveServiceEndpoint, txtDetailedLogTarget.Text);
                            serverName = server.ServerName;
                        }
                        else if (dgvServerStatus.Rows[dgvServerStatus.SelectedCells[0].RowIndex].DataBoundItem is BuildRecord)
                        {
                            BuildRecord buildRec = (BuildRecord)dgvServerStatus.Rows[dgvServerStatus.SelectedCells[0].RowIndex].DataBoundItem;
                            text       = buildManager.GetSpecificDetailedDatabaseLog(buildRec.RemoteEndPoint, txtDetailedLogTarget.Text, buildRec.submissionDate);
                            serverName = buildRec.RemoteServerName;
                        }

                        SqlSync.ScriptDisplayForm frmScript = new ScriptDisplayForm(text, serverName, "Detailed Log from " + txtDetailedLogTarget.Text);
                        frmScript.Show();

                        txtDetailedLogTarget.Text = string.Empty;
                    }
                    catch (Exception exe)
                    {
                        MessageBox.Show("There was an issue retrieving the log file.\r\n" + exe.Message, "Whoops!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Ejemplo n.º 8
0
        private void SetupHistory()
        {
            BuildedList.Clear();

            string verFile = GetBuildVersionTab();
            //MakeSureExportPath(VerCtrlInfo.VerFile, EditorUserBuildSettings.activeBuildTarget);
            KTabFile tabFile;
            if (File.Exists(verFile))
            {
                tabFile = KTabFile.LoadFromFile(verFile);

                foreach (KTabFile.RowInterator row in tabFile)
                {
                    var assetPath = row.GetString("AssetPath");
                    StoreBuildVersion[assetPath] =
                        new BuildRecord(
                            row.GetString("AssetMD5"),
                            row.GetString("AssetDateTime"),
                            row.GetInteger("ChangeCount"));
                }
            }
        }
Ejemplo n.º 9
0
 /// <summary>
 /// 只标记,不做MD5比较
 /// </summary>
 /// <param name="strKey"></param>
 public void MarkRecord(string strKey)
 {
     StoreBuildVersion[strKey] = InstanceBuildVersion[strKey] = new BuildRecord(); // ensure in dict
     Current.BuildedList.Add(strKey);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 只检查是否存在记录,不进行文件检查
 /// </summary>
 /// <param name="strKey"></param>
 /// <returns></returns>
 private bool DoCheckExistRecord(string strKey, out BuildRecord assetMd5)
 {
     return(StoreBuildVersion.TryGetValue(strKey, out assetMd5));
 }
Ejemplo n.º 11
0
        /// <summary>
        /// 标记一个路径为打包
        /// </summary>
        public void MarkBuildVersion(params string[] sourceFiles)
        {
            if (sourceFiles == null || sourceFiles.Length == 0)
                return;

            foreach (string file in sourceFiles)
            {
                //StoreBuildVersion[file] = GetAssetVersion(file);
                BuildRecord theRecord;
                var nowMd5 = KTool.MD5_File(file);
                if (!StoreBuildVersion.TryGetValue(file, out theRecord))
                {
                    theRecord = new BuildRecord();
                    theRecord.Mark(nowMd5);
                }
                else
                {
                    if (nowMd5 != theRecord.MD5) // 只有改变时才会mark,所以可能会出现情况,rebuild时,change count不改变
                    {
                        theRecord.Mark(nowMd5);
                    }
                }
                StoreBuildVersion[file] = InstanceBuildVersion[file] = theRecord; // ensure in dict

                string metaFile = file + ".meta";
                if (File.Exists(metaFile))
                {
                    BuildRecord theMetaRecord;
                    var nowMetaMd5 = KTool.MD5_File(metaFile);
                    if (!StoreBuildVersion.TryGetValue(metaFile, out theMetaRecord))
                    {
                        theMetaRecord = new BuildRecord();
                        theMetaRecord.Mark(nowMetaMd5);
                    }
                    else
                    {
                        if (nowMetaMd5 != theMetaRecord.MD5)
                            theMetaRecord.Mark(nowMetaMd5);
                    }

                    StoreBuildVersion[metaFile] = InstanceBuildVersion[metaFile] = theMetaRecord; // ensure in dict
                }
            }
        }
Ejemplo n.º 12
0
        private void SetupHistory()
        {
            BuildCount = 0;

            string verFile = GetBuildVersionTab();
                //MakeSureExportPath(VerCtrlInfo.VerFile, EditorUserBuildSettings.activeBuildTarget);
            KTabFile tabFile;
            if (File.Exists(verFile))
            {
                tabFile = KTabFile.LoadFromFile(verFile);

                foreach (KTabFile.RowInterator row in tabFile)
                {
                    var assetPath = row.GetString("AssetPath");
                    StoreBuildVersion[assetPath] =
                        new BuildRecord(
                            row.GetString("AssetMD5"),
                            row.GetString("AssetDateTime"),
                            row.GetInteger("ChangeCount"));
                }
            }
        }
Ejemplo n.º 13
0
 /// <summary>
 /// 只检查是否存在记录,不进行文件检查
 /// </summary>
 /// <param name="strKey"></param>
 /// <returns></returns>
 private bool DoCheckExistRecord(string strKey, out BuildRecord assetMd5)
 {
     return StoreBuildVersion.TryGetValue(strKey, out assetMd5);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// 只标记,不做MD5比较
 /// </summary>
 /// <param name="strKey"></param>
 public void MarkRecord(string strKey)
 {
     StoreBuildVersion[strKey] = InstanceBuildVersion[strKey] = new BuildRecord(); // ensure in dict
     Current.BuildedList.Add(strKey);
 }