/// <inheritdoc />
 public void WriteIcs(IcsWriter writer)
 {
     var content = new ContentLine { Name = "related-to", Value = OtherUri };
     if (this.Relationship != null)
         content.Parameters[ParameterName.RelationshipType] = Relationship.Name;
     writer.Write(content);
 }
예제 #2
0
 /// <inheritdoc />
 public void WriteIcs(IcsWriter writer)
 {
     var content = new ContentLine { Name = "contact", Value = Text };
     if (Uri != null)
         content.Parameters[ParameterName.AlternativeRepresentation] = Uri;
     writer.Write(content);
 }
예제 #3
0
 public void ParametersAreLazy()
 {
     var line = new ContentLine();
     Assert.IsFalse(line.HasParameters);
     line.Parameters.Add("foo", "bar");
     Assert.IsTrue(line.HasParameters);
 }
예제 #4
0
        /// <inheritdoc />
        public override ContentLine ToContentLine(ContentLine content = null)
        {
            content = base.ToContentLine(content);
            content.Value = Value;

            return content;
        }
예제 #5
0
        public void contentline(
            iCalObject o
            ) //throws RecognitionException, TokenStreamException
        {
            ContentLine c = new ContentLine(o);
            string      n;
            string      v;


            n      = name();
            c.Name = n;
            {        // ( ... )*
                for (;;)
                {
                    if ((LA(1) == SEMICOLON))
                    {
                        match(SEMICOLON);
                        param(c);
                    }
                    else
                    {
                        goto _loop41_breakloop;
                    }
                }
                _loop41_breakloop :;
            }        // ( ... )*
            match(COLON);
            v       = value();
            c.Value = v; DDay.iCal.Serialization.iCalendar.Components.ContentLineSerializer.DeserializeToObject(c, o);
            match(CRLF);
        }
예제 #6
0
 public void CommaEscapedValue()
 {
     var line = new ContentLine(@"x:alpha\,beta\,omega");
     Assert.AreEqual("alpha,beta,omega", line.Value);
     Assert.AreEqual(1, line.Values.Length);
     Assert.AreEqual("alpha,beta,omega", line.Values[0]);
 }
예제 #7
0
 public void EscapingValue()
 {
     var line = new ContentLine();
     line.Name = "x";
     line.Value = "This is a long description\\,\r\nthat exists on two lines.";
     Assert.AreEqual(1, line.Values.Length);
     Assert.AreEqual(@"X:This is a long description\,\nthat exists on two lines.", line.ToString());
 }
예제 #8
0
 public void ParameterNameIsCaseInsensitive()
 {
     var line = new ContentLine("DESCRIPTION;Foo=1;BAR=2:This is a long description that exists on a long line.");
     Assert.AreEqual("DESCRIPTION", line.Name);
     Assert.AreEqual("This is a long description that exists on a long line.", line.Value);
     Assert.AreEqual("1", line.Parameters["foo"]);
     Assert.AreEqual("2", line.Parameters["bar"]);
 }
예제 #9
0
        /// <inheritdoc />
        public override ContentLine ToContentLine(ContentLine content = null)
        {
            content = base.ToContentLine(content);
            content.Value = Value.Value;
            if (Value.Language != null && Value.Language != LanguageTag.Unspecified)
                content.Parameters[ParameterName.Language] = Value.Language.Name;

            return content;
        }
예제 #10
0
        /// <summary>
        ///   Creates a new instance of the <see cref="Contact"/> class from
        ///   the specified <see cref="ContentLine"/>.
        /// </summary>
        /// <param name="content">
        ///   The <see cref="ContentLine"/> containing the contact.
        /// </param>
        public Contact(ContentLine content)
            : this()
        {
            Guard.IsNotNull(content, "content");
            Guard.Require(content.Name.Equals("CONTACT", StringComparison.InvariantCultureIgnoreCase), "content", "Expected a CONTACT content line.");

            Text = content.ToText();
            Uri = content.Parameters[ParameterName.AlternativeRepresentation];
        }
