Пример #1
0
        /// <summary>
        /// 使用可更新模式并更新资源。
        /// </summary>
        /// <param name="updateResourcesCompleteCallback">使用可更新模式并更新资源全部完成的回调函数。</param>
        public void UpdateResources(UpdateResourcesCompleteCallback updateResourcesCompleteCallback)
        {
            if (updateResourcesCompleteCallback == null)
            {
                throw new GameFrameworkException("Update resources complete callback is invalid.");
            }

            if (m_ResourceMode == ResourceMode.Unspecified)
            {
                throw new GameFrameworkException("You must set resource mode first.");
            }

            if (m_ResourceMode != ResourceMode.Updatable)
            {
                throw new GameFrameworkException("You can not use UpdateResources without updatable resource mode.");
            }

            if (m_ResourceUpdater == null)
            {
                throw new GameFrameworkException("You can not use UpdateResources at this time.");
            }

            m_UpdateResourcesCompleteCallback = updateResourcesCompleteCallback;
            m_ResourceUpdater.UpdateResources();
        }
Пример #2
0
        static void Main(string[] args)
        {
            //string path = Assembly.GetExecutingAssembly().FullName;
            //string path = @"D:\_clickonce\binaries\Launcher.modified.exe";
            string path = @"C:\Users\nikolam\source\repos\PEResources\Launcher\bin\Debug\Launcher.exe";

            // first, try to write it
            ResourceUpdater updater = new ResourceUpdater();

            updater.AddStringResource(NativeMethods.CUSTOM_RESOURCE_TYPE, NativeMethods.BINARYTOLAUNCH_STRING, "1235.dll");
            updater.UpdateResources(path);

            // now try to read it
            //string a = ResourceReader.GetBinaryToLaunch(path);
        }
Пример #3
0
        public BuildResults Build(string filename, string outputPath)
        {
            string launcherFilename = Path.GetFileName(LauncherPath);

            _results = new BuildResults();

            try
            {
                if (filename == null)
                {
                    _results.AddMessage(BuildMessage.CreateMessage(BuildMessageSeverity.Error, "GenerateLauncher.InvalidInput"));
                    return(_results);
                }

                if (String.IsNullOrEmpty(outputPath))
                {
                    _results.AddMessage(BuildMessage.CreateMessage(BuildMessageSeverity.Error, "GenerateLauncher.NoOutputPath"));
                    return(_results);
                }

                // Copy setup.bin to the output directory
                string strOutputExe = System.IO.Path.Combine(outputPath, launcherFilename);
                if (!CopyLauncherToOutputDirectory(strOutputExe))
                {
                    // Appropriate messages should have been stuffed into the results already
                    return(_results);
                }

                var resourceUpdater = new ResourceUpdater();
                resourceUpdater.AddStringResource(LAUNCHER_RESOURCE_TABLE, LAUNCHER_RESOURCENAME, filename);
                if (!resourceUpdater.UpdateResources(strOutputExe, _results))
                {
                    return(_results);
                }

                _results.SetKeyFile(launcherFilename);
                _results.BuildSucceeded();
            }
            catch (Exception ex)
            {
                _results.AddMessage(BuildMessage.CreateMessage(BuildMessageSeverity.Error, "GenerateLauncher.General", ex.Message));
            }

            return(_results);
        }
Пример #4
0
        /// <summary>
        /// 使用可更新模式并更新资源。
        /// </summary>
        public void UpdateResources()
        {
            if (m_ResourceMode == ResourceMode.Unspecified)
            {
                throw new AshException("You must set resource mode first.");
            }

            if (m_ResourceMode != ResourceMode.Updatable)
            {
                throw new AshException("You can not use InitResources without updatable resource mode.");
            }

            if (m_ResourceUpdater == null)
            {
                throw new AshException("You can not use UpdateResources at this time.");
            }

            m_ResourceUpdater.UpdateResources();
        }
Пример #5
0
 public void UpdateResources()
 {
     m_ResourceUpdater.UpdateResources();
 }