|
Probably the best way to do it is with Whitespace. Most people will open the source code file and see nothing. You will see a perfectly formatted program ready to do your bidding!
Hogan
-- modified at 15:57 Tuesday 6th November, 2007
|
|
|
|
|
What you're asking is insane. You can obsfucate the code inside the exe, but with .NET people will always be able to read it. To say people can't see it if they have it, is just plain ridiculous.
You *could* write some sort of add in that encrypts the source code as it's saved and decrypts it into the IDE, but why bother ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
You can obfuscate your executable code, but you cannot secure your source code from others seeing it.
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
I developed a windows application using C# and I want to license it to the buyer using a serial number, like any software one buys, but I don’t know how to do it. Can anyone help me on this?
|
|
|
|
|
There are third party solutions, it depends how far you want to go. Do you want to generate licenses, or have a single key ? The easiest way to generate them is have a name/key pair, so the key is generated from the name.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Below is my code and everytime I try to create a Folder it gives me an error which is in the Exception"00810". So, I dont know where the error lies?? Can someone please help?? Thanks.
private void btnCreate_Click(object sender, EventArgs e)
{
try
{
if (tvFavorites.SelectedNode.Tag == null)
{
OleDbCommand insertfolder = new OleDbCommand("insert into favFolders (folder_name,folder_parent) values('" + txtFolderName.Text + "'," + tvFavorites.SelectedNode.Name + ") ", dbProfiles);
if (dbProfiles.State == ConnectionState.Closed)
dbProfiles.Open();
insertfolder.ExecuteNonQuery();
string folder_id = "";
insertfolder.CommandText = "select max(folder_id) from favFolders";
folder_id = insertfolder.ExecuteScalar().ToString();
TreeNode tn = new TreeNode();
tn.Name = folder_id;
tn.Text = txtFolderName.Text;
tvFavorites.SelectedNode.Nodes.Add(tn);
dbProfiles.Close();
}
else
{
OleDbCommand insertfolder = new OleDbCommand("insert into favFolders (folder_name,folder_parent) values('" + txtFolderName.Text + "'," + tvFavorites.SelectedNode.Parent.Name + ") ", dbProfiles);
if (dbProfiles.State == ConnectionState.Closed)
dbProfiles.Open();
insertfolder.ExecuteNonQuery();
string folder_id = "";
insertfolder.CommandText = "select max(folder_id) from favFolders";
folder_id = insertfolder.ExecuteScalar().ToString();
TreeNode tn = new TreeNode();
tn.Name = folder_id;
tn.Text = txtFolderName.Text;
tvFavorites.SelectedNode.Parent.Nodes.Add(tn);
dbProfiles.Close();
}
txtFolderName.Text = "";
lblFolderName.Visible = false;
txtFolderName.Visible = false;
btnCreate.Visible = false;
btnCancel.Visible = false;
}
catch (Exception ex)
{
func.ErrorReporter(ex, "008010");
}
}
|
|
|
|
|
What line gives the error ? What do you mean by 'create folder', how does this code access the file system ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
btnCreate_Click event creates or supposed to create a Folder. But everytime I click on btnCreate Button to create a button it gives me an error message "Object not set to an instance of an object" The file system is accessed through Access Database
|
|
|
|
|
Hi,
I am running my desktop application in a machine wich its regional settings is configured to English - United States(I cant change this) and I am using a DateTimePicker with "dd/MM/yy HH:mm:ss" as the CustomFormat and Custom as the format.
In the design mode I can see the value of the datetimepicker as the format I specified but when I execute my app it comes as "MM/dd/yy HH:mm:ss".
any ideas ?
JMaior
|
|
|
|
|
Hi,
How can I hide a exe file from user in my project.(setup file of my project in CD)?
My mean of hide IS NOT invisible, in fact in accessible. because I want to prevent my users do reverse engineering on my exe file.
what is your solution?
Best wishes
|
|
|
|
|
Try to Obfsucate your code. That is the best way in C#. They will always be able to get to the code. The goal is to make it very hard to read.
Several companies offer this software.
Hogan
|
|
|
|
|
I retrevied the Images from Database And Display In datalist.
I used Two Buttons(prev and Next).
Here I place one image control at the top.
At Bottom In datalist All the Images is displaying.
At first in that image control first image will be displaying.
if we click next button then next image will be displayed.
if we click previous button then previous image will be displayed.
Here this buttons is not working.please Send the code In Detail Immediatly.
Its Urgent.
Thanking You,
CWAHHHHHH
|
|
|
|
|
I have a fairly simple client/server structure using System.Net.Sockets, where the server only sends data to a collection of clients, and the clients only receive data, so, the data flow is unidirectional. My server sends the same data to each of the connected clients, at the same time through a for loop. The loop sends the data, or removes the client if it has disconnected. My problem is when the client disconnects, it can cause the server program to pause.
This is where the server distributes the data:
<br />
for (int i = Clients.Count - 1; i >= 0; i--)<br />
{<br />
if (((Client)Clients[i]).isAlive() && serve)<br />
{<br />
((Client)Clients[i]).send(data.get_bytes());<br />
}<br />
else<br />
{<br />
((Client)Clients[i]).Stop();
Clients.RemoveAt(i);<br />
}<br />
Also in the server code, there is a client handling class, and this is the send function used above:
<br />
try<br />
{<br />
ns.Write(sendB, 0, sendB.Length);<br />
}<br />
catch (***Exception) { }
<br />
I would like to keep it simple and have the client disconnect, whether or not the client disconnected on purpose, or the connection is cut. The actual client code is simple, and just sits in a loop waiting to call the NetworkStream read() call. I'm sure there's a better and more efficient way of handling the client disconnecting, b/c i don't want this to affect the remaining clients, if one disconnects for any reason. Any ideas? Thanks.
|
|
|
|
|
TCP/IP disconnect is based on timeout, which is set by the OS as a default of 30 minutes. (Or was back when I wrote winsocks). Disconnected network sockets were always then bane of my existence. However, if you are doing async reads and writes is should be that big of a server issue. Just leave the connections till they timeout or set the timeout to be really low on the server and use keep alive.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
well, my problem is that i don't want to attempt to send data to the disconnected clients every iteration. i'd like to remove them from the Client collection without phasing the server. thanks for the response.
|
|
|
|
|
Hi,
I have the below code in a cs file (and it function perfect). But I know, I have to use that code in other files two. So I want to place the code in a Class file (cs file in App_Code dir).
I don't know what I shall do, so I can re-use the code in all the files I want. Can anyone show by example what to do - and how I use ind a file?
My code:
public String sortExpression<br />
{<br />
get<br />
{<br />
if (ViewState["sortExpression"] == null)<br />
{<br />
ViewState["sortExpression"] = Convert.ToString(grdEmployeeList.Columns[0].SortExpression);<br />
}<br />
return Convert.ToString(ViewState["sortExpression"]);<br />
}<br />
set<br />
{<br />
ViewState["sortExpression"] = value;<br />
}<br />
}
If I put the code directly into the Class file, I get an error, that ViewState is unknown.....
Kind regards,
simsen
|
|
|
|
|
I don't know what is a ViewState
But i know it belongs to refrence( using ...)
Maybe u forgat it.
Have Fun
Never forget it
|
|
|
|
|
You need to add a using statement at the top of your new program,
that refers to the namespace which ViewState belongs to.
Kristian Sixhoej "Any fool can learn from his own mistakes, but a wise man learns from mistakes of others"
|
|
|
|
|
Hi Kristian,
Microsoft sais that the namespace are UI, and I have that namespace in the using statements. So I have no clue, what to do?
using System;<br />
using System.Data;<br />
using System.Configuration;<br />
using System.Collections;<br />
using System.Web;<br />
using System.Web.Security;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using System.Web.UI.HtmlControls;<br />
using System.Drawing;<br />
<br />
public class ERSGridView<br />
{
|
|
|
|
|
1) ViewState is serialized and can contain serializable types. Do not convert to string. Use: ViewState["w/e"] = someObject directly.
2) Create a base page that inherits from page then you can reuse the code.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
Hi Ennis,
How do I create a base page that inherits from page. I now tried to search at google, and I cann't figure out to replace the expamples with my code?
|
|
|
|
|
in App_Code:
public class MyPageBase : System.Web.UI.Page {
public string ViewStateItem{
get{
return (string)ViewState["someViewStateItem"];
}
set{
ViewState["someViewStateItem"] = value;
}
}
}
In your Web project
public class SomeWebPage : MyPageBase { ... }
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
I copied the same code into a new file I called ERSBasePage and I gets the same error here to.....
my ERSBasePage.cs file:
using System;<br />
using System.Data;<br />
using System.Configuration;<br />
using System.Web;<br />
using System.Web.Security;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using System.Web.UI.HtmlControls;<br />
<br />
public class ERSPageBase<br />
{<br />
public ERSPageBase()<br />
{<br />
}<br />
public string ViewStateItem <br />
{ <br />
get { return (string)ViewState["someViewStateItem"]; } <br />
set { ViewState["someViewStateItem"] = value; } <br />
}<br />
}
And the page where I want to inherith:
public partial class ERS_Adm_AdmFrontPage : ERSPageBase<br />
{<br />
protected void Page_Load(object sender, EventArgs e)<br />
{
The error sais:
Error 1 The name 'ViewState' does not exist in the current context C:\Inetpub\wwwroot\ANSI\App_Code\ERSPageBase.cs 24 30 C:\...\ANSI\
As you can see, I am using the page directive UI as I read I shall use regarding ViewState
|
|
|
|
|
Look really close at your definition of ERSPageBase. There is something missing that is not missing from my sample.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
Hi,
I have a form which must act like a custom directory browser.
Now my code has one NodeMouseClick event which is handling 2 actions when selecting a TreeView Node:
1)Build the Items for the ListView (this works)
2)Show the Full path of the Selected Node in a StatusBar
In my Code 2) (bold lines) returns the path of the previous clicked Node!!!....Has anyone an idea what is wrong??
string sProjectsPath = global::Offshore_Supports_Menu.Properties.Settings.Default.Projects_Dir;<br />
<br />
string sProject = "10.3459 Ormen Lange II";<br />
<br />
private void PopulateTreeView()<br />
{<br />
TreeNode rootNode;<br />
DirectoryInfo ProjectPath = new DirectoryInfo(sProjectsPath + "\\" + sProject);<br />
if (ProjectPath.Exists)<br />
{<br />
rootNode = new TreeNode(ProjectPath.Name);<br />
rootNode.Tag = ProjectPath;<br />
rootNode.ImageIndex = 2;<br />
rootNode.SelectedImageIndex = 2;<br />
GetDirectories(ProjectPath.GetDirectories(), rootNode);<br />
ProjectTreeView.Nodes.Add(rootNode);<br />
rootNode.Expand();<br />
StatusLabel1.Text = ProjectPath.ToString();<br />
}<br />
}<br />
<br />
void ProjectTreeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)<br />
{<br />
TreeNode newSelected = e.Node;<br />
ProjectListView.Items.Clear();<br />
DirectoryInfo nodeDirInfo = (DirectoryInfo)newSelected.Tag;<br />
ListViewItem.ListViewSubItem[] subItems;<br />
ListViewItem item = null;<br />
<br />
<br />
if (ProjectTreeView.SelectedNode.IsSelected == true)<br />
{<br />
StatusLabel1.Text = sProjectsPath + "\\" + ProjectTreeView.SelectedNode.FullPath;<br />
} <br />
<br />
foreach (DirectoryInfo dir in nodeDirInfo.GetDirectories())<br />
{<br />
item = new ListViewItem(dir.Name, 1);<br />
subItems = new ListViewItem.ListViewSubItem[]<br />
{ new ListViewItem.ListViewSubItem(item, ""), <br />
new ListViewItem.ListViewSubItem(item, "File Folder"),<br />
new ListViewItem.ListViewSubItem(item, dir.LastAccessTime.ToShortDateString())};<br />
<br />
item.SubItems.AddRange(subItems);<br />
ProjectListView.Items.Add(item);<br />
}<br />
<br />
<br />
foreach (FileInfo file in nodeDirInfo.GetFiles())<br />
{<br />
item = new ListViewItem(file.Name, 2);<br />
subItems = new ListViewItem.ListViewSubItem[]<br />
{new ListViewItem.ListViewSubItem(item, file.Length.ToString()),<br />
new ListViewItem.ListViewSubItem(item, "File"),<br />
new ListViewItem.ListViewSubItem (item, file.LastAccessTime.ToShortDateString())};<br />
item.SubItems.AddRange(subItems);<br />
ProjectListView.Items.Add(item);<br />
}<br />
<br />
ProjectListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);<br />
}
|
|
|
|