The left shift operator is equivalent to multiplying by a power of two. So left shifting the total by 1 bit, multiplies it by two. An alternative way of looking at it is that you are just putting the binary ones and zeros into a number in the same order as the characters in the string.
I wanted to add X button for each tab. The drawMode is OwnerDrawFixed. it works fine if it left to right. Once I allow RightToLeftLayout = true and RightToLeft = true, it does not look good because that he still adds the string from left to right, while that tab add from right to left.
How do I make it that string will also be right to left?
privatevoid addCloseButton(object sender, DrawItemEventArgs e)
//This code will render a "x" mark at the end of the Tab caption.
e.Graphics.DrawString("x", e.Font, Brushes.Black, e.Bounds.Right - 15 , e.Bounds.Top +4 );
e.Graphics.DrawString(this.tabControl1.TabPages[e.Index].Text, e.Font, Brushes.Black, e.Bounds.Left+4, e.Bounds.Top+4);
privatevoid actionClose(object sender, MouseEventArgs e)
//Looping through the controls.for (int i = 0; i < this.tabControl1.TabPages.Count; i++)
Rectangle r = tabControl1.GetTabRect(i);
//Getting the position of the "x" mark.
Rectangle closeButton = new Rectangle(r.Right - 15, r.Top + 4, 12, 10);
if (MessageBox.Show("?האם אתה רוצה לסגור טאב זה", "אישור", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
I want to open a form in an existing tab page by pressing on a button outside of the tabcontrol. If I opened a few tabs and to example the third tab is currently open and I click on a button to open a form, then the form will open in the current tab, that is third tab. Also the tab gets the name of the form that opens. The new form will replace the existing form in the current tab page.
NewForm childForm = new NewForm ();
//TopLevel for form is set to false
childForm.TopLevel = false;
//select current TabPageint curr = tabControl1.SelectedIndex;
TabPage tbp = tabControl1.TabPages[curr];
tabControl1.TabPages[curr].Text = "name of new form";
//Added form to tabpage
childForm.WindowState = FormWindowState.Maximized;
Well, you could start be explaining in a little more depth in what way it doesn't work properly.
Remember that we can't see your screen, access your HDD, or read your mind - so we only get to work with what you tell us. So the relevant code you used, any error messages, what it did that you didn't expect, or didn't do that you did: these are all important, and without them we really can't be much help at all...
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
That looks interesting, but I couldn't find out what type of file it was. The closest I got was "maybe some type of Ghost Recon mission script", without any explanation as to how those things work.
Purely going by the contents, I guess that
1 introduces an import
2 introduces a field declaration
3 introduces a method declaration
4 "opens" a class declaration
5 "closes" a class declaration
It's a little tricky to read it like this, I'm used to being able to select the text and see the corresponding bytes highlighted.
You are exactly right, with your explenation it is a ghost recon Advanced warfighter 2
Deisel script file, I have a console aplication that compiles file extention *.dsf to *.dxe
that is what you see in hex is the dxe file.
What I am working on is decompileing them back to dsf
here is some of the c# code I have so far:
private void Openfile(string file)
lastNode = new System.Windows.Forms.TreeNode(System.IO.Path.GetFileName(file_path));
var d = new dxe_dasm.Program.ScriptDecompiler();
d.FoundClassCallback = new dxe_dasm.Program.ScriptDecompiler();
d.FoundMethodCallback = new dxe_dasm.Program.ScriptDecompiler();
d.FoundMemberVarCallback = new dxe_dasm.Program.ScriptDecompiler();
d.FoundGlobalVarCallback = new dxe_dasm.Program.ScriptDecompiler();
d.FoundImportCallback = new dxe_dasm.Program.ScriptDecompiler();
d.FoundEndOfCassCallback = new dxe_dasm.Program.ScriptDecompiler();
d.DecompileHeader = file;
public void CallbackFoundMethod(string file)
public void CallbackFoundVarMember(string file)
public void CallbackFoundVarGlobal(string file)
public void CallbackFoundImport(string file)
public void CallbackFoundEndOfClass(string file)
static class Program
/// The main entry point for the application.
static void Main()
internal class ScriptDecompiler
public ScriptDecompiler FoundClassCallback;
public ScriptDecompiler FoundEndOfCassCallback;
public ScriptDecompiler FoundGlobalVarCallback;
public ScriptDecompiler FoundImportCallback;
public ScriptDecompiler FoundMemberVarCallback;
public ScriptDecompiler FoundMethodCallback;
internal object DecompileHeader
if (value == null)
throw new ArgumentNullException("file");
throw new NotImplementedException();
public string Decompile(object o)
throw new NotImplementedException();
some help with this would be great
my program will load a dxe file and decompile it bakk to dsf
I'm going to have to use some java code for the script enum though
I'm also studying up on decompilation_thesis Reverse Conpilation Techniques by Cristina Cifuentes
I will be applying alot of her techniques in the control flow graph
aswell as some techniques from Redgates .net decompiler
I hope some fellow programmers can help me with this task.
It would be easier to help if you had a specific problem that you needed help with, giving help at random harder.
But I can make a couple of remarks.
Making several instances of the decompiler to bind to the different callbacks is probably a bad thing. The decompiler object has to receive all those callbacks, otherwise it effectively only sees part of the script.
Import = 0x01,
Field = 0x02,
Class = 0x03,
Assembly = 0x04,
Script = 0x05
is weird. The flags attribute is meant to be used for enums that contains a bunch of power of two's that can be combined, and that's not what this enum is.