|
Hi,
I am new to C#, but have 20 years experience in CPP/MFC.I use Visual Studio Express for Web developers 2012 I started a Starter App to give a basic website. The Logging In procedure provided as default is already unsuitable. The website is intended to manage a User/Dealer network. Only Dealers can appoint Sub Dealers, or register customers. Self Registration isimpossible. Dealers and Customers can have multiples of Users(Which are Persons with aname, Passwords and Roles, etc.),Customers are in principle organisations in this model, which requires humans to run it. No Customer or User is required to declare any email address. Dealers are different. I know How to write code that implements this. The question is how to integrate this with webmatrix.
Later on I will have to produce 'User Licence Files' These are files I produced using a fairly basic encryption system. (XOR with a known block, and transpose).It has worked quite well, and there is a substantial code base out in the world that depends on this licence format.
In MFC I stored all this in a C Structure (packed to byte alignment). Do the C# and C++ structures align. Do allignment pragma's exist in C#, How does C# allign DWORDS.(Big End, Little End, or Machine Dependent)
Thanks
Bram
Bram van Kampen
|
|
|
|
|
|
Hi,
well, you live and learn. In the MFC forum,the weekend was historically a good time to ask a question. I followed your link. I do not understand how it can possibly be relevant to my question. Please Explain.
Bram van Kampen
|
|
|
|
|
I don't see a good reason to use WebMatrix here. You should probably stick to ASP.NET alone.
Bram van Kampen wrote:
In MFC I stored all this in a C Structure (packed to byte alignment). Do the C# and C++ structures align. Do allignment pragma's exist in C#, How does C# allign DWORDS.(Big End, Little End, or Machine Dependent) In C#, you can add a StructLayout attribute and with a kind Explicit to the structure. Something like,
[StructLayout(LayoutKind.Explicit)]
public struct Example
{
[FieldOffset(0)]
public int foo;
[FieldOffset(4)]
public int bar;
} This allows you to take finer control over alignment.
If you write a wrapper to your native code in C++/CLI, you don't have to worry about structure alignment in C#. Just work with managed objects.
Best wishes,
Navaneeth
|
|
|
|
|
Hi,
Many Thanks.
Sorry for rounding on you, but, you gave a good sensible answer.
Well an Good.
The C# system I'm faced with, generates dozens of files, and lengthy tutorials. Unlike MFC, it does not appear to have a meaningful Help System. If I double Click a 'System' class name and press F1, I get a list of Tutorials(if anything at all) instead of a Help file which explains the class, and what methods are available.
There is no short explanation anywhere I can find,about which file does what, or how it glues together. It is to me totally unclear whether to start a Website or a Project. Does a Project contain many Websites, or does a Website contain many projects. What is the format of the End Product. An .exe or .dll file,as in MFC, a .cgi File, or what else.
I fully understand Machine code and assembler code. I am fully aware how the CPP Compiler and Linker work, and how the lot comes together at run time. MFC has Header Filesand Libraries, and pragma's to include a DLL. It istotally unclear to me what happensin C#,
The Bottom line is, I need to know how it works, rather than yet another tutorial on how to do something trivial.
Can you help me on this.
Regards
Bram van Kampen
|
|
|
|
|
Bram van Kampen wrote: The C# system I'm faced with, generates dozens of files, and lengthy tutorials. Unlike MFC, it does not appear to have a meaningful Help System. If I double Click a 'System' class name and press F1, I get a list of Tutorials(if anything at all) instead of a Help file which explains the class, and what methods are available.
System is not a class but a namespace .
I never used to look for local help instead always check in online MSDN. They are pretty good and well documented. Try this[^]Bram van Kampen wrote: There is no short explanation anywhere I can find,about which file does what, or how it glues together. It is to me totally unclear whether to start a Website or a Project. Does a Project contain many Websites, or does a Website contain many projects. What is the format of the End Product. An .exe or .dll file,as in MFC, a .cgi File, or what else. A project can contain several C# files which will be compiled together. Output of the compilation depends on the type of project created. If the type is a class library, you get a DLL and an executable file when the project type is Console or Windows or WPF application.
Usually, you will start with creating an empty solution. Then add projects into the solution. So all the componenets in your project can be separate Visual studio projects contained in a single solution file (.sln). Now you can specify the project dependencies and how they reference each other. Let us assume that you are building a website. You will create an empty solution, add a class library to it which contains your websites core logic which don't have any dependencies with web related components. This project could contain wrapper classes to your C++ library. Then you can add a ASP.NET project to the solutuion wich references the assembly from the class library project. Bram van Kampen wrote:
I fully understand Machine code and assembler code. I am fully aware how the CPP Compiler and Linker work, and how the lot comes together at run time. MFC has Header Filesand Libraries, and pragma's to include a DLL. It istotally unclear to me what happensin C#, In C# it is simple. No header files. Just a bunch of files which has classes defined in it. Compiler will compile all the files and generate the output depending on the project type. To use a class, you don't have to include any file like you do for header files. .NET managed assemblies will have class metatdata which is used to resolve classes. Bram van Kampen wrote:
The Bottom line is, I need to know how it works, rather than yet another tutorial on how to do something trivial. It is better if you get couple of .NET and C# books and learn from it. There is a lot and probably can't answer in such detail here.
Once you get a hang of how things are working, you could check my Blog post[^] which will explain how you can reuse your C++ code in C#.
Best wishes,
Navaneeth
|
|
|
|
|
The comment frazzle made about the weekend being a bad time is, frankly, bullshit. I don't know where he got that idea from, but someone is usually volunteering their time here pretty regularly, even on the weekends.
|
|
|
|
|
Old Chineese Saying:-
"be friendly to the barbariens"
Bram van Kampen
|
|
|
|
|