本文整理汇总了C#中ClientType类的典型用法代码示例。如果您正苦于以下问题:C# ClientType类的具体用法?C# ClientType怎么用?C# ClientType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClientType类属于命名空间,在下文中一共展示了ClientType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
public void Load(string path, ClientType type)
{
BinaryReader binaryReader = new BinaryReader(File.Open(path, FileMode.Open));
int num = binaryReader.ReadInt32();
for (int i = 0; i < num; i++)
{
int num2 = binaryReader.ReadInt32();
LIT.Object item = default(LIT.Object);
item.objectID = binaryReader.ReadInt32();
for (int j = 0; j < num2; j++)
{
LIT.Object.Part item2 = default(LIT.Object.Part);
item2.name = RoseFile.ReadBString(ref binaryReader);
item2.partID = binaryReader.ReadInt32();
item2.ddsName = RoseFile.ReadBString(ref binaryReader);
item2.ddsID = binaryReader.ReadInt32();
item2.ddsDivisionSize = binaryReader.ReadInt32();
item2.ddsDivisionCount = binaryReader.ReadInt32();
item2.ddsPartID = binaryReader.ReadInt32();
item.listParts.Add(item2);
}
this.listObject.Add(item);
}
int num3 = binaryReader.ReadInt32();
for (int i = 0; i < num3; i++)
{
string item3 = RoseFile.ReadBString(ref binaryReader);
this.listDDSName.Add(item3);
}
binaryReader.Close();
}
示例2: StartSendingAndReceiving
public void StartSendingAndReceiving(ClientType typeOfClient)
{
m_CurrentClientType = typeOfClient;
if (m_CurrentClientType == ClientType.MultiCast)
{
m_Multicast = new Multicast(m_Port, m_MultiCastEndpoint);
m_Multicast.Start();
m_Multicast.StartPulse(((int)MessageHeaders.USERSNAMES).ToString() + m_UserName);
}
if (m_CurrentClientType == ClientType.TCP)
{
m_TCPClient = new TCPClient();
m_TCPClient.Start();
}
m_displayAllMessages = false;
m_ProcessorThread = new Thread(new ThreadStart(Processor));
m_ProcessorThread.IsBackground = true;
m_ProcessorThread.Start();
AssembleSendString(MessageHeaders.CONNECT, " Has Connected");
}
示例3: GetServiceInfo
public Task<ServiceInfo> GetServiceInfo(
AppConfig appConfig,
CredentialCache credentialCache,
IHttpProvider httpProvider,
ClientType clientType = ClientType.Consumer)
{
if (clientType == ClientType.Business)
{
throw new OneDriveException(
new Error
{
Code = OneDriveErrorCode.AuthenticationFailure.ToString(),
Message = "OnlineIdServiceProvider only supports Microsoft Account authentication."
});
}
var microsoftAccountServiceInfo = new MicrosoftAccountServiceInfo
{
AppId = appConfig.MicrosoftAccountAppId,
ClientSecret = appConfig.MicrosoftAccountClientSecret,
CredentialCache = credentialCache,
HttpProvider = httpProvider,
Scopes = appConfig.MicrosoftAccountScopes,
};
microsoftAccountServiceInfo.AuthenticationProvider = this.AuthenticationProvider ?? new OnlineIdAuthenticationProvider(microsoftAccountServiceInfo);
return Task.FromResult<ServiceInfo>(microsoftAccountServiceInfo);
}
示例4: ClientInformation
private ClientInformation(PacketIn packet)
{
try
{
ProtocolVersion = packet.ReadByte();
var claimedRemainingLength = packet.ReadUInt16();
if (packet.RemainingLength != claimedRemainingLength)
{
Log.Warn(WCell_Core.Auth_Logon_with_invalid_length, claimedRemainingLength, packet.RemainingLength);
}
var clientInstallationType = packet.ReadFourCC();
_clientInstallationType = ClientTypeUtility.Lookup(clientInstallationType);
Version = new ClientVersion(packet.ReadBytes(5));
Architecture = packet.ReadFourCC().TrimEnd('\0');
OS = packet.ReadFourCC().TrimEnd('\0');
var locale = packet.ReadFourCC();
_locale = ClientLocaleUtility.Lookup(locale);
TimeZone = BitConverter.ToUInt32(packet.ReadBytes(4), 0);
IPAddress = new XmlIPAddress(packet.ReadBytes(4));
Log.Info(WCell_Core.ClientInformationFourCCs, ProtocolVersion, ClientInstallationType, Version, Architecture, OS, Locale, TimeZone, IPAddress);
}
catch
{
}
}
示例5: InitializeClient
private async void InitializeClient(ClientType clientType, RoutedEventArgs e)
{
if (((App)Application.Current).OneDriveClient == null)
{
var client = clientType == ClientType.Consumer
? OneDriveClientExtensions.GetUniversalClient(this.scopes) as OneDriveClient
: BusinessClientExtensions.GetActiveDirectoryClient(
oneDriveForBusinessAppId,
oneDriveForBusinessReturnUrl) as OneDriveClient;
try
{
await client.AuthenticateAsync();
((App)Application.Current).OneDriveClient = client;
((App)Application.Current).NavigationStack.Add(new ItemModel(new Item()));
Frame.Navigate(typeof(MainPage), e);
}
catch (OneDriveException exception)
{
// Swallow the auth exception but write message for debugging.
Debug.WriteLine(exception.Error.Message);
client.Dispose();
}
}
else
{
Frame.Navigate(typeof(MainPage), e);
}
}
示例6: AddSuperPeerNodeToConnectionsRepository
private void AddSuperPeerNodeToConnectionsRepository(ClientType clientType, SuperPeerNode superPeerNode)
{
if (clientType == ClientType.Client)
ConnectionsRepository.AddClient((SuperPeerClient) superPeerNode);
else
ConnectionsRepository.AddServer((SuperPeerServer) superPeerNode);
}
示例7: ReadPropertyValue
private static object ReadPropertyValue(object element, ClientType resourceType, string[] srcPathSegments, int currentSegment)
{
if (element == null || currentSegment == srcPathSegments.Length)
{
return element;
}
else
{
String srcPathPart = srcPathSegments[currentSegment];
ClientType.ClientProperty resourceProperty = resourceType.GetProperty(srcPathPart, true);
if (resourceProperty == null)
{
throw Error.InvalidOperation(Strings.EpmSourceTree_InaccessiblePropertyOnType(srcPathPart, resourceType.ElementTypeName));
}
if (resourceProperty.IsKnownType ^ (currentSegment == srcPathSegments.Length - 1))
{
throw Error.InvalidOperation(!resourceProperty.IsKnownType ? Strings.EpmClientType_PropertyIsComplex(resourceProperty.PropertyName) :
Strings.EpmClientType_PropertyIsPrimitive(resourceProperty.PropertyName));
}
PropertyInfo pi = element.GetType().GetProperty(srcPathPart, BindingFlags.Instance | BindingFlags.Public);
Debug.Assert(pi != null, "Cannot find property " + srcPathPart + "on type " + element.GetType().Name);
return ReadPropertyValue(
pi.GetValue(element, null),
resourceProperty.IsKnownType ? null : ClientType.Create(resourceProperty.PropertyType),
srcPathSegments,
++currentSegment);
}
}
示例8: Connect
public static string Connect(ClientType clientType, string serverAddress, string login, string password)
{
string clientCallbackAddress;
if (serverAddress.StartsWith("net.pipe:"))
{
clientCallbackAddress = "net.pipe://127.0.0.1/FiresecCallbackService_" + clientType.ToString() + "/";
}
else
{
clientCallbackAddress = CallbackAddressHelper.GetFreeClientCallbackAddress();
}
FiresecCallbackServiceManager.Open(clientCallbackAddress);
ClientCredentials = new ClientCredentials()
{
UserName = login,
Password = password,
ClientType = clientType,
ClientCallbackAddress = clientCallbackAddress,
ClientUID = Guid.NewGuid()
};
FiresecService = new SafeFiresecService(serverAddress);
var operationResult = FiresecService.Connect(ClientCredentials, true);
if (operationResult.HasError)
{
return operationResult.Error;
}
_userLogin = login;
OnUserChanged();
return null;
}
示例9: LoginViewModel
public LoginViewModel(ClientType clientType, PasswordViewType passwordViewType)
{
TopMost = true;
ClientType = clientType;
_passwordViewType = passwordViewType;
switch (_passwordViewType)
{
case PasswordViewType.Connect:
UserName = Settings.Default.UserName;
CanEditUserName = true;
break;
case PasswordViewType.Validate:
UserName = ClientManager.CurrentUser.Login;
Settings.Default.SavePassword = false;
CanEditUserName = false;
break;
}
CanSavePassword = _passwordViewType != PasswordViewType.Validate;
Password = Settings.Default.SavePassword ? Settings.Default.Password : string.Empty;
SavePassword = Settings.Default.SavePassword;
IsConnected = false;
IsCanceled = false;
Message = null;
Sizable = false;
}
示例10: GetServiceInfo
public async override Task<ServiceInfo> GetServiceInfo(
AppConfig appConfig,
CredentialCache credentialCache,
IHttpProvider httpProvider,
ClientType clientType = ClientType.Business)
{
if (clientType == ClientType.Consumer)
{
throw new OneDriveException(
new Error
{
Code = OneDriveErrorCode.AuthenticationFailure.ToString(),
Message = "AdalServiceInfoProvider only supports Active Directory authentication."
});
}
var serviceInfo = await base.GetServiceInfo(appConfig, null, httpProvider, clientType);
serviceInfo.ServiceResource = appConfig.ActiveDirectoryServiceResource;
if (string.IsNullOrEmpty(serviceInfo.BaseUrl) && !string.IsNullOrEmpty(serviceInfo.ServiceResource))
{
serviceInfo.BaseUrl = string.Format(
Constants.Authentication.OneDriveBusinessBaseUrlFormatString,
serviceInfo.ServiceResource.TrimEnd('/'),
"v2.0");
}
if (serviceInfo.AuthenticationProvider == null)
{
serviceInfo.AuthenticationProvider = new AdalAuthenticationProvider(serviceInfo);
}
return serviceInfo;
}
示例11: Load
public void Load(string Path, ClientType clientType)
{
this.path = Path;
this.clientType = clientType;
BinaryReader binaryReader = new BinaryReader(File.Open(Path, FileMode.Open));
short num = binaryReader.ReadInt16();
for (int i = 0; i < (int)num; i++)
{
ZSC.Mesh mesh = new ZSC.Mesh();
mesh.read(ref binaryReader);
this.listMesh.Add(mesh);
}
short num2 = binaryReader.ReadInt16();
for (int i = 0; i < (int)num2; i++)
{
ZSC.Materiel materiel = new ZSC.Materiel();
materiel.read(ref binaryReader);
this.listMateriel.Add(materiel);
}
short num3 = binaryReader.ReadInt16();
for (int i = 0; i < (int)num3; i++)
{
ZSC.Effect effect = new ZSC.Effect();
effect.read(ref binaryReader);
this.listEffect.Add(effect);
}
short num4 = binaryReader.ReadInt16();
for (int i = 0; i < (int)num4; i++)
{
ZSC.Object @object = new ZSC.Object();
@object.read(ref binaryReader);
this.listObject.Add(@object);
}
binaryReader.Close();
}
示例12: GetServiceInfo
public async override Task<ServiceInfo> GetServiceInfo(
AppConfig appConfig,
CredentialCache credentialCache,
IHttpProvider httpProvider,
ClientType clientType = ClientType.Business)
{
if (clientType == ClientType.Consumer)
{
throw new OneDriveException(
new Error
{
Code = OneDriveErrorCode.AuthenticationFailure.ToString(),
Message = "AdalServiceInfoProvider only supports Active Directory authentication."
});
}
var serviceInfo = await base.GetServiceInfo(appConfig, credentialCache, httpProvider, clientType);
serviceInfo.BaseUrl = appConfig.ActiveDirectoryServiceEndpointUrl;
serviceInfo.ServiceResource = appConfig.ActiveDirectoryServiceResource;
if (serviceInfo.AuthenticationProvider == null)
{
serviceInfo.AuthenticationProvider = new AdalAuthenticationProvider(serviceInfo);
}
return serviceInfo;
}
示例13: Load
public void Load(string filePath, ClientType clientType)
{
this.Path = filePath;
this.clientType = clientType;
BinaryReader binaryReader = new BinaryReader(File.Open(filePath, FileMode.Open));
short num = binaryReader.ReadInt16();
this.listDDS = new List<TSI.DDS>((int)num);
for (int i = 0; i < (int)num; i++)
{
TSI.DDS dDS = new TSI.DDS();
dDS.Path = RoseFile.ReadSString(ref binaryReader);
dDS.ColourKey = binaryReader.ReadInt32();
this.listDDS.Add(dDS);
}
short num2 = binaryReader.ReadInt16();
for (int i = 0; i < (int)num; i++)
{
short num3 = binaryReader.ReadInt16();
this.listDDS[i].ListDDS_element = new List<TSI.DDS.DDSElement>((int)num3);
for (int j = 0; j < (int)num3; j++)
{
TSI.DDS.DDSElement dDSElement = new TSI.DDS.DDSElement();
dDSElement.OwnerId = binaryReader.ReadInt16();
dDSElement.X = binaryReader.ReadInt32();
dDSElement.Y = binaryReader.ReadInt32();
dDSElement.Width = binaryReader.ReadInt32() - dDSElement.X;
dDSElement.Height = binaryReader.ReadInt32() - dDSElement.Y;
dDSElement.Color = binaryReader.ReadInt32();
dDSElement.Name = RoseFile.ReadFString(ref binaryReader, 32);
this.listDDS[i].ListDDS_element.Add(dDSElement);
}
}
binaryReader.Close();
}
示例14: GetRequestsOfType
private IEnumerable<dynamic> GetRequestsOfType(int count, ClientType clientType)
{
using (var db = GetDB())
{
return db.Query("select top (@Count) * from ClientRequests where UserType = @ClientType order by [Timestamp] desc", new { Count = count, ClientType = clientType });
}
}
示例15: GetServiceInfo
/// <summary>
/// Generates the <see cref="ServiceInfo"/> for the current application configuration.
/// </summary>
/// <param name="appConfig">The <see cref="AppConfig"/> for the current application.</param>
/// <param name="credentialCache">The cache instance for storing user credentials.</param>
/// <param name="httpProvider">The <see cref="IHttpProvider"/> for sending HTTP requests.</param>
/// <param name="clientType">The <see cref="ClientType"/> to specify the business or consumer service.</param>
/// <returns>The <see cref="ServiceInfo"/> for the current session.</returns>
public virtual Task<ServiceInfo> GetServiceInfo(
AppConfig appConfig,
CredentialCache credentialCache,
IHttpProvider httpProvider,
ClientType clientType)
{
if (clientType == ClientType.Consumer)
{
var microsoftAccountServiceInfo = new MicrosoftAccountServiceInfo
{
AppId = appConfig.MicrosoftAccountAppId,
ClientSecret = appConfig.MicrosoftAccountClientSecret,
CredentialCache = credentialCache,
HttpProvider = httpProvider,
ReturnUrl = appConfig.MicrosoftAccountReturnUrl,
Scopes = appConfig.MicrosoftAccountScopes,
WebAuthenticationUi = this.webAuthenticationUi,
};
microsoftAccountServiceInfo.AuthenticationProvider = this.AuthenticationProvider?? new MicrosoftAccountAuthenticationProvider(microsoftAccountServiceInfo);
return Task.FromResult<ServiceInfo>(microsoftAccountServiceInfo);
}
var activeDirectoryServiceInfo = new ActiveDirectoryServiceInfo
{
AppId = appConfig.ActiveDirectoryAppId,
AuthenticationProvider = this.AuthenticationProvider,
ClientSecret = appConfig.ActiveDirectoryClientSecret,
CredentialCache = credentialCache,
HttpProvider = httpProvider,
ReturnUrl = appConfig.ActiveDirectoryReturnUrl,
};
return Task.FromResult<ServiceInfo>(activeDirectoryServiceInfo);
}