コード例 #1
0
    //找一个文本类型的
    public static TextAsset LoadTextAsset(string str)
    {
        ReferenceNode node = GetResNodeByIden(str, ExtScript);

        if (node == null)
        {
            return(Resources.Load <TextAsset>(str));
        }
        AssetBundle ab = LoadResNode(node);

        if (ab != null)
        {
            string    shortName = GetShortName(str);
            TextAsset ResObject = (TextAsset)ab.LoadAsset(shortName);
            return(ResObject);
        }
        else
        {
            string shortName = GetShortName(str);
            return(Resources.Load <TextAsset>(shortName));
        }
    }
コード例 #2
0
 //单个节点
 static AssetBundle LoadResNodeInternal(ReferenceNode node)
 {
     if (node == null)
     {
         return(null);
     }
     if (Bundle.ContainsKey(node.strResources))
     {
         return(Bundle[node.strResources]);
     }
     if (File.Exists(ResMng.GetResPath() + "/" + node.strResources))
     {
         FileStream fs     = new FileStream(ResMng.GetResPath() + "/" + node.strResources, FileMode.Open, FileAccess.Read);
         byte[]     buffer = new byte[fs.Length];
         fs.Read(buffer, 0, buffer.Length);
         fs.Close();
         AssetBundle ab = AssetBundle.LoadFromMemory(buffer);
         Bundle.Add(node.strResources, ab);
         return(ab);
     }
     return(null);
 }
コード例 #3
0
    //找第一个名字匹配的.不论类型
    public static UnityEngine.Object Load(string str)
    {
        ReferenceNode node = GetResNodeByIden(str);

        if (node == null)
        {
            return(Resources.Load(str));
        }
        AssetBundle ab = LoadResNode(node);

        if (ab != null)
        {
            string             shortName = GetShortName(str);
            UnityEngine.Object ResObject = ab.LoadAsset(shortName);
            return(ResObject);
        }
        else
        {
            string shortName = GetShortName(str);
            return(Resources.Load(shortName));
        }
    }
コード例 #4
0
        private void ResourceListingOnSelectedIndexChanged(object sender, EventArgs eventArgs)
        {
            if (this.objectReferenceListing.SelectedNode == null)
            {
                this.ResourceReference   = null;
                this.GameObjectReference = null;
                this.ComponentReference  = null;

                return;
            }

            ReferenceNode node = this.objectReferenceListing.SelectedNode.Tag as ReferenceNode;

            if (node == null)
            {
                return;
            }

            this.ResourceReference   = node.ResourceReference;
            this.GameObjectReference = node.GameObjectReference;
            this.ComponentReference  = node.ComponentReference;
        }
コード例 #5
0
        public IEnumerable <ReferenceNode <TItem, TKey> > LastNLowestRefs(ReferenceNode <TItem, TKey> node)
        {
            if (node.References != null)
            {
                for (int i = 0; i < node.References.Length; i++)
                {
                    if (node.References[i].Values != null)
                    {
                        yield return(node.References[i = node.References.Length - 1]);
                    }

                    foreach (var grandChild in AllFrom(node.References[i]))
                    {
                        yield return(grandChild);
                    }
                }
            }
            else if (node.Values != null)
            {
                yield return(node);
            }
        }
コード例 #6
0
        private void OnTestExpandRow(object sender, Gtk.TestExpandRowArgs args)
        {
            bool          filled = (bool)store.GetValue(args.Iter, FilledCol);
            ReferenceNode parent = (ReferenceNode)store.GetValue(args.Iter, ReferenceCol);

            if (!filled)
            {
                store.SetValue(args.Iter, FilledCol, true);
                TreeIter iter;
                store.IterChildren(out iter, args.Iter);
                store.Remove(ref iter);
                if (parent.References.Count > 0 || parent.FieldReferences.Count > 0)
                {
                    int nr = 0;
                    foreach (ReferenceNode nod in parent.References)
                    {
                        if (!AddNode(args.Iter, nod).Equals(TreeIter.Zero))
                        {
                            nr++;
                        }
                    }
                    foreach (FieldReference fref in parent.FieldReferences)
                    {
                        if (!AddNode(args.Iter, fref).Equals(TreeIter.Zero))
                        {
                            nr++;
                        }
                    }
                    if (nr == 0)
                    {
                        args.RetVal = true;
                    }
                }
                else
                {
                    args.RetVal = true;
                }
            }
        }
コード例 #7
0
 static void ReadReferenceTable()
 {
     if (!File.Exists(GetResPath() + "/" + RefTable))
     {
         //Debug.LogError(string.Format("Can not Load RefTable", GetResPath() + "/" + RefTable));
         return;
     }
     ReferenceNode.Reset();
     try
     {
         //A文件异常(被锁定、其他),B序列化异常(内存不足?).
         FileStream           fs       = File.Open(GetResPath() + "/" + RefTable, FileMode.Open);
         List <ReferenceNode> refTable = ProtoBuf.Serializer.Deserialize <List <ReferenceNode> >(fs);
         for (int i = 0; i < refTable.Count; i++)
         {
             RegisterRes(refTable[i]);
         }
     }
     catch
     {
     }
 }
