|
Hi ... Thanks again !
I pass for compiler this code , but the output is wrong
when I run keygen.exe
input name : test
it show
Serial:System.Char[]
somewhere is still wrong .....
---------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
public class MyGen
{
private const string LL = "keygen";
public virtual string getSerial(string userId, string licenseNum)
{
DateTime dDate = DateTime.Now;
dDate.AddYears(3);
dDate.AddDays(-1);
//dDate.Add(1, 3);
//dDate.Add(6, -1);
licenseNum = Int32.Parse(licenseNum).ToString("D3");
string verTime = "-" + dDate.ToString("yyMMdd") + "0";
string type = "YE3MP-";
string need = new StringBuilder(userId.Substring(0, 1)).Append(type).Append("300").Append(licenseNum).Append(verTime).ToString();
string dx = new StringBuilder(need).Append(LL).Append(userId).ToString();
int suf = this.decode(dx);
string code = new StringBuilder(need).Append(Convert.ToString(suf)).ToString();
return this.change(code);
}
private int decode(string s)
{
int i;
char[] ac;
int j;
int k;
i = 0;
ac = s.ToCharArray();
j = 0;
k = ac.Length;
while (j < k)
{
i = (31 * i) + ac[j];
j++;
}
return Math.Abs(i);
}
private string change(string s)
{
//sbyte[] abyte0;
char[] ac;
int i;
int k;
int j;
//abyte0 = s;
ac = new char[s.Length];
i = 0;
k = s.Length;
while (i < k)
{
j = char.ConvertToUtf32(s, i);
if ((j >= 48) && (j <= 57))
{
j = (((j - 48) + 5) % 10) + 48;
}
else if ((j >= 65) && (j <= 90))
{
j = (((j - 65) + 13) % 26) + 65;
}
else if ((j >= 97) && (j <= 122))
{
j = (((j - 97) + 13) % 26) + 97;
}
ac[i] = (char)j;
i++;
}
return Convert.ToString(ac);
}
public MyGen() : base()
{
}
static void Main(string[] args)
{
try
{
System.Console.WriteLine("please input register name:");
string userId = null;
userId = System.Console.ReadLine();
MyGen MyGen = new MyGen();
string res = MyGen.getSerial(userId, "5");
System.Console.WriteLine("Serial:" + res);
System.Console.ReadLine();
}
catch (IOException ex)
{
}
}
}
garnett
|
|
|
|
|
It's the 'Convert.ToString(ac)' line in the change() function. You need to return 'new string(ac)'
|
|
|
|
|
Thanks Computafreak.....
it works
I'll test it !
garnett
|
|
|
|
|
I'm trying to create a new thread which constantly draws graphics to a form.
My problem seems to be when I want to update the graphics, I call the Invalidate() method, but this causes massive flickering which I don't experience if I use a single thread and draw the graphics directly in the Form1_Paint method.
Here's my code:
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Threading;
namespace app
{
public partial class Form1 : Form
{
private System.Drawing.Bitmap myBitmap;
Thread newThread;
public Form1()
{
InitializeComponent();
newThread = new Thread(new ThreadStart(draw));
newThread.Start();
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics graphicsObj = e.Graphics;
graphicsObj.DrawImage(myBitmap, 0, 0, myBitmap.Width, myBitmap.Height);
}
private void Form1_Load(object sender, EventArgs e)
{
myBitmap = new Bitmap(this.ClientRectangle.Width,
this.ClientRectangle.Height,
System.Drawing.Imaging.PixelFormat.Format24bppRgb);
}
public void draw()
{
Graphics gfx;
gfx = Graphics.FromImage(myBitmap);
Pen myPen = new Pen(System.Drawing.Color.Plum, 3);
gfxLoop:
for (int i = 1; i < 100; i++)
{
myPen.Color = Color.FromArgb(0, 0 + (i * 2), 0);
gfx.DrawEllipse(myPen, 50 + i, 50 + i, 200 - (i * 2), 200 - (i * 2));
Thread.Sleep(20);
this.Invalidate();
}
for (int j = 0; j < 100; j++)
{
myPen.Color = Color.FromArgb(200 - (j * 2), 0, 100 - j);
gfx.DrawEllipse(myPen, 150 - j, 150 - j, j * 2, j * 2);
Thread.Sleep(20);
this.Invalidate();
}
goto gfxLoop;
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
newThread.Abort();
}
}
}
Anyone got any good tips in how to overcome this flickering?
|
|
|
|
|
Your Invalidate() method is causing the flicker. Draw the ellipses to a Bitmap, then at the end of each loop iteration, draw the Bitmap to gfx and Invalidate() then. This is double-buffering
|
|
|
|
|
Hi,
Didn't know where to post it else, because there is no VSX Forum.
I'm stuck with this problem for quiet some time and I can't find an example how do it...
Can somebody please help?
Thanks
|
|
|
|
|
|
Dromar wrote: Didn't know where to post it else, because there is no VSX Forum.
sure there is[^]
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Hi
I have Dataset that include table Items, How can I sort this table by Code field ?
thank's in advance
|
|
|
|
|
use this:
var sortedDataRowEnumerable = dataset.Tables[0].AsEnumerable().OrderBy(r => r["coltosort"]);
Or
dataset.Tables[0].DefaultView..Sort = "coltosort DESC";
|
|
|
|
|
thank you very much !
and how can I run any query on this DataSet ?
|
|
|
|
|
Pretty much the same way you would run any query on any DataSet.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
It is an unorganized textfile. It is not a tab delimited file and also comma separated.I want to split this file in 7 coloumn base on the position below. Then, put the file in dataGridView. I'm absolutely need your helps. Thanx before....
Path \ Global \ Direct \ Mult \ Total \ %of \ Cum
1, 9, 4 \ 0.158 \ 0.006\ 3.487 \ 0.019\ 12.3 \ 12.3
1, 11, 4 \ blank \ 0.013 \ 3.683 \ 0.048\ 30.4 \ 42.7\
1, 11, 7, 4 \ blank \ 0.001 \ 4.826 \ 0.005 \ 3.2 \ 45.8\
1, 11, 5 \ 0.042 \ 0.002 \ 2.859 \ 0.005 \ 13.1\ 13.1\
1, 11, 4, 6 \ 0.631\ 0.002 \ 4.434 \ 0.008 \ 1.3 \ 1.3\
1, 9, 7 \ 0.574 \ 0.005 \ 3.504 \ 0.018 \ 3.2 \ 3.2\
1, 11, 7 \ blank \ 0.025 \ 3.604 \ 0.089 \ 15.5 \ 18.6\
|
|
|
|
|
Double posting is very bad and has been show to damage kittens.
Me, I don't care for cats but do you?
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
I'll prefer xml then text file...
here is easiest way
you can write or read XML through DataTable...
DataTable.WriteXml();
DataTable.ReadXml();
then set that DataTable to DataGridView through DataSource property
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I would create an object that contains properties for the seven fields in the string, parse the string, pass the resulting string array to the item objects constructor, and then add the item to the list. At that point, displaying it in a gridview should be a piece of cake :
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
thanks for your reply. I've tried to do that method, but i got problem in parse the string. The string has a blank space delimiters. But, when i use this code, the string can't be splitted. Thanks for your help
string line = "";
string[] fields = null;
string errorInfo = String.Empty;
this.openFileDialog1.ShowDialog();
if (!(this.openFileDialog1.FileName == null))
this.textBox3.Text = this.openFileDialog1.FileName;
string txt = this.textBox3.Text;
DataTable tbl = new DataTable("InputFile");
try
{
using (StreamReader sr = new StreamReader(txt))
{
// first line has headers
if ((line = sr.ReadLine()) != null)
{
fields = line.Split(new char[] { '\x20', '\x20' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string s in fields)
{
tbl.Columns.Add(s);
}
}
else
{
// it's empty, that's an error
throw new ApplicationException("The data provided is not in a valid format.");
}
// fill the rest of the table; positional
while ((line = sr.ReadLine()) != null)
{
DataRow row = tbl.NewRow();
fields = line.Split(new char[] { '\x20', '\x20' }, StringSplitOptions.RemoveEmptyEntries);
int i = 0;
foreach (string s in fields)
{
row[i] = s;
i++;
}
tbl.Rows.Add(row);
}
}
}
catch (Exception)
{
throw new ApplicationException("There was an error attempting to read the data. Please verify the data provided is in a valid format, is tab-delimited text, and includes only ONE header line.");
}
//return tbl;
this.dataGridView1.DataSource = tbl;
|
|
|
|
|
I am assuming that the '\' are the seperators. Here is the code:
string[] values = null;
using (DataTable dt = new DataTable())
{
using (OpenFileDialog ofd1 = new OpenFileDialog())
{
DialogResult diagR = ofd1.ShowDialog();
if (diagR == DialogResult.Cancel)
return;
using (StreamReader sr = new StreamReader(ofd1.FileName))
{
sr.BaseStream.Seek(0, SeekOrigin.Begin);
bool headerLine = true ;
while (!sr.EndOfStream)
{
values = sr.ReadLine().Split(Convert.ToChar(@"\"));
if (headerLine)
{
foreach (string s in values)
{
dt.Columns.Add(s);
headerLine =false ;
}
}
else
{
DataRow dr = dt.NewRow();
for (int i = 0; i < values.Length; i++)
{
if (i > dt.Columns.Count - 1)
break;
dr[dt.Columns[i].ColumnName] = values.GetValue(i).ToString();
}
dt.Rows.Add(dr);
dt.AcceptChanges ();
}
}
}
}
}
|
|
|
|
|
|
Don't give all the data as that's just stoopid.
What have you tried? There are a dozen ways to do this using the .net framework that I can think of. Have a go, then when you get stuck come back, on this thread, and tell us why you can't read in a single line or split it into tokens.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Hi Fellows
Thanx for the help you provided.
now let me ask you another doubt,I hope i'll get solved it quick.
1.i am working(programming)with visual studio 2005.
2.how to change the deployment aspects according to my likeness.
3.In Detail: How to change the place of bitmap and buttons in installation windows.
4.how to change progressbar style/color in installation windows.
Please give me any link that desribs abt Visual studiol deployment specifying the graphical modules
|
|
|
|
|
hi i am trying to retrieve data from access databases multiple tale into a dataset, with dataset iam trying to populate the crystal report of C#. but after doing all this procedure the data is displayed multiple times. i dont know where i have gone wrong. can any one help me out of this.
the code written is as follows
namespace ContractSystem
{
public partial class ViewPSDClrdReport : Form
{
OleDbConnection con;
OleDbDataAdapter da,da1;
OleDbCommand cmd,cmd1;
OleDbDataReader rd,rd1;
DataSet ds;
DataTable dt;
PSDClrdCrystalReport rpt;
string str1, str2, str3,str4;
public ViewPSDClrdReport(string s1,string s2,string s3)
{
InitializeComponent();
str1 = s1;
str2 = s2;
str3 = s3;
}
private void ViewPSDClrdReport_Load(object sender, EventArgs e)
{
crystalReportViewer1.DisplayGroupTree = false;
try
{
con = new OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0; Data Source=e:/Ashish/Practice/ContractSystem/ContractSystem/ContractSystemDB.mdb");
con.Open();
ds = new DataSet();
rpt = new PSDClrdCrystalReport();
if (str3 == "All")
{
cmd = new OleDbCommand("select PrNo from PSDApproval where FwdDtByPSD between '" + str1 + "' and '" + str2 + "'", con);
rd = cmd.ExecuteReader();
if (rd.HasRows)
{
while (rd.Read())
{
str4 = rd.GetString(0);
da = new OleDbDataAdapter("select PrNo,Description,ValueQuoted,PurchaseGrp,RcdDtEA,FwdDtPSD,Initial from InitialApproval where InitialApproval.PrNo='" + str4 + "'", con);
da.Fill(ds, "InitialApproval");
da.Dispose();
da1 = new OleDbDataAdapter("select EstimatedVal,FwdDtByPSD from PSDApproval where PSDApproval.PrNo='" + str4 + "'", con);
da1.Fill(ds, "PSDApproval");
da1.Dispose();
MessageBox.Show("ALL ADDED");
}
}
//rpt.SetDataSource(ds);
}
else
{
cmd = new OleDbCommand("select PrNo from PSDApproval where FwdDtByPSD between '" + str1 + "' and '" + str2 + "'", con);
rd = cmd.ExecuteReader();
if (rd.HasRows)
{
while (rd.Read())
{
str4 = rd.GetString(0);
cmd1 = new OleDbCommand("select PurchaseGrp from InitialApproval where PrNo='" + str4 + "'", con);
rd1 = cmd1.ExecuteReader();
if (rd1.HasRows)
{
while (rd1.Read())
{
string t = rd1.GetString(0);
if (t == str3)
{
da = new OleDbDataAdapter("select PrNo,Description,ValueQuoted,PurchaseGrp,RcdDtEA,FwdDtPSD,Initial from InitialApproval where InitialApproval.PrNo='" + str4 + "'", con);
da.Fill(ds, "InitialApproval");
da.Dispose();
da1 = new OleDbDataAdapter("select EstimatedVal,FwdDtByPSD from PSDApproval where PSDApproval.PrNo='" + str4 + "'", con);
da1.Fill(ds, "PSDApproval");
da1.Dispose();
MessageBox.Show("GRP ADDED");
//rpt.SetDataSource(ds);
}
}
}
}
}
}
rpt.SetDataSource(ds);
crystalReportViewer1.ReportSource = rpt;
MessageBox.Show("Record Added To Report");
}
catch (Exception ex)
{
MessageBox.Show("Error" + ex);
}
finally
{
con.Close();
}
}
}
}
|
|
|
|
|
what is c# object graphs? plz can any1 tell me in detail.
thanks.
|
|
|
|
|
|
`hi want to make an ip messenger can i get the information about the project or can anybody help to getting the codes fro the project
>
|
|
|
|
|