static void Main(string[] args) { Hyland.Unity.SingleSignOnAuthenticationProperties props = Application.CreateSingleSignOnAuthenticationProperties("URL", "Datasource"); Hyland.Unity.Application app = Application.Connect(props); if (app != null) { DocumentType docType = app.Core.DocumentTypes.Find("Test Doc Type"); Document doc = app.Core.GetDocumentByID(12345); KeywordType kt = app.Core.KeywordTypes.Find("test"); //DocumentType docType = app.Core.DocumentTypes.Find("test"); using (PageData pd = app.Core.Retrieval.Default.GetDocument(doc.Revisions[0].DefaultRendition)) { using (System.IO.MemoryStream ms = new System.IO.MemoryStream()) { byte[] buff = new byte[1024]; int read; while ((read = pd.Stream.Read(buff, 0, buff.Length)) > 0) { ms.Write(buff, 0, read); } //fileLength = ms.Length; } } } }
public KeywordUpdate(OnBaseHelper aHelper, string aKeywordType, string aOldValue, string aNewValue, DocumentType aDocumentType = null) { KeywordType lType = aHelper.GetKeywordType(aKeywordType, aDocumentType); OldValue = OnBaseHelper.CreateKeyword(lType, aOldValue); NewValue = OnBaseHelper.CreateKeyword(lType, aNewValue); }
private static void Send(string variable, ref StringBuilder result, KeywordType type, ScriptingAncestorComponent component) { if (variable != null) { switch (type) { case KeywordType.Description: component.Description = result.ToString(); break; case KeywordType.Argument: FindAndDescribe(component.Params.Input, variable, result.ToString()); break; case KeywordType.Return: FindAndDescribe(component.Params.Output, variable, result.ToString()); break; case KeywordType.Help: component.SpecialPythonHelpContent = result.ToString(); break; } result = new StringBuilder(); } }
/// <summary> /// Initializes a new instance of the <see cref="AppKit.TextKit.Formatter.KeywordDescriptor"/> class. /// </summary> /// <param name="type">Specifies the <c>KeywordType</c>.</param> /// <param name="color">Specifies the <c>NSColor</c> that this keyword will be set to.</param> /// <param name="toolTip">Defines the tool tip for this keyword.</param> public KeywordDescriptor(KeywordType type, NSColor color, string toolTip) { // Initialize this.Type = type; this.Color = color; this.Tooltip = toolTip; }
private Keyword CreateKeywordHelper(KeywordType Keytype, string Value) { Keyword key = null; switch (Keytype.DataType) { case KeywordDataType.Currency: case KeywordDataType.Numeric20: decimal decVal = decimal.Parse(Value); key = Keytype.CreateKeyword(decVal); break; case KeywordDataType.Date: case KeywordDataType.DateTime: DateTime dateVal = DateTime.Parse(Value); key = Keytype.CreateKeyword(dateVal); break; case KeywordDataType.FloatingPoint: double dblVal = double.Parse(Value); key = Keytype.CreateKeyword(dblVal); break; case KeywordDataType.Numeric9: long lngVal = long.Parse(Value); key = Keytype.CreateKeyword(lngVal); break; default: key = Keytype.CreateKeyword(Value); break; } return key; }
/// <summary> /// Initializes a new instance of the <see cref="AppKit.TextKit.Formatter.KeywordDescriptor"/> class. /// </summary> /// <param name="type">Specifies the <c>KeywordType</c>.</param> /// <param name="color">Specifies the <c>NSColor</c> that this keyword will be set to.</param> /// <param name="toolTip">Defines the tool tip for this keyword.</param> public KeywordDescriptor (KeywordType type, NSColor color, string toolTip) { // Initialize this.Type = type; this.Color = color; this.Tooltip = toolTip; }
public static void AddKeyword(KeywordType keywordType, string value) { _logger.Debug("Adding keyword"); var keywords = GetKeywords(); switch (keywordType) { case KeywordType.Folder: if (keywords.Directories.Contains(value)) { throw new IdenticalNameException($"Keyword with name '{value}' already exists"); } keywords.Directories.Add(value); break; case KeywordType.File: if (keywords.Files.Contains(value)) { throw new IdenticalNameException($"Keyword with name '{value}' already exists"); } keywords.Files.Add(value); break; } SaveToFile(keywords); }
public List <Keyword> CreateKeywordCollection( IEnumerable <string> aKeywordTypeCollection, IEnumerable <string> aKeywordValueCollection, DocumentType aDocumentType = null ) { if (aKeywordTypeCollection == null && aKeywordValueCollection == null) { return(new List <Keyword>()); } else if (aKeywordTypeCollection.Count() != aKeywordValueCollection.Count()) { throw new Exception("Keyword type and value collections have different number of elements"); } List <Keyword> result = new List <Keyword>(); foreach (KeyValuePair <string, string> item in aKeywordTypeCollection.Zip(aKeywordValueCollection, (x, y) => new KeyValuePair <string, string>(x, y))) { try { KeywordType lType = GetKeywordType(item.Key, aDocumentType); Keyword lKeyword = CreateKeyword(lType, item.Value); result.Add(lKeyword); } catch (ArgumentOutOfRangeException) { //skip undefined keywords continue; } } return(result); }
public static void CreateGrammar() { var unused = Rules.Select(r => r.Name).ToHashSet(); // grammophone output //foreach (var rule in Rules) // Console.WriteLine( // $"{rule.Name} -> {string.Join(" ", rule.Production.Items.Select(i => i is Production.Epsilon ? "" : i is StatementType ? i : i.ToString().ToLower()).ToArray())}."); var ruleDictionary = new Dictionary <string, List <string> >(); foreach (var rule in Rules) { var ruleName = rule.Name.ToString(); if (!ruleDictionary.ContainsKey(ruleName)) { ruleDictionary[ruleName] = new List <string>(); } ruleDictionary[ruleName].Add(string.Join( "\\ ", rule.Production.Items.Select( i => i switch { Production.Epsilon => "\\varepsilon", StatementType _ => $"<{i}>", TokenType _ => $"<{i}>", KeywordType _ => $"\\texttt{{{i}}}", _ => i.ToString().ToLower() }).ToArray())
public KeywordDescription(string key, string description, KeywordType type, KeywordPriority priority, params string[] alternativeKeys) { Key = key; Description = description; Type = type; Priority = priority; AlternativeKeys = alternativeKeys; }
public Command(GestureType gesture, KeywordType keyword, InteractableType focused, InteractableType selected) : this(gesture, keyword, focused, selected, StaticItem.Invariant) { }
public Symbol(string keyword, int defaultParam, bool useDefaultParam, KeywordType keywordType, int index) { Keyword = keyword; DefaultParam = defaultParam; UseDefaultParam = useDefaultParam; KeywordType = keywordType; Index = index; }
/// <summary> /// Preferred constructor. /// </summary> /// <param name="type">The keyword type</param> /// <param name="keyword">The keyword as a string</param> /// <param name="sourceFile">The source file being parsed</param> /// <param name="line">The line in the file currently being parsed</param> /// <param name="positionInLine">The position in the line where the keyword is located at.</param> public KeywordToken(KeywordType type, string keyword, FileInfo sourceFile, int line, int positionInLine) { _tokenType = type; _keywordString = keyword; _file = sourceFile; _line = line; _posInLine = positionInLine; }
public string[] GetKeywords(KeywordType type) { if (!Keywords.TryGetValue(type, out var keywords)) { return(Array.Empty <string>()); } return(keywords.ToArray()); }
public KeywordItem(KeywordType type, string term) : this() { _type = type; if (!String.IsNullOrEmpty(term)) { _listTerms.Add(term); } }
public ObjectType GetObjectType(KeywordType type) { switch (type) { case KeywordType.Float: return(ObjectType.Floating); default: throw new InvalidOperationException($"unknow object type={type}"); } }
public SpeechInteractionEventArgs(SpeechInputEventArgs eventArgs) { Data = eventArgs.Data; Input = eventArgs.Input; string keywordString = eventArgs.Keyword.ToString(); Keyword = (KeywordType)Enum.Parse(typeof(KeywordType), keywordString, true); }
public static Keyword CreateKeyword(KeywordType aKeywordType, string aValue) { Keyword key = null; if (string.IsNullOrWhiteSpace(aValue)) { key = aKeywordType.CreateBlankKeyword(); } else { switch (aKeywordType.DataType) { case KeywordDataType.Currency: case KeywordDataType.Numeric20: decimal decVal = decimal.Parse(aValue); key = aKeywordType.CreateKeyword(decVal); break; case KeywordDataType.Date: case KeywordDataType.DateTime: DateTime dateVal = DateTime.Parse(aValue); key = aKeywordType.CreateKeyword(dateVal); break; case KeywordDataType.FloatingPoint: double dblVal = double.Parse(aValue); key = aKeywordType.CreateKeyword(dblVal); break; case KeywordDataType.Numeric9: long lngVal = long.Parse(aValue); key = aKeywordType.CreateKeyword(lngVal); break; default: key = aKeywordType.CreateKeyword(aValue); break; } } //validate keyword dataset if (aKeywordType.KeywordMustExistInDataSet) { if (key.IsBlank || aKeywordType.GetKeywordDataSet().Find(x => x.Value.Equals(key.Value)) == null) { if (key.IsBlank) { aValue = "<null>"; } const string lErrorFormat = "{0} is not a valid value for keyword {1} ({2})"; throw new ArgumentOutOfRangeException("aValue", aValue, string.Format(lErrorFormat, aValue, aKeywordType.Name, aKeywordType.ID)); } } return(key); }
private void UploadDocument() { var putDocumentParams = new PutDocumentParams(long.Parse(txtDocumentTypeId.Text)); var compassNumberKWT = new KeywordType(136, "", typeof(string), ""); var ssnKWT = new KeywordType(103, "", typeof(string), ""); var firstNameKWT = new KeywordType(104, "", typeof(string), ""); var lastNameKWT = new KeywordType(105, "", typeof(string), ""); putDocumentParams.Keywords.Add(new Keyword(compassNumberKWT, txtCompassNumber.Text)); putDocumentParams.Keywords.Add(new Keyword(ssnKWT, txtSSN.Text)); putDocumentParams.Keywords.Add(new Keyword(firstNameKWT, txtFirstName.Text)); putDocumentParams.Keywords.Add(new Keyword(lastNameKWT, txtLastName.Text)); var multipartContent = new MultipartFormDataContent(); var searlizedPutDocumentMetadata = JsonConvert.SerializeObject(putDocumentParams, new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }); multipartContent.Add(new StringContent(searlizedPutDocumentMetadata, Encoding.UTF8, "application/json"), "PutDocumentParams"); var sw = new Stopwatch(); sw.Start(); var counter = 1; foreach (var fileName in Directory.GetFiles(txtImagesFolderPath.Text)) { var fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); multipartContent.Add(new StreamContent(fs), "File" + counter, Path.GetFileName(fileName)); counter++; } try { using (var response = new HttpClient().PostAsync("http://localhost/CompassDataBroker/api/Document/UploadFile", multipartContent).Result) { var responseContent = response.Content.ReadAsStringAsync().Result; sw.Stop(); MessageBox.Show(String.Format("Document Id: {0} \nCompleted in {1} seconds", responseContent, sw.Elapsed.TotalSeconds)); Trace.Write(responseContent); } } catch (Exception ex) { sw.Stop(); throw; } }
// Resets entry. private void Reset() { IsComplete = IsMalformed = false; Index = -1; Str = ""; Keyword = KeywordType.None; Context = Id = IdPlural = null; Strings = null; }
public static bool IsKeyword(KeywordType type, string keyword) { foreach (var cur in keywordsDictionary[type]) { if (cur == keyword) { return(true); } } return(false); }
private void UpdateDepth(KeywordType keywordType) { if (keywordType == KeywordType.OpeningTag) { depth++; } else if (keywordType == KeywordType.ClosingTag) { depth--; } }
public Command(GestureType gesture, KeywordType keyword, InteractableType focused, InteractableType selected, StaticItem item) { Gesture = gesture; Keyword = keyword; Focused = focused; Selected = selected; Item = item; }
public static bool IsDefined(this DocumentType aDocumentType, KeywordType aKeywordType) { if (aKeywordType == null) { return(false); } if (aDocumentType == null) { throw new ArgumentNullException("Cannot validate keyword definition against a null document type"); } return(KeywordType.Equals(aKeywordType, aDocumentType.KeywordRecordTypes.FindKeywordType(aKeywordType.ID))); }
public static bool IsRequired(this DocumentType aDocumentType, KeywordType aKeywordType) { if (aKeywordType == null) { return(false); } if (aDocumentType == null) { throw new ArgumentNullException("Cannot validate keyword requirements against a null document type"); } return(aDocumentType.KeywordTypesRequiredForArchival.Contains(aKeywordType)); }
/// <summary> /// Возвращает индекс первого токена с данным типом. /// </summary> public int IndexOf(KeywordType type) { for (int i = 0; i < Count; i++) { Token token = this[i]; if (Keywords.GetKeywordType(token) == type) { return(i); } } return(-1); }
private TokenKeyword Consume(KeywordType keywordType) { TokenKeyword keyword = this.GetKeyword(); if (keyword.KeywordType == keywordType) { return(keyword); } else { throw new ParseFailureException(string.Format("Expected keyword {0} but got {1}.", keywordType.ToString(), keyword.KeywordType), keyword.Location); } }
private bool PeekKeyword(KeywordType keywordType) { TokenKeyword tokenKeyword = this.PeekAs <TokenKeyword>(); if (tokenKeyword == null) { return(false); } else { return(tokenKeyword.KeywordType == keywordType); } }
public static int LookUpImgIndexForKeyword(KeywordSource source, KeywordType type) { string str = Enum.GetName(typeof(KeywordSource), source) + Enum.GetName(typeof(KeywordType), type); if (keywordIndex.ContainsKey(str)) { return(keywordIndex[str]); } else { return(-1); } }
public static ConcreteSlotValueType ToConcreteSlotValueType(this KeywordType keywordType) { switch (keywordType) { case KeywordType.Boolean: return(ConcreteSlotValueType.Boolean); case KeywordType.Enum: return(ConcreteSlotValueType.Vector1); default: throw new ArgumentOutOfRangeException(); } }
public ShaderKeyword(KeywordType keywordType) { this.displayName = keywordType.ToString(); this.keywordType = keywordType; // Add sensible default entries for Enum type if (keywordType == KeywordType.Enum) { m_Entries = new List <KeywordEntry>(); m_Entries.Add(new KeywordEntry(1, "A", "A")); m_Entries.Add(new KeywordEntry(2, "B", "B")); m_Entries.Add(new KeywordEntry(3, "C", "C")); } }
//KonohaSpace_syntax internal Syntax GetSyntax(KeywordType keyword, bool isnew) { Syntax syntaxParent = null; for (KonohaSpace ks = this; ks != null; ks = ks.parent) { if (ks.syntaxMap != null && ks.syntaxMap.ContainsKey(keyword)) { syntaxParent = ks.syntaxMap[keyword]; break; } } if (isnew == true) { Console.WriteLine("creating new syntax {0} old={1}", keyword.ToString(), syntaxParent); if (this.syntaxMap == null) { this.syntaxMap = new Dictionary<KeywordType, Syntax>(); } this.syntaxMap[keyword] = new Syntax(); if (syntaxParent != null) { // TODO: RCGC this.syntaxMap[keyword] = syntaxParent; } else { var syn = new Syntax() { KeyWord = keyword, Type = KonohaType.Unknown, Op1 = null, Op2 = null, ParseExpr = KModSugar.UndefinedParseExpr, TopStmtTyCheck = ctx.kmodsugar.UndefinedStmtTyCheck, StmtTyCheck = ctx.kmodsugar.UndefinedStmtTyCheck, ExprTyCheck = ctx.kmodsugar.UndefinedExprTyCheck, }; this.syntaxMap[keyword] = syn; } this.syntaxMap[keyword].Parent = syntaxParent; return this.syntaxMap[keyword]; } return syntaxParent; }
public CodeKeyword(string text, KeywordSource source, KeywordType type) { this.text = text.Trim(); this.source = source; this.type = type; }
private static void Send(string variable, ref StringBuilder result, KeywordType type, ScriptingAncestorComponent component) { if (variable != null) { switch (type) { case KeywordType.Description: component.Description = result.ToString(); break; case KeywordType.Argument: FindAndDescribe(component.Params.Input, variable, result.ToString()); break; case KeywordType.Return: FindAndDescribe(component.Params.Output, variable, result.ToString()); break; case KeywordType.Help: component.AdditionalHelpFromDocStrings = result.ToString(); break; } result = new StringBuilder(); } }
public void AddKeyword(string name, KeywordType kw) { keywordMap.Add(name, new KKeyWord() { Type = kw }); }
public static int LookUpImgIndexForKeyword(KeywordSource source, KeywordType type) { string str = Enum.GetName(typeof(KeywordSource), source) + Enum.GetName(typeof(KeywordType), type); if (keywordIndex.ContainsKey(str)) return keywordIndex[str]; else return -1; }
public void SYN_setTopStmtTyCheck(KeywordType ks, StmtTyChecker checker) { var syn = GetSyntax(ks, true); syn.TopStmtTyCheck = checker; }
internal Syntax GetSyntax(KeywordType keyword) { //return GetSyntax(keyword, true); return GetSyntax(keyword, false); }
public Keyword(KeywordType t) : base(ElementType.Keyword) { KeywordType = t; }
internal TokenKeyword(KeywordType type, string identifier, DocumentRange range) : base(identifier, range) { this.m_type = type; }
public Keyword(String keyword, KeywordType type) { _keyword = keyword; _type = type; }