コード例 #8
0
        public bool IsSubtypeOrEqual(NodeId target, NodeId parent)
        {
            if (target.Equals(parent) || parent.EqualsNumeric(0, 0U))
            {
                return(true);
            }

            if (!this.AddressSpaceTable.TryGetValue(parent, out Node node))
            {
                return(false);
            }

            for (int index = 0; index < node.References.Count; ++index)
            {
                ReferenceNode reference = node.References[index];
                if (!reference.IsInverse && reference.ReferenceType.EqualsNumeric(0, 45U) && this.IsSubtypeOrEqual(target, reference.Target))
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #9
0
        public async Task CheckForCircularReferences(IProgressTask task)
        {
            var projects = await Solutions.Select(sln => sln.Projects.Value)
                           .WhenAll(projs => projs.SelectMany(projs => projs)
                                    .Distinct())
                           .ToDictionaryAsync(proj => proj.PackageId,
                                              proj => proj);

            projects.Values.IncrementForEach(task, 100, project =>
            {
                var rootNode = new ReferenceNode(project, null);
                var open     = new List <ReferenceNode>(project.GetProjectReferences(this).Select(proj => new ReferenceNode(proj, rootNode)).Distinct());
                var closed   = new List <ReferenceNode>(new[] { rootNode });

                while (open.Any())
                {
                    var openProj = open.First();
                    open.Remove(openProj);
                    closed.Add(openProj);

                    foreach (var projRef in openProj.Project.GetProjectReferences(this))
                    {
                        if (projRef == project)
                        {
                            throw new CyclicReferenceException(new ReferenceNode(projRef, openProj).Expand(node => node.Parent)
                                                               .Select(node => node.Project)
                                                               .Reverse()
                                                               .ToList());
                        }

                        if (!closed.Any(node => node.Project == projRef))
                        {
                            open.Add(new ReferenceNode(projRef, openProj));
                        }
                    }
                }
            });
        }
コード例 #10
0
        /// <summary>
        /// Adds a new referece relationship instance.
        /// </summary>
        /// <param name="source">Domain class representing the source.</param>
        /// <param name="target">Domain class representing the target.</param>
        public static void AddNewReferenceRelationship(ReferenceRelationship refRel, DomainClass source, AttributedDomainElement target)
        {
            // tree nodes
            // 1. find the element holder node for source
            // 2. add new ReferenceRSNode, connect to rs
            // 3. add new ReferenceNode for target
            TreeNode elementHolderNode = null;

            foreach (TreeNode node in source.DomainModelTreeNodes)
            {
                if (node.IsElementHolder)
                {
                    elementHolderNode = node;
                    break;
                }
            }

            if (elementHolderNode == null)
            {
                throw new ArgumentNullException("elementHolderNode");
            }

            ReferenceRSNode rsNode = new ReferenceRSNode(source.Store);

            rsNode.ReferenceRelationship = refRel;

            ReferenceNode refNode = new ReferenceNode(source.Store);

            refNode.DomainElement   = target;
            refNode.IsElementHolder = false;
            refNode.IsExpanded      = false;

            elementHolderNode.ReferenceRSNodes.Add(rsNode);
            rsNode.ReferenceNode = refNode;

            source.ModelContext.ViewContext.DomainModelTreeView.ModelTreeNodes.Add(rsNode);
            source.ModelContext.ViewContext.DomainModelTreeView.ModelTreeNodes.Add(refNode);
        }
コード例 #11
0
        /// <summary>
        /// Moves all the references to values one position to the right, starting from a set of coordinates
        /// </summary>
        /// <typeparam name="TItem"></typeparam>
        /// <typeparam name="TKey"></typeparam>
        /// <param name="self"></param>
        /// <param name="coordinateSet"></param>
        /// <returns></returns>
        public static Stack <ReferenceNode <TItem, TKey> > MoveAll2TheRight <TItem, TKey>(this UniqueKeyQuery <TItem, TKey> self, Coordinates[] coordinateSet)
        {
            ReferenceNode <TItem, TKey> previousRef = null;

            return(self.ForEachValuedNodeReverse(coordinateSet,
                                                 (@ref, i) =>
            {
                if (i < 1)
                {
                    previousRef = @ref;
                }
                else
                {
                    if (previousRef != null)
                    {
                        previousRef.Values[0] = @ref.Values[@ref.Values.Length - 1];
                        previousRef = null;
                    }

                    @ref.Values[i] = @ref.Values[i - 1];
                }
            }));
        }
コード例 #12
0
        internal BasicNode Read(ReferenceNode referenceNode)
        {
            if (dataCounter >= data.Length)
            {
                return(RuntimeError(ERuntimeErrors.EndOfData));
            }
            var cons = data[dataCounter++];

            if (referenceNode.IsStringName)
            {
                cons = cons.ToStringConstant();
            }
            else
            {
                cons = cons.ToNumericConstant();
            }
            if (cons == null)
            {
                return(RuntimeError(ERuntimeErrors.ConversionError));
            }

            return(referenceNode.SetValue(this, cons));
        }
コード例 #13
0
        public override bool IsAlreadyAdded(out ReferenceNode existingEquivalentNode)
        {
            string fullPath = Path.GetFullPath(InstalledFilePath).Replace('\\', '/');

            ReferenceContainerNode referencesFolder = this.ProjectManager.FindChild(ReferenceContainerNode.ReferencesNodeVirtualName) as ReferenceContainerNode;

            for (HierarchyNode node = referencesFolder.FirstChild; node != null; node = node.NextSibling)
            {
                JarReferenceNode referenceNode = node as JarReferenceNode;
                if (referenceNode != null)
                {
                    string otherFullPath = Path.GetFullPath(referenceNode.InstalledFilePath).Replace('\\', '/');
                    if (string.Equals(fullPath, otherFullPath, StringComparison.OrdinalIgnoreCase))
                    {
                        existingEquivalentNode = referenceNode;
                        return(true);
                    }
                }
            }

            existingEquivalentNode = null;
            return(false);
        }
コード例 #14
0
 public IEnumerator GetEnumerator()
 {
     List<Reference> references = new List<Reference>();
     IEnumerator baseEnum = container.EnumReferences().GetEnumerator();
     if (null == baseEnum)
     {
         return references.GetEnumerator();
     }
     while (baseEnum.MoveNext())
     {
         ReferenceNode refNode = baseEnum.Current as ReferenceNode;
         if (null == refNode)
         {
             continue;
         }
         Reference reference = refNode.Object as Reference;
         if (null != reference)
         {
             references.Add(reference);
         }
     }
     return references.GetEnumerator();
 }
コード例 #15
0
        private void OnReferenceChanged(object sender, HierarchyNodeEventArgs args)
        {
            // Check if there is any sink for this event.
            if (null == ReferenceChanged)
            {
                return;
            }

            // The sender of this event should be the reference node that was changed
            ReferenceNode refNode = sender as ReferenceNode;
            if (null == refNode)
            {
                return;
            }


            // Check that the removed item implements the Reference interface.
            Reference reference = refNode.Object as Reference;
            if (null != reference)
            {
                ReferenceChanged(reference);
            }
        }
コード例 #16
0
ファイル: NAntTarget.cs プロジェクト: DigDug101/Raspberry-Bot
        private static string BuildReference(SolutionNode solution, ReferenceNode refr)
        {
            string ret = "";

            if (solution.ProjectsTable.ContainsKey(refr.Name))
            {
                ProjectNode project   = (ProjectNode)solution.ProjectsTable[refr.Name];
                string      fileRef   = FindFileReference(refr.Name, project);
                string      finalPath = Helper.NormalizePath(Helper.MakeFilePath("${build.dir}/", refr.Name, GetExtension(refr.Name)), '/');
                ret += finalPath;
                return(ret);
            }
            else
            {
                ProjectNode project = (ProjectNode)refr.Parent;
                string      fileRef = FindFileReference(refr.Name, project);
                string      ext     = GetExtension(refr.Name);

                if (refr.Path != null || fileRef != null)
                {
                    string finalPath = (refr.Path != null) ? Helper.NormalizePath(Helper.MakeFilePath("${build.dir}/", refr.Name, ext), '/') : fileRef;

                    ret += finalPath;
                    return(ret);
                }

                if (refr.Name.EndsWith(".exe") || refr.Name.EndsWith(".dll"))
                {
                    ret += refr.Name;
                }
                else
                {
                    ret += refr.Name + ".dll";
                }
            }
            return(ret);
        }
コード例 #17
0
        private void CompleteWithSymbol([NotNull] string symbol)
        {
            Debug.Assert(!string.IsNullOrEmpty(symbol));
            Debug.Assert(_currentNode != null);

            if (!_currentNode.Continuity.HasFlag(PermittedContinuations.Identifier))
            {
                ExceptionHelper.InvalidExpressionTerm(symbol);
            }

            if (_currentNode is ReferenceNode currentDisembowelerNode)
            {
                Debug.Assert(currentDisembowelerNode.Object != null, "current reference node's object must not be null.");
                Debug.Assert(currentDisembowelerNode.Identifier == null, "current reference node's identifier must be null.");

                currentDisembowelerNode.Identifier = symbol;
            }
            else
            {
                var newNode = new ReferenceNode(_currentNode, symbol);

                if (_currentNode is OperatorNode currentOperatorNode)
                {
                    Debug.Assert(currentOperatorNode.RightNode == null, "current operator node's right node must be null.");

                    currentOperatorNode.RightNode = newNode;
                    _currentNode = newNode;
                }
                else if (_currentNode is RootNode currentRootNode)
                {
                    Debug.Assert(!currentRootNode.Closed, "current root node cannot be closed.");

                    currentRootNode.AddChild(newNode);
                    _currentNode = newNode;
                }
            }
        }
コード例 #18
0
    static void RegisterRes(ReferenceNode node)
    {
        //单一文件名对应各种类型全名,比如
        string fullPath = node.strResources;
        string name     = "";

        string subName  = node.strResources;
        int    extIndex = subName.LastIndexOf('.');

        name = subName;
        if (extIndex != -1)
        {
            name = subName.Substring(0, extIndex);
        }

        if (Res.ContainsKey(name))
        {
            if (!Res[name].Contains(fullPath))
            {
                Res[name].Add(fullPath);
            }
        }
        else
        {
            Res.Add(name, new List <string> {
                node.strResources
            });
        }
        if (!ReferenceNode.referenceDict.ContainsKey(node.strResources))
        {
            ReferenceNode.referenceDict.Add(node.strResources, node);
        }
        else
        {
            Debug.LogError(string.Format("already contains:{0}", node.strResources));
        }
    }
コード例 #19
0
        /// <summary>
        /// Checks whether any references which meet the specified critia exist.
        /// </summary>
        /// <param name="referenceTypeId">The reference type identifier.</param>
        /// <param name="isInverse">if set to <c>true</c> this is inverse reference.</param>
        /// <param name="targetId">The target identifier.</param>
        /// <param name="includeSubtypes">if set to <c>true</c> subtypes are included.</param>
        /// <param name="typeTree">The type tree.</param>
        /// <returns>True if reference exists.</returns>
        public bool Exists(
            NodeId referenceTypeId,
            bool isInverse,
            ExpandedNodeId targetId,
            bool includeSubtypes,
            ITypeTable typeTree)
        {
            ReferenceNode reference = new ReferenceNode(referenceTypeId, isInverse, targetId);

            // check for trivial case.
            if (m_references.ContainsKey(reference))
            {
                return(true);
            }

            // can't search subtypes without a type tree.
            if (!includeSubtypes || typeTree == null)
            {
                return(false);
            }

            // check for subtypes.
            return(m_references.ContainsKey(reference, typeTree));
        }
コード例 #20
0
        public static IField AttachComponents(Slot s, IField <T> target)
        {
            //ValueCopy<T> comp = s.GetComponent<ValueCopy<T>>();
            //if (comp == null) comp = s.AttachComponent<ValueCopy<T>>();
            //comp.WriteBack.Value = true;
            ValueField <T> comp2 = s.GetComponent <ValueField <T> >();

            if (comp2 == null)
            {
                comp2 = s.AttachComponent <ValueField <T> >();
            }
            //comp.Source.Target = comp2.Value;
            //if (target != null)
            //    comp.Target.Target = target;
            //Slot ls = s.FindChild((Slot c) => c.Name == "logix");
            //if (ls == null)
            //{
            Slot ls = s.AddSlot("logix");

            s = ls;
            FireOnChange <T>            fireOnChange   = s.AttachComponent <FireOnChange <T> >();
            HostUser                    hostUser       = s.AttachComponent <HostUser>();
            WriteValueNode <T>          writeValueNode = s.AttachComponent <WriteValueNode <T> >();
            ReferenceNode <IValue <T> > referenceNode  = s.AttachComponent <ReferenceNode <IValue <T> > >();

            referenceNode.RefTarget.Target  = target;
            writeValueNode.Target.Target    = referenceNode;
            writeValueNode.Value.Target     = comp2.Value;
            fireOnChange.OnlyForUser.Target = hostUser;
            fireOnChange.Value.Target       = comp2.Value;
            fireOnChange.Pulse.Target       = writeValueNode.Write;
            //}

            //fieldTracker.driven_field.Target = comp2.Value;
            return(comp2.Value);
        }
コード例 #21
0
 public void RemoveAssembly(ReferenceNode node)
 {
     RemoveAssembly(_assemblyReferences, node, "");
 }
コード例 #22
0
 public void AddAssembly(ReferenceNode node)
 {
     AddAssembly(_assemblyReferences, node, "");
 }
コード例 #23
0
 public AssemblyEntry(ReferenceNode reference)
 {
     this.reference = reference;
 }
コード例 #24
0
 internal void RemoveReference(ReferenceNode referenceNode)
 {
     references.Remove(referenceNode.ID);
     UpdateReferences();
 }
コード例 #25
0
 internal void AddReference(ReferenceNode referenceNode)
 {
     references.Add(referenceNode.ID, new AssemblyEntry(referenceNode));
     UpdateReferences();
 }
コード例 #26
0
ファイル: OAReferenceBase.cs プロジェクト: zyxws012/PTVS
 internal OAReferenceBase(ReferenceNode referenceNode)
 {
     this.referenceNode = referenceNode;
 }
コード例 #27
0
        // =========================================================================================
        // Constructors
        // =========================================================================================

        /// <summary>
        /// Initializes a new instance of the <see cref="WixReferenceNodeProperties"/> class.
        /// </summary>
        /// <param name="node">The node that contains the properties to expose via the Property Browser.</param>
        protected WixReferenceNodeProperties(ReferenceNode node)
            : base(node)
        {
        }
コード例 #28
0
ファイル: EdgeAnalyzer.cs プロジェクト: sys27/Edge
        private void CheckCtor(SyntaxTree tree, Type objType, ObjectNode objNode)
        {
            ConstructorInfo   ctor;
            List <IValueNode> args = null;

            if (objNode.ConstructorArguments != null)
            {
                args = objNode.ConstructorArguments.ToList();
            }

            if (objNode.ConstructorArguments == null || args.Count == 0)
            {
                ctor = objType.GetConstructor(Type.EmptyTypes);
                if (ctor != null)
                {
                    return;
                }
            }
            else
            {
                var types = new Type[args.Count];

                var strType    = typeof(string);
                var doubleType = typeof(double);

                for (int i = 0; i < types.Length; i++)
                {
                    var t = args[0];

                    var refType = t as ReferenceNode;
                    if (refType != null)
                    {
                        types[i] = CheckType(refType.Type);
                    }
                    else if (t is StringNode)
                    {
                        types[i] = strType;
                    }
                    else if (t is NumberNode)
                    {
                        types[i] = doubleType;
                    }
                    else if (t is EnumNode)
                    {
                        types[i] = CheckType(((EnumNode)t).Type);
                    }
                    else
                    {
                        // todo: error message
                        throw new EdgeParserException();
                    }
                }

                ctor = objType.GetConstructor(types);
                if (ctor != null)
                {
                    return;
                }

                // ctor type inference
                // todo: refactor!!!
                var avaliableCtors = objType.GetConstructors()
                                     .Select(t => t.GetParameters())
                                     .Where(t => t.Length == types.Length)
                                     .ToArray();
                var uriType = typeof(Uri);

                for (int i = 0; i < avaliableCtors.Length && ctor == null; i++)
                {
                    var currentCtor = avaliableCtors[i];

                    for (int j = 0; j < currentCtor.Length && ctor == null; j++)
                    {
                        if (currentCtor[j].ParameterType == uriType && types[j] == strType)
                        {
                            types[j] = uriType;

                            // id
                            var    urlStrType = char.ToLowerInvariant(uriType.Name[0]) + uriType.Name.Substring(1);
                            string id         = null;
                            for (int k = 1; k < int.MaxValue; k++)
                            {
                                id = urlStrType + k;
                                if (!tree.Objects.Any(obj => obj.Id == id))
                                {
                                    break;
                                }
                            }
                            if (id == null)
                            {
                                // todo: message
                                throw new EdgeAnalyzerException();
                            }

                            tree.AddObject(new ObjectNode(uriType.Name, id, new[] { args[j] }));
                            args[j] = new ReferenceNode(id, uriType.Name);

                            ctor = objType.GetConstructor(types);
                        }
                    }
                }

                // todo: fix
                if (ctor != null)
                {
                    objNode.ConstructorArguments = args;

                    return;
                }
            }

            // todo: error message
            throw new EdgeAnalyzerException();
        }
コード例 #29
0
        private void WriteSolution(SolutionNode solution)
        {
            kernel.Log.Write("Creating {0} solution and project files", this.VersionName);

            foreach (ProjectNode project in solution.Projects)
            {
                kernel.Log.Write("...Creating project: {0}", project.Name);
                WriteProject(solution, project);
            }

            kernel.Log.Write("");
            string       solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
            StreamWriter ss           = new StreamWriter(solutionFile);

            kernel.CurrentWorkingDirectory.Push();
            Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile));

            using (ss)
            {
                ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion);
                ss.WriteLine("# Visual Studio 2005");
                foreach (ProjectNode project in solution.Projects)
                {
                    if (!tools.ContainsKey(project.Language))
                    {
                        throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
                    }

                    ToolInfo toolInfo = (ToolInfo)tools[project.Language];

                    string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
                    ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"",
                                 toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name,
                                                                                  toolInfo.FileExtension), project.Guid.ToString().ToUpper());

                    //ss.WriteLine("  ProjectSection(ProjectDependencies) = postProject");
                    //ss.WriteLine("  EndProjectSection");

                    ss.WriteLine("EndProject");
                }

                if (solution.Files != null)
                {
                    ss.WriteLine("Project(\"{0}\") = \"Solution Items\", \"Solution Items\", \"{1}\"", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", "{468F1D07-AD17-4CC3-ABD0-2CA268E4E1A6}");
                    ss.WriteLine("\tProjectSection(SolutionItems) = preProject");
                    foreach (string file in solution.Files)
                    {
                        ss.WriteLine("\t\t{0} = {0}", file);
                    }
                    ss.WriteLine("\tEndProjectSection");
                    ss.WriteLine("EndProject");
                }

                ss.WriteLine("Global");

                ss.WriteLine("  GlobalSection(SolutionConfigurationPlatforms) = preSolution");
                foreach (ConfigurationNode conf in solution.Configurations)
                {
                    ss.WriteLine("    {0}|Any CPU = {0}|Any CPU", conf.Name);
                }
                ss.WriteLine("  EndGlobalSection");

                if (solution.Projects.Count > 1)
                {
                    ss.WriteLine("  GlobalSection(ProjectDependencies) = postSolution");
                }
                foreach (ProjectNode project in solution.Projects)
                {
                    for (int i = 0; i < project.References.Count; i++)
                    {
                        ReferenceNode refr = (ReferenceNode)project.References[i];
                        if (solution.ProjectsTable.ContainsKey(refr.Name))
                        {
                            ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name];
                            ss.WriteLine("    ({{{0}}}).{1} = ({{{2}}})",
                                         project.Guid.ToString().ToUpper()
                                         , i,
                                         refProject.Guid.ToString().ToUpper()
                                         );
                        }
                    }
                }
                if (solution.Projects.Count > 1)
                {
                    ss.WriteLine("  EndGlobalSection");
                }
                ss.WriteLine("  GlobalSection(ProjectConfigurationPlatforms) = postSolution");
                foreach (ProjectNode project in solution.Projects)
                {
                    foreach (ConfigurationNode conf in solution.Configurations)
                    {
                        ss.WriteLine("    {{{0}}}.{1}|Any CPU.ActiveCfg = {1}|Any CPU",
                                     project.Guid.ToString().ToUpper(),
                                     conf.Name);

                        ss.WriteLine("    {{{0}}}.{1}|Any CPU.Build.0 = {1}|Any CPU",
                                     project.Guid.ToString().ToUpper(),
                                     conf.Name);
                    }
                }
                ss.WriteLine("  EndGlobalSection");
                ss.WriteLine("  GlobalSection(SolutionProperties) = preSolution");
                ss.WriteLine("    HideSolutionNode = FALSE");
                ss.WriteLine("  EndGlobalSection");

                ss.WriteLine("EndGlobal");
            }

            kernel.CurrentWorkingDirectory.Pop();
        }
