public Rescaler Copy(double newValue) { Rescaler newRescaler = new Rescaler(name, refObject1, refObject2, newValue); foreach (string ctrl in AffectedControls) { newRescaler.AffectedControls.Add(ctrl); } return(newRescaler); }
public bool HasScaler(Rescaler refScaler) { foreach (Rescaler scaler in scalers) { if (scaler.RefObject1 == refScaler.RefObject1 && scaler.RefObject2 == refScaler.RefObject2) { return(true); } } return(false); }
public Rescaler GetScaler(Rescaler refScaler) { foreach (Rescaler scaler in scalers) { if (scaler.RefObject1 == refScaler.RefObject1 && scaler.RefObject2 == refScaler.RefObject2) { return(scaler); } } return(null); }
public string LoadMeta() { string errors = ""; string sRepo = GetRepository(); if (!string.IsNullOrEmpty(sRepo)) { DirectoryInfo repo = new DirectoryInfo(sRepo); if (!repo.Exists) { try { repo.Create(); } catch (Exception e) { errors += "Action Library : Create folder error (" + ExceptionHelper.GetMessages(e) + ")"; } } //Control Maps FileInfo MapsFile = new FileInfo(sRepo + "\\ControlMaps.xml"); if (MapsFile.Exists) { FileStream stream = null; stream = MapsFile.OpenRead(); try { Maps = (ControlsMap)controlsMapSerializer.Deserialize(stream); } catch (Exception e) { errors += "Load xml " + ExceptionHelper.GetMessages(e); } stream.Close(); } if (!Maps.Initialize()) { SaveMap(); } //Model infos ModelInfos.Clear(); DirectoryInfo modelinfosFile = new DirectoryInfo(sRepo + "\\ModelInfos"); if (modelinfosFile.Exists) { FileInfo[] infos = modelinfosFile.GetFiles("*.xml"); if (infos.Length > 0) { foreach (FileInfo info in infos) { FileStream stream = null; stream = info.OpenRead(); try { ModelInfo modelInfo = (ModelInfo)modelInfosSerializer.Deserialize(stream); modelInfo.Name = info.Name.Substring(0, info.Name.Length - 4); if (modelInfo.Name == "REF") { RefModelInfo = modelInfo; } else { ModelInfos.Add(modelInfo.Name, modelInfo); } } catch (Exception e) { errors += "Load Animation Meta " + ExceptionHelper.GetMessages(e); } stream.Close(); } } } else { try { modelinfosFile.Create(); } catch (Exception e) { errors += "Action Library : Create folder error (" + ExceptionHelper.GetMessages(e) + ")"; } } if (RefModelInfo == null) { //Create "Ref" modelInfos RefModelInfo = new ModelInfo("REF"); Rescaler spine = new Rescaler("SpineScaler", "#SPINETOP", "#SPINEBOTTOM", 1); spine.AffectedControls.Add("#SPINEIKTOP"); spine.AffectedControls.Add("#SPINEIKBOTTOM"); RefModelInfo.Scalers.Add(spine); SaveModelInfo(RefModelInfo); } } return(errors); }