예제 #11
0
 public void Stringing()
 {
     var line = new ContentLine();
     line.Name = "DESCRIPTION";
     line.Parameters.Add("foo", "1");
     line.Parameters.Add("bar", "2");
     line.Parameters.Add("bar", "3");
     line.Value = "This is a long description\\, that exists on a long line.";
     Assert.AreEqual(@"DESCRIPTION;FOO=1;BAR=2,3:This is a long description\, that exists on a long line.", line.ToString());
 }
예제 #12
0
 /// <summary>
 ///   Creates a new instance of the <see cref="VCardName"/> class from
 ///   the specified <see cref="ContentLine"/>.
 /// </summary>
 /// <param name="content">
 ///   The <see cref="ContentLine"/> containing the property parameters.
 /// </param>
 public VCardName(ContentLine content)
     : base(content)
 {
     var parts = content.Value.Split(';');
     FamilyNames = parts.Length > 0 ? parts[0].Split(',').ToList() : new List<string>(0);
     GivenNames = parts.Length > 1 ? parts[1].Split(',').ToList() : new List<string>(0);
     AdditionalNames = parts.Length > 2 ? parts[2].Split(',').ToList() : new List<string>(0);
     Prefixes = parts.Length > 3 ? parts[3].Split(',').ToList() : new List<string>(0);
     Suffixes = parts.Length > 4 ? parts[4].Split(',').ToList() : new List<string>(0);
 }
예제 #13
0
 /// <summary>
 ///   A line must be folded when it greater octets per line.
 /// </summary>
 public void LineFolding2()
 {
     var line = new ContentLine("ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:mailto:[email protected]");
     var settings = new IcsWriterSettings();
     var s = new StringWriter();
     using (var writer = IcsWriter.Create(s, settings))
     {
         writer.Write(line);
     }
     var lines = s.ToString().Replace("\r\n", "\n").TrimEnd('\n').Split('\n');
     foreach (var l in lines)
         Assert.IsTrue(Encoding.UTF8.GetByteCount(l) <= settings.OctetsPerLine);
 }
예제 #14
0
        public void TIMEZONE2()
        {
            //
            // First, check against the VALUE parameter; it must be absent in DTSTART
            //

            iCalendar iCal = iCalendar.LoadFromFile(@"Calendars\Serialization\TIMEZONE2.ics");

            iCalTimeZone tz = iCal.TimeZones[0];

            foreach (iCalTimeZoneInfo tzi in tz.TimeZoneInfos)
            {
                tzi.Start = new iCalDateTime(2007, 1, 1);
            }

            iCalendarSerializer serializer = new iCalendarSerializer(iCal);

            serializer.Serialize(@"Calendars\Serialization\Temp\TIMEZONE2.ics");

            iCal = iCalendar.LoadFromFile(@"Calendars\Serialization\Temp\TIMEZONE2.ics");
            tz   = iCal.TimeZones[0];

            foreach (iCalTimeZoneInfo tzi in tz.TimeZoneInfos)
            {
                ContentLine cl = tzi.Start.ContentLine;
                Assert.IsFalse(cl.Parameters.ContainsKey("VALUE"), "\"DTSTART\" property MUST be represented in local time in timezones");
            }

            //
            // Next, check against UTC time; DTSTART must be presented in local time
            //
            iCal = iCalendar.LoadFromFile(@"Calendars\Serialization\TIMEZONE2.ics");

            tz = iCal.TimeZones[0];
            foreach (iCalTimeZoneInfo tzi in tz.TimeZoneInfos)
            {
                tzi.Start = DateTime.Now.ToUniversalTime();
            }

            serializer = new iCalendarSerializer(iCal);
            serializer.Serialize(@"Calendars\Serialization\Temp\TIMEZONE2.ics");

            iCal = iCalendar.LoadFromFile(@"Calendars\Serialization\Temp\TIMEZONE2.ics");
            tz   = iCal.TimeZones[0];

            foreach (iCalTimeZoneInfo tzi in tz.TimeZoneInfos)
            {
                ContentLine cl = tzi.Start.ContentLine;
                Assert.IsFalse(cl.Parameters.ContainsKey("VALUE"), "\"DTSTART\" property MUST be represented in local time in timezones");
            }
        }