コード例 #30
0
 public void AddMacroAssembly(ReferenceNode node)
 {
     AddAssembly(_macroAssemblyReferences, node, "macro ");
 }
コード例 #31
0
ファイル: MasterNodeManager.cs プロジェクト: yuriik83/UA-.NET
        /// <summary>
        /// Adds a reference to the table of external references.
        /// </summary>
        /// <remarks>
        /// This is a convenience function used by custom NodeManagers.
        /// </remarks>
        public static void CreateExternalReference(
            IDictionary<NodeId, IList<IReference>> externalReferences,
            NodeId sourceId,
            NodeId referenceTypeId,
            bool isInverse,
            NodeId targetId)
        {
            ReferenceNode reference = new ReferenceNode();

            reference.ReferenceTypeId = referenceTypeId;
            reference.IsInverse       = isInverse;
            reference.TargetId        = targetId;

            IList<IReference> references = null;

            if (!externalReferences.TryGetValue(sourceId, out references))
            {
                externalReferences[sourceId] = references = new List<IReference>();
            }

            references.Add(reference);
        }
コード例 #32
0
 internal OAReferenceBase(ReferenceNode referenceNode) {
     this.referenceNode = referenceNode;
 }
コード例 #33
0
ファイル: NodeManager.cs プロジェクト: yuriik83/UA-.NET
        /// <summary>
        /// Adds the inverse reference to the table.
        /// </summary>
        private void AddInverseReference(NodeId sourceId, ReferenceNode reference)
        {
            Node target = m_nodes.Find(reference.TargetId);

            if (target != null && target.References != null)
            {
                foreach (ReferenceNode reference2 in target.References)
                {
                    if (reference2.IsInverse == !reference.IsInverse)
                    {
                        if (reference2.ReferenceTypeId == reference.ReferenceTypeId)
                        {
                            if (reference2.TargetId == sourceId)
                            {
                                return;
                            }
                        }
                    }
                }
            }

            if (target.References == null)
            {
                target.References = new ListOfReferenceNode();
            }

            ReferenceNode copy = new ReferenceNode();

            copy.IsInverse = !reference.IsInverse;
            copy.ReferenceTypeId = reference.ReferenceTypeId;
            copy.TargetId = new ExpandedNodeId(sourceId);

            target.References.Add(copy);
        }
