Example #1
0
 private static bool writeGitIgnore(SolutionConfig config)
 {
     return(new GitIgnoreCommand().Execute(new GitIgnoreInput()
     {
         Line = config.SourceFolder + "/packages"
     }));
 }
Example #2
0
 private void Foreach(Action <PropertyConfig> action, SolutionConfig solution)
 {
     foreach (var project in solution.Projects)
     {
         Foreach(action, project);
     }
 }
 private static void ForeachByCurrent(Action <ProjectConfig> action, SolutionConfig solution)
 {
     foreach (var project in solution.Projects)
     {
         ForeachByCurrent(action, project);
     }
 }
Example #4
0
 private void Foreach(Action <EnumConfig> action, SolutionConfig solution)
 {
     foreach (var project in solution.Enums)
     {
         Foreach(action, project);
     }
 }
 private void btnClear_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (0 == _reviewRepo.GetCount())
         {
             return;
         }
         //TODO: Adda aconfirmation here.
         //DialogResult result = MessageBox.Show("Are you sure to clear all items?", Utils.AssemblyTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         //if (DialogResult.Yes == result)
         //{
         _reviewRepo.Clear();
         RefreshReviewList();
         var solutionConfig = SolutionConfig.GetSolutionConfig();
         if (solutionConfig != null)
         {
             solutionConfig.Delete();
         }
         //}
     }
     catch (Exception ex)
     {
         Utils.HandleException(ex);
     }
 }
 private void btnOpen_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (VSIDEHelper.VisualStudioInstance.Solution.IsOpen)
         {
             OpenFileDialog fDialog = new OpenFileDialog();
             fDialog.Title  = "Open Review";
             fDialog.Filter = "html file (*.html)|*.html";
             //fDialog.InitialDirectory = @"C:\";
             if (fDialog.ShowDialog() == DialogResult.OK)
             {
                 _fileLocation = fDialog.FileName;
                 LoadDataFromReviewPalFile();
                 var solutionConfig = SolutionConfig.GetSolutionConfig();
                 if (solutionConfig == null)
                 {
                     solutionConfig = new SolutionConfig();
                 }
                 solutionConfig.ReviewPalFileLocation = _fileLocation;
                 solutionConfig.Save();
             }
         }
         else
         {
             MessageBox.Show(SolutionNotOpen);
         }
     }
     catch (Exception ex)
     {
         Utils.HandleException(ex);
     }
 }
Example #7
0
        private void LoadSolution(string directory, string file, bool isGlobal)
        {
            var sluFile = Path.Combine(directory, file);

            using (WorkModelScope.CreateScope(WorkModel.Loding))
            {
                try
                {
                    _solution = DeSerializer <SolutionConfig>(sluFile) ?? new SolutionConfig
                    {
                        Name        = "GlobalConfig",
                        Caption     = "全局配置",
                        Description = "全局配置"
                    };
                }
                catch (Exception exception)
                {
                    Trace.WriteLine(exception);
                    _solution = new SolutionConfig();
                }
                SolutionConfig.SetCurrentSolution(_solution);
                _solution.IsGlobal     = isGlobal;
                _solution.SaveFileName = sluFile;
                try
                {
                    LoadProjects(directory);
                }
                catch (Exception ex)
                {
                    Trace.WriteLine(ex);
                }
                GlobalTrigger.OnLoad(_solution);
            }
        }
Example #8
0
 public static IEnumerator Solution2Project(SolutionConfig solution)
 {
     foreach (var project in solution.Projects)
     {
         yield return(project);
     }
 }
Example #9
0
 protected void Foreach(Action <ProjectConfig> action, SolutionConfig solution)
 {
     foreach (var project in solution.Projects)
     {
         Foreach(action, project);
     }
 }
Example #10
0
        private static void removePackagesFromGit(SolutionConfig config)
        {
            var packagesFolder = FileSystem.Combine(config.SourceFolder, "packages");
            var arguments      = "rm {0} -r".ToFormat(packagesFolder);

            Runner.Git.Run(arguments);
            Runner.Git.Run("status");
        }
        public void mode_for_nuget_that_matches_floats()
        {
            var config = new SolutionConfig();

            config.Floats = new string[] { "FubuCore" };

            config.ModeForNuget("FubuCore").ShouldEqual(UpdateMode.Float);
        }
