コード例 #1
0
 public static void LoadLocalPackages(string basePath)
 {
     foreach (var i in Directory.EnumerateDirectories(basePath))
     {
         if (File.Exists(Path.Combine(i, "package.json")))
         {
             try
             {
                 var package = new V4Package(i);
                 packages[package.strongName] = package;
             }
             catch (Exception)
             { }
         }
     }
     foreach (var i in packages)
     {
         foreach (var j in i.Value.StartupInfos)
         {
             foreach (var k in j.dependencies)
             {
                 j.isDependencyComplete = true;
                 if (packages.ContainsKey(k) == false)
                 {
                     j.isDependencyComplete = false;
                 }
             }
         }
     }
 }
コード例 #2
0
        private void Label_Pack_Drop(object sender, DragEventArgs e)
        {
            var root = (e.Data.GetData(DataFormats.FileDrop) as string[])[0];

            if (File.Exists(Path.Combine(root, "package.json")) == false)
            {
                return;
            }
            var dialog = new System.Windows.Forms.SaveFileDialog();

            dialog.InitialDirectory = Path.Combine(Path.GetDirectoryName(GetType().Assembly.CodeBase), "packages");
            dialog.Filter           = "HuiDesktop V4 Package|*.hdtpkg4";
            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                using (var fs = File.Open(dialog.FileName, FileMode.Create))
                {
                    var package = new Package.V4Package(root);
                    package.Export(fs);
                }
            }
        }