/// <summary> /// Returns the ItemTreeNode.FullPath of this.item plus its .ext /// </summary> /// <returns>string</returns> private string GetFullFileName() { string tempfile = Common.backupRootFolder + "\\" + this.client.Self.Name + "\\" + this.ItemTreeNode.FullPath.Substring(0, ItemTreeNode.FullPath.LastIndexOf(this.ItemTreeNode.Text)); //Create the path Directory.CreateDirectory(tempfile); if (item.AssetType == AssetType.Notecard) { tempfile = tempfile + MIUtils.CleanForWriteandRead(this.ItemTreeNode.Text) + ".txt"; } else if (item.AssetType == AssetType.LSLText) { tempfile = tempfile + MIUtils.CleanForWriteandRead(this.ItemTreeNode.Text) + ".lsl"; } return(tempfile); }
private void SetFinalImage(System.Drawing.Image finalImage) { try { pbxImage.Image = finalImage; pnlOptions.Visible = true; pnlStatus.Visible = false; string itemdir = Common.backupRootFolder + "\\" + this.client.Self.Name + "\\" + this.ItemTreeNode.FullPath.Substring(0, ItemTreeNode.FullPath.LastIndexOf(this.ItemTreeNode.Text));; //Create the path if (!Directory.Exists(itemdir)) { Directory.CreateDirectory(itemdir); } sfdImage.InitialDirectory = itemdir; //Craft a valid filename string validName = MIUtils.CleanForWriteandRead(this.ItemTreeNode.Text); if ((item.Permissions.OwnerMask & PermissionMask.Copy) == PermissionMask.Copy) { btnSave.Click += delegate(object sender, EventArgs e) { sfdImage.FileName = validName; if (sfdImage.ShowDialog() == DialogResult.OK) { if (sfdImage.FileName != string.Empty) { switch (sfdImage.FilterIndex) { case 1: //BMP pbxImage.Image.Save(sfdImage.FileName, ImageFormat.Bmp); break; case 2: //JPG pbxImage.Image.Save(sfdImage.FileName, ImageFormat.Jpeg); break; case 3: //PNG pbxImage.Image.Save(sfdImage.FileName, ImageFormat.Png); break; default: pbxImage.Image.Save(sfdImage.FileName, ImageFormat.Bmp); break; } //Auto Attach this item to treeView1 node //Write item's key and the image's file path into log file... Logs.ImageLogEntry(ItemTreeNode.Name + "," + sfdImage.FileName + " # " + ItemTreeNode.Text, File.AppendText(Common.ImageLog)); } } }; btnSave.Enabled = true; } } catch (Exception ex) { MessageBox.Show("InventoryImageConsole Error: " + ex.Message, "Name error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }