Пример #1
0
        public override bool Equals(object obj)
        {
            NDOReference ndoRef = obj as NDOReference;

            if ((object)this == null || obj == null)
            {
                return(false);
            }

            return(ndoRef.Name == this.Name);
        }
Пример #2
0
        void CheckProjectDescription(ConfigurationOptions options, ProjectDescription pd, string fileName)
        {
            Dictionary <string, NDOReference> ht = pd.References;             // Build the references
            ProjectDescription storedPd          = new ProjectDescription(fileName);
//			messages.WriteLine(pd.BinFile + ", " + storedPd.BinFile);
//			messages.WriteLine(pd.ProjPath + ", " + storedPd.ProjPath);
//			messages.WriteLine(pd.ObjPath + ", " + storedPd.ObjPath);
            bool storeIt = (string.Compare(storedPd.BinFile, pd.BinFile, true) != 0 ||
                            string.Compare(storedPd.ObjPath, pd.ObjPath, true) != 0 ||
                            string.Compare(storedPd.KeyFile, pd.KeyFile, true) != 0);

            storeIt = storeIt || (pd.References.Count != storedPd.References.Count);
//			messages.WriteLine(pd.References.Count.ToString() + ", " + storedPd.References.Count);

            foreach (string key in pd.References.Keys)
            {
                //					messages.WriteLine("Key " + de.Key + " contained: " + storedPd.References.Contains(de.Key));
                if (!storedPd.References.ContainsKey(key))
                {
                    storeIt = true;
                    continue;
                }

                NDOReference r1 = pd.References[key];
                NDOReference r2 = storedPd.References[key];

                // If we save the collected data, we should use the previously stored CheckThisDLL settings,
                // except in case we changed the state using the UI
                r1.CheckThisDLL = r2.CheckThisDLL;

                //					messages.WriteLine("  " + s1 + ", " + s2);
                if (string.Compare(Path.GetFullPath(r1.Path), Path.GetFullPath(r2.Path), true) != 0)
                {
                    storeIt = true;
                }
            }
            if (storeIt)
            {
                FileInfo fi = new FileInfo(fileName);
                if ((fi.Attributes & FileAttributes.ReadOnly) != 0)
                {
                    MessageBox.Show("The NDO project file '" + fileName + "' is write protected, probably due to your Source Code Control system. NDO needs to update this file now. NDO tries to remove the write protect attribute in order to update the file.", "NDO Add-in", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    fi.Attributes &= (~FileAttributes.ReadOnly);
                }
                options.Save(pd);
            }
        }
Пример #3
0
        public void ToXml(XmlNode parent)
        {
            XmlDocument doc  = (XmlDocument)parent.ParentNode;
            XmlNode     node = doc.CreateElement("ProjectDescription");

            parent.AppendChild(node);
            string reference = this.projPath;

            if (reference.EndsWith("\\"))
            {
                reference = reference.Substring(0, reference.Length - 1);
            }

            MakeNode("BinPath", ExtendedPath.GetRelativePath(reference, binFile), node, doc);
            MakeNode("ObjPath", ExtendedPath.GetRelativePath(reference, objPath), node, doc);
            MakeNode("AssemblyName", assemblyName, node, doc);
            MakeNode("Debug", debug, node, doc);
            MakeNode("IsWebProject", isWebProject, node, doc);
            MakeNode("KeyFile", keyFile, node, doc);
            XmlNode refsNode = MakeNode("References", string.Empty, node, doc);

            foreach (string key in References.Keys)
            {
                NDOReference ndoreference = References[key];
                if (ndoreference.Path == binFile)
                {
                    continue;
                }
                XmlElement refNode = (XmlElement)MakeNode("Reference", "", refsNode, doc);
                refNode.SetAttribute("AssemblyName", ndoreference.Name);
                refNode.SetAttribute("AssemblyPath", ExtendedPath.GetRelativePath(reference, ndoreference.Path));
                if (!ndoreference.CheckThisDLL)
                {
                    refNode.SetAttribute("CheckThisDLL", "False");
                }
            }
        }