예제 #15
0
        public void contentline(
            iCalObject o
            ) //throws RecognitionException, TokenStreamException
        {
            ContentLine c = new ContentLine(o);
            string      n;
            string      v;


            n      = name();
            c.Name = n;
            {        // ( ... )*
                for (;;)
                {
                    if ((LA(1) == SEMICOLON))
                    {
                        match(SEMICOLON);
                        {
                            switch (LA(1))
                            {
                            case IANA_TOKEN:
                            {
                                param(c);
                                break;
                            }

                            case X_NAME:
                            {
                                xparam(c);
                                break;
                            }

                            default:
                            {
                                throw new NoViableAltException(LT(1), getFilename());
                            }
                            }
                        }
                    }
                    else
                    {
                        goto _loop50_breakloop;
                    }
                }
                _loop50_breakloop :;
            }        // ( ... )*
            match(COLON);
            v       = value();
            c.Value = v; DDay.iCal.Serialization.iCalendar.Components.ContentLineSerializer.DeserializeToObject(c, o);
            match(CRLF);
        }
        /// <summary>
        ///   Creates a new instance of the <see cref="RelationshipReference"/> class from
        ///   the specified <see cref="ContentLine"/>.
        /// </summary>
        /// <param name="content">
        ///   The <see cref="ContentLine"/> containing the request status.
        /// </param>
        public RelationshipReference(ContentLine content)
            : this()
        {
            Guard.IsNotNull(content, "content");
            Guard.Require(content.Name.Equals("RELATED-TO", StringComparison.InvariantCultureIgnoreCase), "content", "Expected a RELATED-TO content line.");

            OtherUri = content.Value;
            if (content.HasParameters)
            {
                var name = content.Parameters["RELTYPE"];
                if (name != null)
                    Relationship = new Relationship { Name = name };
            }
        }
예제 #17
0
    private IEnumerator CanvasUpd()
    {
        yield return(new WaitForSeconds(0.05f));

        content.anchoredPosition = new Vector2(content.anchoredPosition.x, (contentLines[playerContentLinesIndex].Transform.anchoredPosition.y * -1) + 50.0f - scrollHeightHalf);

        if (lineDown.UserData == null)
        {
            lineDown = contentLines[55];
        }
        if (lineUp.UserData == null)
        {
            lineUp = contentLines[25];
        }
    }
예제 #18
0
        /// <summary>
        ///   Creates a new instance of the <see cref="VCardValue"/> class from
        ///   the specified <see cref="ContentLine"/>.
        /// </summary>
        /// <param name="content">
        ///   The <see cref="ContentLine"/> containing the property parameters.
        /// </param>
        public VCardValue(ContentLine content)
            : this()
        {
            Guard.IsNotNull(content, "content");
            if (!content.HasParameters)
                return;

            var p = content.Parameters;
            var v = p[ParameterName.Preference];
            if (v != null)
                Preference = int.Parse(v, NumberStyles.Integer, CultureInfo.InvariantCulture);
            AlternativeId = p[ParameterName.AlternativeId];
            Id = p[ParameterName.PropertyId];
            Type = p[ParameterName.Type];
        }
예제 #19
0
 public void LineFolding()
 {
     var line = new ContentLine("prop12;foo=1;bar=2:word1 word2");
     var settings = new IcsWriterSettings() { OctetsPerLine = 7 };
     var s = new StringWriter();
     using (var writer = IcsWriter.Create(s, settings))
     {
         writer.Write(line);
     }
     var ics = s.ToString().Replace("\r\n", "\n").TrimEnd('\n').Split('\n');
     Assert.AreEqual(5, ics.Length);
     Assert.AreEqual("PROP12;", ics[0]);
     Assert.AreEqual(" FOO=1;", ics[1]);
     Assert.AreEqual(" BAR=2:", ics[2]);
     Assert.AreEqual(" word1 ", ics[3]);
     Assert.AreEqual(" word2", ics[4]);
 }
