//-------------------------------------------------------------------------- // // Visitor Methods // //-------------------------------------------------------------------------- /// <summary> Invokes the defineFont visitor on the given TagHandler. /// /// </summary> /// <param name="handler">The SWF TagHandler. /// </param> public override void visit(TagHandler handler) { if (code == Flash.Swf.TagValues.stagDefineFont2) { handler.defineFont2(this); } }
public string ParseText(string runCode, TagHandler tag, TextHandler textHandler, ParseText owner) { textHandler.FlagBreak = true; runCode = "<Hyperlink "; foreach (var el in tag.VariantsTag) { switch (el.Variant.ToLower().Trim()) { case "url": if (el.Value == "") { break; } runCode += "NavigateUri='" + el.Value + "' "; break; case "bold": runCode += @"FontWeight='Bold' "; break; } } return(runCode + ">" + textHandler.Text + " </Hyperlink>"); }
static public void AddTagHandler(Type type) { Assembly tagDLL = type.Assembly; // store Assembly if (!LateBindingAssemblies.ContainsKey(tagDLL.FullName)) { LateBindingAssemblies.Add(tagDLL.FullName, tagDLL); } // create the TagHandler representation TagHandler newTagHandler = new TagHandler(type); newTagHandler.AssemblyName = tagDLL.FullName; newTagHandler.ClassName = type.FullName; newTagHandler.TagName = type.Name.ToLower(); if (CustomTags.ContainsKey(newTagHandler.TagName)) { throw new Exception("ERROR! Unable to add the custom tag: <" + newTagHandler.TagName + ">, found in: " + tagDLL.Location + " as a handler for this tag already exists."); } else { CustomTags.Add(newTagHandler.TagName, newTagHandler); } }
void DecodeHTML() { TagFinder tagFinder = new TagFinder(); TagHandler tagHandler = new TagHandler(); ContentFinder contentFinder = new ContentFinder(); foreach (char c in html) { if (c == '\n') { continue; } Tag t = tagFinder.InputChar(c); tagHandler.InputTag(t); if (tagFinder.Recording) { continue; } /*Debug.Log ("================="); * if (tagHandler.LastStartTag != null) { * Debug.Log ("start: " + tagHandler.LastStartTag.name); * } * if (tagHandler.LastEndTag != null) { * Debug.Log ("end: " + tagHandler.LastEndTag.name); * }*/ contentFinder.InputChar(tagHandler.Tags, tagHandler.LastStartTag, tagHandler.LastEndTag, c); } }
public Musics(string path) { MusicFile = new Mp3File(path); try { OriginalTags = MusicFile.TagHandler; AcrTags = new Mp3File(path).TagHandler; ApiTags = new Mp3File(path).TagHandler; NewTags = new Mp3File(path).TagHandler; } catch (NotImplementedException) { ((IErrorManager)Lookup.GetInstance().Get(typeof(IErrorManager))).NewError(ErrorCodes.id3v2_not_supported, MusicFile.FileName); OriginalTags = new TagHandler(new TagModel()); AcrTags = new TagHandler(new TagModel()); ApiTags = new TagHandler(new TagModel()); NewTags = new TagHandler(new TagModel()); } catch (InvalidFrameException) { ((IErrorManager)Lookup.GetInstance().Get(typeof(IErrorManager))).NewError(ErrorCodes.invalid_encoding, MusicFile.FileName); OriginalTags = new TagHandler(new TagModel()); AcrTags = new TagHandler(new TagModel()); ApiTags = new TagHandler(new TagModel()); NewTags = new TagHandler(new TagModel()); } catch (Exception) { ((IErrorManager)Lookup.GetInstance().Get(typeof(IErrorManager))).NewError(ErrorCodes.unknown, MusicFile.FileName); OriginalTags = new TagHandler(new TagModel()); AcrTags = new TagHandler(new TagModel()); ApiTags = new TagHandler(new TagModel()); NewTags = new TagHandler(new TagModel()); } Logger.Instance.LoadFromDirectoryLog(this); }
/// <summary> /// Searches the CustomTag collection and processes the AIML if an appropriate tag handler is found /// </summary> /// <param name="user">the user who originated the request</param> /// <param name="query">the query that produced this node</param> /// <param name="request">the request from the user</param> /// <param name="result">the result to be sent to the user</param> /// <param name="node">the node to evaluate</param> /// <returns>the output string</returns> public AIMLTagHandler getBespokeTags(User user, SubQuery query, Request request, Result result, XmlNode node) { if (this.CustomTags.ContainsKey(node.Name.ToLower())) { TagHandler customTagHandler = (TagHandler)this.CustomTags[node.Name.ToLower()]; AIMLTagHandler newCustomTag = customTagHandler.Instantiate(this.LateBindingAssemblies); if (object.Equals(null, newCustomTag)) { return(null); } else { newCustomTag.user = user; newCustomTag.query = query; newCustomTag.request = request; newCustomTag.result = result; newCustomTag.templateNode = node; newCustomTag.templateNode.Attributes.RemoveNamedItem("xmlns"); newCustomTag.InputString = node.OuterXml; newCustomTag.bot = this; return(newCustomTag); } } else { return(null); } }
public override void visit(TagHandler h) { switch (code) { case Flash.Swf.TagValues.stagDefineShape: h.defineShape(this); break; case Flash.Swf.TagValues.stagDefineShape2: h.defineShape2(this); break; case Flash.Swf.TagValues.stagDefineShape3: h.defineShape3(this); break; case Flash.Swf.TagValues.stagDefineShape6: h.defineShape6(this); break; default: System.Diagnostics.Debug.Assert(false); break; } }
public virtual void PostSetup() { simulatorBody = transform.FindDeepChild("SimulatorBody"); if (simulatorBody) { Destroy(simulatorBody.gameObject); } rb = GetComponent <Rigidbody2D>(); if (!rb) { rb = gameObject.AddComponent <Rigidbody2D>(); } rb.isKinematic = false; rb.constraints = RigidbodyConstraints2D.FreezeAll; body = transform.FindDeepChild("Body"); sprite = transform.FindDeepChild("Sprite"); sprite.gameObject.SetActive(true); body.gameObject.SetActive(true); destroyer = GetComponent <Destroyer>(); TagHandler handler = GetComponent <TagHandler>(); if (!GetComponent <TagHandler>()) { handler = gameObject.AddComponent <TagHandler>(); } handler.tags.Add(Tag.Feature); if (destroyer) { destroyer.DestroyEvent += Destroy; } }
/// <summary> /// Searches the CustomTag collection and processes the AIML if an appropriate tag handler is found /// </summary> /// <param name="user">the user who originated the request</param> /// <param name="query">the query that produced this node</param> /// <param name="request">the request from the user</param> /// <param name="result">the result to be sent to the user</param> /// <param name="node">the node to evaluate</param> /// <returns>the output string</returns> public AIMLTagHandler getBespokeTags(User user, SubQuery query, Request request, Result result, XmlNode node) { if (CustomTags.ContainsKey(node.Name.ToLower())) { TagHandler customTagHandler = CustomTags[node.Name.ToLower()]; AIMLTagHandler newCustomTag = customTagHandler.Instantiate(LateBindingAssemblies); if (object.Equals(null, newCustomTag)) { return(null); } else { newCustomTag.user = user; newCustomTag.query = query; newCustomTag.request = request; newCustomTag.result = result; newCustomTag.templateNode = node; newCustomTag.bot = this; return(newCustomTag); } } else { return(null); } }
private void createSnippets() { SnippetHandler snippetHandler = new SnippetHandler(); TagHandler tagHandler = new TagHandler(this); AssocationHandler assocationHandler = new AssocationHandler(); Assets.Scripts.DataBase.Snippet[] snippetArr = snippetHandler.GetAllSnippets(); snippetObjectDict = new Dictionary <int, GameObject>(); foreach (Assets.Scripts.DataBase.Snippet snippet in snippetArr) { GameObject instantiatedSnippet = Instantiate(snippetPrefab) as GameObject; //instantiatedSnippet.tag = "group" + Random.Range(1, 2); //Temporary hack measure, randomly assign snippet to one of two groups SnippetState instSnippetState = instantiatedSnippet.GetComponent <SnippetState>(); instSnippetState.loadState(tagHandler.GetTagBySnippetId(snippet.Snippet_Id), snippet, assocationHandler.GetAssociationViewForSnippet(snippet.Snippet_Id)); instantiatedSnippet.name = instSnippetState.title; //names each snippet by its title snippetObjectDict.Add(instSnippetState.id, instantiatedSnippet); } }
public static bool HasTags(this GameObject g, bool all = false, params Tag[] t) { TagHandler th = g.GetComponent <TagHandler>(); if (!th) { th = g.GetComponentInParent <TagHandler>(); } if (!th) { return(false); } else { bool found = all; foreach (Tag tag in t) { if (!th.HasTag(tag)) { if (all) { return(false); } else { found = true; } } } return(found); } }
public ID3AdapterEdit(Mp3File mp3File) { _mp3File = mp3File; _tagHandler = new TagHandler(_mp3File.TagModel); InitializeComponent(); }
/// <summary> /// 构造函数 /// </summary> /// <param name="mFileName">Mp3文件路径</param> public TagHelper(string mFileName) { this.mFileName = mFileName; //创建Mp3File对象 mMp3File = new Mp3File(mFileName); //获取TagHandler mHandler = mMp3File.TagHandler; }
/// <summary> /// Searches the CustomTag collection and processes the AIML if an appropriate tag handler is found /// </summary> /// <param name="user">the user who originated the request</param> /// <param name="query">the query that produced targetBot node</param> /// <param name="request">the request from the user</param> /// <param name="result">the result to be sent to the user</param> /// <param name="node">the node to evaluate</param> /// <returns>the output Unifiable</returns> static public AIMLTagHandler getBespokeTags(User user, SubQuery query, Request request, Result result, XmlNode node) { AltBot targetBot = query.TargetBot; string nodename = node.Name.ToLower(); if (CustomTags != null) { //return null; try { lock (CustomTags) if (CustomTags.ContainsKey(nodename)) { TagHandler customTagHandler = CustomTags[node.Name.ToLower()]; AIMLTagHandler newCustomTag = customTagHandler.Instantiate(LateBindingAssemblies, user, query, request, result, node, targetBot); if (Equals(null, newCustomTag)) { return(null); } else { return(newCustomTag); } } } catch (Exception e) { writeToLog("WARNING IN GET BESPOKE TAGS: " + e); } } { try { if (nodename.StartsWith("#")) { return(null); } String typeName = typeof(TagHandlerProcessor).Namespace + ".AIMLTagHandlers." + nodename; Type t = Type.GetType(typeName); if (t == null) { return(null); } ConstructorInfo c = t.GetConstructor(TagHandler.CONSTRUCTOR_TYPES); return((AIMLTagHandler)c.Invoke(new object[] { targetBot, user, query, request, result, node })); } catch (Exception e) { writeToLog("ERROR getBespokeTags: " + e); return(null); } } }
public static string AlbumArtist(this TagHandler tag) { if (tag.FrameModel.Any(f => f.FrameId == "TPE2")) { return(tag.FrameModel.FirstOrDefault(f => f.FrameId == "TPE2").ToString()); } return(""); }
private void Button_OnClick(object sender, RoutedEventArgs e) { string handRecord; List <Tag> tags = TagHandler.GetCorrectTags(@"E:\2017\DebugStandardTable\SymbolAnalysis\V4_BAIC\Symbol\ZULI3.SDF", out handRecord); ILog logger = LogManager.GetLogger("Tag.Logging"); logger.Debug(handRecord); MessageBox.Show("ok"); }
public void OnTriggerEnter(Collider other) { TagHandler th = other.GetComponent <TagHandler>(); if (th) { if (th.HasTag(item_tag)) { TagEvent?.Invoke(other.transform); } } }
public void GetGainTagsInTheBeginning() { var names = Assembly.GetExecutingAssembly().GetManifestResourceNames(); var name = names.Where(n => n.Contains("Loud.mp3")).First(); using (var strm = Assembly.GetExecutingAssembly().GetManifestResourceStream(name)) { var tags = TagHandler.Read(strm); var id3v2 = tags.Single(t => t.Type == TagTypes.Id3v2); Assert.IsNotNull(id3v2); } }
public AwsCdkSecretHandler(Construct scope, string applicationName, string environmentName, AwsCdkKmsHandler awsCdkKmsHandler, string region, string accountId) : base(scope, applicationName, environmentName, region) { if (string.IsNullOrEmpty(region) || string.IsNullOrEmpty(accountId)) { throw new ArgumentException("The accountId or region can not be null for the secrethandler constructor"); } TagHandler = new TagHandler(); AwsCdkKmsHandler = awsCdkKmsHandler; Region = region; AccountId = accountId; }
public virtual void Awake() { th = GetComponent <TagHandler>(); item = GetComponentInChildren <Item>(); if (item) { th.Add(item.GetComponent <TagHandler>().tagList); } c = GetComponent <Collider>(); if (!item && c) { c.isTrigger = true; } }
/// <summary> /// Loads any custom tag handlers found in the dll referenced in the argument /// </summary> /// <param name="pathToDLL">the path to the dll containing the custom tag handling code</param> public void loadCustomTagHandlers(string pathToDLL) { #if NETSTANDARD Assembly tagDLL = System.Runtime.Loader.AssemblyLoadContext.Default.LoadFromAssemblyPath(pathToDLL); #else Assembly tagDLL = Assembly.LoadFrom(pathToDLL); #endif Type[] tagDLLTypes = tagDLL.GetTypes(); for (int i = 0; i < tagDLLTypes.Length; i++) { var typeCustomAttributes = tagDLLTypes[i] #if NETSTANDARD .GetTypeInfo() #endif .GetCustomAttributes(false); foreach (var typeCustomAttribute in typeCustomAttributes) { if (typeCustomAttribute is CustomTagAttribute) { // We've found a custom tag handling class // so store the assembly and store it away in the Dictionary<,> as a TagHandler class for // later usage // store Assembly if (!this.LateBindingAssemblies.ContainsKey(tagDLL.FullName)) { this.LateBindingAssemblies.Add(tagDLL.FullName, tagDLL); } // create the TagHandler representation TagHandler newTagHandler = new TagHandler(); newTagHandler.AssemblyName = tagDLL.FullName; newTagHandler.ClassName = tagDLLTypes[i].FullName; newTagHandler.TagName = tagDLLTypes[i].Name.ToLower(); if (this.CustomTags.ContainsKey(newTagHandler.TagName)) { throw new Exception("ERROR! Unable to add the custom tag: <" + newTagHandler.TagName + ">, found in: " + pathToDLL + " as a handler for this tag already exists."); } else { this.CustomTags.Add(newTagHandler.TagName, newTagHandler); } } } } }
public static bool HasAnyTag(this GameObject g, params Tag[] tags) { TagHandler handler = g.GetComponent <TagHandler>(); if (!handler) { return(false); } foreach (Tag tag in tags) { if (handler.tags.Contains(tag)) { return(true); } } return(false); }
private static void func0(string path) { string[] files = Directory.GetFiles(path); foreach (string f in files) { Console.WriteLine(f); Mp3File mp3 = new Mp3File(f); TagHandler thd = mp3.TagHandler; string artist = Pinyin.GetPinyin(thd.Artist); thd.Artist = CapFirstLetter(artist).Trim(); string title = Pinyin.GetPinyin(thd.Title); thd.Title = CapFirstLetter(title).Trim(); mp3.TagHandler = thd; mp3.Update(); } Console.WriteLine("Finish"); }
public static bool HasTag(this GameObject g, Tag t) { TagHandler th = g.GetComponent <TagHandler>(); if (!th) { th = g.GetComponentInParent <TagHandler>(); } if (!th) { return(false); } else { return(th.HasTag(t)); } }
private static void func1(string path) { string[] files = Directory.GetFiles(path); foreach (string f in files) { string tmp = f.Substring(path.Length, f.Length - path.Length); Console.WriteLine(tmp); string[] fn = tmp.Split('-'); //tmp = ToDBC(tmp); // 添加后缀 //File.Move(f, f + ".mp3"); // 去除空格 //string filename = fn[0].Trim() + " - " + fn[1].Trim(); // 替换_到& //string fn = tmp.Replace("_", "&"); // 去除括号 //string[] fn = tmp.Split('('); //if (fn.Length > 1) //{ // string filename = fn[0].Trim(); // File.Move(f, path + filename); //} //更新mp3信息 Mp3File mp3 = new Mp3File(f); TagHandler thd = mp3.TagHandler; //thd.Title = CapFirstLetter(Pinyin.GetPinyin(fn[1].Substring(0, fn[1].Length - 4).Trim())); //thd.Artist = CapFirstLetter(Pinyin.GetPinyin(fn[0].Trim())); thd.Title = fn[1].Substring(0, fn[1].Length - 4).Trim(); thd.Artist = fn[0].Trim(); thd.Year = ""; thd.Album = ""; thd.Disc = ""; thd.Track = ""; thd.Genre = ""; mp3.TagHandler = thd; mp3.Update(); } Console.WriteLine("Finish"); }
public void createBlankSnippet() { TagHandler tagHandler = new TagHandler(this); AssocationHandler assocationHandler = new AssocationHandler(); Snippet blankSnippet = SnippetState.CreateBlankSnippet(1); GameObject instantiatedSnippet = Instantiate(snippetPrefab) as GameObject; SnippetState instSnippetState = instantiatedSnippet.GetComponent <SnippetState>(); instSnippetState.loadState(tagHandler.GetTagBySnippetId(blankSnippet.Snippet_Id), blankSnippet, assocationHandler.GetAssociationViewForSnippet(blankSnippet.Snippet_Id)); instantiatedSnippet.name = instSnippetState.title; //names each snippet by its title snippetObjectDict.Add(instSnippetState.id, instantiatedSnippet); }
public string ParseText(string runCode, TagHandler tag, TextHandler textHandler, ParseText owner) { foreach (var var in tag.VariantsTag) { switch (var.Variant.ToLower().Trim()) { case "color": Regex regex = new Regex(@"#\w{6}"); var m = regex.Matches(var.Value); if (m.Count == 1) { return(runCode += "Background='" + m[0].Value + "' "); // Цвет } break; } } return(runCode); }
public static void Main(string[] args) { Console.WriteLine("*** UWB App ***"); string portName; Coord3D[] anchorArray; ReadConfigFile(out portName, out anchorArray, ConfigFilePath); Console.WriteLine($"Reading config file at {ConfigFilePath}.."); Console.WriteLine($"\tUSB port: {portName}"); Console.WriteLine($"\tAnchor positions : {string.Join(" | ", anchorArray)}"); // FIXME What if distances are not right order // TODO Need to return more than distances: pairs (anchor, distance) var tagHandler = new TagHandler(portName); tagHandler.Callbacks.Add(distances => RangeProcessing(anchorArray, distances)); tagHandler.ReadProcess(); }
/// <summary> /// Loads any custom tag handlers found in the dll referenced in the argument /// </summary> /// <param name="pathToDLL">the path to the dll containing the custom tag handling code</param> public void LoadCustomTagHandlers(string pathToDLL) { Assembly tagDLL = Assembly.LoadFrom(pathToDLL); Type[] tagDLLTypes = tagDLL.GetTypes(); for (int i = 0; i < tagDLLTypes.Length; i++) { object[] typeCustomAttributes = tagDLLTypes[i].GetCustomAttributes(false); for (int j = 0; j < typeCustomAttributes.Length; j++) { if (typeCustomAttributes[j] is CustomTagAttribute) { // We've found a custom tag handling class // so store the assembly and store it away in the Dictionary<,> as a TagHandler class for // later usage // store Assembly if (!this.LateBindingAssemblies.ContainsKey(tagDLL.FullName)) { this.LateBindingAssemblies.Add(tagDLL.FullName, tagDLL); } // create the TagHandler representation TagHandler newTagHandler = new TagHandler { AssemblyName = tagDLL.FullName, ClassName = tagDLLTypes[i].FullName, TagName = tagDLLTypes[i].Name.ToLower() }; if (this.CustomTags.ContainsKey(newTagHandler.TagName)) { throw new Exception("ERROR! Unable to add the custom tag: <" + newTagHandler.TagName + ">, found in: " + pathToDLL + " as a handler for this tag already exists."); } else { this.CustomTags.Add(newTagHandler.TagName, newTagHandler); } } } } }
// Token: 0x06000090 RID: 144 RVA: 0x0000616C File Offset: 0x0000516C public AIMLTagHandler getBespokeTags(User user, SubQuery query, Request request, Result result, XmlNode node) { if (!this.CustomTags.ContainsKey(node.Name.ToLower())) { return(null); } TagHandler tagHandler = this.CustomTags[node.Name.ToLower()]; AIMLTagHandler aimltagHandler = tagHandler.Instantiate(this.LateBindingAssemblies); if (object.Equals(null, aimltagHandler)) { return(null); } aimltagHandler.user = user; aimltagHandler.query = query; aimltagHandler.request = request; aimltagHandler.result = result; aimltagHandler.templateNode = node; aimltagHandler.bot = this; return(aimltagHandler); }
public override void visit(TagHandler h) { h.defineScalingGrid(this); }
public MovieEncoder(TagHandler handler) { this.handler = handler; //UPGRADE_TODO: Class 'java.util.HashSet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashSet'" done = new SupportClass.HashSetSupport(); }