Example #12
0
        public static void ApiRefactor(SolutionConfig project)
        {
            var win = new ApiRefactorWindow();
            var vm  = (ApiRefactorViewModel)win.DataContext;

            vm.Model.Solution = project;
            win.Show();
        }
        public void float_nuget()
        {
            var config = new SolutionConfig();

            config.FloatNuget("Nug1");

            config.ModeForNuget("Nug1").ShouldEqual(UpdateMode.Float);
            config.Floats.ShouldContain("Nug1");
        }
Example #14
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="solution"></param>
        private static void SaveSolution(SolutionConfig solution)
        {
            var writer = new ConfigWriter
            {
                Solution = solution,
            };

            writer.SaveSolution();
        }
Example #15
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="solution"></param>
        /// <param name="directory"></param>
        private static void SaveSolution(SolutionConfig solution, string directory)
        {
            var writer = new ConfigWriter
            {
                Solution  = solution,
                Directory = directory
            };

            writer.SaveSolution();
        }
        public void lock_nuget()
        {
            var config = new SolutionConfig();

            config.FloatNuget("Nug1");
            config.LockNuget("Nug1");

            config.ModeForNuget("Nug1").ShouldEqual(UpdateMode.Fixed);
            config.Floats.Any().ShouldBeFalse();
        }
Example #17
0
 public static IEnumerator Solution2Entity(SolutionConfig solution)
 {
     foreach (var project in solution.Projects)
     {
         foreach (var entity in project.Entities)
         {
             yield return(entity);
         }
     }
 }
Example #18
0
        public CustomerCareIntelligenceMetricCollectorBackendWorker(SolutionConfig config)
        {
            APIPingUtil.LanuchPingThread(config[SolutionConfigName.DASHBOARD_APP_INSIGHT_KEY].ToString());

            var dbConnString = config[SolutionConfigName.BIZ_DASHBOARD_DB_CONNECTION_STR].ToString();

            //Create build info collector
            var buildWriter = new OffcialBuildDBMetricStorageWriter(dbConnString);

            this.buildCollector = new OfficialBuildDBMetricCollector(buildWriter, config);
        }
Example #19
0
 public void MarkFloatingDependencies(SolutionConfig config, Solution solution)
 {
     config.Floats.Each(x => solution.Projects.Each(project =>
     {
         var dependency = project.Dependencies.Find(x);
         if (dependency != null)
         {
             dependency.Float();
         }
     }));
 }
Example #20
0
 /// <summary>
 /// 保存
 /// </summary>
 /// <param name="solution"></param>
 /// <param name="filename"></param>
 public static void Save(SolutionConfig solution, string filename)
 {
     if (solution == GlobalConfig.GlobalSolution)
     {
         SaveGlobal();
     }
     else
     {
         solution.FileName = filename;
         SaveSolution(solution, Path.GetDirectoryName(filename));
     }
 }
Example #21
0
 /// <summary>
 /// 保存
 /// </summary>
 /// <param name="solution"></param>
 /// <param name="filename"></param>
 public static void Save(SolutionConfig solution, string filename)
 {
     if (solution == GlobalConfig.GlobalSolution)
     {
         SaveGlobal();
     }
     else
     {
         solution.SaveFileName = filename;
         SaveSolution(solution);
     }
 }