예제 #20
0
        /// <summary>
        ///   Creates a new instance of the <see cref="VCardAddress"/> class from
        ///   the specified <see cref="ContentLine"/>.
        /// </summary>
        /// <param name="content">
        ///   The <see cref="ContentLine"/> containing the property parameters.
        /// </param>
        public VCardAddress(ContentLine content)
            : base(content)
        {
            if (content.HasParameters)
            {
                GeographicPositionUrl = content.Parameters["geo"];
                Label = content.Parameters["label"];
            }

            var parts = content.Value.Split(';');
            PostOfficeBox = parts.Length > 0 ? parts[0] : null;
            ExtendedAddress = parts.Length > 1 ? parts[1] : null;
            StreetAddress = parts.Length > 2 ? parts[2] : null;
            Locality = parts.Length > 3 ? parts[3] : null;
            Region = parts.Length > 4 ? parts[4] : null;
            PostalCode = parts.Length > 5 ? parts[5] : null;
            Country = parts.Length > 6 ? parts[6] : null;
        }
예제 #21
0
        public void TIMEZONE1()
        {
            iCalendar iCal = iCalendar.LoadFromFile(@"Calendars\Serialization\TIMEZONE1.ics");

            DDay.iCal.Components.TimeZone tz = iCal.TimeZones[0];
            tz.Last_Modified = new Date_Time(2007, 1, 1);

            iCalendarSerializer serializer = new iCalendarSerializer(iCal);

            serializer.Serialize(@"Calendars\Serialization\Temp\TIMEZONE1.ics");

            iCal = iCalendar.LoadFromFile(@"Calendars\Serialization\Temp\TIMEZONE1.ics");
            tz   = iCal.TimeZones[0];

            ContentLine cl = tz.Last_Modified.ContentLine;

            Assert.IsFalse(cl.Parameters.ContainsKey("VALUE"), "The \"VALUE\" parameter is not allowed on \"LAST-MODIFIED\"");
        }
예제 #22
0
        public void ToDate()
        {
            var date = new ContentLine("DTSTART:19970714T133000").ToDate();
            Assert.AreEqual(DateTimeKind.Local, date.Value.Kind);
            Assert.AreEqual(new DateTime(1997, 7, 14, 13, 30, 0, DateTimeKind.Local), date.Value);
            Assert.IsFalse(date.IsDateOnly);
            Assert.IsNull(date.TimeZone);

            date = new ContentLine("DTSTART;TZID=America/New_York:19970714T133000").ToDate();
            Assert.AreEqual(DateTimeKind.Local, date.Value.Kind);
            Assert.AreEqual(new DateTime(1997, 7, 14, 13, 30, 0, DateTimeKind.Local), date.Value);
            Assert.IsFalse(date.IsDateOnly);
            Assert.AreEqual("America/New_York", date.TimeZone);

            date = new ContentLine("DTSTART:19970714T173000Z").ToDate();
            Assert.AreEqual(DateTimeKind.Utc, date.Value.Kind);
            Assert.AreEqual(new DateTime(1997, 7, 14, 17, 30, 0, DateTimeKind.Utc), date.Value);
            Assert.IsFalse(date.IsDateOnly);
            Assert.IsNull(date.TimeZone);
        }
예제 #23
0
    private void OnGUI()
    {
        if (GUILayout.Button("add content:" + contents.Count)) {

            var newContentId = Guid.NewGuid().ToString();
            var newContent = new ContentLine(newContentId);

            Undo.RecordObject(this, "Add Content id:" + newContentId);
            contents.Add(newContent);
        }

        EditorGUILayout.Space();

        for (var i = 0; i < contents.Count; i++) {
            /*
                論理削除されてる場合は無視
            */
            if (contents[i].IsDeleted()) continue;

            var contentId = contents[i].GetId();

            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("SetActive")) {
                contents[i].SetActive();
            }

            if (GUILayout.Button("count up content[" + i + "]:" + contents[i].GetData() + " not effect:" + contents[i].GetUnchangeData() + " id:" + contentId)) {
                Undo.RecordObject(this, "Update Content count, id:" + contentId);
                contents[i].CountUp();
            }

            if (GUILayout.Button("delete " + i)) {
                Undo.RecordObject(this, "Delete Content id:" + contentId);
                contents[i].Delete();
            }

            EditorGUILayout.EndHorizontal();
        }
    }
