/// <summary> /// Creates a new VcVjImage object from a GIF image located at the specified folder with the specified file name. /// </summary> /// <param name="folderName">The folder containing the GIF file (including trailing backslash, e.g. 'C:\Pictures\').</param> /// <param name="fileName">The name of the GIF file (including the extension, e.g. 'Balloons.gif').</param> public VcvjImage(string folderName, string fileName) { if (folderName.EndsWith(@"\") == false) { folderName += @"\"; } if (fileName.ToLower().EndsWith(".gif") == false) { fileName += ".gif"; } InputFolderName = folderName; InputFileName = fileName; Stream stream = GlobalUtils.ConvertImageToStream(Image.FromFile(InputFolderName + InputFileName), ImageFormat.Gif); using (MemoryStream ms = new MemoryStream()) { DataStream = new DataStream(); stream.CopyTo(ms); ms.Position = 0; DataStream.Bytes = ms.ToArray(); } DataStream = VcvjParser.ParseDataStream(DataStream.Bytes); }
/// <summary> /// Creates a new VcVjImage object from a GIF image located at the specified file path. /// </summary> /// <param name="filename">The fully qualified path to the file.</param> public VcvjImage(string inputFilePath) { // sanitize input inputFilePath = inputFilePath.Replace(".gif", ""); inputFilePath += ".gif"; InputFolderName = inputFilePath.Substring(0, inputFilePath.LastIndexOf(@"\")); InputFileName = inputFilePath.Substring(inputFilePath.LastIndexOf(@"\", inputFilePath.Length)); Stream stream = GlobalUtils.ConvertImageToStream(Image.FromFile(inputFilePath), ImageFormat.Gif); using (MemoryStream ms = new MemoryStream()) { DataStream = new DataStream(); stream.CopyTo(ms); ms.Position = 0; DataStream.Bytes = ms.ToArray(); } DataStream = VcvjParser.ParseDataStream(DataStream.Bytes); }