コード例 #34
0
 public void RemoveMacroAssembly(ReferenceNode node)
 {
     RemoveAssembly(_macroAssemblyReferences, node, "macro ");
 }
コード例 #35
0
ファイル: OAReferenceItem.cs プロジェクト: whuthj/VisualRust
 internal OAReferenceItem(OAProject project, ReferenceNode node)
     : base(project, node) {
 }
コード例 #36
0
        protected virtual void WriteSolution(SolutionNode solution)
        {
            m_Kernel.Log.Write("Creating Visual Studio {0} solution and project files", m_VersionName);

            foreach (ProjectNode project in solution.Projects)
            {
                m_Kernel.Log.Write("...Creating project: {0}", project.Name);
                WriteProject(solution, project);
            }

            m_Kernel.Log.Write("");
            string       solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
            StreamWriter ss           = new StreamWriter(solutionFile);

            m_Kernel.CWDStack.Push();
            Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile));

            using (ss)
            {
                ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", m_SolutionVersion);
                foreach (ProjectNode project in solution.Projects)
                {
                    if (!m_Tools.ContainsKey(project.Language))
                    {
                        throw new Exception("Unknown .NET language: " + project.Language);
                    }

                    ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language];

                    string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath);
                    ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"",
                                 toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name,
                                                                                  toolInfo.FileExtension), project.Guid.ToString().ToUpper());

                    ss.WriteLine("\tProjectSection(ProjectDependencies) = postProject");
                    ss.WriteLine("\tEndProjectSection");

                    ss.WriteLine("EndProject");
                }

                ss.WriteLine("Global");

                ss.WriteLine("\tGlobalSection(SolutionConfiguration) = preSolution");
                foreach (ConfigurationNode conf in solution.Configurations)
                {
                    ss.WriteLine("\t\t{0} = {0}", conf.Name);
                }
                ss.WriteLine("\tEndGlobalSection");

                ss.WriteLine("\tGlobalSection(ProjectDependencies) = postSolution");
                foreach (ProjectNode project in solution.Projects)
                {
                    for (int i = 0; i < project.References.Count; i++)
                    {
                        ReferenceNode refr = (ReferenceNode)project.References[i];
                        if (solution.ProjectsTable.ContainsKey(refr.Name))
                        {
                            ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name];
                            ss.WriteLine("\t\t({{{0}}}).{1} = ({{{2}}})",
                                         project.Guid.ToString().ToUpper()
                                         , i,
                                         refProject.Guid.ToString().ToUpper()
                                         );
                        }
                    }
                }
                ss.WriteLine("\tEndGlobalSection");

                ss.WriteLine("\tGlobalSection(ProjectConfiguration) = postSolution");
                foreach (ProjectNode project in solution.Projects)
                {
                    foreach (ConfigurationNode conf in solution.Configurations)
                    {
                        ss.WriteLine("\t\t{{{0}}}.{1}.ActiveCfg = {1}|.NET",
                                     project.Guid.ToString().ToUpper(),
                                     conf.Name);

                        ss.WriteLine("\t\t{{{0}}}.{1}.Build.0 = {1}|.NET",
                                     project.Guid.ToString().ToUpper(),
                                     conf.Name);
                    }
                }
                ss.WriteLine("\tEndGlobalSection");

                if (solution.Files != null)
                {
                    ss.WriteLine("\tGlobalSection(SolutionItems) = postSolution");
                    foreach (string file in solution.Files)
                    {
                        ss.WriteLine("\t\t{0} = {0}", file);
                    }
                    ss.WriteLine("\tEndGlobalSection");
                }

                ss.WriteLine("EndGlobal");
            }

            m_Kernel.CWDStack.Pop();
        }
コード例 #37
0
 /// <summary>
 /// Constuctor.
 /// </summary>
 /// <param name="viewModelStore">The store this view model belongs to.</param>
 /// <param name="referenceNode">Reference node.</param>
 /// <param name="parent">Parent.</param>
 public ReferenceNodeViewModel(ViewModelStore viewModelStore, ReferenceNode referenceNode, ReferenceRSNodeViewModel parent)
     : base(viewModelStore, referenceNode, parent.Parent)
 {
     this.parentTreeNode = parent;
 }
コード例 #38
0
        /// <summary>
        /// Adds an external reference to the dictionary.
        /// </summary>
        protected void AddExternalReference(
            NodeId sourceId,
            NodeId referenceTypeId,
            bool isInverse,
            NodeId targetId,
            IDictionary<NodeId, IList<IReference>> externalReferences)
        {
            // get list of references to external nodes.
            IList<IReference> referencesToAdd = null;

            if (!externalReferences.TryGetValue(sourceId, out referencesToAdd))
            {
                externalReferences[sourceId] = referencesToAdd = new List<IReference>();
            }

            // add reserve reference from external node.
            ReferenceNode referenceToAdd = new ReferenceNode();

            referenceToAdd.ReferenceTypeId = referenceTypeId;
            referenceToAdd.IsInverse = isInverse;
            referenceToAdd.TargetId = targetId;

            referencesToAdd.Add(referenceToAdd);
        }