예제 #24
0
        public void contentline(
            iCalObject o
            ) //throws RecognitionException, TokenStreamException
        {
            ContentLine c = new ContentLine(o);
            string      n;
            string      v;


            try {          // for error handling
                n      = name();
                c.Name = n;
                {            // ( ... )*
                    for (;;)
                    {
                        if ((LA(1) == SEMICOLON))
                        {
                            match(SEMICOLON);
                            param(c);
                        }
                        else
                        {
                            goto _loop39_breakloop;
                        }
                    }
                    _loop39_breakloop :;
                }            // ( ... )*
                match(COLON);
                v       = value();
                c.Value = v; o.SetContentLineValue(c);
                match(CRLF);
            }
            catch (RecognitionException ex)
            {
                reportError(ex);
                recover(ex, tokenSet_4_);
            }
        }
예제 #25
0
    public static void UnlockNewContent(ContentType type, string targetFileName, int number)
    {
        string contentText = InfoSaver.GetStringFromResource(targetFileName, number);

        //!!!!!!UNSAFE coding way. Please make sure that the targetFile is absolutely correct!!!!!!
        string[] lineComponents  = contentText.Split('#');
        int      index           = number;
        string   title           = lineComponents[0];
        string   content         = lineComponents[1];
        int      higher          = ((type == ContentType.Truth) ? -1 : int.Parse(lineComponents[2]));
        int      another         = ((type == ContentType.Truth) ? -1 : int.Parse(lineComponents[3]));
        int      another2        = ((type == ContentType.Truth) ? -1 : int.Parse(lineComponents[4]));
        Content  newContentEntry = new Content(type, title, content, index, another, another2, higher);
        //To be CONTINUED : WRITE A NEW CONTENT CLASS AND IMPLEMENT ITS INITIALIZER, THEN ADD IT HERE!!!!
        UIGrid targetTable = null;

        switch (type)
        {
        case ContentType.Reminder:
            targetTable = instance.reminderTable;
            break;

        case ContentType.Conclusion:
            targetTable = instance.conclusionTable;
            break;

        case ContentType.Truth:
            targetTable = instance.truthTable;
            break;

        default:
            break;
        }
        GameObject  targetContent = NGUITools.AddChild(targetTable.gameObject, instance.contentPrefab);
        ContentLine targetLine    = targetContent.GetComponent <ContentLine>();

        targetLine.Initialize(newContentEntry);
    }
예제 #26
0
    private void Start()
    {
        scrollHeight     = scroll.viewport.rect.height;
        scrollHeightHalf = scrollHeight / 2.0f;
        sortState        = SortState.Empty;

        InstantiateUsers();
        localUser = userDatas[RandomValue(allCountUsers)];
        localUser.PlayerName("Player");

        modifierWave = (localUser.Position - 50) / countNewUsersWave;
        Dbg.Log("localUser: "******"mod: " + modifierWave, Color.green);

        InitLines(modifierWave * countNewUsersWave - 1);//localUser.Position - 50);

        playerContentLinesIndex = localUser.Position - (modifierWave * countNewUsersWave - 1);

        middleLineDown = playerContentLinesIndex + 5;
        middleLineUp   = playerContentLinesIndex - 5;
        lineDown       = contentLines[middleLineDown];
        lineUp         = contentLines[middleLineUp];

        StartCoroutine(CanvasUpd());
    }
예제 #27
0
 /// <summary>
 ///   Creates a new instance of the <see cref="VCardText"/> class from
 ///   the specified <see cref="ContentLine"/>.
 /// </summary>
 /// <param name="content">
 ///   The <see cref="ContentLine"/> containing the property parameters.
 /// </param>
 public VCardText(ContentLine content)
     : base(content)
 {
     Value = content.ToText();
 }