Example #22
0
        internal static bool PreLoading()
        {
            //Log = new LogControler(AppName);
            //LogHelper.EnableApplicationLogging(Log);
            //LogHelper.EnableXmlLogging(Log);
            //Log.WriteAppStart(AppName);

            string filePath = Path.Combine(GetSolutionRoot(), AppConfigFileName);   //20091217

            ConfigMgt = new ConfigManager <SolutionConfig>(filePath);
            //ConfigMgt = new ConfigManager<SolutionConfig>(AppConfigFileName);
            if (ConfigMgt.Load())
            {
                Log = new LogControler(AppName, ConfigMgt.Config.LogConfig);
                LogHelper.EnableApplicationLogging(Log);
                LogHelper.EnableXmlLogging(Log);
                Log.WriteAppStart(AppName);

                Log.Write("Load config succeeded. " + ConfigMgt.FileName);
                return(true);
            }
            else
            {
                Log = new LogControler(AppName);
                LogHelper.EnableApplicationLogging(Log);
                LogHelper.EnableXmlLogging(Log);
                Log.WriteAppStart(AppName);

                Log.Write(LogType.Error, "Load config failed. " + ConfigMgt.FileName);
                Log.Write(ConfigMgt.LastError);

                if (MessageBox.Show("Cannot load " + AppName + " configuration file. \r\n" +
                                    ConfigMgt.FileName + "\r\n\r\nDo you want to create a configuration file with default setting and continue?",
                                    AppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    ConfigMgt.Config = SolutionConfig.GetDefault();// new SolutionConfig();
                    if (ConfigMgt.Save())
                    {
                        Log.Write("Create config file succeeded. " + ConfigMgt.FileName);
                        return(true);
                    }
                    else
                    {
                        Log.Write(LogType.Error, "Create config file failed. " + ConfigMgt.FileName);
                        Log.Write(ConfigMgt.LastError);
                        return(false);
                    }
                }

                return(false);
            }
        }
Example #23
0
        public void ExtractSolutionLevelConfiguration(SolutionConfig config, Solution solution)
        {
            var specificDependencies = new List <Dependency>();

            solution.Projects.Each(project => specificDependencies.AddRange(project.Dependencies.Where(x => !x.IsFloat())));

            specificDependencies.Each(dependency =>
            {
                solution.AddDependency(new Dependency(dependency.Name, dependency.Version, UpdateMode.Fixed));

                dependency.Float();
            });
        }
Example #24
0
 protected CsprojFileChanger(
     string solutionPath,
     string newFilePath)
 {
     SolutionConfig = new SolutionConfig()
     {
         AbsolutePath        = solutionPath,
         Name                = Path.GetFileNameWithoutExtension(solutionPath),
         DllName             = Path.GetFileNameWithoutExtension(newFilePath),
         SourceDllVersion    = string.Empty,
         NewFileAbsolutePath = newFilePath
     };
     CheckFile();
 }
Example #25
0
        public SolutionConfig BuildConfig()
        {
            var config = new SolutionConfig()
            {
                Name = Name
            };

            if (SourceFolderFlag.IsNotEmpty())
            {
                config.SourceFolder = SourceFolderFlag;
            }

            return(config);
        }
Example #26
0
        public static bool SetActiveSolutionConfiguration(string ConfigName, string PlatformName)
        {
            SolutionConfigurations DteSolutionConfigs = UnrealVSPackage.Instance.DTE.Solution.SolutionBuild.SolutionConfigurations;

            foreach (SolutionConfiguration2 SolutionConfig in DteSolutionConfigs)
            {
                if (string.Compare(SolutionConfig.Name, ConfigName, StringComparison.Ordinal) == 0 &&
                    string.Compare(SolutionConfig.PlatformName, PlatformName, StringComparison.Ordinal) == 0)
                {
                    SolutionConfig.Activate();
                    return(true);
                }
            }
            return(false);
        }
Example #27
0
        public Solution LoadFrom(IFileSystem fileSystem, string filePath)
        {
            Config = fileSystem.LoadFromFile <SolutionConfig>(filePath);
            var solution = new Solution {
                Mode = SolutionMode.Classic
            };

            solution.Name             = Config.Name;
            solution.SourceFolder     = Config.SourceFolder;
            solution.FastBuildCommand = Config.FastBuildCommand;
            solution.BuildCommand     = Config.BuildCommand;
            solution.NugetSpecFolder  = Config.NugetSpecFolder;

            return(solution);
        }
        public void SetUp()
        {
            theFeed   = new Feed();
            theConfig = new SolutionConfig
            {
                Feeds = new[] { theFeed }
            };

            const string rippleConfig = "ripple.config";
            var          fileSystem   = MockRepository.GenerateStub <IFileSystem>();

            fileSystem.Stub(x => x.LoadFromFile <SolutionConfig>(rippleConfig)).Return(theConfig);

            theLoader   = new NuGetSolutionLoader();
            theSolution = theLoader.LoadFrom(fileSystem, rippleConfig);
        }
Example #29
0
 protected CsprojFileChanger(
     string solutionPath,
     string solutionName,
     string dllName,
     string sourceDllVersion,
     string newFilePath
     )
 {
     SolutionConfig = new SolutionConfig()
     {
         AbsolutePath        = solutionPath,
         Name                = solutionName,
         DllName             = dllName,
         SourceDllVersion    = sourceDllVersion,
         NewFileAbsolutePath = newFilePath
     };
     CheckFile();
 }
        public void SetUp()
        {
            theConfig = new SolutionConfig();

            theSolution = new Solution();
            p1          = theSolution.AddProject("Project1");
            p2          = theSolution.AddProject("Project2");

            p1.AddDependency(new Dependency("Bottles"));
            p1.AddDependency(new Dependency("FubuCore", "1.1.2.3", UpdateMode.Fixed));

            p2.AddDependency(new Dependency("FubuCore", "1.1.2.3", UpdateMode.Fixed));
            p2.AddDependency(new Dependency("FubuLocalization"));
            p2.AddDependency(new Dependency("StructureMap", "2.6.3", UpdateMode.Fixed));

            theLoader = new NuGetSolutionLoader();
            theLoader.ExtractSolutionLevelConfiguration(theConfig, theSolution);
        }
Example #31
0
        private void Load()
        {
            string solutionDirectory = Path.GetDirectoryName(ProjectPath);
            using (StreamReader reader = new StreamReader(ProjectPath))
            {
                string line = reader.ReadLine();
                while (line != null)
                {
                    if (line.StartsWith("Project("))
                    {
                        string[] parts = line.Split(DELIMS);
                        string vsProjectPath = parts[2].Trim(TRIM_CHARS);
                        string vsProjectGuid = parts[3].Trim(TRIM_CHARS);

                        if (VSProject.IsProjectFile(vsProjectPath))
                            _projectLookup[vsProjectGuid] = new VSProject(Path.Combine(solutionDirectory, vsProjectPath));
                    }
                    else if (line.IndexOf(BUILD_MARKER) >= 0)
                    {
                        line = line.Trim();
                        int endBrace = line.IndexOf('}');

                        string vsProjectGuid = line.Substring(0, endBrace + 1);
                        VSProject vsProject;
                        if (_projectLookup.TryGetValue(vsProjectGuid, out vsProject))
                        {
                            line = line.Substring(endBrace + 2);

                            int split = line.IndexOf(BUILD_MARKER) + 1;
                            string solutionConfig = line.Substring(0, split - 1);
                            int bar = solutionConfig.IndexOf('|');
                            if (bar >= 0)
                                solutionConfig = solutionConfig.Substring(0, bar);

                            string projectConfig = line.Substring(split + BUILD_MARKER.Length);
                            if (!vsProject.ConfigNames.Contains(projectConfig))
                            {
                                bar = projectConfig.IndexOf('|');
                                if (bar >= 0)
                                    projectConfig = projectConfig.Substring(0, bar);
                            }

                            SolutionConfig config = null;

                            if (_configs.ContainsKey(solutionConfig))
                                config = _configs[solutionConfig];
                            else
                            {
                                config = new SolutionConfig(solutionConfig);
                                _configs.Add(solutionConfig, config);
                            }

                            foreach (var subPackage in vsProject.GetTestPackage(projectConfig).SubPackages)
                                if (!config.Assemblies.Contains(subPackage.FullName))
                                    config.Assemblies.Add(subPackage.FullName);

                            //if (VSProject.IsProjectFile(vsProjectPath))
                            //    project.Add(new VSProject(Path.Combine(solutionDirectory, vsProjectPath)));
                        }
                    }

                    line = reader.ReadLine();
                }
            }
        }