コード例 #39
0
        /// <summary>
        /// Adds a set of nodes to the table.
        /// </summary>
        /// <param name="nodeSet">The node set.</param>
        /// <param name="externalReferences">The external references.</param>
        /// <returns></returns>
        public List <Node> Import(NodeSet nodeSet, IDictionary <NodeId, IList <IReference> > externalReferences)
        {
            List <Node> importedNodes = new List <Node>();

            if (nodeSet == null)
            {
                return(importedNodes);
            }

            // add the nodes.
            foreach (Node nodeToImport in nodeSet.Nodes)
            {
                // ignore empty nodes.
                if (nodeToImport == null || NodeId.IsNull(nodeToImport.NodeId))
                {
                    continue;
                }

                Node node = nodeSet.Copy(nodeToImport, m_namespaceUris, m_serverUris);

                // assign a browse name.
                if (QualifiedName.IsNull(node.BrowseName))
                {
                    node.BrowseName = new QualifiedName(node.NodeId.ToString(), 1);
                }

                // assign a display name.
                if (LocalizedText.IsNullOrEmpty(node.DisplayName))
                {
                    node.DisplayName = new LocalizedText(node.BrowseName.Name);
                }

                // index references (the node ids in the references were translated by the Copy() call above).
                foreach (ReferenceNode reference in node.References)
                {
                    // ignore invalid references.
                    if (NodeId.IsNull(reference.ReferenceTypeId) || NodeId.IsNull(reference.TargetId))
                    {
                        continue;
                    }

                    // ignore missing targets.
                    ExpandedNodeId targetId = reference.TargetId;

                    if (NodeId.IsNull(targetId))
                    {
                        continue;
                    }

                    // index reference.
                    node.ReferenceTable.Add(reference.ReferenceTypeId, reference.IsInverse, targetId);

                    // see if a remote node needs to be created.
                    if (targetId.ServerIndex != 0)
                    {
                        RemoteNode remoteNode = Find(targetId) as RemoteNode;

                        if (remoteNode == null)
                        {
                            remoteNode = new RemoteNode(this, targetId);
                            InternalAdd(remoteNode);
                        }

                        remoteNode.AddRef();
                    }
                }

                // clear imported references.
                node.References.Clear();

                // add the node.
                InternalAdd(node);
                importedNodes.Add(node);
            }

            // import the nodes.
            foreach (Node node in importedNodes)
            {
                // ignore invalid nodes.
                if (node == null || NodeId.IsNull(node.NodeId))
                {
                    continue;
                }

                // add reverse references.
                foreach (IReference reference in node.ReferenceTable)
                {
                    Node targetNode = Find(reference.TargetId) as Node;

                    if (targetNode == null)
                    {
                        if (reference.TargetId.ServerIndex != 0)
                        {
                            continue;
                        }

                        // return the reverse reference to a node outside the table.
                        if (externalReferences != null)
                        {
                            NodeId targetId = ExpandedNodeId.ToNodeId(reference.TargetId, m_namespaceUris);

                            if (targetId == null)
                            {
                                continue;
                            }

                            IList <IReference> referenceList = null;

                            if (!externalReferences.TryGetValue(targetId, out referenceList))
                            {
                                externalReferences[targetId] = referenceList = new List <IReference>();
                            }

                            ReferenceNode reverseReference = new ReferenceNode();

                            reverseReference.ReferenceTypeId = reference.ReferenceTypeId;
                            reverseReference.IsInverse       = !reference.IsInverse;
                            reverseReference.TargetId        = node.NodeId;

                            referenceList.Add(reverseReference);
                        }

                        continue;
                    }

                    // type definition and modelling rule references are one way.
                    if (reference.ReferenceTypeId != ReferenceTypeIds.HasTypeDefinition && reference.ReferenceTypeId != ReferenceTypeIds.HasModellingRule)
                    {
                        targetNode.ReferenceTable.Add(reference.ReferenceTypeId, !reference.IsInverse, node.NodeId);
                    }
                }

                // see if it is a type.
                if (m_typeTree != null)
                {
                    m_typeTree.Add(node);
                }
            }

            return(importedNodes);
        }