예제 #28
0
        /// <summary>
        /// For iCalendar components, automatically finds and retrieves fields that
        /// match the field specified in the <see cref="ContentLine"/>, and sets
        /// their value.
        /// <example>
        /// For example, if a public DTStart field exists in the specified component,
        /// (i.e. <c>public iCalDateTime DTStart;</c>)
        /// and a content line of <c>DTSTART;TZID=US-Eastern:20060830T090000</c> is
        /// encountered, this method will automatically set the value of the
        /// DTStart field to Aug. 30, 2006, 9:00 AM in the US-Eastern TimeZone.
        /// </example>
        /// <note>
        ///     It should not be necessary to invoke this method manually as it
        ///     is handled automatically during the iCalendar parsing.
        /// </note>
        /// </summary>
        /// <param name="cl">The <see cref="ContentLine"/> to process.</param>
        /// <param name="obj">The <see cref="iCalObject"/> to assign information to.</param>
        static public void DeserializeToObject(ContentLine cl, iCalObject obj)
        {
            if (cl.Name != null)
            {
                // Set the parent of the ContentLine to the object
                cl.Parent = obj;

                string name = cl.Name;
                Type   type = obj.GetType();

                // Remove X- from the property name, since
                // non-standard properties are named like
                // everything else, but also have the NonstandardAttribute
                // attached.
                if (name.StartsWith("X-"))
                {
                    name = name.Remove(0, 2);
                }

                // Replace invalid characters
                name = name.Replace("-", "_");

                //
                // Find the public field that matches the name of our content line (ignoring case)
                //
                FieldInfo    field    = type.GetField(name, BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.GetField | BindingFlags.Static);
                PropertyInfo property = null;

                if (field == null)
                {
                    property = type.GetProperty(name, BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.GetProperty | BindingFlags.Static);
                }

                if (field != null ||
                    property != null)
                {
                    // Get the field/property's value
                    object value = field == null?property.GetValue(obj, null) : field.GetValue(obj);

                    Type     itemType       = field == null ? property.PropertyType : field.FieldType;
                    object[] itemAttributes = field == null?property.GetCustomAttributes(true) : field.GetCustomAttributes(true);

                    Type elementType = itemType.IsArray ? itemType.GetElementType() : itemType;

                    // If it's an iCalDataType, or an array of iCalDataType, then let's fill it!
                    if (itemType.IsSubclassOf(typeof(iCalDataType)) ||
                        (itemType.IsArray && itemType.GetElementType().IsSubclassOf(typeof(iCalDataType))))
                    {
                        iCalDataType icdt = null;
                        if (!itemType.IsArray)
                        {
                            icdt = (iCalDataType)value;
                        }
                        if (icdt == null)
                        {
                            icdt = (iCalDataType)Activator.CreateInstance(elementType);
                        }

                        // Assign custom attributes for the specific field
                        icdt.Attributes = itemAttributes;

                        // Set the content line for the object.
                        icdt.ContentLine = cl;

                        // It's an array, let's add an item to the end
                        if (itemType.IsArray)
                        {
                            ArrayList arr = new ArrayList();
                            if (value != null)
                            {
                                arr.AddRange((ICollection)value);
                            }
                            arr.Add(icdt);
                            if (field != null)
                            {
                                field.SetValue(obj, arr.ToArray(elementType));
                            }
                            else
                            {
                                property.SetValue(obj, arr.ToArray(elementType), null);
                            }
                        }
                        // Otherwise, set the value directly!
                        else
                        {
                            if (field != null)
                            {
                                field.SetValue(obj, icdt);
                            }
                            else
                            {
                                property.SetValue(obj, icdt, null);
                            }
                        }
                    }
                    else
                    {
                        FieldInfo minValue = itemType.GetField("MinValue");
                        object    minVal   = (minValue != null) ? minValue.GetValue(null) : null;

                        if (itemType.IsArray)
                        {
                            ArrayList arr = new ArrayList();
                            if (value != null)
                            {
                                arr.AddRange((ICollection)value);
                            }
                            arr.Add(cl.Value);

                            if (field != null)
                            {
                                field.SetValue(obj, arr.ToArray(elementType));
                            }
                            else
                            {
                                property.SetValue(obj, arr.ToArray(elementType), null);
                            }
                        }
                        // Always assign enum values
                        else if (itemType.IsEnum)
                        {
                            if (field != null)
                            {
                                field.SetValue(obj, Enum.Parse(itemType, cl.Value.Replace("-", "_"), true));
                            }
                            else
                            {
                                property.SetValue(obj, Enum.Parse(itemType, cl.Value.Replace("-", "_"), true), null);
                            }
                        }
                        // Otherwise, set the value directly!
                        else if (value == null || value.Equals(minVal))
                        {
                            if (field != null)
                            {
                                field.SetValue(obj, cl.Value);
                            }
                            else
                            {
                                property.SetValue(obj, cl.Value, null);
                            }
                        }
                        else
                        {
                            ; // FIXME: throw single-value exception, if "strict" parsing is enabled
                        }
                    }
                }
                else
                {
                    // This is a non-standard property.  Let's load it into memory,
                    // So we can serialize it later
                    Property p = new Property(cl);
                    p.AddToParent();
                }
            }
        }
