protected void Uppic(AuthorProfile ap) { if (fudPhoto.FileName == string.Empty) { return; } HttpPostedFile pf = fudPhoto.PostedFile; int intDocLen = pf.ContentLength; string contentType = pf.ContentType; byte[] Docbuffer = new byte[intDocLen]; Stream objStream; objStream = pf.InputStream; objStream.Read(Docbuffer, 0, intDocLen); Res res = new Res(); res.FileName = Path.GetFileName(pf.FileName); res.ResType = pf.ContentType; res.Description = "Profile"; res.Author = ap.UserName; res.Points = 0; res.Save(); res.CurrentPostFileBuffer = Docbuffer; res.BlobUpdate(); res.CurrentPostFileBuffer = null; ap.PhotoURL = res.Id.ToString(); }
public bool Process(AssemblyDefinition containingAssembly, Res resource, ResReader resourceReader, ResourceWriter resourceWriter) { if (!resource.IsBamlStream) return false; _bamlStreams.Add(resource, containingAssembly); return true; }
public bool Process( AssemblyDefinition containingAssembly, Res resource, ResReader resourceReader, ResourceWriter resourceWriter) { if (!resource.IsBamlStream) return false; resource.data = GetProcessedResource(resource, containingAssembly); return false; }
public bool Process(AssemblyDefinition containingAssembly, Res resource, ResReader resourceReader, ResourceWriter resourceWriter) { if (!resource.IsString) return false; string content = (string)resourceReader.GetObject(resource); content = _repackContext.FixStr(content); resourceWriter.AddResource(resource.name, content); return true; }
public bool Process(AssemblyDefinition containingAssembly, Res resource, ResReader resourceReader, ResourceWriter resourceWriter) { string fix = _repackContext.FixStr(resource.type); if (fix == resource.type) { resourceWriter.AddResourceData(resource.name, resource.type, resource.data); } else { var output2 = new MemoryStream(resource.data.Length); var sr = new SerReader(_repackContext, new MemoryStream(resource.data), output2); sr.Stream(); resourceWriter.AddResourceData(resource.name, fix, output2.ToArray()); } return true; }
private byte[] GetProcessedResource(Res resource, AssemblyDefinition containingAssembly) { BamlDocument bamlDocument = BamlUtils.FromResourceBytes(resource.data); foreach (BamlRecord node in bamlDocument) { Action<BamlRecord, AssemblyDefinition> recordProcessor; if (_nodeProcessors.TryGetValue(node.GetType(), out recordProcessor)) { recordProcessor(node, containingAssembly); } } //TODO: diminishing return optimisation: remove duplications + update assembly ids return BamlUtils.ToResourceBytes(bamlDocument); }
private void ApproveRess(Res cm) { bool found = false; for (int i = 0; i < Res.Ress.Count; i++) { if (Res.Ress[i].Id == cm.Id) { if (!cm.IsPublished) { Res.Ress[i].IsPublished = true; Res.Ress[i].Save(); } found = true; break; } if (found) { break; } } }
static internal Exception SmallDateTimeOverflow(string datetime) { return(ADP.Overflow(Res.GetString(Res.SQL_SmallDateTimeOverflow, datetime))); }
static internal Exception NullEmptyTransactionName() { return(ADP.Argument(Res.GetString(Res.SQL_NullEmptyTransactionName))); }
static internal Exception SynchronousCallMayNotPend() { return(new Exception(Res.GetString(Res.Sql_InternalError))); }
private static Res GetLoader() { if (loader == null) { lock (InternalSyncObject) { if (loader == null) { loader = new Res(); } } } return loader; }
//izvrsuvanje na gameover se zapisuva rezultatot i se zaveduva ako e pogolem od toa sto e vo file public void gameover() { Res k = new Res(); k.writes(resultat); }
/// <summary> /// Saves an existing field to the database /// </summary> /// <param name="category">field to be saved</param> public override void UpdateRes(Res res) { List<Res> Ress = Res.Ress; Ress.Remove(res); Ress.Add(res); string connString = ConfigurationManager.ConnectionStrings[connStringName].ConnectionString; string providerName = ConfigurationManager.ConnectionStrings[connStringName].ProviderName; DbProviderFactory provider = DbProviderFactories.GetFactory(providerName); using (DbConnection conn = provider.CreateConnection()) { conn.ConnectionString = connString; conn.Open(); using (DbCommand cmd = conn.CreateCommand()) { string sqlQuery = "UPDATE " + tablePrefix + "Res " + "SET FileName=@FileName,ResType=@ResType,Description=@Description,Author=@Author,IsPublished=@IsPublished,DateCreated=@DateCreated,Points=@Points " + "WHERE ResID=@ResID"; if (parmPrefix != "@") sqlQuery = sqlQuery.Replace("@", parmPrefix); cmd.CommandText = sqlQuery; cmd.CommandType = CommandType.Text; DbParameter dpID = provider.CreateParameter(); dpID.ParameterName = parmPrefix + "ResID"; dpID.Value = res.Id.ToString(); cmd.Parameters.Add(dpID); DbParameter dpFileName = provider.CreateParameter(); dpFileName.ParameterName = parmPrefix + "FileName"; dpFileName.Value = res.FileName.ToString(); cmd.Parameters.Add(dpFileName); DbParameter dpResType = provider.CreateParameter(); dpResType.ParameterName = parmPrefix + "ResType"; dpResType.Value = res.ResType; cmd.Parameters.Add(dpResType); DbParameter dpDescription = provider.CreateParameter(); dpDescription.ParameterName = parmPrefix + "Description"; dpDescription.Value = res.Description; cmd.Parameters.Add(dpDescription); DbParameter dpAuthor = provider.CreateParameter(); dpAuthor.ParameterName = parmPrefix + "Author"; dpAuthor.Value = res.Author; cmd.Parameters.Add(dpAuthor); DbParameter dpPublished = provider.CreateParameter(); dpPublished.ParameterName = parmPrefix + "IsPublished"; dpPublished.Value = res.IsPublished; cmd.Parameters.Add(dpPublished); DbParameter dpDateCreated = provider.CreateParameter(); dpDateCreated.ParameterName = parmPrefix + "DateCreated"; dpDateCreated.Value = res.DateCreated; cmd.Parameters.Add(dpDateCreated); DbParameter dpPoints = provider.CreateParameter(); dpPoints.ParameterName = parmPrefix + "Points"; dpPoints.Value = res.Points; cmd.Parameters.Add(dpPoints); cmd.ExecuteNonQuery(); } } }
static internal Exception NonLocalSSEInstance() { return(ADP.NotSupported(Res.GetString(Res.SQL_NonLocalSSEInstance))); }
// // SQL.DataCommand // static internal ArgumentOutOfRangeException NotSupportedEnumerationValue(Type type, int value) { return(ADP.ArgumentOutOfRange(Res.GetString(Res.SQL_NotSupportedEnumerationValue, type.Name, value.ToString(System.Globalization.CultureInfo.InvariantCulture)), type.Name)); }
static internal Exception MARSUnspportedOnConnection() { return(ADP.InvalidOperation(Res.GetString(Res.SQL_MarsUnsupportedOnConnection))); }
static internal Exception CannotModifyPropertyAsyncOperationInProgress([CallerMemberName] string property = "") { return(ADP.InvalidOperation(Res.GetString(Res.SQL_CannotModifyPropertyAsyncOperationInProgress, property))); }
static internal Exception InvalidPartnerConfiguration(string server, string database) { return(ADP.InvalidOperation(Res.GetString(Res.SQL_InvalidPartnerConfiguration, server, database))); }
static internal Exception InstanceFailure() { return(ADP.InvalidOperation(Res.GetString(Res.SQL_InstanceFailure))); }
static internal Exception ConnectionLockedForBcpEvent() { return(ADP.InvalidOperation(Res.GetString(Res.SQL_ConnectionLockedForBcpEvent))); }
public Score() { InitializeComponent(); Res k = new Res(); textBox1.Text = k.score.ToString(); }
static internal Exception OperationCancelled() { Exception exception = ADP.InvalidOperation(Res.GetString(Res.SQL_OperationCancelled)); return(exception); }
static internal Exception InvalidSSPIPacketSize() { return(ADP.Argument(Res.GetString(Res.SQL_InvalidSSPIPacketSize))); }
static internal Exception PendingBeginXXXExists() { return(ADP.InvalidOperation(Res.GetString(Res.SQL_PendingBeginXXXExists))); }
public override int UpateBlob(Res res) { string connString = ConfigurationManager.ConnectionStrings[connStringName].ConnectionString; string providerName = ConfigurationManager.ConnectionStrings[connStringName].ProviderName; DbProviderFactory provider = DbProviderFactories.GetFactory(providerName); using (DbConnection conn = provider.CreateConnection()) { conn.ConnectionString = connString; conn.Open(); using (DbCommand cmd = conn.CreateCommand()) { cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = tablePrefix + "UploadFilePrd"; DbParameter dpID = provider.CreateParameter(); dpID.ParameterName = parmPrefix + "ResID"; dpID.Value = res.Id.ToString(); cmd.Parameters.Add(dpID); DbParameter dpResType = provider.CreateParameter(); dpResType.ParameterName = parmPrefix + "ResType"; dpResType.Value = res.ResType; cmd.Parameters.Add(dpResType); DbParameter dpBlob = provider.CreateParameter(); dpBlob.ParameterName = parmPrefix + "Blob"; dpBlob.Value = res.CurrentPostFileBuffer; cmd.Parameters.Add(dpBlob); return cmd.ExecuteNonQuery(); } } }
static internal Exception NonXmlResult() { return(ADP.InvalidOperation(Res.GetString(Res.SQL_NonXmlResult))); }
public override byte[] GetBlob(Res res) { string connString = ConfigurationManager.ConnectionStrings[connStringName].ConnectionString; string providerName = ConfigurationManager.ConnectionStrings[connStringName].ProviderName; DbProviderFactory provider = DbProviderFactories.GetFactory(providerName); using (DbConnection conn = provider.CreateConnection()) { conn.ConnectionString = connString; using (DbCommand cmd = conn.CreateCommand()) { string sqlQuery = "SELECT Blob " + "FROM " + tablePrefix + "Res "+ "WHERE ResID = " + parmPrefix + "ResID"; cmd.CommandText = sqlQuery; cmd.CommandType = CommandType.Text; conn.Open(); DbParameter dpID = provider.CreateParameter(); dpID.ParameterName = parmPrefix + "ResID"; dpID.Value = res.Id.ToString(); cmd.Parameters.Add(dpID); using (DbDataReader rdr = cmd.ExecuteReader()) { if (rdr.Read()) { return ((Byte[])rdr["Blob"]); } else { return null; } } } } }
// // SQL.DataParameter // static internal Exception InvalidParameterTypeNameFormat() { return(ADP.Argument(Res.GetString(Res.SQL_InvalidParameterTypeNameFormat))); }
static internal Exception UserInstanceFailoverNotCompatible() { return(ADP.Argument(Res.GetString(Res.SQL_UserInstanceFailoverNotCompatible))); }
static internal Exception InvalidParameterNameLength(string value) { return(ADP.Argument(Res.GetString(Res.SQL_InvalidParameterNameLength, value))); }
static internal Exception MoneyOverflow(string moneyValue) { return(ADP.Overflow(Res.GetString(Res.SQL_MoneyOverflow, moneyValue))); }
static internal Exception PrecisionValueOutOfRange(byte precision) { return(ADP.Argument(Res.GetString(Res.SQL_PrecisionValueOutOfRange, precision.ToString(CultureInfo.InvariantCulture)))); }
private string GetResourceName(Res resource, AssemblyDefinition assembly) { if (assembly == _primaryAssemblyDefinition) return resource.name; return string.Format("{0}/{1}", assembly.Name.Name.ToLowerInvariant(), resource.name); }
static internal Exception TimeScaleValueOutOfRange(byte scale) { return(ADP.Argument(Res.GetString(Res.SQL_TimeScaleValueOutOfRange, scale.ToString(CultureInfo.InvariantCulture)))); }
protected void btnAdd_Click(object sender, EventArgs e) { HttpPostedFile pf = FileUpload.PostedFile; int intDocLen = pf.ContentLength; string contentType = pf.ContentType; byte[] Docbuffer = new byte[intDocLen]; Stream objStream; objStream = pf.InputStream; objStream.Read(Docbuffer, 0, intDocLen); Res res = new Res(); res.FileName = Path.GetFileName(pf.FileName); res.ResType = pf.ContentType; res.Description = txtDesription.Text; res.Author = Page.User.Identity.Name; res.Points = Convert.ToInt32(txtPoints.Text); res.Save(); res.CurrentPostFileBuffer = Docbuffer; if (res.BlobUpdate() > 0) { res.CurrentPostFileBuffer = null; Response.Redirect(Request.RawUrl); } }
static internal Exception UnsupportedTVPOutputParameter(ParameterDirection direction, string paramName) { return(ADP.NotSupported(Res.GetString(Res.SqlParameter_UnsupportedTVPOutputParameter, direction.ToString(), paramName))); }
private void RemoveRess(Res cm) { bool found = false; for (int i = 0; i < Res.Ress.Count; i++) { if (Res.Ress[i].Id == cm.Id) { Res.Ress[i].Delete(); Res.Ress[i].Save(); found = true; break; } if (found) { break; } } }
static internal Exception DBNullNotSupportedForTVPValues(string paramName) { return(ADP.NotSupported(Res.GetString(Res.SqlParameter_DBNullNotSupportedForTVP, paramName))); }
private void textBox1_TextChanged(object sender, EventArgs e) { Res k = new Res(); textBox1.Text = k.score.ToString(); }
static internal Exception UnexpectedTypeNameForNonStructParams(string paramName) { return(ADP.NotSupported(Res.GetString(Res.SqlParameter_UnexpectedTypeNameForNonStruct, paramName))); }
public Resource(Res r, int q) { TheResource = r; Quantity = q; }
private void _ProcessUsabilityResult(PluginDetails pluginType, Res<PluginExclusionReason, object> usabilityCheckResult) { if (usabilityCheckResult.Success) { pluginType.MarkAsUsable(); } else { pluginType.MarkAsUnusable(usabilityCheckResult.Result); } }
/// <summary> /// Returns a field /// </summary> /// <param name="id">Id of field to return</param> /// <returns></returns> public override Res SelectRes(Guid id) { List<Res> Ress = Res.Ress; Res res = new Res(); foreach (Res cat in Ress) { if (cat.Id == id) res = cat; } res.MarkOld(); return res; }
public static byte[] GetBlob(Res res) { LoadProviders(); return _provider.GetBlob(res); }
/// <summary> /// Deletes a field from the database /// </summary> /// <param name="res">field to be removed</param> public override void DeleteRes(Res res) { List<Res> infos = Res.Ress; infos.Remove(res); string connString = ConfigurationManager.ConnectionStrings[connStringName].ConnectionString; string providerName = ConfigurationManager.ConnectionStrings[connStringName].ProviderName; DbProviderFactory provider = DbProviderFactories.GetFactory(providerName); using (DbConnection conn = provider.CreateConnection()) { conn.ConnectionString = connString; conn.Open(); using (DbCommand cmd = conn.CreateCommand()) { string sqlQuery = "DELETE FROM " + tablePrefix + "Res WHERE ResID = " + parmPrefix + "ResID"; cmd.CommandText = sqlQuery; cmd.CommandType = CommandType.Text; DbParameter dpID = provider.CreateParameter(); dpID.ParameterName = parmPrefix + "ResID"; dpID.Value = res.Id.ToString(); cmd.Parameters.Add(dpID); cmd.ExecuteNonQuery(); } } }
public static int UpdateBlob(Res res) { LoadProviders(); return _provider.UpateBlob(res); }
/// <summary> /// Gets all categories in database /// </summary> /// <returns>List of categories</returns> public override List<Res> FillRess() { List<Res> infos = new List<Res>(); string connString = ConfigurationManager.ConnectionStrings[connStringName].ConnectionString; string providerName = ConfigurationManager.ConnectionStrings[connStringName].ProviderName; DbProviderFactory provider = DbProviderFactories.GetFactory(providerName); using (DbConnection conn = provider.CreateConnection()) { conn.ConnectionString = connString; using (DbCommand cmd = conn.CreateCommand()) { string sqlQuery = "SELECT ResID,FileName,ResType,Description,Author,IsPublished,DateCreated,Points " + "FROM " + tablePrefix + "Res "; cmd.CommandText = sqlQuery; cmd.CommandType = CommandType.Text; conn.Open(); using (DbDataReader rdr = cmd.ExecuteReader()) { if (rdr.HasRows) { while (rdr.Read()) { Res inf = new Res(); inf.Id = new Guid(rdr.GetGuid(0).ToString()); inf.FileName = rdr.GetString(1); inf.ResType = rdr.GetString(2); inf.Description = rdr.GetString(3); inf.Author = rdr.GetString(4); inf.IsPublished = rdr.GetBoolean(5); inf.DateCreated = rdr.GetDateTime(6); inf.Points = rdr.GetInt32(7); infos.Add(inf); inf.MarkOld(); } } } } } return infos; }
protected void btnAdd_Click(object sender, EventArgs e) { GetCurrentRess(); HttpPostedFile pf = FileUpload.PostedFile; int intDocLen = pf.ContentLength; string contentType = pf.ContentType; if (_excellent.Ress.Count >= 5) { lblMess.Text = "上传图片文件数目已达上限!"; lblMess.Visible = true; return; } if (!contentType.ToLower().StartsWith("image")) { lblMess.Text = "请选择图片类型的文件!"; lblMess.Visible = true; return; } else { lblMess.Text = ""; lblMess.Visible = false; } byte[] Docbuffer = new byte[intDocLen]; Stream objStream; objStream = pf.InputStream; objStream.Read(Docbuffer, 0, intDocLen); Res res = new Res(); res.FileName = Path.GetFileName(pf.FileName); res.ResType = pf.ContentType; res.Description = "Update by Excellent"; res.Author = User.Identity.Name; res.IsPublished = true; res.Save(); res.CurrentPostFileBuffer = Docbuffer; if (res.BlobUpdate() > 0) { res.CurrentPostFileBuffer = null; //_excellent.TempAddRess.Add(res, "Add"); _excellent.AddRes(res); BindGrid(); } }
static internal Exception ParameterInvalidVariant(string paramName) { return(ADP.InvalidOperation(Res.GetString(Res.SQL_ParameterInvalidVariant, paramName))); }
static internal Exception InvalidSQLServerVersionUnknown() { return(ADP.DataAdapter(Res.GetString(Res.SQL_InvalidSQLServerVersionUnknown))); }
/// <summary> /// Deletes the specified Res from the current provider. /// </summary> public static void DeleteRes(Res res) { LoadProviders(); _provider.DeleteRes(res); }
static internal Exception MustSetTypeNameForParam(string paramType, string paramName) { return(ADP.Argument(Res.GetString(Res.SQL_ParameterTypeNameRequired, paramType, paramName))); }
/// <summary> /// Persists a new Res in the current provider. /// </summary> public static void InsertRes(Res res) { LoadProviders(); _provider.InsertRes(res); }
static internal Exception EnumeratedRecordMetaDataChanged(string fieldName, int recordNumber) { return(ADP.Argument(Res.GetString(Res.SQL_EnumeratedRecordMetaDataChanged, fieldName, recordNumber))); }
/// <summary> /// Updates an exsiting Res. /// </summary> public static void UpdateRes(Res res) { LoadProviders(); _provider.UpdateRes(res); }
static internal Exception EnumeratedRecordFieldCountChanged(int recordNumber) { return(ADP.Argument(Res.GetString(Res.SQL_EnumeratedRecordFieldCountChanged, recordNumber))); }
protected void btnUppic_Click(object sender, EventArgs e) { HttpPostedFile pf = fudPhoto.PostedFile; int intDocLen = pf.ContentLength; string contentType = pf.ContentType; if (!contentType.ToLower().StartsWith("image")) { lblMess.Text = "请选择图片类型的文件!"; lblMess.Visible = true; return; } else if (pf.InputStream.Length> 512000 ) { lblMess.Text = "选择图片文件大小超过500K!"; lblMess.Visible = true; return; } else { lblMess.Text = ""; lblMess.Visible = false; } if (lbUpPicId.Text != string.Empty) { Res rsd = Res.GetRes(new Guid(lbUpPicId.Text)); rsd.Delete(); rsd.Save(); } byte[] Docbuffer = new byte[intDocLen]; Stream objStream; objStream = pf.InputStream; objStream.Read(Docbuffer, 0, intDocLen); Res res = new Res(); res.FileName = Path.GetFileName(pf.FileName); res.ResType = pf.ContentType; res.Description = "Profile"; res.Author = Page.User.Identity.Name; res.Points = 0; res.Save(); res.CurrentPostFileBuffer = Docbuffer; res.BlobUpdate(); res.CurrentPostFileBuffer = null; string userProfileToSave = ViewState["selectedProfile"] as string; AuthorProfile pc = AuthorProfile.GetProfile(userProfileToSave); if (pc == null) pc = new AuthorProfile(userProfileToSave); pc.PhotoURL = lbUpPicId.Text = res.Id.ToString(); pc.Save(); SetImageUrl(pc.PhotoURL); }
// // SQL.SqlDataAdapter // // // SQL.TDSParser // static internal Exception InvalidTDSVersion() { return(ADP.InvalidOperation(Res.GetString(Res.SQL_InvalidTDSVersion))); }
static internal Exception ParsingError() { return(ADP.InvalidOperation(Res.GetString(Res.SQL_ParsingError))); }
/// <summary> /// Deletes a Res from the data store specified by the provider. /// </summary> public abstract void DeleteRes(Res res);