C# with zenno variables?

hsupowers

Client
Регистрация
26.12.2012
Сообщения
40
Благодарностей
3
Баллы
8
I save the screenshot of web through C#.

img.Save(@"C:\images\{-TimeNow.Date-}"+count.ToString()+@".jpg");

I need to set the image name with current time, but it can't work. anyone help me, thank you! If i need to use C# cunrrent time, how to do?
 

Hungry Bulldozer

Moderator
Регистрация
12.01.2011
Сообщения
3 441
Благодарностей
831
Баллы
113
System.DateTime.Today.ToShortDateString(); to get current date.
You can use macro this way {-TimeNow.Date-}
 

hsupowers

Client
Регистрация
26.12.2012
Сообщения
40
Благодарностей
3
Баллы
8

hsupowers

Client
Регистрация
26.12.2012
Сообщения
40
Благодарностей
3
Баллы
8

hsupowers

Client
Регистрация
26.12.2012
Сообщения
40
Благодарностей
3
Баллы
8
sorry, i don't know why show two posts
 

Hungry Bulldozer

Moderator
Регистрация
12.01.2011
Сообщения
3 441
Благодарностей
831
Баллы
113
@"C:\images\"+System.DateTime.Today.ToShort DateString()+i.ToString()+@".jpg"
 

hsupowers

Client
Регистрация
26.12.2012
Сообщения
40
Благодарностей
3
Баллы
8
@"C:\images\"+System.DateTime.Today.ToShort DateString()+i.ToString()+@".jpg"
HtmlElement he = instance.ActiveTab.FindElementByAttribute("body","fulltag","body","text",0);
int heHeight = Convert.ToInt32(he.GetAttribute("height"));
int heWidth = Convert.ToInt32(he.GetAttribute("width"));
int step =1000;
int countOfIterations = heHeight/step;
var bitmaps = new List<System.Drawing.Bitmap>();
int count =0;
for(int i =0;i<countOfIterations;i++)
{
var text = he.DrawPartToBitmap(0, i*step, heWidth, step, true);
byte[] imageBytes = Convert.FromBase64String(text);
var ms = new System.IO.MemoryStream(imageBytes, 0, imageBytes.Length);
var img = (System.Drawing.Bitmap)System.Drawing.Image.FromStream(ms);
img.Save(@"C:\images\"+System.DateTime.Today.ToShort DateString()+i.ToString()+@".jpg");
count++;
}
int lastPieceHeight = heHeight%step;
if (lastPieceHeight>10)
{
var text = he.DrawPartToBitmap(0, heHeight-lastPieceHeight, heWidth, lastPieceHeight,

true);
byte[] imageBytes = Convert.FromBase64String(text);
var ms = new System.IO.MemoryStream(imageBytes, 0, imageBytes.Length);
var img = (System.Drawing.Bitmap)System.Drawing.Image.FromStream(ms);
img.Save(@"C:\images\"+System.DateTime.Today.ToShort DateString()+i.ToString()+@".jpg");
}


Dispaly error:

Error in action "CS1026" ") expected" в строке " img.Save(@"C:\images\"+System.DateTime.Today.ToShort DateString()+i.ToString()+@".jpg");
"
 

hsupowers

Client
Регистрация
26.12.2012
Сообщения
40
Благодарностей
3
Баллы
8
"Invalid expression term ')'" в строке " img.Save(@"C:\images\"+System.DateTime.Today.ToShort DateString()+i.ToString()+@".jpg");
"
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)