예제 #29
0
    //An animation is expected here to enhace gamer experience. Just for test currently.
    public static void AnalyzeContent()
    {
        int count = instance.contentSlots.Count;

        if (count == 0)
        {
            instance.PlayAnalyzeEffect(AnalyzeResult.Empty);
        }
        else if (count == 1)
        {
            instance.PlayAnalyzeEffect(AnalyzeResult.NeedMore);
        }
        else if (count == 2)
        {
            ContentLine c1 = instance.contentSlots[0];
            ContentLine c2 = instance.contentSlots[1];
            if (c1.content.another == c2.content.index)
            {
                if (c1.content.another2 == -1)
                {
                    instance.PlayAnalyzeEffect(AnalyzeResult.Success);
                }
                else
                {
                    instance.PlayAnalyzeEffect(AnalyzeResult.NeedMore);
                }
            }
            else
            {
                instance.PlayAnalyzeEffect(AnalyzeResult.Irrelevant);
            }
        }
        else if (count == 3)
        {
            ContentLine c1 = instance.contentSlots[0];
            ContentLine c2 = instance.contentSlots[1];
            ContentLine c3 = instance.contentSlots[2];
            //Enumerate all the possiblilities and then go on to check.
            if (c1.content.another == c2.content.index || c1.content.another2 == c2.content.index)
            {
                if (c1.content.another == c3.content.index || c1.content.another2 == c3.content.index)
                {
                    instance.PlayAnalyzeEffect(AnalyzeResult.Success);
                }
                else if (c1.content.another2 == -1)
                {
                    instance.PlayAnalyzeEffect(AnalyzeResult.Contradictive);
                }
                else
                {
                    instance.PlayAnalyzeEffect(AnalyzeResult.Irrelevant);
                }
            }
            else if (c2.content.another == c3.content.index || c2.content.another2 == c2.content.index)
            {
                if (c2.content.another == c1.content.index || c2.content.another2 == c1.content.index)
                {
                    instance.PlayAnalyzeEffect(AnalyzeResult.Success);
                }
                else if (c2.content.another2 == -1)
                {
                    instance.PlayAnalyzeEffect(AnalyzeResult.Contradictive);
                }
                else
                {
                    instance.PlayAnalyzeEffect(AnalyzeResult.Irrelevant);
                }
            }
            else if (c3.content.another == c1.content.index || c3.content.another2 == c1.content.index)
            {
                if (c3.content.another == c2.content.index || c3.content.another2 == c2.content.index)
                {
                    instance.PlayAnalyzeEffect(AnalyzeResult.Success);
                    return;
                }
                else if (c3.content.another2 == -1)
                {
                    instance.PlayAnalyzeEffect(AnalyzeResult.Contradictive);
                }
                else
                {
                    instance.PlayAnalyzeEffect(AnalyzeResult.Irrelevant);
                }
            }
            else
            {
                instance.PlayAnalyzeEffect(AnalyzeResult.Irrelevant);
            }
        }
    }
예제 #30
0
 public void Folded()
 {
     var line = new ContentLine("DESCRIPTION:This is a lo\r\n ng description\r\n\t that exists on a long line.");
     Assert.AreEqual("DESCRIPTION", line.Name);
     Assert.AreEqual("This is a long description that exists on a long line.", line.Value);
 }
