public void SourceControls_Delete()
        {
            using (var context = MockContext.Start(this.GetType()))
            {
                var SecurityInsightsClient = TestHelper.GetSecurityInsightsClient(context);
                var SourceControlId        = Guid.NewGuid().ToString();
                var ContentTypes           = new List <string>();
                ContentTypes.Add("AnalyticRule");
                var RepoProperties = new Repository()
                {
                    Branch = "main",
                    Url    = "https://github.com/SecCxPNinja/Ninja"
                };
                var SourceControlsProperties = new SourceControl()
                {
                    DisplayName  = "SDK Test",
                    RepoType     = "GitHub",
                    ContentTypes = ContentTypes,
                    Repository   = RepoProperties
                };

                var SourceControls = SecurityInsightsClient.SourceControls.List(TestHelper.ResourceGroup, TestHelper.WorkspaceName);
                //SecurityInsightsClient.SourceControls.Create(TestHelper.ResourceGroup, TestHelper.WorkspaceName, SourceControlId, SourceControlsProperties);
                //SecurityInsightsClient.SourceControls.Delete(TestHelper.ResourceGroup, TestHelper.WorkspaceName, SourceControlId);
            }
        }
Exemple #2
0
        private void SetWidth(int level, SourceControl source, HashSet <SourceControl> usedList,
                              Dictionary <int, double> posXs, Dictionary <SourceControl, Point> positions)
        {
            positions[source] = new Point(posXs[level], positions[source].Y);
            usedList.Add(source);

            foreach (Item item in source.CurrentSource.InItems)
            {
                if (item.InConnection != null)
                {
                    if (usedList.Contains(sourceDict[item.InConnection.Target.Source]))
                    {
                        continue;
                    }

                    SetWidth(level - 1, sourceDict[item.InConnection.Target.Source], usedList, posXs, positions);
                }
            }
            foreach (Item item in source.CurrentSource.OutItems)
            {
                foreach (Connection connection in item.OutConnections)
                {
                    if (usedList.Contains(sourceDict[connection.Target.Source]))
                    {
                        continue;
                    }

                    SetWidth(level + 1, sourceDict[connection.Target.Source], usedList, posXs, positions);
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Downloads the source for the specified changeset.
        /// </summary>
        /// <param name="projectSourcePath">The project source path.</param>
        /// <param name="changesetID">The ID of the changeset to be downloaded.</param>
        /// <param name="workspaceName">The name of the local workspace.</param>
        /// <param name="localWorkspacePath">The local workspace path.</param>
        public void DownloadSource(string projectSourcePath, int changesetID, string workspaceName, string localWorkspacePath)
        {
            if (string.IsNullOrEmpty(projectSourcePath))
            {
                throw new ArgumentNullException(projectSourcePath);
            }

            Workspace workspace = null;

            try
            {
                workspace = SourceControl.GetWorkspace(workspaceName,
                                                       SourceControl.AuthorizedUser);
            }
            catch (WorkspaceNotFoundException)
            {
                workspace = SourceControl.CreateWorkspace(workspaceName,
                                                          SourceControl.AuthorizedUser);
            }

            var serverFolder  = String.Format(CultureInfo.InvariantCulture, "$/{0}/", projectSourcePath.TrimEnd('/'));
            var workingFolder = new WorkingFolder(serverFolder, localWorkspacePath);

            // Create a workspace mapping
            workspace.CreateMapping(workingFolder);
            if (!workspace.HasReadPermission)
            {
                throw new SecurityException(
                          String.Format(CultureInfo.InvariantCulture, Resources.ReadPermissionException,
                                        SourceControl.AuthorizedUser, serverFolder));
            }

            workspace.Get(new ChangesetVersionSpec(changesetID), GetOptions.GetAll);
        }
Exemple #4
0
    public void fillListViewForEvaluation(ListView listView, string sourceName, string dateFrom, string dateTo)
    {
        listView.Items.Clear();
        locationControl = new LocationControl();
        sourceControl   = new SourceControl();
        employee        = new Employee();
        employeeDB      = new EmployeeDB();
        connection      = new DBConnection();
        int sourceID = sourceControl.selectID(sourceName);

        employee.setSourceID(sourceID);
        employee.setDateFrom(dateFrom);
        employee.setDateTo(dateTo);
        SqlDataReader reader = employeeDB.fillListViewRelatedToSource(employee);

        while (reader.Read())
        {
            ListViewItem lvi = new ListViewItem(reader["ID"].ToString());
            lvi.SubItems.Add(reader["name"].ToString());
            lvi.SubItems.Add(reader["position"].ToString());
            int    locationID   = int.Parse(reader["locationID"].ToString());
            string locationName = locationControl.getLocationName(locationID);
            lvi.SubItems.Add(locationName);
            listView.Items.Add(lvi);
        }
        connection.close();
    }
Exemple #5
0
        /// <summary>
        /// Connects to the TFS server.
        /// </summary>
        public void Connect()
        {
            configurationServer = new TfsConfigurationServer(ServerUri, System.Net.CredentialCache.DefaultCredentials);

            // Get the catalog of team project collections
            ReadOnlyCollection <CatalogNode> collectionNodes = configurationServer.CatalogNode.QueryChildren(
                new[] { CatalogResourceTypes.ProjectCollection },
                false, CatalogQueryOptions.None);

            // List the team project collections
            foreach (CatalogNode collectionNode in collectionNodes)
            {
                // Use the InstanceId property to get the team project collection
                Guid collectionId = new Guid(collectionNode.Resource.Properties["InstanceId"]);
                TfsTeamProjectCollection teamProjectCollection = configurationServer.GetTeamProjectCollection(collectionId);

                // Find the requested team project collection
                if (teamProjectCollection.Name.ToUpper(CultureInfo.InvariantCulture).EndsWith(this.TeamProjectCollectionName.ToUpper(CultureInfo.InvariantCulture), StringComparison.Ordinal))
                {
                    SourceControl = (VersionControlServer)teamProjectCollection.GetService(typeof(VersionControlServer));

                    this.TeamProjects = new ReadOnlyCollection <TeamProject>(SourceControl.GetAllTeamProjects(false));

                    break; // We got what we want, now exit the loop
                }
            }
        }
Exemple #6
0
 public bool AddCode(string code)
 {
     #if WINDOWS
     if (string.IsNullOrWhiteSpace(code))
     {
         return false;
     }
     SourceControl<object> controlFull = new SourceControl<object>(code);
     if (!RemoveComments(ref controlFull))
     {
         return false;
     }
     if (!CleanAndExpand(ref controlFull))
     {
         return false;
     }
     if (controlFull.Lines.Count == 0)
     {
         //All comments, so code was "compiled", return true
         return true;
     }
     List<SourceControl<string>> names = new List<SourceControl<string>>();
     if (!GetPackages(controlFull, ref names))
     {
         return false;
     }
     //TODO
     return true;
     #else
     return false;
     #endif
 }
        public async Task <bool> DeleteCode(JObject data)
        {
            var code = await base.Delete(data);

            SourceControl.RecycleBin(code.PathOrUrl.Replace(code.Guid, "").Replace("//", "/"), code.Guid);
            return(DeleteDirectory(code.PathOrUrl));
        }
Exemple #8
0
        public void   GenerateSource(string excel, string gendir)
        {
            if (BRKGS)
            {
                System.Diagnostics.Debugger.Break();
            }
            //if(string.IsNullOrEmpty(INCDIR))
            //    INCDIR = gendir;

            //var sm = new SourceControl();
            //sm.G = this;
            //sm.m_excel = excel;
            //sm.m_gendir = gendir;

            //_runSourceControl(sm,SourceControl.MODE.INIT);
            //_runSourceControl(sm,SourceControl.MODE.CVT);

            var sm = new SourceControl();

            sm.G            = this;
            sm.m_excel      = excel;
            sm.m_gendir     = gendir;
            sm.m_cvthexchar = CVTHEXCHAR;

            _runSourceControl(sm, SourceControl.MODE.INIT);
            _runSourceControl(sm, SourceControl.MODE.CVT);

            return;
        }
        /// <summary>
        /// Deserializes the specified element.
        /// </summary>
        /// <param name="element">The element.</param>
        public override void Deserialize(System.Xml.XmlElement element)
        {
            this.SourceControlProvider = null;
            this.ExclusionFilters      = new ExclusionFilterGroup( );
            this.InclusionFilters      = new InclusionFilterGroup( );

            if (string.Compare(element.GetAttribute("type"), this.TypeName, false) != 0)
            {
                throw new InvalidCastException(string.Format("Unable to convert {0} to a {1}", element.GetAttribute("type"), this.TypeName));
            }

            XmlElement ele = ( XmlElement )element.SelectSingleNode("sourceControlProvider");

            if (ele != null)
            {
                SourceControl sc = Util.GetSourceControlFromElement(ele);
                if (sc != null)
                {
                    this.SourceControlProvider = sc;
                    this.SourceControlProvider.Deserialize(ele);
                }
            }

            ele = ( XmlElement )element.SelectSingleNode("inclusionFilters");
            if (ele != null)
            {
                this.InclusionFilters.Deserialize(ele);
            }

            ele = ( XmlElement )element.SelectSingleNode("exclusionFilters");
            if (ele != null)
            {
                this.ExclusionFilters.Deserialize(ele);
            }
        }
Exemple #10
0
        public void LinkAndUnlinkSourceControlToWebsiteShouldSucceed()
        {
            RunWebsiteTestScenario(
                (webSiteName, resourceGroupName, whpName, locationName, webSitesClient, resourcesClient) =>
            {
                var gitHubSourceControl = new SourceControl()
                {
                    SourceControlName = "GitHub",
                    Token             = "36c7290f81fda5877d52d2fc3fbc7c31acd25051",
                    Location          = locationName
                };

                webSitesClient.Provider.UpdateSourceControl(gitHubSourceControl.SourceControlName, gitHubSourceControl);

                var siteSourceControlUpdateResponse =
                    webSitesClient.Sites.UpdateSiteSourceControl(
                        resourceGroupName,
                        webSiteName,
                        new SiteSourceControl()
                {
                    RepoUrl = "https://github.com/amitaptest/HelloKudu"
                });

                Assert.Equal("https://github.com/amitaptest/HelloKudu", siteSourceControlUpdateResponse.RepoUrl);

                var operationResponse =
                    webSitesClient.Sites.DeleteSiteSourceControl(
                        resourceGroupName,
                        webSiteName);
            });
        }
Exemple #11
0
        void ImportLatestLogs(object o)
        {
            UnitOfWork unitOfWork = null;;

            try
            {
                unitOfWork = new UnitOfWork();

                var sourceControl = new SourceControl();
                var houseKeeper   = new HouseKeepingService(unitOfWork, sourceControl);

                int logsImported = houseKeeper.ImportLatestLogs();

                unitOfWork.Save();

                System.Diagnostics.Trace.TraceInformation(logsImported + " revisions imported");
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.TraceError("ImportLatestLogs: " + ex);
            }
            finally
            {
                if (unitOfWork != null)
                {
                    unitOfWork.Dispose();
                }
            }
        }
Exemple #12
0
        protected void git(string url, string branchName)
        {
            var sourceControl = SourceControl.Create <GitSourceControl>(url);

            sourceControl.BranchName    = branchName;
            buildMetaData.SourceControl = sourceControl;
        }
        public async Task DeterminesDeltaOnModification()
        {
            var file         = "BB";
            var readModel    = "AB";
            var fileProvider = Substitute.For <IFileProvider>();

            fileProvider.Exists(Arg.Any <string>()).Returns(true);
            fileProvider.ReadAsync(Arg.Any <string>()).Returns(Encoding.UTF8.GetBytes(file).ToAsyncEnumerable());
            fileProvider.ReadAsync(Arg.Any <Stream>()).Returns(Encoding.UTF8.GetBytes(readModel).ToAsyncEnumerable());
            var eventSource = Substitute.For <IEventSource>();

            eventSource.Rebuild(Arg.Any <string>()).Returns(new Document());
            var watcher = Substitute.For <IFileSystemWatcher>();
            var target  = new SourceControl(fileProvider, eventSource, watcher);
            await target.Add("path");

            watcher.Changed += Raise.Event <FileChangedEventHandler>("path");

            var actual = eventSource.ReceivedCalls().Last().GetArguments().Last();

            actual.Should().BeEquivalentTo(new UpdateEvent
            {
                Updates = new List <Changeset>
                {
                    new Changeset
                    {
                        Offset = 0,
                        Values = Encoding.UTF8.GetBytes("B").ToList()
                    }
                }
            });
        }
Exemple #14
0
    public Boolean insertApplication(string applayDate, string name, string sex, string address, string birthDate, string education, string source, string state, string comment, double salary, int workHours, int mobilePhone, int phone, int familyPhone, string nationalID, byte[] image)
    {
        application   = new ApplicationForm();
        applicationDB = new ApplicationDB();
        sourceControl = new SourceControl();

        application.setName(name);
        application.setApplayDate(applayDate);
        application.setSex(sex);
        application.setAddress(address);
        application.setBirthDate(birthDate);
        application.setEducation(education);
        application.setSource(sourceControl.selectID(source));
        application.setState(state);
        application.setComment(comment);
        application.setSalary(salary);
        application.setWorkHours(workHours);
        application.setMobilePhone(mobilePhone);
        application.setPhone(phone);
        application.setFamilyPhone(familyPhone);
        application.setNationalID(nationalID);
        application.setImage(image);
        check = applicationDB.checkApplication(application);
        if (check == true)
        {
            return(false);
        }
        else
        {
            applicationDB.insert(application);
            return(true);
        }
    }
Exemple #15
0
        /// <summary>
        /// Returns a sequence of all first level children of the control.
        /// </summary>
        public override IEnumerable <ControlBase> GetChildren()
        {
            WaitForControlReadyIfNecessary();

            ControlBase[] children = SourceControl.GetChildren()
                                     .Select(child => WrapUtil((CUITControls.HtmlControl)child))
                                     .ToArray();

            Dictionary <Type, int> tagInstancesByType = new Dictionary <Type, int>();

            foreach (ControlBase child in children)
            {
                if (child.SourceControl.SearchProperties.Any())
                {
                    int tagInstances;
                    if (tagInstancesByType.ContainsKey(child.GetType()))
                    {
                        tagInstances = tagInstancesByType[child.GetType()] += 1;
                    }
                    else
                    {
                        tagInstances = tagInstancesByType[child.GetType()] = 1;
                    }

                    child.SourceControl.FilterProperties.Add(
                        CUITControls.HtmlControl.PropertyNames.TagInstance,
                        tagInstances.ToString());
                }

                yield return(child);
            }
        }
 protected virtual void CheckOut(ProjectAssemblyInfo assemblyInfo, string assemblyInfoFile)
 {
     if (SourceControl != null)
     {
         try
         {
             var files =
                 SourceControl.CheckOut(
                     Path.GetDirectoryName(assemblyInfo.Project.DTE.Solution.FullName),
                     assemblyInfoFile);
             if (files <= 0)
             {
                 File.SetAttributes(assemblyInfoFile, FileAttributes.Normal);
             }
         }
         catch (Exception exception)
         {
             Common.MyLogger.WriteExceptionLog(exception);
             File.SetAttributes(assemblyInfoFile, FileAttributes.Normal);
         }
     }
     else
     {
         File.SetAttributes(assemblyInfoFile, FileAttributes.Normal);
     }
 }
        /// <summary>
        /// Creates a new output file or updates it's contents if it already exists.
        /// </summary>
        /// <param name="output">An <see cref="OutputFile"/> object.</param>
        private static void UpdateOutputFile(OutputFile output)
        {
            if (File.Exists(output.File))
            {
                // Don't do anything unless the output file has changed and needs to be overwritten
                if (output.Content.ToString() == File.ReadAllText(output.File, output.Encoding))
                {
                    return;
                }

                // Don't do anything if the file should be preserved.
                if (output.PreserveExistingFile)
                {
                    return;
                }
            }

            // Check out the file if it is under source control
            SourceControl sourceControl = GetDte().SourceControl;

            if (sourceControl.IsItemUnderSCC(output.File) && !sourceControl.IsItemCheckedOut(output.File))
            {
                sourceControl.CheckOutItem(output.File);
            }

            Directory.CreateDirectory(Path.GetDirectoryName(output.File));
            File.WriteAllText(output.File, output.Content.ToString(), output.Encoding);
        }
 private void comboBoxSorceName_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         sourceControl = new SourceControl();
         string sourceName = comboBoxSorceName.Text;
         string address    = sourceControl.getSourceAddress(sourceName);
         string employee1  = sourceControl.getSourceEmployee1(sourceName);
         string employee2  = sourceControl.getSourceEmployee2(sourceName);
         string phone1     = sourceControl.getSourcePhone1(sourceName);
         string phone2     = sourceControl.getSourcePhone2(sourceName);
         string phone3     = sourceControl.getSourcePhone3(sourceName);
         txtSourceName.Text      = sourceName;
         txtSourceAddress.Text   = address;
         txtSourceEmployee1.Text = employee1;
         txtSourceEmployee2.Text = employee2;
         txtSourcePhone1.Text    = phone1;
         txtSourcePhone2.Text    = phone2;
         txtSourcePhone3.Text    = phone3;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemple #19
0
        private void Reverse(SourceControl source, Dictionary <SourceControl, Point> positions)
        {
            var widths = new Dictionary <int, double>();

            Reverse(0, source, new HashSet <SourceControl>(), widths, new Dictionary <int, double>(), positions);
            var    posXs = new Dictionary <int, double>();
            double sum   = 0;

            foreach (KeyValuePair <int, double> pair in widths.OrderBy(p => p.Key))
            {
                posXs[pair.Key] = sum;
                sum            += pair.Value + 30;
            }
            SetWidth(0, source, new HashSet <SourceControl>(), posXs, positions);
            var selectables   = new List <Selectable>();
            var tempPositions = new List <Point>();

            foreach (KeyValuePair <SourceControl, Point> pair in positions)
            {
                selectables.Add(pair.Key.CurrentSource);
                tempPositions.Add(pair.Value);
            }
            var command = new Command.MovePositionablesCommand(selectables.ToArray(), tempPositions.ToArray());

            commandManager.AddCommand(command);
        }
Exemple #20
0
        private bool CheckoutFile(string fileName)
        {
            Debug.WriteLine("CheckoutFile: file = '{0}'", fileName);

            SourceControl sourceControl = applicationObject.SourceControl;

            if (sourceControl == null)
            {
                Debug.WriteLine("CheckoutFile: SourceControl is null");
                return(true);
            }
            Debug.WriteLine("CheckoutFile: SourceControl is not null");

            if (!sourceControl.IsItemUnderSCC(fileName))
            {
                Debug.WriteLine("CheckoutFile: file is not under source control");
                return(true);
            }

            Debug.WriteLine("CheckoutFile: file is under source control");
            if (sourceControl.IsItemCheckedOut(fileName))
            {
                Debug.WriteLine("CheckoutFile: file is already checked out");
                return(true);
            }

            var result = sourceControl.CheckOutItem(fileName);

            Debug.WriteLine(result ? "CheckoutFile: file successfully checked out" : "CheckoutFile: failed check out file");
            return(result);
            //return sourceControl.IsItemCheckedOut(fileName);
        }
Exemple #21
0
        private CUITControls.SilverlightCell GetCell(int iRow, int iCol)
        {
            SourceControl.WaitForControlReady();
            CUITControls.SilverlightCell _SlCell = null;
            int rowCount = -1;

            foreach (CUITControls.SilverlightRow cont in SourceControl.Rows)
            {
                rowCount++;
                if (rowCount == iRow)
                {
                    int colCount = -1;
                    foreach (CUITControls.SilverlightCell cell in cont.Cells)
                    {
                        colCount++;
                        if (colCount == iCol)
                        {
                            _SlCell = cell;
                            break;
                        }
                    }
                }
                if (_SlCell != null)
                {
                    break;
                }
            }
            return(_SlCell);
        }
Exemple #22
0
        public void MarkTextAsError(int LineIndex, int CharPosStart, int CharLength)
        {
            if ((LineIndex < 0) ||
                (LineIndex >= SourceControl.LinesCount))
            {
                Debug.Log("MarkTextAsError lineindex out of bounds!");
                return;
            }
            // several warnings/errors in one line, mark the full line
            if ((LineIndex < m_LineInfos.Count) &&
                (m_LineInfos[LineIndex].HasCollapsedContent))
            {
                string lineText = SourceControl[LineIndex].Text;

                // find first non white space
                CharPosStart = 0;
                while ((CharPosStart < lineText.Length) &&
                       ((lineText[CharPosStart] == ' ') ||
                        (lineText[CharPosStart] == '\t')))
                {
                    ++CharPosStart;
                }
                CharLength = lineText.TrimEnd().Length - CharPosStart;
            }

            int startPos = SourceControl.VirtualPositionToPositionInLine(LineIndex, CharPosStart);

            var range = new FastColoredTextBoxNS.Range(SourceControl, new FastColoredTextBoxNS.Place(startPos, LineIndex), new FastColoredTextBoxNS.Place(startPos + CharLength, LineIndex));

            range.SetStyle(FastColoredTextBoxNS.StyleIndex.Style10);
        }
Exemple #23
0
        public override void ApplyState(ASPxEditState state)
        {
            base.ApplyState(state);

            SourceControl.ClientEnabled = state.ClientEnabled;
            SourceControl.SetValue(state.Value);
        }
 /// <summary>
 /// Check out file from source control.
 /// </summary>
 /// <param name="sourceControl">Source control object</param>
 /// <param name="file">The name of the file to check out</param>
 private static void CheckOutFile(SourceControl sourceControl, string file)
 {
     if (sourceControl != null && sourceControl.IsItemUnderSCC(file) &&
         !sourceControl.IsItemCheckedOut(file))
     {
         sourceControl.CheckOutItem(file);
     }
 }
        /// <summary>
        /// Gets a preview image from the source control
        /// </summary>
        /// <returns></returns>
        private Bitmap GetControlPreviewBitmap()
        {
            var preview = new Bitmap(SourceControl.Width, SourceControl.Height);

            SourceControl.DrawToBitmap(preview, new Rectangle(Point.Empty, SourceControl.Size));

            return(preview);
        }
Exemple #26
0
 public void UnCheck()
 {
     SourceControl.WaitForControlReady();
     if (SourceControl.Checked)
     {
         SourceControl.Checked = false;
     }
 }
Exemple #27
0
 public void Check()
 {
     SourceControl.WaitForControlReady();
     if (!SourceControl.Checked)
     {
         SourceControl.Checked = true;
     }
 }
Exemple #28
0
        /// <summary>
        /// Returns a sequence of all first level children of the control.
        /// </summary>
        public override IEnumerable <ControlBase> GetChildren()
        {
            WaitForControlReady();

            return(SourceControl.GetChildren()
                   .Select(child => WrapUtil((CUITControls.HtmlControl)child))
                   .ToArray());
        }
Exemple #29
0
        protected override void Because()
        {
            SourceControl.ClearDownLoadedPackages();

            SourceControl svn = new SVNSourceControl(HORN_URL);

            svn.RetrieveSource(packageTree);
        }
Exemple #30
0
        /// <summary>
        /// Clicks on the center of the UITestControl based on its point on the screen.
        /// This may "work-around" Coded UI tests (on third-party controls) that throw the following exception:
        /// Microsoft.VisualStudio.TestTools.UITest.Extension.FailedToPerformActionOnBlockedControlException: Another control is blocking the control. Please make the blocked control visible and retry the action.
        /// </summary>
        public void PointAndClick()
        {
            SourceControl.WaitForControlReady();
            int x = SourceControl.BoundingRectangle.X + SourceControl.BoundingRectangle.Width / 2;
            int y = SourceControl.BoundingRectangle.Y + SourceControl.BoundingRectangle.Height / 2;

            Mouse.Click(new Point(x, y));
        }
 public BuildMetaDataStub(Core.BuildEngines.BuildEngine buildEngine, SourceControl sourceControl)
 {
     BuildEngine = buildEngine;
     SourceControl = sourceControl;
     PrebuildCommandList = new List<string>();
     RepositoryElementList = new List<IRepositoryElement>();
     ExportList = new List<SourceControl>();
     ProjectInfo = new Dictionary<string, object>();
 }
Exemple #32
0
        private void SetSourceControl(string url, string sourceControlType, string path)
        {
            var scmType = sourceControlType.ToLower();

            if (scmType != "svn")
                throw new ArgumentOutOfRangeException(string.Format("Unkown SourceControlType {0}",
                                                                        sourceControlType));
            SourceControl = new SVNSourceControl(url, path);
        }
Exemple #33
0
 public BuildMetaDataStub(Core.BuildEngines.BuildEngine buildEngine, SourceControl sourceControl)
 {
     BuildEngine           = buildEngine;
     SourceControl         = sourceControl;
     PrebuildCommandList   = new List <string>();
     RepositoryElementList = new List <IRepositoryElement>();
     ExportList            = new List <SourceControl>();
     ProjectInfo           = new Dictionary <string, object>();
 }
        public static void DumpObjectTree(SourceControl.ObjectTree ot)
        {
            //System.Console.WriteLine("== Folder: " + ot.Name);
            _logger.Debug("== Folder: " + ot.Name);

            foreach (string key in ot.Objects)
            {
                //System.Console.WriteLine(key);
                _logger.Debug(key);
            }

            foreach (SourceControl.ObjectTree childOT in ot.ObjectTrees)
            {
                DumpObjectTree(childOT);
            }
        }
Exemple #35
0
 private bool GetPackages(SourceControl<object> sc, ref List<SourceControl<string>> names)
 {
     bool onPackage = false;
     string package = null;
     int depth = 0;
     List<SourceLine> lines = new List<SourceLine>();
     for (int i = 0; i < sc.Lines.Count; i++)
     {
         SourceLine line = sc.Lines[i];
         if (onPackage)
         {
             if (line.Line.StartsWith("{"))
             {
                 depth++;
             }
             else if (line.Line.StartsWith("}"))
             {
                 depth--;
             }
             if (depth == 0)
             {
                 if (package == null)
                 {
                     package = string.Empty;
                 }
                 if (lines.Count > 0)
                 {
                     names.Add(new SourceControl<string>(lines, package));
                     lines = new List<SourceLine>();
                 }
                 package = null;
                 onPackage = false;
             }
             else
             {
                 lines.Add(line);
             }
         }
         else
         {
             if (package == null)
             {
                 if (line.Line.StartsWith("package"))
                 {
                     package = line.Line.Substring(8).Trim();
                 }
                 //What do we do if package is not the first line? What do we do if it has a modifier (documentation seems to mention it, not sure how it works)
             }
             else
             {
                 if (line.Line.StartsWith("{"))
                 {
                     onPackage = true;
                     depth = 1;
                 }
             }
         }
     }
     ResetError();
     return true;
 }
Exemple #36
0
        public AssemblyStatus(SourceControl.BuildServers.SourceController prj)
        {
            State = prj.BuildServer.GetState().ToString();

            IRevision scmBS = prj.BuildServerRevision;
            IRevision scmPck = prj.PackageRevision;

            BuildServerRev = scmBS;
            PackageRev = scmPck;

            packagedDate = prj.Versions.LastPackagedDate;
            Loaded = prj.RuntimeLoaded;
            LoadedRevision = prj.RuntimeLoadedRevision;
            LoadedRemarks = prj.RuntimeLoadedRemark;
        }
Exemple #37
0
        //TODO
        //TODO
        //TODO
        //TODO
        //TODO

        //Goes through all the lines and "expands" them so braces have their own lines and empty-lines are removed
        private bool CleanAndExpand(ref SourceControl<object> sc)
        {
            //TODO

            //Remove all blank lines to speed up processing, line numbers are kept intact
            List<SourceLine> lines = new List<SourceLine>();
            for (int i = 0; i < sc.Lines.Count; i++)
            {
                SourceLine line = sc.Lines[i];
                if (!string.IsNullOrWhiteSpace(line.Line))
                {
                    lines.Add(line);
                }
            }
            sc.Lines = lines;
            return true;
        }
 /// <summary>
 /// Check out file from source control.
 /// </summary>
 /// <param name="sourceControl">Source control object</param>
 /// <param name="file">The name of the file to check out</param>
 private static void CheckOutFile(SourceControl sourceControl, string file)
 {
     if (sourceControl != null && sourceControl.IsItemUnderSCC(file)
         && !sourceControl.IsItemCheckedOut(file))
     {
         sourceControl.CheckOutItem(file);
     }
 }
Exemple #39
0
 private bool RemoveComments(ref SourceControl<object> sc)
 {
     bool comment = false;
     int index;
     //Remove comments
     for (int i = 0; i < sc.Lines.Count; i++)
     {
         string line = sc.Lines[i].Line;
         if (comment)
         {
             index = line.IndexOf("*/");
             if (index >= 0)
             {
                 index += 2;
                 sc.Lines[i].ColNumber = index;
                 sc.Lines[i].Line = line.Substring(index);
                 comment = false;
                 i--; //Just in case
             }
             else
             {
                 sc.Lines[i].ColNumber = 0;
                 sc.Lines[i].Line = string.Empty;
             }
         }
         else
         {
             index = line.IndexOf("//");
             if (index >= 0 && ParaCount(line, index) % 2 == 0)
             {
                 sc.Lines[i].ColNumber = 0;
                 sc.Lines[i].Line = line.Substring(0, index).TrimEnd();
             }
             else
             {
                 index = line.IndexOf("/*");
                 if (index >= 0 && ParaCount(line, index) % 2 == 0)
                 {
                     int start = index;
                     index = line.IndexOf("*/", index);
                     if (index >= 0)
                     {
                         //Single line comment
                         index += 2;
                         sc.Lines[i].ColNumber = 0;
                         sc.Lines[i].Line = line.Substring(0, start) + new string(' ', index - start) + line.Substring(index);
                         i--; //So the comment checks repeat on single line comments
                     }
                     else
                     {
                         //Multiline comment
                         sc.Lines[i].ColNumber = 0;
                         sc.Lines[i].Line = line.Substring(0, start).TrimEnd();
                         this.line = i;
                         this.col = start + sc.Lines[i].ColNumber;
                         comment = true;
                     }
                 }
             }
         }
     }
     //If we are still in comment mode then we are missing a end of comment marker. This means the code has been corrupted by the cleaner
     if (comment)
     {
         this.message = Messages.Compiler_Error_NoEndComment;
         return false;
     }
     ResetError();
     return true;
 }
 public MetaDataSynchroniser(SourceControl sourceControl)
 {
     this.sourceControl = sourceControl;
 }
 public SourceControlAdapter(SourceControl sourceControl)
 {
     _sourceControl = sourceControl;
 }
Exemple #42
0
        public virtual IGet From(SourceControl sourceControlToGetFrom)
        {
            sourceControl = sourceControlToGetFrom;

            return this;
        }
        protected override void Before_each_spec()
        {
            sourceControl = new SourceControlDouble("http://somesvnuri.com/Svn");

            packageTree = TreeHelper.GetTempPackageTree().RetrievePackage(PackageTreeHelper.PackageWithoutRevision);
        }