コード例 #1
0
ファイル: NodeEndpoint.cs プロジェクト: 0xCM/Meta.Core
 protected NodeEndpoint(N Node, SystemUri Identifier, Type EndpointType, EndpointRole Role)
 {
     this.Node         = Node;
     this.Identifier   = Identifier;
     this.Role         = Role;
     this.EndpointType = EndpointType;
 }
コード例 #2
0
ファイル: http.cs プロジェクト: 0xCM/Meta.Core
        public static Option <string> get(SystemUri query)
        => Use(HttpBasicClient.Client(uri(query)), client =>
        {
            var response = client.GetAsync(string.Empty).Result;
            var content  = response.Content.ReadAsStringAsync().Result;
            if (response.IsSuccessStatusCode)
            {
                return(content);
            }

            throw new Exception(($"{response.StatusCode} {content}"));
        });
コード例 #3
0
ファイル: JsonEntityStore.cs プロジェクト: 0xCM/Meta.Core
 public Option <T> FindEntity <T>(SystemUri id)
 => from e in Lookup(ifNull(id, () => typeof(T).Uri()))
 from r in TryReconsitute <T>(e.Body)
 select r;
コード例 #4
0
ファイル: JsonEntityStore.cs プロジェクト: 0xCM/Meta.Core
 public Option <SystemUri> SaveEntity <T>(T Body, SystemUri id)
 => from j in TrySerialize(Body)
 from s in Persist(ifNull(id, () => typeof(T).Uri()), typeof(T).Uri(), j)
 select s;
コード例 #5
0
ファイル: JsonEntityStore.cs プロジェクト: 0xCM/Meta.Core
 Option <SystemUri> Persist(SystemUri id, SystemUri type, Json json)
 => from saved in id.ToLocalPath().TryWriteAllText(json)
 select id;
コード例 #6
0
ファイル: JsonEntityStore.cs プロジェクト: 0xCM/Meta.Core
 Option <JsonEntity> Lookup(SystemUri id)
 => from text in id.ToLocalPath().TryReadAllText()
 let json = Json.FromText(text)
            from recon in TryReconsitute <JsonEntity>(json)
            select recon;
コード例 #7
0
 protected CatalogSubject(SystemUri Uri, INodeCatalogSubject Parent = null)
     : this(new SystemResourceScheme(Uri.Scheme), Uri.Host, Uri.Path, Parent)
 {
 }
コード例 #8
0
 /// <summary>
 /// Converts the uri to a local file system path
 /// </summary>
 /// <param name="uri">The uri to convert</param>
 /// <returns></returns>
 public static FilePath ToLocalPath(this SystemUri uri)
 => string.Join(bslash(), uri.Path.Components());
コード例 #9
0
ファイル: SystemUri.api.cs プロジェクト: 0xCM/Meta.Core
 /// <summary>
 /// Converts a text-based uri representation to a <see cref="SystemUri"/> representation
 /// </summary>
 /// <param name="uriText"></param>
 /// <returns></returns>
 public static SystemUri uri(string uriText)
 => SystemUri.Parse(uriText);