Changeset 49
- Timestamp:
- 07/31/06 03:29:20 (6 years ago)
- Files:
-
- trunk/wipt-get/src/Main.cs (modified) (7 diffs)
- trunk/wipt-put/src/Main.cs (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wipt-get/src/Main.cs
r43 r49 116 116 Remove(packages.Split(',')); 117 117 break; 118 case "download": 119 foreach(string package in packages.Split(',')) 120 { 121 success = Download(package) && success; 122 } 123 break; 118 124 case "show": 119 125 List(); … … 189 195 if((transform.minVersion == null || instVersion >= transform.minVersion) && 190 196 (transform.maxVersion == null || instVersion <= transform.maxVersion)) 191 properties = transform.URL + ";";197 properties += transform.URL + ";"; 192 198 } 193 199 properties += " "; … … 287 293 if(product == null) 288 294 { 289 Console. WriteLine("Could not find product " + parts[0]);295 Console.Error.WriteLine("Could not find product " + parts[0]); 290 296 continue; 291 297 } … … 313 319 } 314 320 } 321 } 322 323 private static bool Download(string p) 324 { 325 if(p == "") 326 return true; 327 Version instVersion = new Version("0","0","0"); 328 string[] parts = p.Split('='); 329 if(parts.Length > 1) 330 { 331 instVersion = new Version(parts[1]); 332 } 333 else 334 { 335 instVersion = null; 336 } 337 try 338 { 339 Product product = Library.GetProduct(parts[0]); 340 if(product == null) 341 { 342 Console.Error.WriteLine("Could not find product " + parts[0]); 343 return false; 344 } 345 346 string URL = ""; 347 if(instVersion == null) 348 instVersion = product.stableVersion; 349 foreach(Package package in product.packages) 350 { 351 if(package.version == instVersion) 352 { 353 URL = package.URL; 354 break; 355 } 356 } 357 358 if(URL == "") 359 { 360 Console.Error.WriteLine("No package listed for specified version of " 361 + product.name + ". Contact the repository maintainer."); 362 return false; 363 } 364 365 string[] URLParts = URL.Split('/'); 366 WebClient wc = new WebClient(); 367 wc.DownloadFile(URL, Environment.CurrentDirectory + "\\" + URLParts[URLParts.Length - 1]); 368 } 369 catch(Exception e) 370 { 371 Console.Error.WriteLine(e.Message); 372 return false; 373 } 374 375 return true; 315 376 } 316 377 … … 372 433 install Install product(s) 373 434 remove Remove product(s) 435 show List all products and packages 374 436 update Download package lists from repositories 375 437 upgrade Perform small updates and minor upgrades 376 438 dist-upgrade Perform major upgrades to stable version 377 show List all products and packages439 download Just download the MSI to current directory 378 440 "; 379 441 Console.WriteLine(usage); … … 464 526 ApplyPatches(p.patches, prod); 465 527 } 466 break;467 528 } 468 529 } … … 538 599 if(p.stableVersion == k.version) 539 600 installstring = "(stable)"; 540 if(ApplicationDatabase.getProductState(k.productCode) 541 == InstallState.Default) 601 if(IsInstalled(p.name, k.version, k.version)) 542 602 installstring += "(installed)"; 543 603 Console.WriteLine(" v{0} {1}", k.version.ToString(), installstring); trunk/wipt-put/src/Main.cs
r48 r49 68 68 else 69 69 { 70 Console.Error.WriteLine("E rror: invalid command specified");70 Console.Error.WriteLine("ERROR: invalid command specified"); 71 71 Usage(); 72 72 return; … … 88 88 else 89 89 { 90 Console.Error.WriteLine("E rror: too many arguments");90 Console.Error.WriteLine("ERROR: too many arguments"); 91 91 Usage(); 92 92 return; … … 103 103 else 104 104 { 105 Console.Error.WriteLine("E rror: too many arguments");105 Console.Error.WriteLine("ERROR: too many arguments"); 106 106 Usage(); 107 107 return; … … 118 118 if(repofile == "" || msiurl == "") 119 119 { 120 Console.Error.WriteLine("E rror: not enough parameters");120 Console.Error.WriteLine("ERROR: not enough parameters"); 121 121 Usage(); 122 122 return; 123 123 } 124 124 125 theRepo = new Repository(repofile); 125 try 126 { 127 theRepo = new Repository(repofile); 128 } 129 catch(Exception) 130 { 131 Console.Error.WriteLine("ERROR: could not open repository file"); 132 return; 133 } 126 134 127 135 WebClient wc = new WebClient(); … … 137 145 catch(Exception) 138 146 { 139 Console.Error.WriteLine("ERROR: Could not open MSI database.");147 Console.Error.WriteLine("ERROR: could not open MSI database"); 140 148 return; 141 149 } … … 145 153 if(repofile == "" || maintainer == "" || supporturl == "") 146 154 { 147 Console.Error.WriteLine("E rror: not enough parameters");155 Console.Error.WriteLine("ERROR: not enough parameters"); 148 156 Usage(); 149 157 return; 150 158 } 151 152 Repository.Create(repofile, maintainer, supporturl); 159 160 try 161 { 162 Repository.Create(repofile, maintainer, supporturl); 163 } 164 catch(Exception) 165 { 166 Console.Error.WriteLine("ERROR: Could not create repository file."); 167 return; 168 } 153 169 break; 154 170 default: 155 Console.Error.WriteLine("E rror: no command specified");171 Console.Error.WriteLine("ERROR: no command specified"); 156 172 Usage(); 157 173 break;
