public IActionResult References() { var bob = new ReferenceModel(); var commentList = bob.Builder(); return(View(commentList)); }
/// <summary> /// Carga los datos de la referencia /// </summary> public ReferenceModel Load(Model.Solutions.FileModel file) { ReferenceModel reference = new ReferenceModel(file); // Carga el archivo si existe if (System.IO.File.Exists(file.DocumentFileName)) { MLFile fileML = new XMLParser().Load(file.DocumentFileName); if (fileML != null) { foreach (MLNode nodeML in fileML.Nodes) { if (nodeML.Name == TagRoot) { foreach (MLNode childML in nodeML.Nodes) { reference.ProjectName = nodeML.Nodes[TagPathProject].Value; reference.FileNameReference = nodeML.Nodes[TagFileName].Value; } } } } } // Devuelve la referencia return(reference); }
public static string ToDisplayString(this ReferenceModel reference, Func <AssemblyModel, string> nameProvider) { if (!reference.LoadedAssembly.IsResolved && !string.IsNullOrEmpty(reference.AssemblyVersion)) { return($"{nameProvider(reference.LoadedAssembly)} (v{reference.AssemblyVersion})"); } if (!reference.LoadedAssembly.IsResolved) { return(nameProvider(reference.LoadedAssembly)); } if (reference.AssemblyVersion != reference.LoadedAssembly.Version) { return($"{nameProvider(reference.LoadedAssembly)} (v{ reference.AssemblyVersion } ➜ v{ reference.LoadedAssembly.Version})"); } if (reference.LoadedAssembly.IsNative) { var version = string.IsNullOrEmpty(reference.LoadedAssembly.Version) ? "No version" : $"loaded v{ reference.LoadedAssembly.Version }"; return($"{nameProvider(reference.LoadedAssembly)} ({ version })"); } return(nameProvider(reference.LoadedAssembly)); }
public static TreeViewItem ToTreeViewItem(this ReferenceModel reference, bool showConflictingOnly = false) { if (showConflictingOnly && !reference.IsConflicting) { return(null); } var node = new TreeViewItem { Header = String.Format("{0}: {1}", reference.ItemType, reference.ItemLocation), Foreground = new SolidColorBrush(reference.Color), }; if (!reference.Exists) { node.Header = String.Format("{0} (Missing)", node.Header); } if (reference.SimilarRefences != null && reference.SimilarRefences.Any()) { var parents = reference.SimilarRefences.Select(r => r.Parent).Distinct().ToCsv(i => i.Name, ", "); node.Header = String.Format("{0} (Conflicting with: {1})", node.Header, parents); } return(node); }
public int SaveRoleMenus(int roleid_g, ReferenceModel<BW_RoleMenu> data) { BaseSearchModel sm = new BaseSearchModel("BW_RoleMenu"); sm["roleid"] = roleid_g; var olds = sm.Load<BW_RoleMenu>(); foreach (BW_RoleMenu old in olds.Data) { var target = data.Contexts.Where(e => e.MenuID == old.MenuID); if (target.Count() > 0) { data.Contexts.Remove(target.ElementAt(0)); } else { old["IsDelete"] = 1; data.Contexts.Add(old); } } try { data.Save(); } catch { return 0; } return 1; }
public ReferenceItemViewModel(ReferenceWindowViewModel parent, ReferenceModel model, bool isInProject) { Parent = parent; Reference = model; StartedInProject = isInProject; IsInProject = isInProject; }
public ReferenceModel Convert(EntityReference entityReference) { ReferenceModel tmp = new ReferenceModel(); if (EntityExist(entityReference.TargetId, entityReference.TargetEntityId) && EntityExist(entityReference.SourceId, entityReference.SourceEntityId)) { tmp.Target = new ReferenceElementModel( entityReference.TargetId, entityReference.TargetVersion, entityReference.TargetEntityId, GetEntityTitle(entityReference.TargetId, entityReference.TargetEntityId, entityReference.TargetVersion), GetEntityTypeName(entityReference.TargetEntityId), entityReference.TargetVersion == CountVersions(entityReference.TargetId, entityReference.TargetEntityId) ? true : false ); tmp.Source = new ReferenceElementModel( entityReference.SourceId, entityReference.SourceVersion, entityReference.SourceEntityId, GetEntityTitle(entityReference.SourceId, entityReference.SourceEntityId, entityReference.SourceVersion), GetEntityTypeName(entityReference.SourceEntityId), entityReference.SourceVersion == CountVersions(entityReference.SourceId, entityReference.SourceEntityId) ? true : false ); tmp.Context = entityReference.Context; tmp.ReferenceType = entityReference.ReferenceType; tmp.RefId = entityReference.Id; return(tmp); } return(null); }
public Task <int> InsertReference(ReferenceModel reference) { string sql = @$ "INSERT INTO reference (title, link, description, category) SELECT @Title, @Link, @Description, @Category ;"; return(_db.SaveData(sql, reference)); }
public static List <ReferenceModel> GetReferences(string xmlFilePath, bool externalOnly = false, Func <string> match = null) { var referenceList = new List <ReferenceModel>(); var doc = XDocument.Load(xmlFilePath); doc.IterateThroughAllNodes((n, depth) => { if (n is XElement element) { if (element.Name.LocalName == "Reference") { string refName = element.Attributes()?.Where(a => a.Name.LocalName == "Include").FirstOrDefault()?.Value; string hintPath = element.Elements().Where(e => e.Name.LocalName == "HintPath").FirstOrDefault()?.Value ?? string.Empty; if (!string.IsNullOrEmpty(refName)) { if (!string.IsNullOrEmpty(hintPath) || !externalOnly) { var refItem = new ReferenceModel(refName, n.Parent, hintPath); if (hintPath.Contains($"$(BeatSaberDir")) { refItem.RelativeDirectory = hintPath.Replace("$(BeatSaberDir)", string.Empty) .Replace(refItem.Name + ".dll", string.Empty) .Trim(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); } referenceList.Add(refItem); } } } } }); return(referenceList); }
public static List <ReferenceModel> GetAvailableReferences(string beatSaberDir) { List <ReferenceModel> retList = new List <ReferenceModel>(); if (string.IsNullOrEmpty(beatSaberDir) || !Directory.Exists(beatSaberDir)) { return(retList); } string[] libraryPaths = new string[] { Path_Managed, Path_Libs, Path_Plugins }; foreach (string path in libraryPaths) { try { DirectoryInfo fullPath = new DirectoryInfo(Path.Combine(beatSaberDir, path)); if (fullPath.Exists) { foreach (FileInfo item in fullPath.GetFiles("*.dll").ToArray()) { ReferenceModel refItem = null; refItem = CreateReferenceFromFile(item.FullName); retList.Add(refItem); if (refItem != null) { refItem.RelativeDirectory = path; } } } } catch { } } return(retList); }
private void ResolveProjectReferences(VSLangProj.VSProject project, Dictionary <string, ReferenceModel> availableReplaceReferences, Dictionary <string, ReferenceModel> referencesThanMustBeAdded) { this.Worker.ReportProgress(50, GetAction(() => { this.Info.DoOnProjectModifyingStart(project); })); VSLangProj.References existingRefs = project.References; List <VSLangProj.Reference> refsToRemove; Dictionary <string, ReferenceModel> refsToAdd; this.GetReferencesToAddAndRemove(existingRefs, availableReplaceReferences, referencesThanMustBeAdded, out refsToRemove, out refsToAdd); for (int i = 0; i < refsToRemove.Count; i++) { VSLangProj.Reference refToRemove = refsToRemove[i]; ReferenceModel refModelToRemove = new ReferenceModel(refToRemove.Name, refToRemove.Path); refToRemove.Remove(); this.Worker.ReportProgress(50, GetAction(() => { this.Info.DoOnReferenceRemoved(refModelToRemove); })); } foreach (KeyValuePair <string, ReferenceModel> refToAdd in refsToAdd) { existingRefs.Add(refToAdd.Value.Path); this.Worker.ReportProgress(50, GetAction(() => { this.Info.DoOnReferenceAdded(refToAdd.Value); })); } this.Worker.ReportProgress(50, GetAction(() => { this.Info.DoOnProjectModifyingEnd(project); })); }
public void DoOnReferenceAdded(ReferenceModel reference) { if (this.OnReferenceAdded != null) { this.OnReferenceAdded(reference); } }
public static dynamic GetTSObject(ReferenceModel dynObject) { if (dynObject is null) { return(null); } return(dynObject.teklaObject); }
public void ReferenceModel_DefaultConstructor_InitializesProperties() { var model = new ReferenceModel(); Assert.AreEqual(0, model.ReferenceFrom.Count()); Assert.AreEqual(0, model.ReferenceTo.Count()); Assert.AreEqual(0, model.References.Count()); }
protected override void Dispose(bool disposing) { if (disposing) { References = null; SelectedReference = default(ReferenceModel); } base.Dispose(disposing); }
// For designer internal ReferenceItemViewModel() { Reference = new ReferenceModel("TestName") { HintPath = @"$(BeatSaberDir)\Plugins\Test.dll", RelativeDirectory = "Plugins", Version = "1.0.1.0" }; }
public MathModel(IList <Constraint> synthesizedModel, IBenchmark benchmark) { SynthesizedModel = synthesizedModel; ReferenceModel = benchmark.Constraints; Domains = benchmark.Domains; SynthesizedModelInLpFormat = SynthesizedModel.ToLpFormat(benchmark.Domains); ReferenceModelInLpFormat = ReferenceModel.ToLpFormat(benchmark.Domains); }
public void TryAddReferenceReferenceModel_ReturnedReferenceIsLastPriority() { var input = new ReferenceModel(DummyReferenceInfo, 0); var reconciler = AddRemoveReferencesSetup.ArrangeReferenceReconciler(); var references = AddRemoveReferencesSetup.GetReferencesMock(out var project, out _).Object; var priority = reconciler.TryAddReference(project.Object, input).Priority; Assert.IsTrue(priority > 0); }
/// <summary> /// Graba los datos de una referencia /// </summary> public void Save(ReferenceModel reference) { MLFile fileML = new MLFile(); MLNode nodeML = fileML.Nodes.Add(TagRoot); // Añade el nombre de archivo nodeML.Nodes.Add(TagPathProject, reference.ProjectName); nodeML.Nodes.Add(TagFileName, reference.FileNameReference); // Graba el archivo new XMLWriter().Save(reference.File.FullFileName, fileML); }
public void TryAddReferenceReferenceModel_ReturnedReferenceIsRecent() { var input = new ReferenceModel(DummyReferenceInfo, 0); var reconciler = AddRemoveReferencesSetup.ArrangeReferenceReconciler(); AddRemoveReferencesSetup.GetReferencesMock(out var project, out _); var model = reconciler.TryAddReference(project.Object, input); Assert.IsTrue(model.IsRecent); }
public IActionResult References(string message, string name, string email, string website) { using (var writer = new StreamWriter(System.IO.File.Open($"comments.csv", FileMode.Append))) { writer.WriteLine($"'{message}',{name},{email},{website},{DateTime.Now},"); } var bob = new ReferenceModel(); var commentList = bob.Builder(); return(View(commentList)); }
public void TryAddReferenceReferenceModel_ReturnsNullOnThrow() { var input = new ReferenceModel(DummyReferenceInfo, 0); var reconciler = AddRemoveReferencesSetup.ArrangeReferenceReconciler(); var references = AddRemoveReferencesSetup.GetReferencesMock(out var project, out _); references.Setup(m => m.AddFromFile(input.FullPath)).Throws(new COMException()); var model = reconciler.TryAddReference(project.Object, input); Assert.IsNull(model); }
public HeapOperation( SpecialOperationKind kind, ReferenceModel reference, ImmutableArray <FieldDefinition> fields) : base(kind) { Contract.Requires(IsKindSupported(kind)); Contract.Requires <ArgumentNullException>(reference != null, nameof(reference)); Contract.Requires <ArgumentNullException>(fields != null, nameof(fields)); this.Reference = reference; this.Fields = fields; }
public static ReferenceModel CreateReferenceFromFile(string fileName) { //var assembly = System.Reflection.Assembly.ReflectionOnlyLoadFrom(fileName); //var assemblyName = assembly.GetName(); string version = FileVersionInfo.GetVersionInfo(fileName).FileVersion; ReferenceModel refItem = new ReferenceModel(Path.GetFileNameWithoutExtension(fileName)) { Version = version, HintPath = fileName }; return(refItem); }
public static void AppendReferencedAssemblyNames(this ReferenceModel reference, HashSet <string> includedReferences) { if (includedReferences.Contains(reference.AssemblyFullName)) { return; } includedReferences.Add(reference.AssemblyFullName); foreach (var item in reference.LoadedAssembly.References) { item.AppendReferencedAssemblyNames(includedReferences); } }
public async Task <ActionResult> Post(ReferenceModel reference) { var rowsChanged = await _db.InsertReference(reference); if (rowsChanged == 0) { return(Conflict("Cannot create the Reference at this time.")); } else { var resourceUrl = Path.Combine(Request.Path.ToString(), Uri.EscapeUriString(reference.Id.ToString())); return(Created(resourceUrl, reference)); } }
public void TryAddReferenceReferenceModel_DisplaysMessageOnThrow() { var input = new ReferenceModel(DummyReferenceInfo, 0); const string exception = "Don't mock me."; var reconciler = AddRemoveReferencesSetup.ArrangeReferenceReconciler(null, out var messageBox, out _); var references = AddRemoveReferencesSetup.GetReferencesMock(out var project, out _); references.Setup(m => m.AddFromFile(input.FullPath)).Throws(new COMException(exception)); reconciler.TryAddReference(project.Object, input); messageBox.Verify(m => m.NotifyWarn(exception, RubberduckUI.References_AddFailedCaption)); }
/// <summary> /// Obtiene el nombre del archivo origen /// </summary> public string GetFileName(SolutionModel solution, ReferenceModel reference) { ProjectModel projectSource = solution.SearchProjectByName(reference.ProjectName); // Si se ha encontrado el proyecto, transforma la referencia if (projectSource != null) { return(Path.Combine(projectSource.File.Path, reference.FileNameReference)); } else { return(reference.FileNameReference); } }
public async Task ViewParentReferenceAsync(AssemblyModel?baseAssembly, ReferenceModel reference) { if (baseAssembly is null) { return; } await busyService.RunActionAsync(async() => { var vm = new AssemblyParentsViewModel(reference.LoadedAssembly, baseAssembly); _ = await DialogHost.Show(vm, mainViewIdentifier.Id).ConfigureAwait(false); }).ConfigureAwait(false); }
/// <summary> /// Creates an instance of <see cref="Model"/> with huge content. /// This is used to test the serializer performance. /// </summary> /// <param name="dimension">The dimension of the desired class. This actually controls the number of elements in the lists of the <see cref="Model"/></param> /// <returns>An instance of <see cref="Model"/> that contains many <see cref="SingleKeyRelationship"/> and <see cref="ReferenceModel"/>.</returns> private Model CreateHugeModel(int dimension) { var ret = new Model(); ret.Description = "The description of the Entity"; ret.LastChildFileModifiedTime = DateTimeOffset.Now; ret.LastFileStatusCheckTime = DateTimeOffset.Now; ret.Name = "The name of the entity"; ret.ReferenceModels = new List <ReferenceModel>(); for (int i = 0; i < dimension; i++) { var referenceModel = new ReferenceModel() { Id = "ReferenceModel Id no " + i, Location = "Location no" + i }; ret.ReferenceModels.Add(referenceModel); } ret.Relationships = new List <SingleKeyRelationship>(); for (int i = 0; i < dimension; i++) { var extensionFields = new JObject(); for (int j = 1; j < 3; j++) { extensionFields.TryAdd("extension " + j, "value of extension " + j + " for relationship " + i); } var relationship = new SingleKeyRelationship() { FromAttribute = new AttributeReference() { EntityName = "FromAttribute.EntityName no " + i, AttributeName = "FromAttribute.AttributeName no" + i }, ToAttribute = new AttributeReference() { EntityName = "ToAttribute.EntityName no" + i, AttributeName = "ToAttribute.AttributeName" + i }, Type = "Type of Realtionship no " + i, Name = "Name of Realtionship no " + i, Description = "Description of Relatioship no " + i, ExtensionFields = extensionFields }; ret.Relationships.Add(relationship); } return(ret); }
public List <ReferenceModel> GetReferences(string csprojPath) { var results = new List <ReferenceModel>(); if (!csprojPath.ToLower().EndsWith("csproj") || !File.Exists(csprojPath)) { return(results); } // Step through each item group. foreach (XmlNode item in GetNodes(csprojPath)) { if (item.Name != CSPROJ_REFERENCE) { continue; } var refObj = new ReferenceModel { Include = item.Attributes[CSPROJ_INCLUDE]?.Value }; if (item.HasChildNodes) { foreach (XmlNode property in item.ChildNodes) { if (property.Name == "SpecificVersion") { refObj.SpecificVersion = property.InnerText; } else if (property.Name == "HintPath") { refObj.HintPath = property.InnerText; } else if (property.Name == "Private") { refObj.Private = Convert.ToBoolean(property.InnerText); } } } results.Add(refObj); } return(results); }