public bool HasIllegalItems(string vaultRoot) { if ((Mirrors.Count() == 0) && (Deletes.Count() == 0)) { return(false); } if (IsStringIllegal(vaultRoot)) { return(true); } foreach (string mirror in Mirrors) { string local = GetLocalFolder(mirror, vaultRoot); if (IsStringIllegal(local)) { return(true); } } foreach (string delete in Deletes) { string local = delete;//GetLocalFolder(delete, vaultRoot); if (IsStringIllegal(local)) { return(true); } } return(false); }
public void BreakMirrorTest() { Mirrors test = new Mirrors(); test.smashMirror(); Assert.IsTrue(test.isCracked()); Assert.IsTrue(test.isDirty()); }
private string ValidateAndCorrectSelectedMirror(string selectedMirrorName, Func <Mirrors.MirrorConfiguration, string> mirrorProperty) { if (selectedMirrorName != null && Mirrors.ContainsKey(selectedMirrorName) && !String.IsNullOrWhiteSpace(mirrorProperty(Mirrors[selectedMirrorName]))) { return(selectedMirrorName); } return(null); }
public void CreateEmptyFolders(string localPath, int retries) { if (Mirrors.Count() > 0) { foreach (Folder folder in FoldersToCreate) { if (VaultEagle.VaultUtils.HandleNetworkErrors(() => !System.IO.Directory.Exists(GetLocalFolder(folder.FullName, localPath)), retries)) { VaultEagle.VaultUtils.HandleNetworkErrors(() => System.IO.Directory.CreateDirectory(GetLocalFolder(folder.FullName, localPath)), retries); } } } }
private void Clear() { Mirrors.Remove(this); if (mTex) { mTex.Release(); DestroyImmediate(mTex); mTex = null; } if (reflectionCamera) { DestroyImmediate(reflectionCamera.gameObject); } }
//public Car() : this("Unknown", "Unknown", 100, 1.5, "100", 100, 4) { } public Car(string EngineHealth, string Transmission, double MaxSpeed, double TankCapacity, string QualityOfSparkPlug, byte BatteryChargeInPercent, int nubmerOfWheels, int seatsHealth, int roofHealth, byte howManyMirrors, int countOfDoors, int doorsHealth, byte countOfSeats) { this.EngineHealth = EngineHealth; this.Transmission = Transmission; this.MaxSpeed = MaxSpeed; this.TankCapacity = TankCapacity; this.QualityOfSparkPlug = QualityOfSparkPlug; this.BatteryChargeInPercent = BatteryChargeInPercent; this.MirrorsObj = new Mirrors(howManyMirrors); this.OdometrObj = new Odometr(); this.SeatsObj = new Seats(seatsHealth, countOfSeats); this.DoorsObj = new Doors(countOfDoors, doorsHealth); this.WaterProofObj = new WaterProof(); this.RoofObj = new Roof(roofHealth); this.WheelsObj = new Wheels(nubmerOfWheels); }
public PixivSite(bool isR18 = false) { IsR18 = isR18; InitCat(); DownloadTypes.Add("原图", DownloadTypeEnum.Origin); DownloadTypes.Add("大图", DownloadTypeEnum.Large); LoginPageUrl = "https://accounts.pixiv.net/login"; Mirrors.Add(new MirrorSiteConfig { Name = "pixiviz", HomeUrl = "https://pixiviz.pwp.app/" }); }
public Model.DataStructures.DownloadItem[] GetFilesAndPathsForItem(Connection connection, List <Tuple <FileFolder, Option <string> > > fileAndFolders, List <File> addedFiles, string vaultRoot, bool allowChildren, int networkRetries) { List <string> skipFolder = new List <string>(); VaultEagle.VaultCommunication com = new VaultEagle.VaultCommunication(); com.InitializeFromConnection(connection); // List<Tuple<File, string, bool, bool>> filesAndPaths = new List<Tuple<File, string, bool, bool>>(); List <Model.DataStructures.DownloadItem> filesToDownload = new List <Model.DataStructures.DownloadItem>(); foreach (Tuple <FileFolder, Option <string> > fileAndFolderComponent in fileAndFolders) { FileFolder fileAndFolder = fileAndFolderComponent.Item1; foreach (string fp in SkipFolders) { if ((!skipFolder.Contains(fileAndFolder.Folder.FullName)) && (fileAndFolder.Folder.Cat.CatName.Equals(fp))) { skipFolder.Add(fileAndFolder.Folder.FullName); } } if ((AbhereSynchronizationRules(fileAndFolder, Recursive, allowChildren)) && (!skipFolder.Contains(fileAndFolder.Folder.FullName))) { if ((Mirrors.Where(m => fileAndFolder.Folder.FullName.ToLower().Contains(m.ToLower())).Count() > 0) && !(RecursiveMirrors.Where(m => fileAndFolder.Folder.FullName.Equals(m, StringComparison.InvariantCultureIgnoreCase)).Count() == 1)) { RecursiveMirrors.Add(fileAndFolder.Folder.FullName); MirrorsToFiles.Add(new Tuple <string, List <File> >(fileAndFolder.Folder.FullName, new List <File>())); } foreach (Tuple <string, List <File> > mirrorItem in MirrorsToFiles) { if (mirrorItem.Item1.Equals(fileAndFolder.Folder.FullName, StringComparison.InvariantCultureIgnoreCase)) { mirrorItem.Item2.Add(fileAndFolder.File); } } string localFilePath = GetLocalFolder(fileAndFolder.Folder.FullName + "/" + fileAndFolder.File.Name, vaultRoot); // if (System.IO.Path. string localPath = System.IO.Path.GetDirectoryName(localFilePath); File file = null; if ((DownloadOnState.Count > 0) /* && (DownloadOnState.Get().Equals("Released", StringComparison.InvariantCultureIgnoreCase))*/) { File releasedFile = null; VaultEagle.VaultUtils.FileState state = VaultEagle.VaultUtils.GetLastRelevantFileState(fileAndFolder.File.VerNum, fileAndFolder.File.MasterId, connection, ref releasedFile, DownloadOnState, InvalidStates.ToList()); if (state == VaultEagle.VaultUtils.FileState.Ok) { file = releasedFile; } else if (state == VaultEagle.VaultUtils.FileState.Obsolete) { DeleteFile(localFilePath, networkRetries); //Delete file? } } else { file = fileAndFolder.File; } if (file == null) { continue; } if (VaultEagle.VaultUtils.HandleNetworkErrors(() => System.IO.File.Exists(localPath + "/" + fileAndFolder.File.Name), networkRetries)) { if (file != null) { if (Force || file.Cksum != VaultEagle.VaultUtils.HandleNetworkErrors(() => { return(VaultEagle.VaultCommunication.CalculateCrc32(localPath + "/" + fileAndFolder.File.Name)); }, networkRetries)) { if (!addedFiles.Contains(file)) { if (DownloadToTemp) { bool run = RunFile(file); TempFilesAndFinalPath.Add(new Tuple <string, string>(System.IO.Path.Combine(TempPath, file.Name), System.IO.Path.Combine(localPath, file.Name))); //filesAndPaths.Add(new Tuple<File, string, bool, bool>(PatternsToSynchronize.Count() == 1 && PatternsToSynchronize[0].Equals("/") ? null : file, TempPath, Writable, run)); filesToDownload.Add(GetDownloadItem(TempPath, file, Writable, run, fileAndFolderComponent.Item2)); } else { bool run = RunFile(file); //filesAndPaths.Add(new Tuple<File, string, bool, bool>(PatternsToSynchronize.Count() == 1 && PatternsToSynchronize[0].Equals("/") ? null : file, localPath, Writable, run)); filesToDownload.Add(GetDownloadItem(localPath, file, Writable, run, fileAndFolderComponent.Item2)); } addedFiles.Add(file); } } } } else if (file != null) { if (!addedFiles.Contains(file)) { if (DownloadToTemp) { bool run = RunFile(file); TempFilesAndFinalPath.Add(new Tuple <string, string>(System.IO.Path.Combine(TempPath, file.Name), System.IO.Path.Combine(localPath, file.Name))); // filesAndPaths.Add(new Tuple<File, string, bool, bool>(PatternsToSynchronize.Count() == 1 && PatternsToSynchronize[0].Equals("/") ? null : file, TempPath, Writable, run)); filesToDownload.Add(GetDownloadItem(TempPath, file, Writable, run, fileAndFolderComponent.Item2)); } else { bool run = RunFile(file); //filesAndPaths.Add(new Tuple<File, string, bool, bool>(PatternsToSynchronize.Count() == 1 && PatternsToSynchronize[0].Equals("/") ? null : file, localPath, Writable, run)); filesToDownload.Add(GetDownloadItem(localPath, file, Writable, run, fileAndFolderComponent.Item2)); } addedFiles.Add(file); } } } else if (!Recursive && fileAndFolder.Folder.FullName.Equals(VaultPath)) { filesToDownload.Add(new Model.DataStructures.DownloadFolder(GetLocalFolder(VaultPath, vaultRoot))); } //filesAndPaths.Add(new Tuple<File, string, bool, bool>(null, GetLocalFolder(VaultPath, vaultRoot), false, false)); } UpdateMirrorToFiles(vaultRoot); return(filesToDownload.ToArray()); }
public void SimpleConstructorTest() { Mirrors test = new Mirrors(); Assert.IsTrue(test.isFixed()); }
/// <summary> /// Converts the value of the current <see cref="RepositoryDescription"/> object to its equivalent <see cref="String"/> representation. /// </summary> /// <returns>The <see cref="String"/> representation of the values of the <see cref="RepositoryDescription"/> object</returns> public override string ToString() { return("{version:" + Version.Major + ",services:{" + String.Join(",", Services.Select(s => "\"" + s.Name + "\": \"" + s.RootUrl.ToString() + "\"")) + "},mirrors:[" + String.Join(",", Mirrors.Select(u => "\"" + u.ToString() + "\"")) + "]}"); }
public void AddMirror(Mirror mirror) { Mirrors.Add(mirror); }