예제 #1
0
 private static void ValidateUpdateCaptionArgs(IUpdateCaptionArgs args)
 {
     // caption file should exist
     if (!File.Exists(args.CaptionPath))
     {
         var message = string.Format(Localization.ValidateArgsCaptionFile, args.CaptionPath);
         throw new IOException(message);
     }
 }
예제 #2
0
        // adds user-friendly caption to screensaver
        private static void InjectCaption(IUpdateCaptionArgs args)
        {
            string caption;
            try
            {
                // read caption from file
                caption = File.ReadAllText(args.CaptionPath, Constants.CaptionEncoding);
            }
            catch (Exception ex)
            {
                var message = string.Format(Localization.InjectCaptionFileRead,
                    args.CaptionPath, ex.Message);
                throw new IOException(message, ex);
            }

            // convert text to string table data
            var stringTableRow = PInvoke.GetStringTable(new[] { null, caption }).Single();

            // add string table data to screensaver
            InjectResource(args.OutputPath, (ushort)PInvoke.ResourceType.STRING,
                stringTableRow.Key, stringTableRow.Value);
        }
예제 #3
0
        // adds user-friendly caption to screensaver
        private static void InjectCaption(IUpdateCaptionArgs args)
        {
            string caption;

            try
            {
                // read caption from file
                caption = File.ReadAllText(args.CaptionPath, Constants.CaptionEncoding);
            }
            catch (Exception ex)
            {
                var message = string.Format(Localization.InjectCaptionFileRead,
                                            args.CaptionPath, ex.Message);
                throw new IOException(message, ex);
            }

            // convert text to string table data
            var stringTableRow = PInvoke.GetStringTable(new[] { null, caption }).Single();

            // add string table data to screensaver
            InjectResource(args.OutputPath, (ushort)PInvoke.ResourceType.STRING,
                           stringTableRow.Key, stringTableRow.Value);
        }
예제 #4
0
 private static void ValidateUpdateCaptionArgs(IUpdateCaptionArgs args)
 {
     // caption file should exist
     if (!File.Exists(args.CaptionPath))
     {
         var message = string.Format(Localization.ValidateArgsCaptionFile, args.CaptionPath);
         throw new IOException(message);
     }
 }