本文整理汇总了C#中ObjectType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectType.ToString方法的具体用法?C# ObjectType.ToString怎么用?C# ObjectType.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectType
的用法示例。
在下文中一共展示了ObjectType.ToString方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetObjectsByOptionalData
public int[] GetObjectsByOptionalData (ObjectType objectType, ObjectOptionalDataType dataType, string data)
{
List<int> objectIds = new List<int>();
using (DbConnection connection = GetMySqlDbConnection())
{
connection.Open();
DbCommand command =
GetDbCommand(
"SELECT" + objectOptionalDataFieldSequence + "WHERE ObjectTypes.Name='" + objectType.ToString() + "' " +
"AND ObjectOptionalDataTypes.Name='" + dataType.ToString() + "' " +
"AND ObjectOptionalData.Data='" + data.Replace("'", "''") + "';", connection);
using (DbDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
objectIds.Add(reader.GetInt32(1));
}
return objectIds.ToArray();
}
}
}
示例2: GetObjectTypeString
protected string GetObjectTypeString(ObjectType objectType)
{
return objectType.ToString().ToLower();
}
示例3: ProcessObject
private void ProcessObject(XmlElement xmlElement, ObjectType objectType, IExtendedProperties smoObject)
{
// Delete old ExtendedProperties
while (smoObject.ExtendedProperties.Count > 0) smoObject.ExtendedProperties[0].Drop();
// Dictionary to hold new properties, required for mergin multiple tags
Dictionary<string, string> properties = new Dictionary<string, string>();
foreach (XmlElement e in xmlElement.ChildNodes)
{
// Try to parse as subitem (column, param)
ParameterType pt = ParameterType.Unknown;
bool subitem = Enum.TryParse<ParameterType>(e.Name, true, out pt);
if (subitem)
{
// Process tag as subitem
if (!Constants.TagPairs[objectType].Contains(pt))
{
throw new Exception(String.Format("Invalid tag found, '{0}' cannot be part of '{1}'", pt.ToString(), objectType.ToString()));
}
IExtendedProperties paramobject;
string name = e.Attributes[Constants.AttributeName].Value.Trim('[', ']');
switch (objectType)
{
case ObjectType.Table:
paramobject = ((Table)smoObject).Columns[name];
break;
case ObjectType.View:
paramobject = ((View)smoObject).Columns[name];
break;
case ObjectType.Procedure:
paramobject = ((StoredProcedure)smoObject).Parameters[name];
break;
case ObjectType.Function:
switch (pt)
{
case ParameterType.Param:
paramobject = ((UserDefinedFunction)smoObject).Parameters[name];
break;
case ParameterType.Column:
paramobject = ((UserDefinedFunction)smoObject).Columns[name];
break;
default:
throw new NotImplementedException();
}
break;
default:
throw new Exception("Invalid tag found.");
}
ProcessParameter(e, paramobject);
}
else
{
if (properties.Keys.Contains<string>(e.Name))
{
// merge
string s = properties[e.Name];
s += Environment.NewLine + e.InnerXml;
properties[e.Name] = s;
}
else
{
// new
properties.Add(e.Name, e.InnerXml);
}
}
}
// Save extended properties
foreach (string key in properties.Keys)
{
AddExtendedProperty(key, properties[key], smoObject);
}
}
示例4: GetObjectTypeString
private String GetObjectTypeString(ObjectType objectType)
{
return objectType.ToString().ToLower();
}
示例5: ConnectMe
public IPEndPoint ConnectMe(ObjectType type, string name)
{
if ((int)type >= receipentList.Length ||
string.IsNullOrEmpty(name) ||
string.IsNullOrWhiteSpace(name))
{
return null;
}
IPEndPoint id = GetCurrentEndpoint();
IPEndPoint outendpoint;
if (!receipentList[(int)type].TryGetValue(name, out outendpoint))//add new client
{
trafficMessages.Add(id, new TrafficClient());
receipentList[(int)type].Add(name, id);
}
else if (outendpoint != id)//move client to new ip:port
{
TrafficClient client = trafficMessages[outendpoint];
trafficMessages.Remove(outendpoint);
trafficMessages.Add(id, client);
}
switch (type)
{
case ObjectType.Station:
{
Station s = new Station(name);
s = administration.Add(s);
s.Address = id;
}
break;
//case ObjectType.Train:
//{
// administration.Add(new Train(name, 999));
//}
//break;
}
Console.WriteLine("ConnectMe(" + type.ToString() + ", " + name + ")::('" + id.ToString() + "');");
return id;
}
示例6: Delete
static void Delete (ObjectType type, X509Store store, string hash, bool verbose)
{
switch (type) {
case ObjectType.Certificate:
foreach (X509Certificate x509 in store.Certificates) {
if (hash == CryptoConvert.ToHex (x509.Hash)) {
store.Remove (x509);
Console.WriteLine ("Certificate removed from store.");
return;
}
}
break;
case ObjectType.CRL:
foreach (X509Crl crl in store.Crls) {
if (hash == CryptoConvert.ToHex (crl.Hash)) {
store.Remove (crl);
Console.WriteLine ("CRL removed from store.");
return;
}
}
break;
default:
throw new NotSupportedException (type.ToString ());
}
}
示例7: List
static void List (ObjectType type, X509Store store, string file, bool verbose)
{
switch (type) {
case ObjectType.Certificate:
foreach (X509Certificate x509 in store.Certificates) {
DisplayCertificate (x509, verbose);
}
break;
case ObjectType.CRL:
// TODO
break;
default:
throw new NotSupportedException (type.ToString ());
}
}
示例8: Add
static void Add (ObjectType type, X509Store store, string file, bool verbose)
{
switch (type) {
case ObjectType.Certificate:
X509CertificateCollection coll = LoadCertificates (file);
foreach (X509Certificate x509 in coll) {
store.Import (x509);
}
Console.WriteLine ("{0} certificate(s) added to store {1}.",
coll.Count, store.Name);
break;
case ObjectType.CRL:
ArrayList list = LoadCRLs (file);
foreach (X509Crl crl in list) {
store.Import (crl);
}
Console.WriteLine ("{0} CRL(s) added to store {1}.",
list.Count, store.Name);
break;
default:
throw new NotSupportedException (type.ToString ());
}
}
示例9: Read
public byte[] Read(object data, ObjectType type, int AttributeOrdinal)
{
LastTransaction = DateTime.Now;
if (data is GXDLMSObject)
{
GXDLMSObject obj = data as GXDLMSObject;
data = obj.Name;
}
byte[] tmp = m_Cosem.Read(data, type, AttributeOrdinal)[0];
GXLogWriter.WriteLog(string.Format("Reading object {0} from interface {1}", data.ToString(), type.ToString()), tmp);
return tmp;
}
示例10: SaveEvent
public static string SaveEvent(ObjectType objType, EventType eventType)
{
return String.Format("INSERT INTO `events` (object_type, event_type) VALUES ('{0}', '{1}')", objType.ToString(),
eventType.ToString());
}
示例11: ImportKey
static void ImportKey (ObjectType type, bool machine, string file, string password, bool verbose)
{
switch (type) {
case ObjectType.Certificate:
X509CertificateCollection coll = LoadCertificates (file, password, verbose);
int count = 0;
foreach (X509Certificate x509 in coll) {
RSACryptoServiceProvider pk = x509.RSA as RSACryptoServiceProvider;
if (pk == null || pk.PublicOnly)
continue;
CspParameters csp = new CspParameters ();
csp.KeyContainerName = CryptoConvert.ToHex (x509.Hash);
csp.Flags = machine ? CspProviderFlags.UseMachineKeyStore : 0;
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider (csp);
rsa.ImportParameters (pk.ExportParameters (true));
rsa.PersistKeyInCsp = true;
count++;
}
Console.WriteLine ("{0} keys(s) imported to KeyPair {1} persister.",
count, machine ? "LocalMachine" : "CurrentUser");
break;
default:
throw new NotSupportedException (type.ToString ());
}
}
示例12: LogQueryBuilding
private void LogQueryBuilding(ObjectType queryType)
{
this.logger.InfoFormat("Building {0} query", queryType.ToString());
}