Example #1
0
        protected override bool ImportXml(XmlReader xr, IWarningLogger log)
        {
            bool gotdir  = false;
            bool gotname = false;
            int  depth   = xr.Depth;

            while (xr.Depth >= depth)
            {
                if (xr.NodeType != XmlNodeType.Element)
                {
                    //Console.WriteLine ("skipping {0}: {1} = \"{2}\"", xr.NodeType, xr.Name, xr.Value);
                    xr.Read();
                    continue;
                }

                switch (xr.Name)
                {
                case "result":
                    string ignore;

                    Result r = Result.ImportXml(xr, out ignore, log);
                    if (r == null)
                    {
                        return(true);
                    }
                    if (!(r is MBDirectory))
                    {
                        log.Warning(3019, "Result embedded in file result is not directory during XML import", null);
                        return(true);
                    }
                    dir    = (MBDirectory)r;
                    gotdir = true;
                    break;

                case "name":
                    name    = xr.ReadElementString();
                    gotname = true;
                    break;

                default:
                    log.Warning(3019, "Unknown element in file result during XML import", xr.Name);
                    xr.Skip();
                    break;
                }
            }

            if (!gotdir)
            {
                log.Warning(3019, "Did not find directory in file element during XML import", null);
                return(true);
            }

            if (!gotname)
            {
                log.Warning(3019, "Did not find name in file element during XML import", null);
                return(true);
            }

            return(false);
        }
Example #2
0
        // Clone

        protected override void CloneTo(Result dest)
        {
            MBDirectory ddest = (MBDirectory)dest;

            ddest.storage = storage;
            ddest.subpath = subpath;
            ddest.modtime = modtime;
        }
Example #3
0
        public MBFile(MBDirectory dir, string name) : base()
        {
            if (dir == null)
            {
                throw new ArgumentNullException("dir");
            }
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            this.dir     = dir;
            this.name    = name;
            this.modtime = invalid_modtime;
        }
Example #4
0
        // Equality

        protected override bool ContentEquals(Result other)
        {
            MBDirectory d = (MBDirectory)other;

            return((storage == d.storage) && (subpath == d.subpath));
        }
Example #5
0
 public void SetToInsecureTemporary(string ext, IBuildContext ctxt)
 {
     dir  = ctxt.WorkingDirectory;
     name = String.Format("tmp{0}.{1}", new Random().Next(), ext);
 }
Example #6
0
 public void SetFromSystemPath(string path)
 {
     dir = new MBDirectory(ResultStorageKind.System,
                           Path.GetDirectoryName(path));
     name = Path.GetFileName(path);
 }
Example #7
0
        public void CopyTo(MBDirectory dir, IBuildContext ctxt)
        {
            string dest = Path.Combine(ctxt.PathTo(dir), Name);

            CopyToUnsafe(dest, ctxt);
        }