本文整理汇总了C#中Identifier.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Identifier.ToString方法的具体用法?C# Identifier.ToString怎么用?C# Identifier.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Identifier
的用法示例。
在下文中一共展示了Identifier.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompareTo
public override int CompareTo(Identifier other)
{
if (other is NamespaceIdentifier)
return ToString().CompareTo(other.ToString());
return -1;
}
示例2: parameterizedProgrammaticOPIdentifierTest
void parameterizedProgrammaticOPIdentifierTest(Identifier opIdentifier, ProtocolVersion version,
Identifier claimedUrl, AuthenticationRequestMode requestMode,
AuthenticationStatus expectedResult, bool provideStore) {
var rp = TestSupport.CreateRelyingParty(provideStore ? TestSupport.RelyingPartyStore : null, null, null);
var returnTo = TestSupport.GetFullUrl(TestSupport.ConsumerPage);
var realm = new Realm(TestSupport.GetFullUrl(TestSupport.ConsumerPage).AbsoluteUri);
var request = rp.CreateRequest(opIdentifier, realm, returnTo);
request.Mode = requestMode;
var rpResponse = TestSupport.CreateRelyingPartyResponseThroughProvider(request,
opReq => {
opReq.IsAuthenticated = expectedResult == AuthenticationStatus.Authenticated;
if (opReq.IsAuthenticated.Value) {
opReq.ClaimedIdentifier = claimedUrl;
}
});
Assert.AreEqual(expectedResult, rpResponse.Status);
if (rpResponse.Status == AuthenticationStatus.Authenticated) {
Assert.AreEqual(claimedUrl, rpResponse.ClaimedIdentifier);
} else if (rpResponse.Status == AuthenticationStatus.SetupRequired) {
Assert.IsNull(rpResponse.ClaimedIdentifier);
Assert.IsNull(rpResponse.FriendlyIdentifierForDisplay);
Assert.IsNull(rpResponse.Exception);
Assert.IsInstanceOfType(typeof(ISetupRequiredAuthenticationResponse), rpResponse);
Assert.AreEqual(opIdentifier.ToString(), ((ISetupRequiredAuthenticationResponse)rpResponse).ClaimedOrProviderIdentifier.ToString());
}
}
示例3: BaseDocumentationElement
protected BaseDocumentationElement(Identifier identifier)
{
Name = identifier.ToString();
this.identifier = identifier;
IsResolved = true;
Summary = new Summary();
Remarks = new Remarks();
Value = new Value();
}
示例4: BaseDocumentationElement
/// <summary>
/// Initializes a new instance of the <see cref="BaseDocumentationElement"/> class.
/// </summary>
/// <param name="identifier">
/// The identifier.
/// </param>
protected BaseDocumentationElement(Identifier identifier)
{
this.Name = identifier.ToString();
this.identifier = identifier;
this.IsResolved = true;
this.Summary = new Summary();
this.Remarks = new Remarks();
this.Value = new Value();
this.Example = new MultilineCode();
}
示例5: MockIdentifier
public MockIdentifier(Identifier wrappedIdentifier, IEnumerable<ServiceEndpoint> endpoints)
: base(false) {
if (wrappedIdentifier == null) throw new ArgumentNullException("wrappedIdentifier");
if (endpoints == null) throw new ArgumentNullException("endpoints");
this.wrappedIdentifier = wrappedIdentifier;
this.endpoints = endpoints;
// Register a mock HTTP response to enable discovery of this identifier within the RP
// without having to host an ASP.NET site within the test.
MockHttpRequest.RegisterMockXrdsResponse(new Uri(wrappedIdentifier.ToString()), endpoints);
}
示例6: CreateAccessToken
/// <summary>
/// Creates an anonymous access token using the specified policy and ACL
/// </summary>
/// <param name="id">identifier of the target object for the access token.</param>
/// <param name="policy">the token policy for the new access token.</param>
/// <param name="acl">the ACL that will be assigned to objects created using this access token.</param>
/// <returns>The URL of the access token.</returns>
public Uri CreateAccessToken(Identifier id, PolicyType policy, Acl acl)
{
HttpWebResponse resp = null;
try
{
string resource = context + "/accesstokens";
Uri u = buildUrl(resource);
HttpWebRequest con = createWebRequest(u);
// Build headers
Dictionary<string, string> headers = new Dictionary<string, string>();
headers.Add("Content-Type", "application/xml");
headers.Add("x-emc-uid", uid);
// Add id
if (id != null)
{
if (id is ObjectId) headers.Add("x-emc-objectid", id.ToString());
else if (id is ObjectPath) headers.Add("x-emc-path", id.ToString());
else throw new EsuException("Only object ID and path are supported with access tokens");
}
// Add acl
if (acl != null)
{
processAcl(acl, headers);
}
// Add date
addDateHeader(headers);
// Sign request
signRequest(con, "POST", resource, headers);
// serialize XML
Stream memStream = new MemoryStream();
XmlSerializer serializer = new XmlSerializer(typeof(PolicyType));
serializer.Serialize(memStream, policy);
memStream.Position = 0;
// post data
writeRequestBodyFromStream(con, memStream, memStream.Length);
// Check response
resp = (HttpWebResponse)con.GetResponse();
int statInt = (int)resp.StatusCode;
if (statInt > 299)
{
handleError(resp);
}
// The token URL is returned in the location response header
string location = resp.Headers["location"];
return buildUrl(location);
}
catch (UriFormatException e)
{
throw new EsuException("Invalid URL", e);
}
catch (IOException e)
{
throw new EsuException("Error connecting to server", e);
}
catch (WebException e)
{
if (e.Response != null)
{
handleError((HttpWebResponse)e.Response);
}
else
{
throw new EsuException("Error executing request: " + e.Message, e);
}
}
finally
{
if (resp != null)
{
resp.Close();
}
}
return null;
}
示例7: GetName
/// <summary>
/// Get the localized name of the stat.
/// </summary>
static public string GetName (Identifier i)
{
return i.ToString();
}
示例8: ExtractUserName
public static string ExtractUserName(Identifier identifier) {
return ExtractUserName(new Uri(identifier.ToString()));
}
示例9: IsUserLocalIdentifier
/// <summary>
/// Determines whether a given identifier is the primary (non-PPID) local identifier for some user.
/// </summary>
/// <param name="identifier">The identifier in question.</param>
/// <returns>
/// <c>true</c> if the given identifier is the valid, unique identifier for some uesr (and NOT a PPID); otherwise, <c>false</c>.
/// </returns>
public virtual bool IsUserLocalIdentifier(Identifier identifier) {
return !identifier.ToString().StartsWith(this.BaseIdentifier.AbsoluteUri, StringComparison.Ordinal);
}
示例10: GetDummyTypeNode
private TypeNode/*!*/ GetDummyTypeNode(Identifier namesp, Identifier name, Module declaringModule, TypeNode declaringType, bool expectStruct)
{
TypeNode result = null;
if (this.module != null)
{
string modName = declaringModule == null ? "" : declaringModule.Name == null ? "" : declaringModule.Name.ToString();
HandleError(this.module, String.Format(CultureInfo.CurrentCulture, ExceptionStrings.CouldNotResolveTypeReference,
"[" + modName + "]" + namesp + "." + name));
}
result = expectStruct ? (TypeNode)new Struct() : (TypeNode)new Class();
if (name != null && name.ToString().StartsWith("I") && name.ToString().Length > 1 && char.IsUpper(name.ToString()[1]))
result = new Interface();
result.Flags |= TypeFlags.Public;
result.Name = name;
result.Namespace = namesp;
if (declaringType != null)
{
result.DeclaringType = declaringType;
result.DeclaringModule = declaringType.DeclaringModule;
declaringType.Members.Add(result);
}
else
{
if (declaringModule == null) declaringModule = this.module;
//^ assume declaringModule != null;
result.DeclaringModule = declaringModule;
if (declaringModule.types != null)
declaringModule.types.Add(result);
}
return result;
}
示例11: GetCompendiumUrl
static string GetCompendiumUrl(Identifier id, string type, string idPrefix)
{
return
"http://www.wizards.com/dndinsider/compendium/" +
type + ".aspx?id=" + id.ToString().Substring(idPrefix.Length);
}
示例12: QuoteString
public static string QuoteString(Identifier id)
{
return QuoteString(id.ToString());
}
示例13: BaseDocumentationElement
protected BaseDocumentationElement(Identifier identifier)
{
Name = identifier.ToString();
this.identifier = identifier;
IsResolved = true;
}
示例14: WriteTypePrefix
public void WriteTypePrefix(Identifier type)
{
WriteTypePrefix(type.ToString());
}
示例15: GetNestedNamespacesAndTypes
protected virtual void GetNestedNamespacesAndTypes(Identifier name, Scope scope, bool constructorMustBeVisible, MemberList list,
TrivialHashtable alreadyInList, AssemblyReferenceList assembliesToSearch, bool listAllUnderRootNamespace) {
if (name == null || scope == null || this.currentModule == null) return;
bool mustBeAttribute = scope is AttributeScope;
string nameStr = name.ToString();
int nameLen = nameStr.Length;
if (nameLen > 0){
int i = nameStr.LastIndexOf('.');
if (i < 0){
nameLen = 0;
nameStr = "";
}else{
nameLen = i;
nameStr = nameStr.Substring(0, i);
if (this.GetNestedTypesIfNameResolvesToType(nameStr, scope, list, alreadyInList))
return;
}
}
string fullNameStr = null;
int fullNameLen = 0;
alreadyInList[StandardIds.StructuralTypes.UniqueIdKey] = this;
if (assembliesToSearch != null && assembliesToSearch.Count > 0) {
for (int i = 0, n = assembliesToSearch == null ? 0 : assembliesToSearch.Count; i < n; i++) {
AssemblyReference aRef = assembliesToSearch[i];
if (aRef == null || aRef.Assembly == null) continue;
if (fullNameStr != null)
this.GetNestedNamespacesAndTypes(aRef.Assembly, constructorMustBeVisible, mustBeAttribute, fullNameStr, fullNameLen, list, alreadyInList, listAllUnderRootNamespace);
this.GetNestedNamespacesAndTypes(aRef.Assembly, constructorMustBeVisible, mustBeAttribute, nameStr, nameLen, list, alreadyInList, listAllUnderRootNamespace);
}
return;
}
while (scope != null && !(scope is NamespaceScope)) scope = scope.OuterScope;
NamespaceScope nsScope = scope as NamespaceScope;
if (nsScope != null){
Namespace nSpace = nsScope.AssociatedNamespace;
if (nSpace != null && nSpace.FullName != null && nSpace.FullName.Length > 0){
fullNameStr = nSpace.FullName;
if (nameLen > 0) fullNameStr += "."+nameStr;
fullNameLen = fullNameStr.Length;
}
}
if (fullNameStr != null)
this.GetNestedNamespacesAndTypes(this.currentModule, constructorMustBeVisible, mustBeAttribute, fullNameStr, fullNameLen, list, alreadyInList, listAllUnderRootNamespace);
this.GetNestedNamespacesAndTypes(this.currentModule, constructorMustBeVisible, mustBeAttribute, nameStr, nameLen, list, alreadyInList, listAllUnderRootNamespace);
ModuleReferenceList mRefs = this.currentModule.ModuleReferences;
for (int i = 0, n = mRefs == null ? 0 : mRefs.Count; i < n; i++){
ModuleReference mRef = mRefs[i];
if (mRef == null || mRef.Module == null) continue;
if (fullNameStr != null)
this.GetNestedNamespacesAndTypes(mRef.Module, constructorMustBeVisible, mustBeAttribute, fullNameStr, fullNameLen, list, alreadyInList, listAllUnderRootNamespace);
this.GetNestedNamespacesAndTypes(mRef.Module, constructorMustBeVisible, mustBeAttribute, nameStr, nameLen, list, alreadyInList, listAllUnderRootNamespace);
}
AssemblyReferenceList aRefs = this.currentModule.AssemblyReferences;
for (int i = 0, n = aRefs == null ? 0 : aRefs.Count; i < n; i++){
AssemblyReference aRef = aRefs[i];
if (aRef == null || aRef.Assembly == null ) continue;
if (fullNameStr != null)
this.GetNestedNamespacesAndTypes(aRef.Assembly, constructorMustBeVisible, mustBeAttribute, fullNameStr, fullNameLen, list, alreadyInList, listAllUnderRootNamespace);
this.GetNestedNamespacesAndTypes(aRef.Assembly, constructorMustBeVisible, mustBeAttribute, nameStr, nameLen, list, alreadyInList, listAllUnderRootNamespace);
}
}