예제 #1
0
파일: UpdateMgr.cs 프로젝트: sgww/cozy
        private List <FileVersionInfo> GetLocalFileVersionInfo()
        {
            var filelist = new List <string> {
                "CozyLauncher.exe",
                "CozyLauncher.Core.dll",
                "CozyLauncher.Infrastructure.dll",
                "CozyLauncher.PluginBase.dll",

                "NHotkey.dll",
                "NHotkey.Wpf.dll",
                "Newtonsoft.Json.dll",
                "YAMP.dll",
                "System.Windows.Interactivity.dll",

                "CozyLauncher.Plugin.Core.dll",

                "CozyLauncher.Plugin.Program.dll",
                "CozyLauncher.Plugin.Dirctory.dll",
                "CozyLauncher.Plugin.ManualRun.dll",
                "CozyLauncher.Plugin.WebSearch.dll",
                "CozyLauncher.Plugin.Ip.dll",
                "CozyLauncher.Plugin.Sys.dll",
                "CozyLauncher.Plugin.Calculator.dll",

                "CozyLauncher.Plugin.MouseClick.dll",
            };

            return(filelist.Select(x => new FileVersionInfo
            {
                Name = x,
                Md5 = FileMd5.GetMD5HashFromFile((PathTransform.LocalFullPath(Path.Combine("..\\", x)))),
            }).ToList());
        }
예제 #2
0
파일: Program.cs 프로젝트: sgww/cozy
        static void Main(string[] args)
        {
            List <FileVersionInfo> filelist = new List <FileVersionInfo>();

            foreach (var file in Directory.GetFiles(args[0]))
            {
                if (Path.GetExtension(file) == ".exe" || Path.GetExtension(file) == ".dll")
                {
                    filelist.Add(new FileVersionInfo
                    {
                        Name = Path.GetFileName(file),
                        Md5  = FileMd5.GetMD5HashFromFile(PathTransform.LocalFullPath(file)),
                    });
                }
            }

            // to json
            var filename = (args.Length < 2 || string.IsNullOrEmpty(args[1])) ? "./publish.json" : args[1];

            using (var fs = new FileStream(filename, FileMode.Create, FileAccess.ReadWrite))
            {
                using (var sr = new StreamWriter(fs))
                {
                    sr.Write(JsonConvert.SerializeObject(filelist));
                }
            }
        }