|
Not certain what embedding as a resource means exactly. However, I would need to be able to overwrite them when more current files are available. If I embedded them as a binary file somehow, if that is what you mean, could that be overwritten utilizing a binary writer in System.IO.BinaryWriter, or something?
I need to be able to have the user overwrite the files when properly interacting with the application, but I do not want the user to be able to overwrite the graphics files while the program is not running. Otherwise, the user could set the graphics to something that is an unintended usage for the program. Meaning, I do not want undesirable graphic files overwriting the intended graphic files for the application.
Could you kindly enlighten me about what you mean by embedding it as a resource. I would appreciate it. Thanks
|
|
|
|
|
It means that you make the file part of the project, and then select 'embed as resource' from the properties for the file. This means the file is part of the exe, and loaded from the exe, but it therefore means you cannot edit it.
Now that I understand the problem, I'd recommend some sort of digital signature on your images, so that you can reject images that don't fit it. There are articles on embedding a string in an image on this site, that's probably how I'd go.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
(1) The application does not change the graphics.
Try Christian Graus' solution.
(2) The application changes the graphics.
Change the filenames, so that the user does not recognise them as graphics files.
If that's not possible, save a backup of the files everytime the application is being closed (in /data/important.dat, or something like that). On next start, check last modification time and, if the backups are older than the original, restore the backups.
(3) The application won't crash with different images, you just don't like them to get changed.
Embed a watermark in the graphics, and try to extract it whenever the application starts. Refuse to run, if the watermark is not okay.
_________________________________
Vote '1' if you're too lazy for a discussion
|
|
|
|
|
Not certain exactly how to embed a watermark in a .gif file. Isn't a .gif file the equivalent of a raster graphics file, while a watermark would require something like a vector-based photoshop file so that the watermark could be somehow extracted and compared to some text value? Also, I would need to be able to overwrite them when more current files are available.
I like the idea of changing the properties of the files to readonly, system and hidden that smbecker had suggested, but then I would need to also be able to hide the folder in which the files are stored. If I embedded them as a binary file somehow, if that is what you mean, could that be overwritten utilizing a binary writer in System.IO.BinaryWriter, or something?
I need to be able to have the user overwrite the files when properly interacting with the application, but I do not want the user to be able to overwrite the graphics files while the program is not running. Otherwise, the user could set the graphics to something that is an unintended usage for the program.
Could you kindly enlighten me about how to store the graphic files in a .dat file that could be overwritten by the application when the user interacts with the program properly? I also need to be able to prevent the user from deleting the folder or the files entirely so some interaction with the O/S is necessary via the System.IO.FileAttributes.System interface which restricts what the user can do with files.
Also, with above Windows 2000, graphic files when right-clicked have permissions provided, could C# interface with these properties and change those when the application interacts with them properly when running? To see what I mean, simple right-click on a graphics file when using above Windows 2000. Could these permissions be interfaced with as well as utilizing the .Hidden and .System and .ReadOnly attributes of FileAttributes?
I seriously doubt that an end user would know that they would be required to not only find the file folder, then the files, then change the attributes of the files, and then change the permission to the files provided by right clicking on them. Would these steps be enough to protect the graphic files?
I would appreciate more assistance. Thanks
|
|
|
|
|
There is no way to prevent a user if he's really set on it to modify a file when the application thats supposed to gaurd it is not running. Not even marking it as readonly/systemfile/hidden really works if the user knows where to look.
However, u can make the task as hard as u can. Some ideas could be (many more possibilities but dont have the time to really think through all of them ):
1)Change extension of files so the user or image viewing/editing applications dont recognize them as images. U could even encrypt the byte array so that even if the user is smart enough to recognize the files, he still wont be able to process the images.
2)Save them in "obscure folders" the user will normally not interact/look in: For example the user's Application Data folder in Documents and Settings
3)If the images are not really big u could even think about saving them into the registry as byte arrays (I think its possible)
|
|
|
|
|
new_phoenix wrote:
Not certain exactly how to embed a watermark in a .gif file.
You can embed a certain code in a .gif file, there are two different methods:
(1) GIF Shuffle: Good for images with a palette of 256 colors, or very small watermarks. Google for it, there are several examples on the web.
(2) Palette Stretching: Not perfect, but might be okay for images with a small palette, where GIF Shuffle could not embed enough bits. There's an article on CP.[^]
how to store the graphic files in a .dat file
Copy the file an rename it from *.gif to *.dat. Users will need a while to find it.
You can also encrypt the images when writing the .dat file. Search CP for Encrypted Streams, I think there is an example, too.
_________________________________
Vote '1' if you're too lazy for a discussion
|
|
|
|
|
I have this code for getting the column names of a table in an Access database:
<br />
DataTable schemaColumns = Conn.GetOleDbSchemaTable(OleDbSchemaGuid.Columns,<br />
new object[] {null, null, tableName, null});<br />
<br />
foreach (DataRow column in schemaColumns.Rows)<br />
{<br />
string columnName = (string) column["COLUMN_NAME"];<br />
...<br />
but it is returning the column names already sorted, is there a way to get them in the order they were created? (this is what I get when opening the database in Access)
thanks
|
|
|
|
|
supose we have a page (PAGE_A) that it have several link in other pages.
How we can detect the SENDER page?
from wich page and with witch link?
|
|
|
|
|
|
Hi.
How i can create a lookup field in a bind datagrid?(WEB)
thanks
|
|
|
|
|
I have managed to display a Microsoft Access database in C# using ADO.NET.
Now I would like to do the same thing but now using Microsoft Excel database to be displayed.
Any tips?
Much appreciated.
|
|
|
|
|
Excel is not a database.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
ok fine they are not databases. they are spreadsheets or some such thing.
I'd like some REAL help here please. Thank you.
|
|
|
|
|
You can do this with ADO.Net. Just change the connection string to :
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\myfiles\\myworkbook.xls;Extended Properties=\"Excel 8.0;\""
(note the escaped backslash and quote characters. Data Source needs to be full path to the workbook file, UNC paths are ok if you have sufficient permissions to the location).
Table Name will be the worksheet name with '$" appended (e.g [Sheet1$] ).
If the spreadsheed contains mixed numeric and text data in the same column, you may wish to add to the "extended properties part IMEX =1
( ";Extended Properties=\"Excel 8.0;IMEX=1\"") to force all the columns to map to string data types (otherwise things get ugly when a column is misidentified as numeric and a non-convertible string is encountered after the first 8 rows or so).
Good luck.
Anger is the most impotent of passions. It effects nothing it goes about, and hurts the one who is possessed by it more than the one against whom it is directed.
Carl Sandburg
|
|
|
|
|
hi rob
thanks for the tips!
It helps a lot.
Appreciate it tons.
|
|
|
|
|
I am using the Novell.Directory.LDAP.dll v2.0.3600.0 taken from Mono v1.0.5.
This library is meant to have functionalities similar to .NET DirectoryServices, which unfortunately cannot be used with IBM Directory Server.
I tried binding using the following code:
ldapConn= new LdapConnection();<br />
ldapConn.Connect(txtServerAddress.Text,Int32.Parse(txtServerPort.Text));
and got the following error:
Connection.freeWhiteSemaphore(0): thread does not own the semaphore, owned<br />
by -2
It seems that the source of the error is from
Novell.Directory.Ldap.Connection.freeWriteSemaphore(Int32 msgId)\r\n .
Does anyone know why this happened and how to resolve it?
I'm using VS .NET 2003 on a WinXP Pro connecting to (1) ActiveDirectory
and (2) IBM Directory Server on Win2K.
[Edit]There is no problem connecting with LDAP.dll v1.0 that doesn't require Mono.Security.
I'm assuming the code resulting in the above problem has not been added.[/Edit]
Thanks,
Edbert
|
|
|
|
|
Turned out that Mono has 2 sets of DLLs for .NET Framework 1.1 and 2.0
Next time I should read more carefully what the difference between net_1_1 directory and net_2_0 directory is.
Edbert P.
Sydney, Australia.
|
|
|
|
|
Hello,
Is there a way for me to add comma separators to my numbers using some formatting option? (For example 151238.34 becomes 151,238.34 and 13752375.92 becomes 13,752,375.92 etc.) What formatting option should I use?
I see that I can use # as an integer placeholder so I can use something like "#,##0.00" but how about if the numbers are more than 4 digits long begore the decimal? Is there a formatting option I can use regardless of the size of the double?
Thanx
-Flack
|
|
|
|
|
You can use regular expressions to create this number format, it's a commonly documented problem. I dunno if it's possible with a formatting option.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
|
Not certain what is required when developing a packaging and deployment application for a C# windows program with several forms. First, when the application is built using the Build menu command, does it incorporate the forms into the executable itself, or do the forms need to be included individually into the application. If they are required to be individually included into the application, then is there perhaps some way that these files could ALL be converted to individual .dll files or even incorporated into a single .dll files, or something? It would seem to me that if each file were required to be included into the application individually, that they would be too vulnerable -- any suggestions?
Also, when the path to files are written in the code for your application, and the files are expected to be stored in "C:/windows/" directory, for example, the package and deployment folder for Windows could store the files in WINNT or in Windows based upon which operating system is loaded onto the client computer. Since the programmer does not know what operating system the user is utilizing, how would the programmer write the path information to where the files are expected to be installed by the installer? That is, is there some environmental variables code that would work with the package and deployment program in which the deployment application makes the determination where to store the files during installation, and the code path to the files would agree with that path decision? Is there some code like Application.windir() or something?
Third question. If an application required the installation of other applications, or even the .NET framework itself, does the package and deployment application provide a transparent way of installing these applications first without the end user realizing that they are being installed? We have all seen the applications that have several installation modules included, and they are considerably bothersome to the end user. I would like to install the other applications and even the .NET framework transparently without the end user knowing that it is occurring. That is, if the .NET framework is installed already, then ignore, else install. If the third party application is installed already, do likewise. Any ideas?
Would really appreciate the input on these questions, as I do believe that others would like to hear the answer as well. Thanks.
|
|
|
|
|
What forms are you talking about? Any forms or any other classes you defined in your assemblies will be in those assemblies. You need to add your assemblies to a folder, though, by opening the Folder editor from the View menu, then add project output (best, rather than file paths, since they establish build dependencies with the dependent projects). Now those files get installed. Windows Installer does not muck with your files and is not specific to the .NET Framework (it's used for most Microsoft applications and libraries, as well as many, many third-party applications and libraries). It will not "convert" into a single DLL.
If you want only a single DLL then you need to define all your classes in a single project. Once again, Windows Installer installs files, registry keys, etc. It does not change your compiled code.
You need to pick which folder the files go into using the Folder editor. You really need to start by reading the documentation if you're having trouble figuring out. Read Deploying Applications and Components[^] in the VS.NET product documentation, especially the walk-throughs.
Regarding your third question - as also documented for the Windows Installer projects that are included in VS.NET and are very limited, BTW - the .NET Framework is not installed by the Windows Installer package that is produced in VS.NET. You need to use or create a bootstrap application that installs the .NET Framework if necessary, the proceeds to install your application. Read Dotnetfx.exe Deployment Scenarios[^] in the .NET Framework SDK, specifically the Creating a Single Setup Project[^] sub-section.
In "Whidbey" (.NET 2.0) a bootstrapper will be included with the installer projects, as of beta 1.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi,(new to programming)
I populate a datatable with a dataadapter
myDAdapter1.Fill(myDTableItems);
This is probably a silly question, but...
Is it possible to append the datatable data with the dataadapter?
I want to keep adding rows to the existing table using the dataadapter. This is probably not possible, or even a good idea?
PS - not needing to use the dataadapter to update the original database.
thanks,
Ron
|
|
|
|
|
That's the default behavior for DataAdapter derivatives if you read the .NET Framework SDK documentation for the class. Rows are added or refreshed (based on key information, if your DataTable defines key columns) when you fill an existing DataTable .
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I have question about browsable in propertygrid. I am trying to change browsable 's bool value bec sometimes it dont need to show all properties. Like sometimes First dont need to be browsable. I am well-aware that I cant change the browsable's value bec it need to be constant variable while it is run-time. what is your suggestions tht I can change browsable 's bool value while it is run-time?
For example:
for()
{
[Browsable(???)] or [SwitchBrowsable(type,propertyName,bool)]//////can be true or false
public string First
{
get { return m_strFirst; }
set { m_strFirst = value; }
}
[Browsable(???)] or [SwitchBrowsable(type,propertyName,bool)]///can be true or false
public string Second
{
get { return m_strSecond; }
set { m_strSecond = value; }
}
[Browsable(????)] or [SwitchBrowsable(type,propertyName,bool)]//////can be true or false
public string Third
{
get { return m_strThird; }
set { m_strThird = value; }
}
}
I made this function to change true to false from browable but it wont let
me to change bec it is readonly so it wont work or I may overlooking something.
public static void SwitchBrowsable(Type type, string propertyName)
{
try
{
object[] o = type.GetProperty(propertyName).GetCustomAttributes(typeof(BrowsableAttribute), true);
if (o != null && o.Length > 0)
{
BrowsableAttribute ba = o[0] as BrowsableAttribute;
bool test = ba.Browsable;
//ba.Browsable = !ba.Browsable;
test = false;
//ba.Browsable = false;
//ba.Browsable = !ba.Browsable;
}
}
catch(Exception error)
{
Debug.Assert(false);
//CExceptionLib.DisplayErrorMessage(error);
}
}
|
|
|
|
|