本文整理汇总了C#中Solution.GetAllSolutionItems方法的典型用法代码示例。如果您正苦于以下问题:C# Solution.GetAllSolutionItems方法的具体用法?C# Solution.GetAllSolutionItems怎么用?C# Solution.GetAllSolutionItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Solution
的用法示例。
在下文中一共展示了Solution.GetAllSolutionItems方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartupOptionsPanelWidget
public StartupOptionsPanelWidget (Solution sol)
{
this.Build();
this.sol = sol;
startupItems = new List<SolutionEntityItem> ();
foreach (SolutionEntityItem it in sol.GetAllSolutionItems<SolutionEntityItem> ()) {
// Include in the list if it can run in any of the existing execution modes and configurations
foreach (IExecutionModeSet mset in Runtime.ProcessService.GetExecutionModes ()) {
bool matched = false;
foreach (IExecutionMode mode in mset.ExecutionModes) {
foreach (SolutionConfiguration sc in sol.Configurations) {
if (it.CanExecute (new ExecutionContext (mode, null), sc.Selector)) {
startupItems.Add (it);
matched = true;
break;
}
}
if (matched)
break;
}
if (matched)
break;
}
}
listStore = new ListStore (typeof(SolutionItem), typeof(bool), typeof(string));
treeItems.Model = listStore;
CellRendererToggle crt = new CellRendererToggle ();
treeItems.AppendColumn ("", crt, "active", 1);
treeItems.AppendColumn (GettextCatalog.GetString ("Project"), new CellRendererText (), "text", 2);
if (startupItems.Count > 0) {
for (int n=0; n<startupItems.Count; n++) {
SolutionEntityItem it = startupItems [n];
comboItems.AppendText (it.Name);
listStore.AppendValues (it, sol.MultiStartupItems.Contains (it), it.Name);
if (sol.StartupItem == it)
comboItems.Active = n;
}
}
else {
comboItems.AppendText (GettextCatalog.GetString ("The solution does not contain any executable project"));
comboItems.Active = 0;
comboItems.Sensitive = false;
radioMulti.Sensitive = false;
radioSingle.Sensitive = false;
}
radioSingle.Active = sol.SingleStartup;
radioMulti.Active = !sol.SingleStartup;
UpdateButtons ();
crt.Toggled += OnItemToggled;
treeItems.Selection.Changed += OnSelectionChanged;
}
示例2: WriteFileInternal
void WriteFileInternal (string file, string sourceFile, Solution solution, bool saveProjects, ProgressMonitor monitor)
{
if (saveProjects) {
var items = solution.GetAllSolutionItems ().ToArray ();
monitor.BeginTask (items.Length + 1);
foreach (var item in items) {
try {
monitor.BeginStep ();
item.SavingSolution = true;
item.SaveAsync (monitor).Wait ();
} finally {
item.SavingSolution = false;
}
}
} else {
monitor.BeginTask (1);
monitor.BeginStep ();
}
SlnFile sln = new SlnFile ();
sln.FileName = file;
if (File.Exists (sourceFile)) {
try {
sln.Read (sourceFile);
} catch (Exception ex) {
LoggingService.LogError ("Existing solution can't be updated since it can't be read", ex);
}
}
sln.FormatVersion = format.SlnVersion;
// Don't modify the product description if it already has a value
if (string.IsNullOrEmpty (sln.ProductDescription))
sln.ProductDescription = format.ProductDescription;
solution.WriteSolution (monitor, sln);
sln.Write (file);
monitor.EndTask ();
}
示例3: WriteProjectConfigurations
void WriteProjectConfigurations (Solution sol, SlnFile sln)
{
var col = sln.ProjectConfigurationsSection;
foreach (var item in sol.GetAllSolutionItems ()) {
// Don't save configurations for shared projects
if (!item.SupportsConfigurations ())
continue;
// <ProjectGuid>...</ProjectGuid> in some Visual Studio generated F# project files
// are missing "{"..."}" in their guid. This is not generally a problem since it
// is a valid GUID format. However the solution file format requires that these are present.
string itemGuid = item.ItemId;
if (!itemGuid.StartsWith ("{") && !itemGuid.EndsWith ("}"))
itemGuid = "{" + itemGuid + "}";
var pset = col.GetOrCreatePropertySet (itemGuid, ignoreCase:true);
var existingKeys = new HashSet<string> (pset.Keys);
foreach (SolutionConfiguration cc in sol.Configurations) {
var cce = cc.GetEntryForItem (item);
if (cce == null)
continue;
var configId = ToSlnConfigurationId (cc);
var itemConfigId = ToSlnConfigurationId (cce.ItemConfiguration);
string key;
pset.SetValue (key = configId + ".ActiveCfg", itemConfigId);
existingKeys.Remove (key);
if (cce.Build) {
pset.SetValue (key = configId + ".Build.0", itemConfigId);
existingKeys.Remove (key);
}
if (cce.Deploy) {
pset.SetValue (key = configId + ".Deploy.0", itemConfigId);
existingKeys.Remove (key);
}
}
foreach (var k in existingKeys)
pset.Remove (k);
}
}
示例4: WriteProjectConfigurations
void WriteProjectConfigurations (Solution sol, List<string> list)
{
foreach (SolutionConfiguration cc in sol.Configurations) {
foreach (SolutionConfigurationEntry cce in cc.Configurations) {
SolutionEntityItem p = cce.Item;
// Ignore unknown projects. We deal with them below
if (p is UnknownSolutionItem)
continue;
list.Add (String.Format (
"\t\t{0}.{1}.ActiveCfg = {2}", p.ItemId, ToSlnConfigurationId (cc), ToSlnConfigurationId (cce.ItemConfiguration)));
if (cce.Build)
list.Add (String.Format (
"\t\t{0}.{1}.Build.0 = {2}", p.ItemId, ToSlnConfigurationId (cc), ToSlnConfigurationId (cce.ItemConfiguration)));
}
}
// Dump config lines for unknown projects
foreach (UnknownSolutionItem item in sol.GetAllSolutionItems<UnknownSolutionItem> ()) {
ItemSlnData data = ItemSlnData.ForItem (item);
list.AddRange (data.ConfigLines);
}
}
示例5: WriteProjectConfigurations
void WriteProjectConfigurations (Solution sol, List<string> list)
{
foreach (SolutionConfiguration cc in sol.Configurations) {
foreach (SolutionConfigurationEntry cce in cc.Configurations) {
SolutionEntityItem p = cce.Item;
// Ignore unknown projects. We deal with them below
if (p is UnknownSolutionItem)
continue;
// <ProjectGuid>...</ProjectGuid> in some Visual Studio generated F# project files
// are missing "{"..."}" in their guid. This is not generally a problem since it
// is a valid GUID format. However the solution file format requires that these are present.
string itemGuid = p.ItemId;
if (!itemGuid.StartsWith("{") && !itemGuid.EndsWith("}"))
itemGuid = "{" + itemGuid + "}";
list.Add (String.Format (
"\t\t{0}.{1}.ActiveCfg = {2}", itemGuid, ToSlnConfigurationId (cc), ToSlnConfigurationId (cce.ItemConfiguration)));
if (cce.Build)
list.Add (String.Format (
"\t\t{0}.{1}.Build.0 = {2}", itemGuid, ToSlnConfigurationId (cc), ToSlnConfigurationId (cce.ItemConfiguration)));
}
}
// Dump config lines for unknown projects
foreach (UnknownSolutionItem item in sol.GetAllSolutionItems<UnknownSolutionItem> ()) {
ItemSlnData data = ItemSlnData.ForItem (item);
list.AddRange (data.ConfigLines);
}
}
示例6: AnalyzeCombine
/// <summary>
/// Enumerates each entry in a combine and runs analysis for it.
/// </summary>
static void AnalyzeCombine (Solution combine, double work)
{
List<SolutionItem> entriesToAnalyze = new List<SolutionItem> ();
ReadOnlyCollection<SolutionItem> children = combine.GetAllSolutionItems ();
foreach (object child in children)
if (child != combine && CanAnalyze (child))
entriesToAnalyze.Add (child as SolutionItem);
double entryWork = work / entriesToAnalyze.Count;
foreach (SolutionItem childEntry in entriesToAnalyze) {
AnalyzeCombineEntry (childEntry, entryWork);
}
}
示例7: ConfigurationEquals
bool ConfigurationEquals(Solution sol, SolutionConfiguration s1, SolutionConfiguration s2)
{
foreach (var p in sol.GetAllSolutionItems<SolutionEntityItem> ()) {
var c1 = s1.GetEntryForItem (p);
var c2 = s2.GetEntryForItem (p);
if (c1 == null && c2 == null)
continue;
if (c1 == null || c2 == null)
return false;
if (c1.Build != c2.Build || c1.ItemConfiguration != c2.ItemConfiguration)
return false;
}
return true;
}
示例8: CreateStartupModes
void CreateStartupModes (Solution sol)
{
// Initialize the startup modes
ReadOnlyCollection<SolutionFolder> folders = sol.GetAllSolutionItems<SolutionFolder> ();
foreach (SolutionFolder folder in folders) {
CombineStartupMode startupMode = new CombineStartupMode ();
startupMode.SingleStartup = true;
startupMode.StartEntryName = null;
foreach (SolutionItem it in folder.Items)
startupMode.AddEntry (it.Name);
folder.ExtendedProperties ["StartMode"] = startupMode;
}
// Get the list of startup items
IEnumerable<SolutionEntityItem> items;
if (sol.SingleStartup)
items = new SolutionEntityItem [] { sol.StartupItem };
else
items = sol.MultiStartupItems;
// Setup the startup modes
foreach (SolutionEntityItem it in items) {
if (it == null)
continue;
SolutionFolder folder = it.ParentFolder;
SolutionItem prevItem = it;
while (folder != null) {
CombineStartupMode startupMode = (CombineStartupMode) folder.ExtendedProperties ["StartMode"];
if (startupMode.SingleStartup) {
// If a start entry is already set, convert to multi startup mode
if (startupMode.StartEntryName == null)
startupMode.StartEntryName = prevItem.Name;
else if (startupMode.StartEntryName != prevItem.Name) {
startupMode.SingleStartup = false;
startupMode.MakeExecutable (startupMode.StartEntryName);
startupMode.MakeExecutable (prevItem.Name);
}
} else {
// Already multi startup, just add the new item
startupMode.MakeExecutable (prevItem.Name);
}
prevItem = folder;
folder = folder.ParentFolder;
}
}
// Set the startup item for folders which don't have one
foreach (SolutionFolder folder in folders) {
CombineStartupMode startupMode = (CombineStartupMode) folder.ExtendedProperties ["StartMode"];
if (startupMode.SingleStartup && startupMode.StartEntryName == null) {
if (folder.Items.Count > 0)
startupMode.StartEntryName = folder.Items [0].Name;
}
}
}
示例9: CreateSolutionConfigurations
void CreateSolutionConfigurations (Solution sol)
{
CombineConfigurationSet configs = (CombineConfigurationSet) sol.ExtendedProperties ["Configurations"];
foreach (CombineConfiguration config in configs.Configurations) {
SolutionConfiguration sconf = config.SolutionConfiguration ?? new SolutionConfiguration (config.Name);
sol.Configurations.Add (sconf);
}
foreach (SolutionEntityItem item in sol.GetAllSolutionItems<SolutionEntityItem> ()) {
List<IExtendedDataItem> chain = new List<IExtendedDataItem> ();
SolutionItem it = item;
while (it != null) {
chain.Insert (0, it);
it = it.ParentFolder;
}
chain [0] = sol;
foreach (SolutionConfiguration sconfig in sol.Configurations) {
SolutionConfigurationEntry se = sconfig.AddItem (item);
string itemConfig = FindItemConfiguration (chain, sconfig.Id);
if (itemConfig != null) {
se.Build = true;
se.ItemConfiguration = itemConfig;
}
else
se.Build = false;
}
}
sol.DefaultConfigurationId = configs.Active;
}