private string SaveProjectInfo(VMMasterForm MstrInf)
        {
            var ProjCode = _projInfoService.All().ToList().FirstOrDefault(x => x.ProjCode == MstrInf.Code);

            if (ProjCode == null)
            {
                ProjInfo _proj = new ProjInfo();

                _proj.ProjCode      = MstrInf.Code;
                _proj.ProjName      = MstrInf.Name;
                _proj.ProjLocalName = MstrInf.LocalName;
                _proj.ProjDescrip   = MstrInf.Descr;

                _projInfoService.Add(_proj);
                _projInfoService.Save();

                var ProjID = _proj.ProjID;

                TransactionLogService.SaveTransactionLog(_transactionLogService, "MasterInformation", "SaveProjectInfo",
                                                         ProjID.ToString(), Session["UserName"].ToString());

                return("1");
            }
            else
            {
                return("2");
            }
        }
Beispiel #2
0
        private void frm_NewProj_NewProjUpdated(object sender, NewProjUpdateEventArgs e)
        {
            ProjInfo pi = new ProjInfo();

            string newprojdirname = e.ProjDate.ToString("yyyyMMdd") + "_" + e.ProjName + "_" + e.ProjOwner;

            pi.projectpath = e.ProjPath + "\\" + newprojdirname; //ez a vegleges
            //pi.projectpath = e.ProjPath; //de most tesztelunk

            if (Directory.Exists(pi.projectpath))
            {
                MessageBox.Show("The folder already exists.", "Folder Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                //uj verzio
                pi.projectname     = e.ProjName;
                pi.projectowner    = e.ProjOwner;
                pi.projectdate     = e.ProjDate;
                pi.projectcomments = e.ProjComments;
                Project.AddNewProject(pi);
                CreateEmptyProject(pi.projectpath, pi.projectname);
                this.ProjectRoot = pi.projectpath;//abszolút projektelérés gyökérkönyvtár
                UpdateTreeView();

                DisplayStatusMessage("A new project has been created.", MessageColor.Normal);
            }
        }
Beispiel #3
0
        public void AssInfoFrom_HappyCase()
        {
            ProjInfo result = SdkStyleCsProj.ProjInfoFrom("SdkStyleCsprojSample.xml");

            result.AssName.Should().Be("AssembliesByRepo.Logic.Name");
            result.AssType.Should().Be(ProjInfo.AssTypes.Dll);
            result.CsProjPath.Should().Be("SdkStyleCsprojSample.xml");
        }
        public void AssInfoFrom_HappyCase()
        {
            ProjInfo result = OldStyleCsProj.ProjInfoFrom("OldStyleCsProjSample.xml");

            result.AssName.Should().Be("AssembliesByRepo");
            result.AssType.Should().Be(ProjInfo.AssTypes.Exe);
            result.CsProjPath.Should().Be("OldStyleCsProjSample.xml");
        }
Beispiel #5
0
        private void Web_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            HtmlDocument doc     = web.Document;
            string       lastLOB = "";
            string       dateStr = "";

            //traverse whole HTML document to get required project information
            foreach (HtmlElement ele in doc.All)
            {
                //check if that's a LOB name
                if ((ele.TagName.ToLower() == "tr") && (ele.GetAttribute("ClassName") == "header blue-header"))
                {
                    lastLOB = ele.InnerText;
                }
                //get the project
                if ((ele.TagName.ToLower() == "tr") && (ele.GetAttribute("ClassName") == "platform-row"))
                {
                    if (!PNames.Contains(ele.Children[1].InnerText))
                    {
                        ProjInfo item = new ProjInfo();
                        item.PName = ele.Children[1].InnerText;
                        item.link  = ele.Children[1].Children[0].GetAttribute("href");
                        item.LOB   = lastLOB;
                        if (ele.Children[6].InnerText != null)
                        {
                            dateStr = ele.Children[6].InnerText.Replace(" ", "");
                            if (dateStr == "")
                            {
                                item.RSTDate = "";
                            }
                            else
                            {
                                item.RSTDate = dateConvt(dateStr);
                            }
                        }
                        else
                        {
                            item.RSTDate = "";
                        }
                        proj.Add(item);
                        PNames.Add(ele.Children[1].InnerText);
                        continue;
                    }
                }
            }
            //divide projects into groups based on their initial letters
            int totCnt = 0;

            foreach (ProjInfo p in proj)
            {
                if (p.RSTDate == "")
                {
                    continue;
                }
                if (Convert.ToInt32(p.RSTDate) <= 20160000)
                {
                    continue;
                }
                if (p.LOB == "ENTERPRISE SERVERS")
                {
                    continue;
                }
                Label lblNew = new Label();
                lblNew.Text = p.PName;
                Debug.WriteLine(p.PName);
                string initLetter = p.PName.ToUpper().Substring(0, 1);
                TabControl.TabPageCollection pages = tabCtrl.TabPages;
                foreach (TabPage page in pages)
                {
                    if (page.Name.IndexOf(initLetter) > 0)
                    {
                        lblNew.Tag       = initLetter;
                        lblNew.ForeColor = Color.Blue;
                        lblNew.Left      = 10 + ((page.Name.IndexOf(initLetter) - 3) * 240);
                        int cnt = 0;
                        foreach (Control ctrl in page.Controls)
                        {
                            Label x = (Label)(ctrl);
                            if (x.Tag.ToString() == initLetter)
                            {
                                cnt++;
                            }
                        }
                        lblNew.Top = 10 + (cnt * 25);
                        page.Controls.Add(lblNew);
                        break;
                    }
                }
                totCnt++;
                if (totCnt == 215)
                {
                    break;
                }
            }
            btnLoad.Enabled = true;
        }
        private void CreateProjectsCMakeLists(string slnDir, List <ProjInfo> projs)
        {
            foreach (ProjInfo p in projs)
            {
                using (StreamWriter sw = new StreamWriter(Path.Combine(p.Directory, CMFILE)))
                {
                    sw.WriteLine("cmake_minimum_required (VERSION 3.0)");
                    sw.WriteLine();

                    int iDirLen = p.Directory.Length;
                    if (!p.Directory.EndsWith(Path.DirectorySeparatorChar.ToString()))
                    {
                        iDirLen++;
                    }

                    List <string> sKeys = new List <string>();

                    Directory.EnumerateFiles(
                        p.Directory,
                        "*.*",
                        SearchOption.AllDirectories
                        )
                    .Where(w => w.EndsWith(".cpp") || w.EndsWith(".h"))
                    .Select(s => s.Substring(iDirLen))
                    .Where(w => !w.StartsWith(CMDIR))
                    .Select(s => new KeyValuePair <string, string>(ToKey(s), s))
                    .ToList()
                    .ForEach(f =>
                    {
                        string linPath = f.Value.Replace('\\', '/');
                        string grpPath = Path.GetDirectoryName(f.Value).Replace("\\", "\\\\");
                        sw.WriteLine($"set ({f.Key} \"{linPath}\")");
                        sw.WriteLine($"source_group(\"{grpPath}\" FILES ${{{f.Key}}})");
                        sKeys.Add($"${{{f.Key}}}");
                    });

                    sw.WriteLine();

                    if (p.ProjDependencyNames.Count > 0)
                    {
                        sw.WriteLine("# Properties->C/C++->General->Additional Include Directories");
                        foreach (string sDepProjName in p.ProjDependencyNames)
                        {
                            ProjInfo pDep = projs.FirstOrDefault(f => string.Equals(f.Name, sDepProjName, StringComparison.InvariantCultureIgnoreCase));
                            if (null == pDep)
                            {
                                continue;
                            }

                            int iSlnDirLength = slnDir.Length;
                            if (!slnDir.EndsWith(Path.DirectorySeparatorChar.ToString()))
                            {
                                iSlnDirLength++;
                            }

                            string sRelDepProjPath = pDep.Directory
                                                     .Substring(iSlnDirLength)
                                                     .Replace('\\', '/');
                            sw.WriteLine($"include_directories (\"${{PROJECT_SOURCE_DIR}}/{sRelDepProjPath}\")");
                        }
                    }

                    sw.WriteLine();
                    sw.WriteLine("# Properties->C/C++->General->Additional Include Directories");
                    sw.WriteLine("include_directories (.)");

                    sw.WriteLine();
                    sw.WriteLine($"# Set Properties->General->Configuration Type to {p.ProjType}");
                    if (EConfType.Application == p.ProjType)
                    {
                        sw.Write($"add_executable ({p.Name}");
                    }
                    else if (EConfType.DynamicLibrary == p.ProjType)
                    {
                        sw.Write($"add_library({p.Name} DYNAMIC");
                    }
                    else if (EConfType.StaticLibrary == p.ProjType)
                    {
                        sw.Write($"add_library({p.Name} STATIC");
                    }

                    sw.WriteLine($" {string.Join(" ", sKeys)})");
                    sw.WriteLine();
                    sw.WriteLine("if(WIN32)");
                    sw.WriteLine("set (CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} /W4\")");
                    sw.WriteLine("endif(WIN32)");
                    sw.WriteLine();
                    sw.WriteLine("if(UNIX)");
                    sw.WriteLine("set (CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -std=c++11\")");
                    sw.WriteLine("endif(UNIX)");

                    sw.WriteLine();
                    sw.WriteLine($"set_property(TARGET {p.Name} PROPERTY FOLDER \"{(EConfType.Application == p.ProjType ? "apps" : "libs")}\")");
                    sw.WriteLine($"set_property(TARGET {p.Name} PROPERTY CXX_STANDARD 11)"); // Cmake 3.1.3+

                    if (p.ProjDependencyNames.Count > 0)
                    {
                        sw.WriteLine();
                        sw.WriteLine("# Properties->Linker->Input->Additional Dependencie");
                        sw.WriteLine($"target_link_libraries ({p.Name} {string.Join(" ", p.ProjDependencyNames)})");
                    }
                }
            }
        }
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void MenuItemCallback(object sender, EventArgs e)
        {
            DTE dte = (DTE)this.ServiceProvider.GetService(typeof(DTE));

            Window       window       = dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
            OutputWindow outputWindow = (OutputWindow)window.Object;

            OutputWindowPane owp = null;

            foreach (OutputWindowPane opane in outputWindow.OutputWindowPanes)
            {
                if (string.Equals(CMPANE, opane.Name, StringComparison.InvariantCultureIgnoreCase))
                {
                    owp = opane;
                    break;
                }
            }
            owp = owp ?? outputWindow.OutputWindowPanes.Add(CMPANE);
            owp?.Activate();
            owp?.Clear();

            string          slnDir  = Path.GetDirectoryName(dte.Solution.FileName);
            string          slnName = Path.GetFileNameWithoutExtension(dte.Solution.FullName);
            List <ProjInfo> projs   = new List <ProjInfo>();

            {
                EConfType eConfigurationType = EConfType.Unknown;
                foreach (BuildDependency dep in dte.Solution.SolutionBuild.BuildDependencies)
                {
                    string pname = dep.Project.Name;
                    string pdir  = Path.GetDirectoryName(dep.Project.FileName);
                    string ptype = dep.Project.Kind;

                    if (CMPROJS.Contains(pname))
                    {
                        continue;
                    }


                    ProjInfo pInf = new ProjInfo
                    {
                        Name      = pname,
                        Directory = pdir
                    };
                    projs.Add(pInf);
                    owp?.OutputString($"Project: {pname} ({ptype}) @ {pdir}\n");

                    var depp = dep.RequiredProjects as System.Collections.IEnumerable;
                    foreach (Project rp in depp)
                    {
                        if (CMPROJS.Contains(rp.Name))
                        {
                            continue;
                        }

                        pInf.ProjDependencyNames.Add(rp.Name);
                        owp?.OutputString($"\tDep: {rp.Name}\n");
                    }

                    Configuration cfg = dep.Project.ConfigurationManager.ActiveConfiguration;
                    foreach (Property prop in cfg.Properties)
                    {
                        if (string.Equals("ConfigurationType", prop.Name, StringComparison.InvariantCultureIgnoreCase))
                        {
                            eConfigurationType = (EConfType)Enum.Parse(typeof(EConfType), prop.Value.ToString());
                            pInf.ProjType      = eConfigurationType;
                            owp?.OutputString($"\tProp: {prop.Name} = {prop.Value} ({eConfigurationType})\n");
                        }
                    }
                }
            }

            this.CreateSolutionCMakeList(slnName, slnDir, projs.Select(s => s.Name));
            this.CreateProjectsCMakeLists(slnDir, projs);
        }
 public Element(Library project, ProjInfo projInfo)
 {
     Project = project;
     ProjInfo = projInfo;
     Text = null;
 }
 public OutputMessage Append(Library proj, ProjInfo info)
 {
     elements.Add(new Element(proj, info));
     return this;
 }