本文整理汇总了C#中StorageType类的典型用法代码示例。如果您正苦于以下问题:C# StorageType类的具体用法?C# StorageType怎么用?C# StorageType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StorageType类属于命名空间,在下文中一共展示了StorageType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Storage
public Storage(StorageType type) : base()
{
localFolder = ApplicationData.Current.LocalFolder;
path = type == StorageType.SECURE ? MPIN_STORAGE : USER_STORAGE;
this.Data = string.Empty;
}
示例2: LoadStorage
public Storage LoadStorage(Player player, StorageType type)
{
string SQL = "SELECT * FROM `inventory` WHERE "
+ "`playerid` = ?pid AND `storagetype` = ?type";
MySqlCommand cmd = new MySqlCommand(SQL, InventoryDAOConnection);
cmd.Parameters.AddWithValue("?pid", player.Id);
cmd.Parameters.AddWithValue("?type", type.ToString());
MySqlDataReader LoadStorageReader = cmd.ExecuteReader();
var storage = new Storage { StorageType = StorageType.Inventory };
if (LoadStorageReader.HasRows)
{
while (LoadStorageReader.Read())
{
if (LoadStorageReader.GetInt32(2) != 20000000)
{
StorageItem item = new StorageItem()
{
ItemId = LoadStorageReader.GetInt32(2),
Amount = LoadStorageReader.GetInt32(3),
Color = LoadStorageReader.GetInt32(4),
};
storage.Items.Add(LoadStorageReader.GetInt32(5), item);
}
else
{
storage.Money = LoadStorageReader.GetInt32(3);
}
}
}
LoadStorageReader.Close();
return storage;
}
示例3: CreateOrUpdateAccount
public async Task<AccountConfiguration> CreateOrUpdateAccount(StorageType type)
{
var newAccount = await _storageService.CreateAccount(type);
if (newAccount == null) return null;
var existingAccount = _configService.Accounts.SingleOrDefault(_ => _.Type == newAccount.Type && _.Id == newAccount.Id);
if (existingAccount == null) // New Account
{
// ensure account's name is unique
var i = 1;
var name = newAccount.Name;
while (
_configService.Accounts.Any(
_ => _.Type == newAccount.Type && _.Name.Equals(newAccount.Name, StringComparison.InvariantCultureIgnoreCase)))
{
i++;
newAccount.Name = string.Format("{0} ({1})", name, i);
}
_configService.Accounts.Add(newAccount);
return newAccount;
}
MessageService.ShowInfo("This account already exists.\r\nUpdating account data only.");
//existingAccount.Name = newAccount.Name;
existingAccount.Secret = newAccount.Secret;
return existingAccount;
}
示例4: GetImageCount
/// <summary>
/// Gets total number of images in a presentation from a 3rd party storage
/// </summary>
/// <param name="storageType"></param>
/// <param name="storageName">Name of the storage</param>
/// <param name="folderName">In case of Amazon S3 storage the folder's path starts with Amazon S3 Bucket name.</param>
/// <returns>Total number of images</returns>
public int GetImageCount(StorageType storageType, string storageName, string folderName)
{
//build URI to get image count
StringBuilder strURI = new StringBuilder(Product.BaseProductUri + "/slides/" + FileName
+ "/images" + (string.IsNullOrEmpty(folderName) ? "" : "?folder=" + folderName));
switch (storageType)
{
case StorageType.AmazonS3:
strURI.Append("&storage=" + storageName);
break;
}
string signedURI = Utils.Sign(strURI.ToString());
Stream responseStream = Utils.ProcessCommand(signedURI, "GET");
StreamReader reader = new StreamReader(responseStream);
string strJSON = reader.ReadToEnd();
//Parse the json string to JObject
JObject parsedJSON = JObject.Parse(strJSON);
//Deserializes the JSON to a object.
ImagesResponse imagesResponse = JsonConvert.DeserializeObject<ImagesResponse>(parsedJSON.ToString());
return imagesResponse.Images.List.Count;
}
示例5: AddItem
public bool AddItem(Player player, StorageType type, KeyValuePair<int, StorageItem> KeyVP)
{
string SQL = "INSERT INTO `inventory` "
+ "(`accountname`, `playerid`, `itemid`, `amount`, `color`, `slot`, `storagetype`) "
+ "VALUES(?accountname, ?pid, ?itemid, ?count, ?color, ?slot, ?type);";
MySqlCommand cmd = new MySqlCommand(SQL, InventoryDAOConnection);
cmd.Parameters.AddWithValue("?accountname", player.AccountName);
cmd.Parameters.AddWithValue("?pid", player.pid);
cmd.Parameters.AddWithValue("?itemid", KeyVP.Value.ItemId);
cmd.Parameters.AddWithValue("?count", KeyVP.Value.Count);
cmd.Parameters.AddWithValue("?color", KeyVP.Value.Color);
cmd.Parameters.AddWithValue("?slot", KeyVP.Key);
cmd.Parameters.AddWithValue("?type", type.ToString());
try
{
cmd.ExecuteNonQuery();
return true;
}
catch (Exception e)
{
Log.ErrorException("DAO: ADD ITEM ERROR!", e);
}
return false;
}
示例6: IsSigned
internal static bool IsSigned(StorageType type) {
return(type == StorageType.Int16 ||
type == StorageType.Int32 ||
type == StorageType.Int64 ||
type == StorageType.SByte ||
IsFloat(type));
}
示例7: DataExpression
internal DataExpression(DataTable table, string expression, Type type)
{
ExpressionParser parser = new ExpressionParser(table);
parser.LoadExpression(expression);
_originalExpression = expression;
_expr = null;
if (expression != null)
{
_storageType = DataStorage.GetStorageType(type);
if (_storageType == StorageType.BigInteger)
{
throw ExprException.UnsupportedDataType(type);
}
_dataType = type;
_expr = parser.Parse();
_parsed = true;
if (_expr != null && table != null)
{
Bind(table);
}
else
{
_bound = false;
}
}
}
示例8: SetBytes
internal int SetBytes(long fieldOffset, byte[] buffer, int bufferOffset, int length)
{
int dstOffset = (int) fieldOffset;
if (this.IsNull || (StorageType.ByteArray != this._type))
{
if (dstOffset != 0)
{
throw ADP.ArgumentOutOfRange("fieldOffset");
}
this._object = new byte[length];
this._type = StorageType.ByteArray;
this._isNull = false;
this.BytesLength = length;
}
else
{
if (dstOffset > this.BytesLength)
{
throw ADP.ArgumentOutOfRange("fieldOffset");
}
if ((dstOffset + length) > this.BytesLength)
{
int num2 = ((byte[]) this._object).Length;
if ((dstOffset + length) > num2)
{
byte[] dst = new byte[Math.Max((int) (dstOffset + length), (int) (2 * num2))];
Buffer.BlockCopy((byte[]) this._object, 0, dst, 0, (int) this.BytesLength);
this._object = dst;
}
this.BytesLength = dstOffset + length;
}
}
Buffer.BlockCopy(buffer, bufferOffset, (byte[]) this._object, dstOffset, length);
return length;
}
示例9: ClientStorageMoveSlotPacket
public ClientStorageMoveSlotPacket(long sourceSlot, long destSlot, StorageType storageType)
: this()
{
SourceSlot = sourceSlot;
DestSlot = destSlot;
StorageType = storageType;
}
示例10: DataExpression
internal DataExpression(DataTable table, string expression, Type type)
{
this.dependency = DataTable.zeroColumns;
ExpressionParser parser = new ExpressionParser(table);
parser.LoadExpression(expression);
this.originalExpression = expression;
this.expr = null;
if (expression != null)
{
this._storageType = DataStorage.GetStorageType(type);
if (this._storageType == StorageType.BigInteger)
{
throw ExprException.UnsupportedDataType(type);
}
this._dataType = type;
this.expr = parser.Parse();
this.parsed = true;
if ((this.expr != null) && (table != null))
{
this.Bind(table);
}
else
{
this.bound = false;
}
}
}
示例11: StorageTypeInfo
public StorageTypeInfo (StorageType storage_type, string name, string description)
{
Type = storage_type;
Name = name;
Description = description;
}
示例12: InventoryPage
internal InventoryPage(InventoryType type, StorageType storage, byte size, Item bag = null)
{
_type = type;
_storage = storage;
Size = size;
Bag = bag;
}
示例13: IsIntegerSql
internal static bool IsIntegerSql(StorageType type)
{
if (((((type != StorageType.Int16) && (type != StorageType.Int32)) && ((type != StorageType.Int64) && (type != StorageType.UInt16))) && (((type != StorageType.UInt32) && (type != StorageType.UInt64)) && ((type != StorageType.SByte) && (type != StorageType.Byte)))) && (((type != StorageType.SqlInt64) && (type != StorageType.SqlInt32)) && (type != StorageType.SqlInt16)))
{
return (type == StorageType.SqlByte);
}
return true;
}
示例14: IsFloatSql
internal static bool IsFloatSql(StorageType type)
{
if ((((type != StorageType.Single) && (type != StorageType.Double)) && ((type != StorageType.Decimal) && (type != StorageType.SqlDouble))) && ((type != StorageType.SqlDecimal) && (type != StorageType.SqlMoney)))
{
return (type == StorageType.SqlSingle);
}
return true;
}
示例15: IsFloat
internal static bool IsFloat(StorageType type)
{
if ((type != StorageType.Single) && (type != StorageType.Double))
{
return (type == StorageType.Decimal);
}
return true;
}