Beispiel #1
0
 /// <summary>
 /// Provides emojis from Emoji One (http://emojione.com/) stored as local files.
 /// </summary>
 /// <param name="SourceFileType">Type of files to use.</param>
 /// <param name="Width">Desired width of emojis.</param>
 /// <param name="Height">Desired height of emojis.</param>
 /// <param name="ImageURL">URL for remote clients to fetch the image. If not provided, images are embedded into generated pages.
 /// Include the string %FILENAME% where the name of the emoji image file is to be inserted.</param>
 /// <param name="FileExists">Delegate to method used to check if a file exists.</param>
 /// <param name="ReadAllBytes">Method to read all bytes of a file.</param>
 public Emoji1LocalFiles(Emoji1SourceFileType SourceFileType, int Width, int Height, string ImageURL,
                         FileExistsHandler FileExists, ReadAllBytesHandler ReadAllBytes)
 {
     this.sourceFileType = SourceFileType;
     this.width          = Width;
     this.height         = Height;
     this.imageUrl       = ImageURL;
     this.fileexists     = FileExists;
     this.readAllBytes   = ReadAllBytes;
 }
Beispiel #2
0
        /// <summary>
        /// Provides emojis from Emoji One (http://emojione.com/) stored as local files.
        /// </summary>
        /// <param name="SourceFileType">Type of files to use.</param>
        /// <param name="Width">Desired width of emojis.</param>
        /// <param name="Height">Desired height of emojis.</param>
        /// <param name="ImageURL">URL for remote clients to fetch the image. If not provided, images are embedded into generated pages.
        /// Include the string %FILENAME% where the name of the emoji image file is to be inserted.</param>
        /// <param name="ZipFileName">Full path of the emoji1 zip file. It will be deleted after unpacking to <paramref name="ProgramDataFolder"/>.</param>
        /// <param name="ProgramDataFolder">Folder to unzip emojis to.</param>
        public Emoji1LocalFiles(Emoji1SourceFileType SourceFileType, int Width, int Height, string ImageURL,
                                string ZipFileName, string ProgramDataFolder)
        {
            this.sourceFileType    = SourceFileType;
            this.width             = Width;
            this.height            = Height;
            this.imageUrl          = ImageURL;
            this.zipFileName       = ZipFileName;
            this.programDataFolder = ProgramDataFolder;

            try
            {
                DateTime TP = File.GetLastWriteTime(this.zipFileName);

                if (File.Exists(this.zipFileName) && RuntimeSettings.Get(this.zipFileName, DateTime.MinValue) != TP)
                {
                    if (!Directory.Exists(ProgramDataFolder))
                    {
                        Directory.CreateDirectory(ProgramDataFolder);
                    }
                    else
                    {
                        string Folder = Path.Combine(ProgramDataFolder, "Emoji1");

                        if (Directory.Exists(Folder))
                        {
                            Directory.Delete(Folder, true);
                        }
                    }

                    this.initialized = new ManualResetEvent(false);

                    Task.Run(this.Unpack);
                }
                else
                {
                    this.initialized = new ManualResetEvent(true);
                }
            }
            catch (Exception ex)
            {
                Log.Critical(ex);
            }
        }
 /// <summary>
 /// Provides emojis from Emoji One (http://emojione.com/) stored as local files.
 /// </summary>
 /// <param name="SourceFileType">Type of files to use.</param>
 /// <param name="Width">Desired width of emojis.</param>
 /// <param name="Height">Desired height of emojis.</param>
 /// <param name="ZipFileName">Full path of the emoji1 zip file. It will be deleted after unpacking to <paramref name="ProgramDataFolder"/>.</param>
 /// <param name="ProgramDataFolder">Folder to unzip emojis to.</param>
 public Emoji1LocalFiles(Emoji1SourceFileType SourceFileType, int Width, int Height,
                         string ZipFileName, string ProgramDataFolder)
     : this(SourceFileType, Width, Height, string.Empty, ZipFileName, ProgramDataFolder)
 {
 }
Beispiel #4
0
 /// <summary>
 /// Provides emojis from Emoji One (http://emojione.com/) stored as local files.
 /// </summary>
 /// <param name="SourceFileType">Type of files to use.</param>
 /// <param name="Width">Desired width of emojis.</param>
 /// <param name="Height">Desired height of emojis.</param>
 /// <param name="FileExists">Delegate to method used to check if a file exists.</param>
 /// <param name="ReadAllBytes">Method to read all bytes of a file.</param>
 public Emoji1LocalFiles(Emoji1SourceFileType SourceFileType, int Width, int Height,
                         FileExistsHandler FileExists, ReadAllBytesHandler ReadAllBytes)
     : this(SourceFileType, Width, Height, string.Empty, FileExists, ReadAllBytes)
 {
 }