public Builder(
     string pName
     , TreeID pTreeID
     )
 {
     this.Name   = pName;
     this.TreeID = pTreeID;
 }
 public Builder(
     StageName pName
     , TreeID pTreeID
     )
 {
     this.Name   = pName;
     this.TreeID = pTreeID;
 }
        public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
        {
            string strValue = value as string;

            if (strValue != null)
            {
                return(TreeID.TryParse(strValue).Value);
            }

            return(base.ConvertFrom(context, culture, value));
        }
        public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
        {
            if (typeof(string) == destinationType)
            {
                return(((MaybeTreeBlobPath)value).ToString());
            }
            else if (typeof(Errorable <MaybeTreeBlobPath>) == destinationType)
            {
                string strValue = value as string;
                if (strValue == null)
                {
                    return((Errorable <MaybeTreeBlobPath>)null);
                }

                try
                {
                    // {TreeID}:{CanonicalBlobPath}
                    CanonicalBlobPath path;
                    Maybe <TreeID>    rootTreeID;

                    int colon = strValue.IndexOf(':');
                    if (colon >= 0)
                    {
                        var eroot = TreeID.TryParse(strValue.Substring(0, colon));
                        if (eroot.HasErrors)
                        {
                            return((Errorable <MaybeTreeBlobPath>)eroot.Errors);
                        }

                        rootTreeID = eroot.Value;
                        // TODO: TryParse on CanonicalBlobPath...
                        path = (CanonicalBlobPath)('/' + strValue.Substring(colon + 1));
                    }
                    else
                    {
                        rootTreeID = Maybe <TreeID> .Nothing;
                        // TODO: TryParse on CanonicalBlobPath...
                        path = (CanonicalBlobPath)('/' + strValue);
                    }

                    return((Errorable <MaybeTreeBlobPath>) new MaybeTreeBlobPath(rootTreeID, path));
                }
                catch (ErrorBase err)
                {
                    return((Errorable <MaybeTreeBlobPath>)err);
                }
                catch (Exception ex)
                {
                    return((Errorable <MaybeTreeBlobPath>) new InputError(ex.Message));
                }
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
 public Builder(
     List <CommitID> pParents
     , TreeID pTreeID
     , string pCommitter
     , DateTimeOffset pDateCommitted
     , string pMessage
     )
 {
     this.Parents       = pParents;
     this.TreeID        = pTreeID;
     this.Committer     = pCommitter;
     this.DateCommitted = pDateCommitted;
     this.Message       = pMessage;
 }
 public Builder(
     CommitID pID
     , TreeID pTreeID
     , string pCommitter
     , DateTimeOffset pDateCommitted
     , string pMessage
     )
 {
     this.ID            = pID;
     this.TreeID        = pTreeID;
     this.Committer     = pCommitter;
     this.DateCommitted = pDateCommitted;
     this.Message       = pMessage;
 }
        public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
        {
            if (typeof(string) == destinationType)
            {
                return(((TreeID)value).ToString());
            }
            else if (typeof(Errorable <TreeID>) == destinationType)
            {
                string strValue = value as string;
                if (strValue != null)
                {
                    return(TreeID.TryParse(strValue));
                }
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
        public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
        {
            if (typeof(string) == destinationType)
            {
                return(((TreeBlobPath)value).ToString());
            }
            else if (typeof(Errorable <TreeBlobPath>) == destinationType)
            {
                string strValue = value as string;
                if (strValue == null)
                {
                    return((Errorable <TreeBlobPath>)null);
                }

                try
                {
                    // {TreeID}:{CanonicalBlobPath}
                    int colon = strValue.IndexOf(':');
                    if (colon < 0)
                    {
                        return((Errorable <TreeBlobPath>) new TreeID.ParseError("Could not find first ':' char of TreeBlobPath"));
                    }

                    var eroot = TreeID.TryParse(strValue.Substring(0, colon));
                    if (eroot.HasErrors)
                    {
                        return((Errorable <TreeBlobPath>)eroot.Errors);
                    }

                    // TODO: TryParse on CanonicalBlobPath...
                    CanonicalBlobPath path = (CanonicalBlobPath)('/' + strValue.Substring(colon + 1));

                    return((Errorable <TreeBlobPath>) new TreeBlobPath(eroot.Value, path));
                }
                catch (ErrorBase err)
                {
                    return((Errorable <TreeBlobPath>)err);
                }
                catch (Exception ex)
                {
                    return((Errorable <TreeBlobPath>) new InputError(ex.Message));
                }
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
예제 #9
0
 public TreeTreePath(TreeID rootTreeID, CanonicalTreePath path)
 {
     this.RootTreeID = rootTreeID;
     this.Path       = path;
 }
 public Builder(Stage imm)
 {
     this.Name   = imm.Name;
     this.TreeID = imm.TreeID;
 }
 public Stage(Builder b)
 {
     this.Name   = b.Name;
     this.TreeID = b.TreeID;
 }
 public Builder(TreeTreeReference imm)
 {
     this.Name   = imm.Name;
     this.TreeID = imm.TreeID;
 }
 public TreeTreeReference(Builder b)
 {
     this.Name   = b.Name;
     this.TreeID = b.TreeID;
 }
예제 #14
0
 public TreePathStreamedBlob(TreeID rootTreeID, CanonicalBlobPath path, IStreamedBlob blob)
     : this(new TreeBlobPath(rootTreeID, path), blob)
 {
 }
 public TreeTree(TreeID rootID, ImmutableContainer <TreeID, TreeNode> trees)
 {
     this.RootID = rootID;
     this.Trees  = trees;
 }