public void SetValues(List <TableBlock> blocks) { List <TableBlock> newBlocks = new List <TableBlock>(); foreach (TableBlock block in blocks) { ContentBase content = this.presenter.FindContent(block); if (content != null) { // visual is visible as it was found so we need to remove it if (block.Visibility) { this.presenter.ChangeValues(content, block); } else { this.presenter.Delete(content); } } else { newBlocks.Add(block); } } if (newBlocks.Count > 0) { this.Add(newBlocks); } }
public virtual ActionResult Update(string folderName, string schemaName, string uuid) { folderName = Decrypt(folderName); schemaName = Decrypt(schemaName); TextFolder textFolder; Schema schema; GetSchemaAndFolder(folderName, schemaName, out textFolder, out schema); Exception exception = null; ContentBase content = null; try { if (textFolder != null) { var addCategories = ContentPlugin.GetCategories("AddCategories", this.ControllerContext, this.ControllerContext.HttpContext.Request.Form); var removeCategories = ContentPlugin.GetCategories("RemoveCategories", this.ControllerContext, this.ControllerContext.HttpContext.Request.Form); content = CMS.Content.Services.ServiceFactory.TextContentManager.Update(Repository.Current, textFolder, uuid, HttpContext.Request.Form , HttpContext.Request.Files, DateTime.UtcNow, addCategories, removeCategories, HttpContext.User.Identity.Name); } else { content = CMS.Content.Services.ServiceFactory.TextContentManager.Update(Repository.Current, schema, uuid, HttpContext.Request.Form, HttpContext.Request.Files, HttpContext.User.Identity.Name); } } catch (Exception e) { exception = e; } return(ReturnActionResult(content, exception)); }
public static Hashtable RawGetProductsFromWiki() { #if WIKI string topicName = "Orionsbelt.Shop"; AbsoluteTopicName topic = new AbsoluteTopicName(topicName); ContentBase cb = GetFederation().ContentBaseForNamespace(topic.Namespace); Hashtable categories = new Hashtable(); ArrayList current = null; using (TextReader sr = cb.TextReaderForTopic(topic)) { string line = null; while ((line = sr.ReadLine()) != null) { if (line.StartsWith("!!!")) { current = new ArrayList(); string category = line.Replace("!!!", "").Trim(); categories.Add(category, current); } if (line.StartsWith("||")) { line = line.Replace("||", "|"); string[] parts = line.Split('|'); current.Add(new ShopItem(parts[1], parts[2], parts[3])); } } return(categories); } #else return(new Hashtable()); #endif }
public static void SetUpdatedFields(this ContentBase content) { content.UpdatedBy = System.Security.Principal.WindowsIdentity.GetCurrent().Name; content.UpdatedUtc = DateTime.UtcNow; content.Version++; content.VersionStatus = (int)VersionStatusEnum.Current; }
private bool CheckSetting(ContentBase content, ReceivingSetting receivingSetting, ContentAction action) { if (receivingSetting.ReceivingFolder == null && receivingSetting.ReceivingFolder.Length == 0) { return(false); } if (!string.IsNullOrEmpty(receivingSetting.SendingRepository) && string.Compare(receivingSetting.SendingRepository, content.Repository, true) != 0) { return(false); } if (!string.IsNullOrEmpty(receivingSetting.SendingFolder) && string.Compare(receivingSetting.SendingFolder, content.FolderName, true) != 0) { return(false); } //if (receivingSetting.Published.HasValue && content.Published != receivingSetting.Published.Value) //{ // return false; //} //if ((receivingSetting.AcceptAction & action) != action) //{ // return false; //} return(true); }
public Stream Build(ContentBase content) { var body = content as TextCompressorBody; var finalContent = new StringBuilder(); finalContent.AppendLine(BodyBegin); for (var position = 0; position < body.Content.Length; position++) { var headerToken = body.HeaderTokens.FirstOrDefault(h => h.Value.OccurenceIndexes.Any(o => o == position)); if (string.IsNullOrEmpty(headerToken.Key)) { var character = body.Content[position]; finalContent.Append(character); } else { finalContent.Append(string.Format(SpecialKeyFormat, headerToken.Value.Id)); position += headerToken.Key.Length - 1; } } finalContent.AppendLine(); finalContent.AppendLine(BodyEnd); var byteArray = Encoding.ASCII.GetBytes(finalContent.ToString()); var stream = new MemoryStream(byteArray); return(stream); }
public virtual string Generate(ContentBase content) { string userKey = content.UserKey; if (string.IsNullOrEmpty(userKey)) { userKey = GetColumnValueForUserKey(content); } if (string.IsNullOrEmpty(userKey)) { userKey = content.UUID; } else { if (userKey.Length > 256) { userKey = userKey.Substring(0, 256); } var escapedUserKey = EscapeUserKey(content, userKey); var tmpUserKey = escapedUserKey; int tries = 0; while (IfUserKeyExists(content, tmpUserKey)) { tries++; tmpUserKey = escapedUserKey + "-" + UniqueIdGenerator.GetInstance().GetBase32UniqueId(tries); } userKey = tmpUserKey; } return userKey; }
public static void ShowPropertiesControl(ContentBase content) { frmContentBase frm = null; if (content is StringContent) { frm = new frmStringContent(); } else if (content is NumericContent) { frm = new frmNumericContent(); } else if (content is DateTimeContent) { frm = new frmDateTimeContent(); } else { throw new NotImplementedException(); } frm.Content = content; frm.ShowDialog(); }
public virtual ActionResult Create(string folderName, string schemaName, string parentFolder, string parentUUID) { folderName = Decrypt(folderName); schemaName = Decrypt(schemaName); parentFolder = Decrypt(parentFolder); TextFolder textFolder; Schema schema; GetSchemaAndFolder(folderName, schemaName, out textFolder, out schema); Exception exception = null; ContentBase content = null; try { if (textFolder != null) { var categories = ContentPlugin.GetCategories("Categories", this.ControllerContext, this.ControllerContext.HttpContext.Request.Form); content = ServiceFactory.TextContentManager.Add(Repository.Current, textFolder, parentFolder, parentUUID, HttpContext.Request.Form, HttpContext.Request.Files, categories, HttpContext.User.Identity.Name); } else { content = CMS.Content.Services.ServiceFactory.TextContentManager.Add(Repository.Current, schema, parentUUID, HttpContext.Request.Form, HttpContext.Request.Files, HttpContext.User.Identity.Name); } } catch (Exception e) { exception = e; } return(ReturnActionResult(content, exception)); }
public void AddContent(ContentBase content) { MethodResponse response; if (string.IsNullOrEmpty(content.Id)) { content.GenerateId(); } content.CreateTime = DateTime.UtcNow; var parent = GetContent(content.ParentId); if (parent == null) { content.ParentId = ""; } var totalLevel = GetChildrenNode(content.ParentId).Count(); content.SortOrder = totalLevel + 1; Add <ContentBase>(content, BaseContentType, out response); if (parent != null && response.Success) { parent.Children.Add(content.Id); UpdateContent(parent, null, new string[] { "Children" }); } }
public HistoryListItemViewModel(ContentBase content, IClipboard clipboard) : this() { _content = content; CopyToClipboardCommand = ReactiveCommand.Create(() => { content.SetToClipboard(clipboard); }); Update(); }
public static IEnumerable <ContentBase> Breadcrumb(this ContentBase input) { if (input == null) { return(Enumerable.Empty <ContentBase>()); } return(ContentBase.context.GetBreadcrumb(input.Id)); }
public static void UpdatePageContent(this ContentBase input) { if (input == null) { return; } ContentBase.context.UpdatePageContent(input); }
public static void AddContent(this ContentBase input) { if (input == null) { return; } ContentBase.context.AddContent(input); }
public static void MoveTo(this ContentBase input, ContentBase target) { if (input == null || target == null) { return; } ContentBase.context.MoveContent(input, target); }
public static IQueryable <ContentBase> Children(this ContentBase input) { if (input == null) { return(Enumerable.Empty <ContentBase>().AsQueryable()); } return(ContentBase.context.Find <ContentBase>(input.Children, "ContentBase", out var r)); }
public void RemoveContent(ContentBase content) { if (content == null) { return; } RemoveContent(content.Id); }
public static IQueryable <BsonDocument> ChildrenNode(this ContentBase input) { if (input == null) { return(Enumerable.Empty <BsonDocument>().AsQueryable()); } return(ContentBase.context.Where(b => b["_id"] == input.Id, "ContentBase")); }
public override IContentPipeline GetPipeline(ContentBase content) { if (content is ShaderProgram) { return(new ShaderProgramPipeline()); } return(base.GetPipeline(content)); }
static protected AbsoluteTopicName WriteTestTopicAndNewVersion(ContentBase cb, string localName, string content, string author) { AbsoluteTopicName name = new AbsoluteTopicName(localName, cb.Namespace); name.Version = AbsoluteTopicName.NewVersionStringForUser(author); cb.WriteTopicAndNewVersion(name.LocalName, content); return name; //return new AbsoluteTopicName(localName, cb.Namespace); }
public static ContentBase Parent(this ContentBase input) { if (input == null) { return(null); } return(ContentBase.context.Where(b => b["_id"] == input.ParentId, "ContentBase").FirstOrDefault().ConvertToContentBase()); }
private void WriteSearchResults(HtmlTextWriter writer) { string search = WikiSearch; if (search != null) { writer.WriteLine("<p>Referncias Encontradas para <b>{0}</b>:</p>", search); TopicName topicName = new AbsoluteTopicName(search); if (topicName == null) { OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.ResearchManagement, "Procura sobre " + search); } else { OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.ResearchManagement, "Procura sobre " + topicName.FormattedName); } Hashtable searchTopics = new Hashtable(); ArrayList uniqueNamespaces = new ArrayList(GetFederation().Namespaces); foreach (string ns in uniqueNamespaces) { ContentBase cb = GetFederation().ContentBaseForNamespace(ns); if (cb == null) { continue; } searchTopics[cb] = cb.AllTopics(false); } foreach (ContentBase cb in searchTopics.Keys) { string ns = cb.Namespace; writer.WriteLine("<ul>"); foreach (AbsoluteTopicName topic in (ArrayList)(searchTopics[cb])) { string s = cb.Read(topic); string bodyWithTitle = topic.ToString() + s; if (Regex.IsMatch(bodyWithTitle, search, RegexOptions.IgnoreCase)) { writer.WriteLine("<li>"); writer.WriteLine("<a title='" + topic.Fullname + "' href='" + GetUrl(topic) + "'>"); writer.WriteLine(GetDisplay(topic)); writer.WriteLine("</a>"); writer.WriteLine("</li>"); } } writer.WriteLine("</ul>"); } } else { writer.WriteLine("Pedido Invlido"); } }
/// <inheritdoc/> public virtual IContent CreateMemberContent(INodeBuilder nodeBuilder, ContentBase container, IMemberDescriptor member, bool isPrimitive, object value, bool shouldProcessReference) { var reference = nodeBuilder.CreateReferenceForNode(member.Type, value); return(new MemberContent(nodeBuilder, container, member, isPrimitive, reference) { ShouldProcessReference = shouldProcessReference }); }
public static TEntity MapTo <TEntity>(this ContentBase content) { if (content != null) { return((TEntity)Activator.CreateInstance(typeof(TEntity), content)); } return(default(TEntity)); }
public TEntity Get(ContentBase content) { if (content != null) { var textContent = new TextContent(content); return(Get(textContent)); } return(null); }
public GridContent(ContentBase content, Index2D idx, GridSize widthDefinition, GridSize heightDefinition) : this(idx, widthDefinition, heightDefinition) { Content = content; MinSize = ComputeMinSize(); }
private void InitialCommitObject(ContentBase data) { var commitObject = data.CommitObject; var table = data.Table; foreach (var member in commitObject.Members.OfType <CommitMemberFragment>()) { member.Metadata = table.Members[member.Property.Name]; } }
public static void WriteBlock(ContentBase content) { bool isUniverse = content.Block.ObjectType == ContentType.System; // get properties of content foreach (EditorIniOption option in content.Block.Block.Options) { switch (option.Name.ToLowerInvariant()) { case "pos": if (option.Values.Count > 0) { option.Values[0].Value = WritePosition(content.Position, isUniverse); } else { option.Values.Add(new EditorIniEntry(WritePosition(content.Position, isUniverse))); } break; case "rotate": if (option.Values.Count > 0) { if (!IsZeroRounded(content.Rotation)) { option.Values[0].Value = WriteRotation(content.Rotation, IsCylinder(content.Block.ObjectType)); } else { option.Values.Clear(); } } else if (!IsZeroRounded(content.Rotation)) { option.Values.Add(new EditorIniEntry(WriteRotation(content.Rotation, IsCylinder(content.Block.ObjectType)))); } break; case "size": if (option.Values.Count > 0) { option.Values[0].Value = WriteScale(content.Scale, content.Block.ObjectType); } else { option.Values.Add(new EditorIniEntry(WriteScale(content.Scale, content.Block.ObjectType))); } break; } } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var str = value as string; var par = 0; var pars = parameter as string; if (pars != null) { par = pars.TryInt(); } return(ContentBase.GetResourcePath(str, par)); }
/// <summary> /// 排序系统字段的其它自定义字段值 /// </summary> /// <param name="content">The content.</param> /// <returns></returns> public static NameValueCollection ExcludeBasicFields(ContentBase content) { NameValueCollection values = new NameValueCollection(); foreach (var key in content.Keys.Where(key => !contentBasicFields.Contains(key, StringComparer.CurrentCultureIgnoreCase))) { if (content[key] != null) { values[key] = content[key].ToString(); } } return values; }
protected virtual string EscapeUserKey(ContentBase content, string userKey) { string tmpUserKey = userKey.StripAllTags(); //http://stackoverflow.com/questions/9565360/how-to-convert-utf-8-characters-to-ascii-for-use-in-a-url/9628594#9628594 tmpUserKey = RemoveDiacritics(tmpUserKey); Repository repository = content.GetRepository().AsActual(); tmpUserKey = Regex.Replace(tmpUserKey, repository.UserKeyReplacePattern, repository.UserKeyHyphens); return tmpUserKey; }
public void UpdatePageContent(ContentBase content) { var ignoreKeys = new List <string>() { "ParentId", "Children", "CreateTime", "SortOrder", }; Update(content, content.Id, BaseContentType, ignoreKeys, null, out var response); }
public IActionResult Index(string names) { try { ContentBase selectPage = null; var root = ContentBase.context.Where(b => b["ParentId"] == "", "ContentBase").OrderBy(b => b["SortOrder"]).FirstOrDefault().ConvertToContentBase(); if (String.IsNullOrEmpty(names)) { selectPage = root; if (selectPage == null) { goto GoTO404; } else { goto GoTOView; } } var urls = names.Split('/').Select(b => b.Trim().ToLower()).ToList(); var contains = new List <ContentBase>(); var rootId = ""; var parentId = root.Id; foreach (var url in urls) { var content = ContentBase.context .Where(b => b["Name"] == url && (b["ParentId"] == rootId || b["ParentId"] == parentId), "ContentBase") .OrderBy(b => b["SortOrder"]).FirstOrDefault().ConvertToContentBase(); if (content == null) { goto GoTO404; } if (content.ParentId != rootId && content.ParentId != parentId) { goto GoTO404; } rootId = parentId; parentId = content.Id; contains.Add(content); } selectPage = contains.LastOrDefault(); GoTOView: return(View($"Views/{selectPage.GetType().Name}.cshtml")); GoTO404: return(Content("404")); } catch (Exception ex) { Console.WriteLine(ex.Message); return(Content("")); } }
/// <summary> /// 排序系统字段的其它自定义字段值 /// </summary> /// <param name="content">The content.</param> /// <returns></returns> public static NameValueCollection ExcludeBasicFields(ContentBase content) { NameValueCollection values = new NameValueCollection(); foreach (var key in content.Keys.Where(key => !contentBasicFields.Contains(key, StringComparer.CurrentCultureIgnoreCase))) { if (content[key] != null) { values[key] = content[key].ToString(); } } return(values); }
[SetUp] public void Init() { string author = "tester-joebob"; _lm = new LinkMaker(_bh); TheFederation = new Federation(OutputFormat.HTML, _lm); _base = CreateStore("FlexWiki.Base"); _other1 = CreateStore("FlexWiki.Other1"); _other2 = CreateStore("Other2"); _other3 = CreateStore("Other3"); _cb5 = CreateStore("Space5"); WriteTestTopicAndNewVersion(_base, _base.DefinitionTopicName.Name, @"Import: FlexWiki.Other1, Other2", author); WriteTestTopicAndNewVersion(_base, "TopicOne", @"OtherOneHello", author); WriteTestTopicAndNewVersion(_base, "TopicTwo", @"FlexWiki.Other1.OtherOneGoodbye", author); WriteTestTopicAndNewVersion(_base, "TopicThree", @"No.Such.Namespace.FooBar", author); WriteTestTopicAndNewVersion(_base, "TopicFour", @".TopicOne", author); WriteTestTopicAndNewVersion(_base, "TopicFive", @"FooBar Role:Designer", author); WriteTestTopicAndNewVersion(_base, "TopicSix", @".GooBar Role:Developer", author); WriteTestTopicAndNewVersion(_other1, _other1.DefinitionTopicName.Name, @"Import: Other3,Other2", author); WriteTestTopicAndNewVersion(_other1, "OtherOneHello", @"hello Role:Developer", author); WriteTestTopicAndNewVersion(_other1, "OtherOneGoodbye", @"goodbye", author); WriteTestTopicAndNewVersion(_other1, "OtherOneRefThree", @"OtherThreeTest", author); WriteTestTopicAndNewVersion(_other1, "OtherOneTopicOne", @"OtherTwoHello", author); WriteTestTopicAndNewVersion(_other1, "OtherOneTopicTwo", @"Other2.OtherTwoGoodbye", author); WriteTestTopicAndNewVersion(_other1, "OtherOneTopicThree", @"No.Such.Namespace.FooBar", author); WriteTestTopicAndNewVersion(_other1, "OtherOneTopicFour", @".OtherOneTopicOne", author); WriteTestTopicAndNewVersion(_other1, "OtherOneTopicFive", @"FooBar", author); WriteTestTopicAndNewVersion(_other1, "OtherOneTopicSix", @".GooBar", author); WriteTestTopicAndNewVersion(_other2, "OtherTwoHello", @"hello", author); WriteTestTopicAndNewVersion(_other2, "OtherTwoGoodbye", @"goodbye", author); WriteTestTopicAndNewVersion(_other3, "OtherThreeTest", @"yo", author); WriteTestTopicAndNewVersion(_cb5, "AbsRef", @"Other2.OtherTwoHello", author); }
[SetUp] public void Init() { _lm = new LinkMaker(_base); TheFederation = new Federation(OutputFormat.HTML, _lm); TheFederation.WikiTalkVersion = 1; string ns = "FlexWiki"; string ns2 = "FlexWiki2"; _cb = CreateStore(ns); _cb2 = CreateStore(ns2); WriteTestTopicAndNewVersion(_cb, _cb.DefinitionTopicName.Name, "Import: FlexWiki2", user); WriteTestTopicAndNewVersion(_cb, "HomePage", "This is a simple topic RefOne plus PluralWords reference to wiki://PresentIncluder wiki://TestLibrary/foo.gif", user); WriteTestTopicAndNewVersion(_cb2, "AbsentIncluder", "{{NoSuchTopic}}", user); WriteTestTopicAndNewVersion(_cb2, "PresentIncluder", "{{IncludePresent}}", user); WriteTestTopicAndNewVersion(_cb2, "IncludePresent", "hey! this is ReferencedFromIncludePresent", user); WriteTestTopicAndNewVersion(_cb2, "TestLibrary", "URI: whatever", user); }
[SetUp] public void Init() { TheFederation = new Federation(OutputFormat.HTML, new LinkMaker("/federationtests/")); string author = "tester-joebob"; _base = CreateStore("FlexWiki.Base"); WriteTestTopicAndNewVersion(_base, "TopicOne", @"Hello there", author); WriteTestTopicAndNewVersion(_base, "Versioned", "v1", "tester-bob"); WriteTestTopicAndNewVersion(_base, "Versioned", "v2", "tester-sally"); WriteTestTopicAndNewVersion(_base, "TopicTwo", @"Something about TopicOne and more!", author); WriteTestTopicAndNewVersion(_base, "Props", @"First: one Second: two Third:[ lots and lots ] more stuff ", author); }
public string getContentTypeIcon(ContentBase objCont) { try { int ContentTypeID; string strAssetIcon; ContentTypeID = System.Convert.ToInt32(objCont.ContentType); if (ContentTypeID == 2) { return (formsIcon); } else if (ContentTypeID > Ektron.Cms.Common.EkConstants.ManagedAsset_Min && ContentTypeID < Ektron.Cms.Common.EkConstants.ManagedAsset_Max) { try { strAssetIcon = (string)objCont.AssetInfo.ImageUrl; strAssetIcon = "<img src=\"" + strAssetIcon + "\" alt=\"Asset\">"; return (strAssetIcon); } catch (Exception) { return (ContentIcon); } } else if (objCont.ContentSubType == EkEnumeration.CMSContentSubtype.WebEvent) { return CalendarIcon; } else { return (ContentIcon); } } catch (Exception) { return (ContentIcon); } }
protected virtual string GetColumnValueForUserKey(ContentBase content) { if (content is TextContent) { var textContent = (TextContent)content; var repository = new Repository(textContent.Repository); var schema = new Schema(repository, textContent.SchemaName).AsActual(); var summarizeField = schema.Columns.Where(it => it.Summarize == true).FirstOrDefault(); if (summarizeField == null || textContent[summarizeField.Name] == null) { return textContent.UUID; } else { return textContent[summarizeField.Name].ToString(); } } else if (content is MediaContent) { return ((MediaContent)content).FileName; } return null; }
public static SEQ FromStream(EndianBinaryReader reader, ContentBase activeSHP) { SHP targetSHP = (SHP)activeSHP; /*===================================================================== TODO: add lenght =====================================================================*/ // base ptr needed because the SEQ could be embedded. uint ptrBase = (uint)reader.BaseStream.Position; byte numFrames = reader.ReadByte(); // total number of frames? var unknownPaddingValue1 = reader.ReadByte(); // padding //Trace.Assert(unknownPaddingValue1 == 0); byte numBones = reader.ReadByte(); var unknownPaddingValue2 = reader.ReadByte(); // padding //Trace.Assert(unknownPaddingValue2 == 0); uint size = reader.ReadUInt32(); var unknownPaddingValue3 = reader.ReadUInt32(); // unknown //Trace.Assert(unknownPaddingValue3 == 0); uint ptrFrames = (uint)reader.ReadUInt32() + 8; // pointer to the frames data section uint ptrSequence = ptrFrames + (uint)numFrames; // pointer to the sequence section // number of animations // length of all the headers / length of one animation header int numAnimations = (((int)ptrSequence - numFrames) - 16) / (numBones * 4 + 10); List<AnimationHeader> headers = new List<AnimationHeader>(); for (int i = 0; i < numAnimations; i++) { AnimationHeader animHeader = new AnimationHeader { length = reader.ReadUInt16(), idOtherAnimation = reader.ReadSByte(), // the intial source animation. Used to get initial frames. mode = reader.ReadByte(), ptrLooping = reader.ReadUInt16(), // seems to point to a data block that controls looping ptrTranslation = reader.ReadUInt16(), // points to a translation vector for the animated mesh (root motion?) ptrMove = reader.ReadUInt16(), // points to a data block that controls movement (root motion?) ptrBones = new ushort[numBones], }; // assign bone ptrs for (int p = 0; p < numBones; p++) { animHeader.ptrBones[p] = reader.ReadUInt16(); } for (int j = 0; j < numBones; j++) { var unknownBoneValues = reader.ReadUInt16(); //TODO: this is 0 for all SEQs? //Trace.Assert(unknownBoneValues == 0); // will show if value is ever NOT zero } headers.Add(animHeader); } // TODO: Never used!? sbyte[] frames = new sbyte[numFrames]; for (int i = 0; i < numFrames; i++) { frames[i] = reader.ReadSByte(); } // get source animation data from .SEQ List<Animation> animations = new List<Animation>(); for (int i = 0; i < numAnimations; i++) { Animation animation = new Animation(); // seek translation data long seekTranslationPtr = (long)(headers[i].ptrTranslation + ptrSequence + ptrBase); reader.BaseStream.Seek(seekTranslationPtr, SeekOrigin.Begin); reader.CurrentEndian = Endian.Big; // this is code used in the opcode portion (machine code uses Big) Int16 x = reader.ReadInt16(); Int16 y = reader.ReadInt16(); Int16 z = reader.ReadInt16(); reader.CurrentEndian = Endian.Little; // TODO: implement move // set base animation if (headers[i].idOtherAnimation != -1) { // TODO: FIX THIS // should store other animation inside as base // I assume it only references animations that // have been constructed first otherwise it will hold a dead copy. // animation.baseAnimation = animations[i]; } // read base pose and keyframes animation.poses = new Vector3[numBones]; animation.keyframes = new List<NullableVector4>[numBones]; for (int k = 0; k < numBones; k++) { animation.keyframes[k] = new List<NullableVector4>(); animation.keyframes[k].Add(NullableVector4.Zero()); // read pose long seekBonePtr = (long)(headers[i].ptrBones[k] + ptrSequence + ptrBase); reader.BaseStream.Seek(seekBonePtr, SeekOrigin.Begin); reader.CurrentEndian = Endian.Big; // machine code uses Big Int16 rx = reader.ReadInt16(); Int16 ry = reader.ReadInt16(); Int16 rz = reader.ReadInt16(); reader.CurrentEndian = Endian.Little; animation.poses[k] = new Vector3(rx, ry, rz); // read keyframe float? f = 0; while (true) { // this could be optimized using out values and an advanced way of recording and reading frames NullableVector4 op = ReadOPCode(reader); if (op == null) break; f += op.W; animation.keyframes[k].Add(op); if (f >= headers[i].length - 1) break; } } animations.Add(animation); } // build useable animation data for (int a = 0; a < numAnimations; a++) { // rotation bones for (int i = 0; i < numBones; i++) { List<NullableVector4> keyframes = animations[a].keyframes[i]; Vector3 pose = animations[a].poses[i]; // multiplication by two at 0xad25c, 0xad274, 0xad28c // value * (180f / uint16.max); float rx = pose.X * 2; float ry = pose.Y * 2; float rz = pose.Z * 2; List<Keyframe> keys = new List<Keyframe>(); float t = 0; for (var j = 0; j < keyframes.Count; j++) { NullableVector4 keyframe = keyframes[j]; float f = (float)keyframe.W; t += f; if (keyframe.X == null) keyframe.X = keyframes[j - 1].X; if (keyframe.Y == null) keyframe.Y = keyframes[j - 1].Y; if (keyframe.Z == null) keyframe.Z = keyframes[j - 1].Z; rx += (float)keyframe.X * f; ry += (float)keyframe.Y * f; rz += (float)keyframe.Z * f; Quaternion q = VSTools.Rot2Quat(rx * VSTools.Rot13ToRad, ry * VSTools.Rot13ToRad, rz * VSTools.Rot13ToRad); Keyframe key = new Keyframe(); key.Time = t * VSTools.TimeScale; key.Rotation = q; keys.Add(key); } animations[a].jointKeys.Add(keys); } // root's translation bone List<Keyframe> rootKey = new List<Keyframe>(); rootKey.Add(new Keyframe()); animations[a].jointKeys.Add(rootKey); // translation bones for (int t = 1; t < numBones; t++) { List<Keyframe> transBone = new List<Keyframe>(); Keyframe key = new Keyframe(); key.Position = new Vector3(targetSHP.joints[t].boneLength, 0, 0); transBone.Add(key); animations[a].jointKeys.Add(transBone); } if (headers[a].idOtherAnimation != -1) { animations[a].baseAnimation = animations[headers[a].idOtherAnimation]; } } return new SEQ(animations); }
protected void Page_Load(object sender, EventArgs e) { WebDialogueContext.AddDialogueButton(btnOk); _session = WebDialogueContext.Session; _action = (Enum)WebDialogueContext.DialogueParameters["Action"]; _contentKey = (CKeyNLRC)WebDialogueContext.DialogueParameters["ContentKey"]; _content = _session.GetContent<ContentBase>(_contentKey); if (!IsPostBack) txtNote.Focus(); List<SystemUser> notifyUsers = new List<SystemUser>(); if (!IsPostBack) { if (_action is RevisionAction) { RevisionAction revAction = (RevisionAction)_action; switch (revAction) { case RevisionAction.PublishRequest: case RevisionAction.DeleteRequest: case RevisionAction.UnPublishRequest: case RevisionAction.DeleteCancel: case RevisionAction.PublishCancel: case RevisionAction.UnPublishCancel: notifyUsers = _session.GetAllUserMembersOfGroup(_content.PublishAccessGroupId); break; case RevisionAction.DeleteReject: case RevisionAction.UnPublishReject: case RevisionAction.PublishReject: case RevisionAction.DeleteApprove: case RevisionAction.PublishApprove: case RevisionAction.UnPublishApprove: if (_session.ContentExists(_content.RevisionStateRequestById)) { notifyUsers.Add(_session.GetContent<SystemUser>(_content.RevisionStateRequestById)); } break; case RevisionAction.None: case RevisionAction.UpdateChanges: case RevisionAction.New: case RevisionAction.Archive: case RevisionAction.Restore: case RevisionAction.Delete: case RevisionAction.DeletePermanently: case RevisionAction.Publish: case RevisionAction.UnPublish: case RevisionAction.AddLanguage: case RevisionAction.ActivateLanguage: case RevisionAction.DeactivateLanguage: case RevisionAction.RemoveLanguage: default: break; } } if (_action is NodeAction) { NodeAction nodeAction = (NodeAction)_action; switch (nodeAction) { case NodeAction.DeleteRequest: case NodeAction.RestoreRequest: case NodeAction.DeleteCancel: case NodeAction.RestoreCancel: notifyUsers = _session.GetAllUserMembersOfGroup(_content.PublishAccessGroupId); break; case NodeAction.DeleteApprove: case NodeAction.RestoreApprove: case NodeAction.RestoreReject: case NodeAction.DeleteReject: if (_session.ContentExists(_content.NodeStateRequestById)) { notifyUsers.Add(_session.GetContent<SystemUser>(_content.NodeStateRequestById)); } break; case NodeAction.None: case NodeAction.Delete: case NodeAction.DeletePermanently: case NodeAction.Restore: default: break; } } chkList.Items.Clear(); foreach (SystemUser u in notifyUsers) { ListItem item = new ListItem(WAFContext.GetHtmlContentIcon(u) + u.EmailName, u.NodeId.ToString(), true); chkList.Items.Add(item); } } }
public void Init() { TheFederation = new Federation(OutputFormat.HTML, new LinkMaker("/morecontentbasetests/")); _base = CreateStore("FlexWiki.Projects.Wiki"); _imp1 = CreateStore("FlexWiki.Projects.Wiki1"); _imp2 = CreateStore("FlexWiki.Projects.Wiki2"); string author = "tester-joebob"; WriteTestTopicAndNewVersion(_base, _base.DefinitionTopicName.Name, @" Description: Test description Import: FlexWiki.Projects.Wiki1, FlexWiki.Projects.Wiki2", author); }
void StopMonitoringEvents(ContentBase cb) { cb.FederationUpdated -= new ContentBase.FederationUpdateEventHandler(FederationUpdateMonitor); }
void StartMonitoringEvents(ContentBase cb) { cb.FederationUpdated += new ContentBase.FederationUpdateEventHandler(FederationUpdateMonitor); _Events = new ArrayList(); }
public void Init() { string author = "tester-joebob"; _lm = new LinkMaker("/contentbasetests/"); TheFederation = new Federation(OutputFormat.HTML, _lm); _base = CreateStore("FlexWiki.Base"); WriteTestTopicAndNewVersion(_base, "TopicOne", @"Hello there", author); System.Threading.Thread.Sleep(100); // need the newer one to be newer enough! WriteTestTopicAndNewVersion(_base, "TopicOne", @"Hello a", author); System.Threading.Thread.Sleep(100); // need the newer one to be newer enough! WriteTestTopicAndNewVersion(_base, "TopicOne", @"Hello b", author); System.Threading.Thread.Sleep(100); // need the newer one to be newer enough! WriteTestTopicAndNewVersion(_base, "TopicOne", @"Hello c", author); WriteTestTopicAndNewVersion(_base, "Versioned", "v1", "tester-bob"); WriteTestTopicAndNewVersion(_base, "Versioned", "v2", "tester-sally"); WriteTestTopicAndNewVersion(_base, "TopicTwo", @"Something about TopicOne and more!", author); WriteTestTopicAndNewVersion(_base, "Props", @"First: one Second: two Third:[ lots and lots ] more stuff ", author); WriteTestTopicAndNewVersion(_base, "TopicOlder", @"write first", author); WriteTestTopicAndNewVersion(_base, "ExternalWikis", @"@wiki1=dozo$$$ @wiki2=fat$$$", author); System.Threading.Thread.Sleep(100); // need the newer one to be newer enough! // THIS ONE (TopicNewer) MUST BE WRITTEN LAST!!!! WriteTestTopicAndNewVersion(_base, "TopicNewer", @"write last", author); }
public virtual string Generate(ContentBase content) { return UniqueIdGenerator.GetInstance().GetBase32UniqueId(16); }
[SetUp] public void Init() { TheFederation = new Federation(OutputFormat.HTML, new LinkMaker("http://boobar")); _base = CreateStore("FlexWiki.Projects.Wiki"); _imp1 = CreateStore("FlexWiki.Projects.Wiki1"); _imp2 = CreateStore("FlexWiki.Projects.Wiki2"); string author = "tester-joebob"; WriteTestTopicAndNewVersion(_base, _base.DefinitionTopicName.Name, @" Description: Test description Import: FlexWiki.Projects.Wiki1", author); WriteTestTopicAndNewVersion(_imp1, _imp1.DefinitionTopicName.Name, @" Description: Test1 description Import: FlexWiki.Projects.Wiki2", author); WriteTestTopicAndNewVersion(_imp2, _imp2.DefinitionTopicName.Name, @" Description: Test1 description Import: FlexWiki.Projects.Wiki", author); }
protected virtual bool IfUserKeyExists(ContentBase content, string userKey) { var repository = new Repository(content.Repository); if (content is TextContent) { var textContent = (TextContent)content; var schema = new Schema(repository, textContent.SchemaName); var contentExists = schema.CreateQuery().WhereEquals("UserKey", userKey).FirstOrDefault(); if (contentExists != null) { return contentExists.UUID != content.UUID; } return false; } else if (content is MediaContent) { var mediaContent = (MediaContent)content; var folder = new MediaFolder(repository, mediaContent.FolderName); var contentExists = folder.CreateQuery().WhereEquals("UserKey", userKey).FirstOrDefault(); if (contentExists != null) { return contentExists.UUID != content.UUID; } return false; } return false; }
[SetUp] public void Init() { _lm = new LinkMaker(_base); TheFederation = new Federation(OutputFormat.HTML, _lm); TheFederation.WikiTalkVersion = 1; string ns = "FlexWiki"; string ns2 = "FlexWiki2"; _cb = CreateStore(ns); _cb2 = CreateStore(ns2); WriteTestTopicAndNewVersion(_cb, "HomePage", "", user); WriteTestTopicAndNewVersion(_cb, _cb.DefinitionTopicName.Name, @"Import: FlexWiki2", user); WriteTestTopicAndNewVersion(_cb, "QualifiedLocalPropertyRef", @" Color: green color=@@topics.QualifiedLocalPropertyRef.Color@@", user); WriteTestTopicAndNewVersion(_cb, "UnqualifiedLocalPropertyRef", @" Color: green color=@@Color@@", user); WriteTestTopicAndNewVersion(_cb, "QualifiedLocalMethodRef", @" len=@@topics.QualifiedLocalMethodRef.DirectStringLength(""hello"")@@ DirectStringLength: { str | str.Length } ", user); WriteTestTopicAndNewVersion(_cb, "UnqualifiedLocalMethodRef", @" len=@@DirectStringLength(""hello"")@@ DirectStringLength: { str | str.Length } ", user); WriteTestTopicAndNewVersion(_cb, "LocalMethodIndirection", @" len=@@StringLength(""hello"")@@ StringLength: { str | Len(str) } Len: { str | str.Length } ", user); WriteTestTopicAndNewVersion(_cb, "LocalMethodIndirection2", @" len=@@StringLength(""hello"")@@ StringLength: { str | Len(str) } Len: { s | s.Length } ", user); WriteTestTopicAndNewVersion(_cb, "CallerBlockLocalsShouldBeInvisible", @" len=@@StringLength(""hello"")@@ StringLength: { str | Len(str) } Len: { s | str.Length } ", user); WriteTestTopicAndNewVersion(_cb2, "Profile", @"Color: puce", user); WriteTestTopicAndNewVersion(_cb, "ReferAcrossNamespaces", @"@@topics.Profile.Color@@", user); WriteTestTopicAndNewVersion(_cb, "TestChecker", @" Test: { FearFactor } Color: green", user); WriteTestTopicAndNewVersion(_cb, "CallTestChecker", @" FearFactor: nighttime test=@@topics.TestChecker.Test@@ ", user); WriteTestTopicAndNewVersion(_cb, "Topic1", @" Function: { arg1 | topics.Topic2.FunctionTwo( { arg1 } ) } ", user); WriteTestTopicAndNewVersion(_cb, "Topic2", @" FunctionTwo: { someArg | someArg.Value } ", user); WriteTestTopicAndNewVersion(_cb, "Topic3", @"@@topics.Topic1.Function(100)@@", user); WriteTestTopicAndNewVersion(_cb, "BlockCanSeeLexicalScopeCaller", @" result=@@ topics.BlockCanSeeLexicalScopeCallee.BlockValue( { Color } ) @@ Color: green", user); WriteTestTopicAndNewVersion(_cb, "BlockCanSeeLexicalScopeCallee", @" BlockValue: {aBlock | aBlock.Value }", user); WriteTestTopicAndNewVersion(_cb, "ThisTests", @" topic=@@topic.Name@@ namespace=@@namespace.Name@@ nscount=@@federation.Namespaces.Count@@ color=@@this.Color@@ Color: red ", user); }
public ContentIntegrateId(ContentBase content) : this(content.Repository, content.FolderName, content.UUID) { }