예제 #31
0
        void ReadIcs(ContentLine content)
        {
            Guard.IsNotNull(content, "content");
            Guard.Require(content.Name.Equals(PropertyName.Attachment, StringComparison.InvariantCultureIgnoreCase), "content", "Expected an attachment content line.");

            ContentType = content.Parameters[ParameterName.FormatType];
            var valueType = content.Parameters["value"];
            if (valueType != null && valueType.Equals("binary", StringComparison.InvariantCultureIgnoreCase))
            {
                switch (content.Parameters[ParameterName.InlineEncoding].ToLowerInvariant())
                {
                    case "base64":
                        Content = Convert.FromBase64String(content.Value);
                        break;
                    default:
                        throw new CalendarException(string.Format("The encoding '{0}' is not known.", content.Parameters[ParameterName.InlineEncoding]));
                }
            }
            else
            {
                Uri = content.Value;
            }
        }
예제 #32
0
        /// <inheritdoc />
        public void WriteIcs(IcsWriter writer)
        {
            Guard.IsNotNull(writer, "writer");

            var content = new ContentLine { Name = PropertyName.Attachment };
            if (ContentType != null)
                content.Parameters[ParameterName.FormatType] = ContentType;

            if (Uri != null)
                content.Value = Uri;
            else if (Content != null)
            {
                content.Parameters[ParameterName.InlineEncoding] = "BASE64";
                content.Parameters["VALUE"] = "BINARY";
                content.Value = Convert.ToBase64String(Content);
            }

            writer.Write(content);
        }
예제 #33
0
        public override void SetContentLineValue(ContentLine cl)
        {
            base.SetContentLineValue(cl);

            if (cl.Name == "UID")
            {
                Text text = new Text();
                text.ContentLine = cl;
                UID = text.Value;
            }
        }
예제 #34
0
 /// <summary>
 ///   Creates a new instance of the <see cref="VCardUri"/> class from
 ///   the specified <see cref="ContentLine"/>.
 /// </summary>
 /// <param name="content">
 ///   The <see cref="ContentLine"/> containing the property parameters.
 /// </param>
 public VCardUri(ContentLine content)
     : base(content)
 {
     Value = content.Value;
 }
예제 #35
0
 public void MissingValue()
 {
     var content = new ContentLine("description;language=en-NZ;Colouring"); // 2nd ';' should be ':'
 }
예제 #36
0
 /// <summary>
 ///   Creates a new instance of the <see cref="CalendarAttachment"/> class from
 ///   the specified <see cref="ContentLine"/>.
 /// </summary>
 /// <param name="content">
 ///   The <see cref="ContentLine"/> containing the CalendarAttachment.
 /// </param>
 public CalendarAttachment(ContentLine content)
     : this()
 {
     ReadIcs(content);
 }
예제 #37
0
	public void contentline(
		iCalObject o
	) //throws RecognitionException, TokenStreamException
{
		
		
		ContentLine c = new ContentLine(o);
		string n;
		string v;
		
		
		try {      // for error handling
			n=name();
			c.Name = n;
			{    // ( ... )*
				for (;;)
				{
					if ((LA(1)==SEMICOLON))
					{
						match(SEMICOLON);
						param(c);
					}
					else
					{
						goto _loop41_breakloop;
					}
					
				}
_loop41_breakloop:				;
			}    // ( ... )*
			match(COLON);
			v=value();
			c.Value = v; o.SetContentLineValue(c);
			match(CRLF);
		}
		catch (RecognitionException ex)
		{
			reportError(ex);
			recover(ex,tokenSet_4_);
		}
	}
예제 #38
0
 /**
     保存されているデータをcontentsに適応
     ここでは初期化だけを行っている。
 */
 public void ApplySavedData()
 {
     contents = new List<ContentLine>();
     var newContent = new ContentLine(Guid.NewGuid().ToString());
     contents.Add(newContent);
 }
예제 #39
0
 public void RRule()
 {
     var line = new ContentLine("RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-2");
     Assert.AreEqual("RRULE", line.Name);
     Assert.AreEqual("FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-2", line.Value);
 }
예제 #40
0
 public void EscapedValue()
 {
     var line = new ContentLine(@"DESCRIPTION:Project XYZ Final Review\nConference Room - 3B\nCome Prepared.");
     Assert.AreEqual("Project XYZ Final Review\r\nConference Room - 3B\r\nCome Prepared.", line.Value);
 }