예제 #1
0
		private Serializer()
		{
			serializers = new NeoDatis.Tool.Wrappers.Map.OdbHashMap<string, NeoDatis.Odb.Impl.Core.Layers.Layer2.Meta.Serialization.ISerializer
				>();
			serializers.Add(GetClassId(typeof(NeoDatis.Odb.Core.Layers.Layer2.Meta.AtomicNativeObjectInfo
				)), new NeoDatis.Odb.Impl.Core.Layers.Layer2.Meta.Serialization.AtomicNativeObjectSerializer
				());
			serializers.Add(GetClassId(typeof(NeoDatis.Odb.Core.Layers.Layer2.Meta.CollectionObjectInfo
				)), new NeoDatis.Odb.Impl.Core.Layers.Layer2.Meta.Serialization.CollectionObjectInfoSerializer
				());
		}
예제 #2
0
 public virtual void LockFile(string fileName)
 {
     lock (openFiles)
     {
         openFiles.Add(fileName, fileName);
     }
 }
예제 #3
0
 public static void AddAll(System.Collections.Generic.IDictionary <string, string> hashtable, System.Collections.Generic.ICollection <string> items)
 {
     foreach (string s in items)
     {
         hashtable.Add(s, s);
     }
 }
예제 #4
0
        ///// <summary>
        ///// https://open.1688.com/api/apidocdetail.htm?id=cn.alibaba.open:push.query.messageList-1
        ///// https://open.1688.com/api/apidocdetail.htm?id=cn.alibaba.open:push.cursor.messageList-1
        ///// </summary>

        //private NJsonSchema.JsonSchema getCnAlibabaOpenPushMessageListV1(System.Collections.Generic.IDictionary<string, JsonSchema> definitions, string propertieName, string @namespace, string apiname, int version, string type, string description)
        //{
        //    var jsonSchema = getMessageTypeToSchema(definitions, @namespace, apiname, version, type, description);


        //    var pushMessageList = new NJsonSchema.JsonSchema
        //    {
        //        AllowAdditionalProperties = false,
        //        Type = NJsonSchema.JsonObjectType.Object,
        //        Properties = {
        //            {propertieName, jsonSchema.ToJsonSchemaProperty()} ,
        //        }
        //    };

        //    definitions.Add(apiname.ToPascalCase() + "Response", pushMessageList);
        //    return new NJsonSchema.JsonSchema
        //    {
        //        AllowAdditionalProperties = false,
        //        Type = NJsonSchema.JsonObjectType.Object,
        //        Reference = pushMessageList,
        //        //Definitions = { { "PushMessageList", pushMessageList } }
        //    };
        //}

        /// <summary>
        /// https://open.1688.com/api/apidocdetail.htm?id=aliexpress.open:api.getChildrenPostCategoryById-1
        /// </summary>
        /// <returns></returns>
        private NJsonSchema.JsonSchema getAliexpressOpenApiGetChildrenPostCategoryByIdV1(System.Collections.Generic.IDictionary <string, JsonSchema> definitions)
        {
            var jsonSchemaAeopPostCategoryList = new NJsonSchema.JsonSchema
            {
                AllowAdditionalProperties = false,
                Type       = NJsonSchema.JsonObjectType.Object,
                Properties =
                {
                    { "names",  DictionarySchema(typeof(string)).ToJsonSchemaProperty()         },
                    { "level",  NJsonSchema.JsonSchema.FromType <int>().ToJsonSchemaProperty()  },
                    { "id",     NJsonSchema.JsonSchema.FromType <int>().ToJsonSchemaProperty()  },
                    { "isleaf", NJsonSchema.JsonSchema.FromType <bool>().ToJsonSchemaProperty() }
                }
            };


            var jsonSchema = new NJsonSchema.JsonSchema
            {
                AllowAdditionalProperties = false,
                Type       = NJsonSchema.JsonObjectType.Object,
                Properties =
                {
                    { "aeopPostCategoryList", makeArraySchemaType(jsonSchemaAeopPostCategoryList, 1).ToJsonSchemaProperty() },
                    { "success",              NJsonSchema.JsonSchema.FromType <bool>().ToJsonSchemaProperty() }
                }
            };

            definitions.Add("ApiGetChildrenPostCategoryByIdResult", jsonSchema);
            return(new NJsonSchema.JsonSchema
            {
                AllowAdditionalProperties = false,
                Type = NJsonSchema.JsonObjectType.Object,
                Reference = jsonSchema
            });
        }
예제 #5
0
        /// <summary>Speak the text.</summary>
        public void Speak()
        {
            Silence();
            stack.Clear();
            clipDict.Clear();

            foreach (AudioClip clip in Clips)
            {
                clipDict.Add("#" + clip.name + "#", clip);
            }

            string[] speechParts = splitRegex.Split(Text).Where(s => s != string.Empty).ToArray <string>();

            System.Text.RegularExpressions.MatchCollection mc = splitRegex.Matches(Text);

            int index = 0;

            foreach (System.Text.RegularExpressions.Match match in mc)
            {
                //Debug.Log("MATCH: '" + match + "' - " + Text.IndexOf(match.ToString(), index));
                stack.Add(index = Text.IndexOf(match.ToString(), index), match.ToString());
                index++;
            }

            index = 0;
            foreach (string speech in speechParts)
            {
                //Debug.Log("PART: '" + speech + "' - " + Text.IndexOf(speech, index));
                stack.Add(index = Text.IndexOf(speech, index), speech);
                index++;
            }

            StartCoroutine(processStack());
        }
예제 #6
0
 /// <summary>Create a copy oh this meta object</summary>
 /// <param name="onlyData">if true, only copy attributes values</param>
 /// <returns></returns>
 public override NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo CreateCopy
     (System.Collections.Generic.IDictionary <NeoDatis.Odb.OID, NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo
                                              > cache, bool onlyData)
 {
     NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo nnoi = (NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo
                                                                      )cache[objectHeader.GetOid()];
     if (nnoi != null)
     {
         return(nnoi);
     }
     if (onlyData)
     {
         NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader oih = new NeoDatis.Odb.Core.Layers.Layer2.Meta.ObjectInfoHeader
                                                                         ();
         nnoi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo(@object, classInfo
                                                                             , null, oih.GetAttributesIdentification(), oih.GetAttributeIds());
     }
     else
     {
         nnoi = new NeoDatis.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo(@object, classInfo
                                                                             , null, objectHeader.GetAttributesIdentification(), objectHeader.GetAttributeIds
                                                                                 ());
         nnoi.GetHeader().SetOid(GetHeader().GetOid());
     }
     NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo[] newAttributeValues = new
                                                                                    NeoDatis.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo[attributeValues.Length];
     for (int i = 0; i < attributeValues.Length; i++)
     {
         newAttributeValues[i] = attributeValues[i].CreateCopy(cache, onlyData);
     }
     nnoi.attributeValues = newAttributeValues;
     cache.Add(objectHeader.GetOid(), nnoi);
     return(nnoi);
 }
 private void SetUnpackedValueOfDictPolymorphicItself(MsgPack.Serialization.PolymorphicMemberTypeKnownType_Dict_DictPolymorphicItselfPrivateSetterCollectionProperty unpackingContext, System.Collections.Generic.IDictionary <string, string> unpackedValue)
 {
     System.Collections.Generic.IDictionary <string, string> existent = default(System.Collections.Generic.IDictionary <string, string>);
     existent = unpackingContext.DictPolymorphicItself;
     if ((existent == null))
     {
         this._methodBasePolymorphicMemberTypeKnownType_Dict_DictPolymorphicItselfPrivateSetterCollectionProperty_set_DictPolymorphicItself0.Invoke(unpackingContext, new object[] {
             unpackedValue
         });
     }
     else
     {
         System.Collections.Generic.IEnumerator <System.Collections.Generic.KeyValuePair <string, string> > enumerator = unpackedValue.GetEnumerator();
         System.Collections.Generic.KeyValuePair <string, string> current;
         try {
             for (
                 ; enumerator.MoveNext();
                 )
             {
                 current = enumerator.Current;
                 existent.Add(current.Key, current.Value);
             }
         }
         finally {
             enumerator.Dispose();
         }
     }
 }
예제 #8
0
        /// <summary>
        /// Adds a new collection, it's assumed to be sorted.
        /// </summary>
        private uint AddCollection(int[] collection)
        {
            uint id;

            if (_collectionReverseIndex != null)
            {
                // check duplicates.
                if (_collectionReverseIndex.TryGetValue(collection, out id))
                { // collection already exists.
                    return(id + 2);
                }
            }

            id = (uint)_collectionIndex.Add(collection);
            if (_index != null)
            { // use next id.
                if (_nextId >= _index.Length)
                {
                    _index.Resize(_index.Length + 1024);
                }
                _index[_nextId] = id;
                id = _nextId;
                _nextId++;
            }
            if (_collectionReverseIndex != null)
            {
                _collectionReverseIndex.Add(collection, id);
            }
            return(id + 2);
        }
예제 #9
0
 public void JoinConfig(StructureConfig config)
 {
     foreach (var pair in config._dictionary)
     {
         _dictionary.Add(pair.Key, pair.Value);
     }
 }
예제 #10
0
        /// <summary>
        /// Adds a new collection, it's assumed to be sorted.
        /// </summary>
        private uint AddCollection(int[] collection)
        {
            uint id;

            if (_collectionReverseIndex != null)
            {
                // check duplicates.
                if (_collectionReverseIndex.TryGetValue(collection, out id))
                { // collection already exists.
                    return(id + 2);
                }
            }

            id = (uint)_collectionIndex.Add(collection);
            if (_index != null)
            { // use next id.
                _index.EnsureMinimumSize(_nextId + 1);
                _index[_nextId] = id;
                id = _nextId;
                _nextId++;
            }
            if (_collectionReverseIndex != null)
            {
                _collectionReverseIndex.Add(collection, id);
            }
            return(id + 2);
        }
예제 #11
0
        /// <summary>
        /// Extension method for IDictionary.
        /// Adds a dictionary to an existing one.
        /// </summary>
        /// <param name="dict">IDictionary-instance.</param>
        /// <param name="collection">Dictionary to add.</param>
        public static void CTAddRange <K, V>(this System.Collections.Generic.IDictionary <K, V> dict, System.Collections.Generic.IDictionary <K, V> collection)
        {
            if (dict == null)
            {
                throw new System.ArgumentNullException("dict");
            }

            if (collection == null)
            {
                throw new System.ArgumentNullException("collection");
            }

            foreach (System.Collections.Generic.KeyValuePair <K, V> item in collection)
            {
                if (!dict.ContainsKey(item.Key))
                {
                    dict.Add(item.Key, item.Value);
                }
                else
                {
                    // handle duplicate key issue here
                    Debug.LogWarning("Duplicate key found: " + item.Key);
                }
            }
        }
예제 #12
0
        protected bool IsInternalToDynamicProxy(Assembly asm)
        {
#if dotNet2
            internalsToDynProxyLock.AcquireReaderLock(-1);
            try
            {
                if (!internalsToDynProxy.ContainsKey(asm))
                {
                    internalsToDynProxyLock.UpgradeToWriterLock(-1);
                    InternalsVisibleToAttribute[] atts = (InternalsVisibleToAttribute[])asm.GetCustomAttributes(typeof(InternalsVisibleToAttribute), false);
                    bool found = false;
                    foreach (InternalsVisibleToAttribute internals in atts)
                    {
                        if (internals.AssemblyName.Contains(ModuleScope.ASSEMBLY_NAME))
                        {
                            found = true;
                            break;
                        }
                    }
                    internalsToDynProxy.Add(asm, found);
                }
                return(internalsToDynProxy[asm]);
            }
            finally
            {
                internalsToDynProxyLock.ReleaseLock();
            }
#else
            return(false);
#endif
        }
예제 #13
0
 public static void AddLogId(string logId)
 {
     if (logIds == null)
     {
         logIds = new NeoDatis.Tool.Wrappers.Map.OdbHashMap <string, string>();
     }
     logIds.Add(logId, logId);
 }
예제 #14
0
파일: Connection.cs 프로젝트: ekicyou/pasta
 /// <exception cref="System.Exception"></exception>
 public virtual bool LockObjectWithOid(NeoDatis.Odb.OID oid)
 {
     lock (this)
     {
         connectionManager.LockOidForConnection(oid, this);
         oidsLockedForUpdate.Add(oid, NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs());
         return(true);
     }
 }
예제 #15
0
 public static void Decode(this System.Collections.Generic.IDictionary <string, string> self, string encodedDictionary, char separator, char keyValueSplitter, DictionaryExtension.Encoder keyDecoder, DictionaryExtension.Encoder valueDecoder, bool endsWithSeparator)
 {
     if (encodedDictionary == null)
     {
         throw new System.ArgumentNullException("encodedDictionary");
     }
     if (keyDecoder == null)
     {
         throw new System.ArgumentNullException("keyDecoder");
     }
     if (valueDecoder == null)
     {
         throw new System.ArgumentNullException("valueDecoder");
     }
     if (endsWithSeparator && encodedDictionary.LastIndexOf(separator) == encodedDictionary.Length - 1)
     {
         encodedDictionary = encodedDictionary.Substring(0, encodedDictionary.Length - 1);
     }
     string[] array = encodedDictionary.Split(new char[]
     {
         separator
     });
     for (int i = 0; i < array.Length; i++)
     {
         string   text   = array[i];
         string[] array2 = text.Split(new char[]
         {
             keyValueSplitter
         });
         if ((array2.Length == 1 || array2.Length > 2) && !string.IsNullOrEmpty(array2[0]))
         {
             throw new System.ArgumentException("The request is not properly formatted.", "encodedDictionary");
         }
         if (array2.Length != 2)
         {
             throw new System.ArgumentException("The request is not properly formatted.", "encodedDictionary");
         }
         string text2 = keyDecoder(array2[0].Trim());
         string value = valueDecoder(array2[1].Trim().Trim(new char[]
         {
             '"'
         }));
         try
         {
             self.Add(text2, value);
         }
         catch (System.ArgumentException)
         {
             string message = string.Format(System.Globalization.CultureInfo.InvariantCulture, "The request is not properly formatted. The parameter '{0}' is duplicated.", new object[]
             {
                 text2
             });
             throw new System.ArgumentException(message, "encodedDictionary");
         }
     }
 }
예제 #16
0
        internal static bool TryAdd <TKey, TValue>(this System.Collections.Generic.IDictionary <TKey, TValue> dictionary, TKey key, TValue value)
        {
            if (dictionary.ContainsKey(key))
            {
                return(false);
            }

            dictionary.Add(key, value);
            return(true);
        }
예제 #17
0
 public static void AddAllIfNotContains(System.Collections.Generic.IDictionary <string, string> hashtable, System.Collections.Generic.ICollection <string> items)
 {
     foreach (string s in items)
     {
         if (hashtable.ContainsKey(s) == false)
         {
             hashtable.Add(s, s);
         }
     }
 }
예제 #18
0
 /// <exception cref="System.Exception"></exception>
 public virtual void LockOidForConnection(NeoDatis.Odb.OID oid, NeoDatis.Odb.Core.Server.Connection.IConnection
                                          connection)
 {
     lock (this)
     {
         long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
         if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId))
         {
             start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs();
             NeoDatis.Tool.DLogger.Debug("Trying to lock object with oid " + oid + " - id=" +
                                         connection.GetId());
         }
         try
         {
             NeoDatis.Odb.Core.Server.Connection.IConnection c = lockedOids[oid];
             if (c == null)
             {
                 lockedOids.Add(oid, connection);
                 return;
             }
             // If oid is locked for by the passed connection, no problem, it is not considered as being locked
             if (c != null && c.Equals(connection))
             {
                 return;
             }
             while (c != null)
             {
                 NeoDatis.Tool.Wrappers.OdbThread.Sleep(10);
                 c = lockedOids[oid];
             }
             lockedOids.Add(oid, connection);
         }
         finally
         {
             if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId))
             {
                 NeoDatis.Tool.DLogger.Debug("Object with oid " + oid + " locked (" + (NeoDatis.Tool.Wrappers.OdbTime
                                                                                       .GetCurrentTimeInMs() - start) + "ms) - " + connection.GetId());
             }
         }
     }
 }
예제 #19
0
        public virtual NeoDatis.Odb.Core.Server.Connection.IConnection NewConnection(string
                                                                                     ip, long dateTime, int sequence)
        {
            string connectionId = NeoDatis.Odb.Core.Server.Connection.ConnectionIdGenerator.NewId
                                      (ip, dateTime, sequence);

            NeoDatis.Odb.Core.Server.Connection.IConnection connection = new NeoDatis.Odb.Impl.Core.Server.Connection.DefaultServerConnection
                                                                             (this, connectionId, storageEngine);
            connections.Add(connectionId, connection);
            return(connection);
        }
예제 #20
0
        public virtual void AddSession(NeoDatis.Odb.Core.Transaction.ISession session)
        {
            string id = NeoDatis.Tool.Wrappers.OdbThread.GetCurrentThreadName() + session.GetBaseIdentification
                            ();

            sessions.Add(id, session);
            if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId))
            {
                NeoDatis.Tool.DLogger.Debug("Associating id = " + id + " to session " + session.GetId
                                                ());
            }
        }
예제 #21
0
        protected override void OnCompile(HouseRegion o, System.Collections.Generic.IDictionary <string, System.SimpleType> data)
        {
            if (o == null || !o.Registered)
            {
                data.Clear();
                return;
            }

            base.OnCompile(o, data);

            data.Add("house", o.House != null ? o.House.Serial.Value : -1);
        }
 /// <summary>Loads a node from its id.</summary>
 /// <remarks>
 /// Loads a node from its id. Tries to get if from memory, if not present
 /// then loads it from odb storage
 /// </remarks>
 /// <param name="id">The id of the nod</param>
 /// <returns>The node with the specific id</returns>
 public virtual NeoDatis.Btree.IBTreeNode LoadNodeById(object id)
 {
     NeoDatis.Odb.OID oid = (NeoDatis.Odb.OID)id;
     // Check if node is in memory
     NeoDatis.Btree.IBTreeNode node = (NeoDatis.Btree.IBTreeNode)oids[oid];
     if (node != null)
     {
         nbLoadNodesFromCache++;
         return(node);
     }
     nbLoadNodes++;
     // else load from odb
     try
     {
         if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId))
         {
             NeoDatis.Tool.DLogger.Debug("Loading node with id " + oid);
         }
         if (oid == null)
         {
             throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Btree.BTreeError.InvalidIdForBtree
                                                        .AddParameter(oid));
         }
         NeoDatis.Btree.IBTreeNode pn = (NeoDatis.Btree.IBTreeNode)engine.GetObjectFromOid
                                            (oid);
         pn.SetId(oid);
         if (tree != null)
         {
             pn.SetBTree(tree);
         }
         // Keep the node in memory
         oids.Add(oid, pn);
         return(pn);
     }
     catch (System.Exception e)
     {
         throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Btree.BTreeError.InternalError
                                                    , e);
     }
 }
예제 #23
0
 public static NeoDatis.Odb.Core.Lookup.ILookup Get(string key)
 {
     lock (typeof(LookupFactory))
     {
         NeoDatis.Odb.Core.Lookup.ILookup lookup = lookups[key];
         if (lookup == null)
         {
             lookup = new NeoDatis.Odb.Core.Lookup.LookupImpl();
             lookups.Add(key, lookup);
         }
         return(lookup);
     }
 }
예제 #24
0
 public static NeoDatis.Tool.Mutex.Mutex Get(string name)
 {
     lock (typeof(MutexFactory))
     {
         NeoDatis.Tool.Mutex.Mutex mutex = mutexs[name];
         if (mutex == null)
         {
             mutex = new NeoDatis.Tool.Mutex.Mutex(name);
             mutex.SetDebug(debug);
             mutexs.Add(name, mutex);
         }
         return(mutex);
     }
 }
예제 #25
0
 public virtual void AddClass(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo
                              )
 {
     if (classInfo.IsSystemClass())
     {
         rapidAccessForSystemClassesByName.Add(classInfo.GetFullClassName(), classInfo);
     }
     else
     {
         rapidAccessForUserClassesByName.Add(classInfo.GetFullClassName(), classInfo);
     }
     rapidAccessForClassesByOid.Add(classInfo.GetId(), classInfo);
     allClassInfos.Add(classInfo);
 }
 /// <summary>
 /// Stores the references to all the parts in the package.
 /// They could be retrieved by their URIs later.
 /// </summary>
 private static void BuildUriPartDictionary()
 {
     System.Collections.Generic.Queue <OpenXmlPartContainer> queue = new System.Collections.Generic.Queue <OpenXmlPartContainer>();
     queue.Enqueue(document);
     while (queue.Count > 0)
     {
         foreach (var part in queue.Dequeue().Parts)
         {
             if (!UriPartDictionary.Keys.Contains(part.OpenXmlPart.Uri.ToString()))
             {
                 UriPartDictionary.Add(part.OpenXmlPart.Uri.ToString(), part.OpenXmlPart);
                 queue.Enqueue(part.OpenXmlPart);
             }
         }
     }
 }
예제 #27
0
        /// <summary>
        /// Adds a new string.
        /// </summary>
        private int AddString(string value, bool key)
        {
            int id;

            if ((_mode & AttributesIndexMode.ReverseStringIndex) == AttributesIndexMode.ReverseStringIndex ||
                (((_mode & AttributesIndexMode.ReverseStringIndexKeysOnly) == AttributesIndexMode.ReverseStringIndexKeysOnly) && key))
            {
                if (!_stringReverseIndex.TryGetValue(value, out id))
                { // the key doesn't exist yet.
                    id = (int)_stringIndex.Add(value);
                    _stringReverseIndex.Add(value, id);
                }
                return(id);
            }
            return((int)_stringIndex.Add(value));
        }
 public virtual void AddSelectTriggerFor(string className, NeoDatis.Odb.Core.Trigger.SelectTrigger
                                         trigger)
 {
     if (className == null)
     {
         className = AllClassTrigger;
     }
     NeoDatis.Tool.Wrappers.List.IOdbList <NeoDatis.Odb.Core.Trigger.Trigger> c = listOfSelectTriggers
                                                                                  [className];
     if (c == null)
     {
         c = new NeoDatis.Tool.Wrappers.List.OdbArrayList <NeoDatis.Odb.Core.Trigger.Trigger
                                                           >();
         listOfSelectTriggers.Add(className, c);
     }
     c.Add(trigger);
 }
예제 #29
0
 /// <summary>
 /// Get CurrentNodeEnum By Value
 /// </summary>
 public static CurrentNodeEnum GetFromValue(System.Int32 value)
 {
     //仅返回空的方法不是太好,在用的时候,枚举值可能就会设置一个枚举项中没有的,或者枚举值被删除.?
     if (!innerEnums.ContainsKey(value))
     {
         lock (lockobj)
         {
             if (!innerEnums.ContainsKey(value))
             {
                 CurrentNodeEnum newValue = new CurrentNodeEnum(value, "");
                 innerEnums.Add(value, newValue);
                 return(newValue);
             }
         }
     }
     return(innerEnums[value]);
 }
예제 #30
0
 // This method os not used in Values Query API
 public virtual void ObjectMatch(NeoDatis.Odb.OID oid, object @object, NeoDatis.Tool.Wrappers.OdbComparable
                                 orderByKey)
 {
     NeoDatis.Odb.Core.Layers.Layer2.Meta.AttributeValuesMap values = (NeoDatis.Odb.Core.Layers.Layer2.Meta.AttributeValuesMap
                                                                       )@object;
     NeoDatis.Tool.Wrappers.OdbComparable groupByKey = NeoDatis.Odb.Core.Query.Execution.IndexTool
                                                       .BuildIndexKey("GroupBy", values, groupByFieldList);
     NeoDatis.Odb.Impl.Core.Query.Values.ValuesQueryResultAction result = groupByResult
                                                                          [groupByKey];
     if (result == null)
     {
         result = new NeoDatis.Odb.Impl.Core.Query.Values.ValuesQueryResultAction(query, null
                                                                                  , instanceBuilder);
         result.Start();
         groupByResult.Add(groupByKey, result);
     }
     result.ObjectMatch(oid, @object, orderByKey);
 }
예제 #31
0
        private void cmbVariant_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (this.cmbVariant.Text.Trim().Length > 0)
            {
                this.m_strVariant = this.cmbVariant.Text.Trim().Substring(0, 2).ToString();

                if (m_strVariant.Trim().Length > 0)
                {
                    this.cmbFvsSpCd.Items.Clear();
                    // cache convertToSpcd
                    int intMyConvertToSpcd = -1;
                    if (m_intConvertToSpCd > 0)
                    {
                        intMyConvertToSpcd = m_intConvertToSpCd;
                    }
                    this.m_dictFvsCommonName.Clear();
                    m_ado.m_strSQL = "SELECT  spcd,fvs_species,common_name,fvs_common_name " +
                                     "FROM " + m_strFvsTreeSpcTable + " " +
                                     "WHERE LEN(TRIM(fvs_species)) > 0 AND " +
                                     "LEN(TRIM(common_name)) > 0 AND " +
                                     "TRIM(fvs_variant) = '" + m_strVariant.Trim() + "' order by spcd;";

                    m_ado.SqlQueryReader(m_ado.m_OleDbConnection, m_ado.m_OleDbTransaction, m_ado.m_strSQL);
                    if (m_ado.m_OleDbDataReader.HasRows)
                    {
                        while (m_ado.m_OleDbDataReader.Read())
                        {
                            string strMySpCd = Convert.ToString(m_ado.m_OleDbDataReader["spcd"]);
                            this.cmbFvsSpCd.Items.Add(strMySpCd + " - " + Convert.ToString(m_ado.m_OleDbDataReader["common_name"]) + " - " + m_ado.m_OleDbDataReader["fvs_species"]);
                            if (!m_dictFvsCommonName.ContainsKey(strMySpCd))
                            {
                                m_dictFvsCommonName.Add(strMySpCd, Convert.ToString(m_ado.m_OleDbDataReader["fvs_common_name"]));
                            }
                        }

                        if (intMyConvertToSpcd > 0)
                        {
                            this.intConvertToSpCd = intMyConvertToSpcd;
                        }
                    }
                    m_ado.m_OleDbDataReader.Close();
                }
            }
        }
예제 #32
0
    private PhotoEditorUI(ArrayList selectedphotos, DeskFlickrUI.ModeSelected mode)
    {
        Glade.XML gxml = new Glade.XML (null, "organizer.glade", "window2", null);
          gxml.Autoconnect (this);
          _isconflictmode = (mode == DeskFlickrUI.ModeSelected.ConflictMode);
          _isuploadmode = (mode == DeskFlickrUI.ModeSelected.UploadMode);
          _isblogmode = (mode == DeskFlickrUI.ModeSelected.BlogMode);
          if (mode == DeskFlickrUI.ModeSelected.BlogAndConflictMode) {
        _isconflictmode = true;
        _isblogmode = true;
          }
          _tags = new ArrayList();
          _comments = new ArrayList();
          window2.Title = "Edit information for " + selectedphotos.Count + " photos";
          window2.SetIconFromFile(DeskFlickrUI.ICON_PATH);
          notebook1.SetTabLabelText(notebook1.CurrentPageWidget, "Information");
          notebook1.NextPage();
          notebook1.SetTabLabelText(notebook1.CurrentPageWidget, "Tags");
          notebook1.NextPage();
          notebook1.SetTabLabelText(notebook1.CurrentPageWidget, "Comments");

          tips = new Tooltips();
          SetCommentsToolBar();
          tips.Enable();
          SetCommentsTree();

          if (_isconflictmode) {
            notebook1.NextPage();
            notebook1.SetTabLabelText(notebook1.CurrentPageWidget, "Information at Server");
          } else {
            notebook1.RemovePage(3);
          }

          if (_isblogmode) {
            notebook1.NextPage();
            notebook1.SetTabLabelText(notebook1.CurrentPageWidget, "Blog Entry");
            notebook1.Page = 3; // Default page is blog entry if editor is in Blog mode.
          } else {
            if (_isconflictmode) notebook1.RemovePage(4);
            else notebook1.RemovePage(3);
            notebook1.Page = 0; // Default page is photo editing.
          }

          table1.SetColSpacing(0, 50);
          // Set Labels
          label6.Text = "Edit";
          label5.Text = "Title:";
          label4.Text = "Description:";
          label3.Text = "Visibility:";
          label2.Text = "License:";
          if (_isuploadmode) label2.Sensitive = false;
          // Labels for blog tab.
          label17.Text = "Title: ";
          label18.Text = "Description: ";

          // Search box
          label15.Markup = "<span weight='bold'>Search: </span>";
          entry2.Changed += new EventHandler(OnFilterEntryChanged);

          // Revert button
          button9.Label = "Revert Photo(s)";
          button9.Clicked += new EventHandler(OnRevertButtonClicked);

          // entry1.ModifyFont(Pango.FontDescription.FromString("FreeSerif 10"));
          SetPrivacyComboBox();
          SetLicenseComboBox();
          SetTagTreeView();

          // Make previous and next buttons insensitive. They'll become sensitive
          // only when the user ticks the 'Per Photo' checkbutton.
          button3.Sensitive = false;
          button4.Sensitive = false;
          checkbutton1.Toggled += new EventHandler(OnPerPageCheckToggled);
          button3.Clicked += new EventHandler(OnPrevButtonClick);
          button4.Clicked += new EventHandler(OnNextButtonClick);
          button5.Clicked += new EventHandler(OnSaveButtonClick);
          button6.Clicked += new EventHandler(OnCancelButtonClick);

          entry1.Changed += new EventHandler(OnTitleChanged);
          textview5.Buffer.Changed += new EventHandler(OnDescChanged);

          combobox1.Changed += new EventHandler(OnPrivacyChanged);
          combobox2.Changed += new EventHandler(OnLicenseChanged);

          entry4.Changed += new EventHandler(OnBlogTitleChanged);
          textview7.Buffer.Changed += new EventHandler(OnBlogDescChanged);

          textview3.Buffer.Changed += new EventHandler(OnTagsChanged);

          TextTag texttag = new TextTag("conflict");
          texttag.Font = "Times Italic 10";
          texttag.WrapMode = WrapMode.Word;
          texttag.ForegroundGdk = new Gdk.Color(0x99, 0, 0);
          textview4.Buffer.TagTable.Add(texttag);

          // Showing photos should be the last step.
          this._selectedphotos = selectedphotos;
          if (selectedphotos.Count == 1) {
        checkbutton1.Sensitive = false;
        ShowInformationForCurrentPhoto();
          } else {
        EmbedCommonInformation();
          }
          // Save a copy of the original photos, so that only those photos
          // which  have been edited, would have their dirty bit set. Advantage:
          // this would reduce the number of dirty photos, and hence there'll
          // be lesser photos to update when sycing with server.
          _originalphotos = new System.Collections.Generic.Dictionary<string, Photo>();
          foreach (DeskFlickrUI.SelectedPhoto sel in _selectedphotos) {
        Photo p = sel.photo;
        _originalphotos.Add(p.Id, new Photo(p));
          }

          eventbox5.ButtonPressEvent += OnLinkPressed;
          eventbox5.EnterNotifyEvent += MouseOnLink;
          eventbox5.LeaveNotifyEvent += MouseLeftLink;

          window2.ShowAll();
    }
예제 #33
0
		/// <summary> Read a particular segmentFileName.  Note that this may
		/// throw an IOException if a commit is in process.
		/// 
		/// </summary>
		/// <param name="directory">-- directory containing the segments file
		/// </param>
		/// <param name="segmentFileName">-- segment file to load
		/// </param>
		/// <throws>  CorruptIndexException if the index is corrupt </throws>
		/// <throws>  IOException if there is a low-level IO error </throws>
		public void  Read(Directory directory, System.String segmentFileName)
		{
			bool success = false;
			
			// Clear any previous segments:
			Clear();
			
			ChecksumIndexInput input = new ChecksumIndexInput(directory.OpenInput(segmentFileName));
			
			generation = GenerationFromSegmentsFileName(segmentFileName);
			
			lastGeneration = generation;
			
			try
			{
				int format = input.ReadInt();
				if (format < 0)
				{
					// file contains explicit format info
					// check that it is a format we can understand
					if (format < CURRENT_FORMAT)
						throw new CorruptIndexException("Unknown format version: " + format);
					version = input.ReadLong(); // read version
					counter = input.ReadInt(); // read counter
				}
				else
				{
					// file is in old format without explicit format info
					counter = format;
				}
				
				for (int i = input.ReadInt(); i > 0; i--)
				{
					// read segmentInfos
					Add(new SegmentInfo(directory, format, input));
				}
				
				if (format >= 0)
				{
					// in old format the version number may be at the end of the file
					if (input.GetFilePointer() >= input.Length())
						version = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
					// old file format without version number
					else
						version = input.ReadLong(); // read version
				}
				
				if (format <= FORMAT_USER_DATA)
				{
					if (format <= FORMAT_DIAGNOSTICS)
					{
						userData = input.ReadStringStringMap();
					}
					else if (0 != input.ReadByte())
					{
                        userData = new System.Collections.Generic.Dictionary<string,string>();
						userData.Add("userData", input.ReadString());
					}
					else
					{
                        userData = new System.Collections.Generic.Dictionary<string, string>();
					}
				}
				else
				{
                    userData = new System.Collections.Generic.Dictionary<string, string>();
				}
				
				if (format <= FORMAT_CHECKSUM)
				{
					long checksumNow = input.GetChecksum();
					long checksumThen = input.ReadLong();
					if (checksumNow != checksumThen)
						throw new CorruptIndexException("checksum mismatch in segments file");
				}
				success = true;
			}
			finally
			{
				input.Close();
				if (!success)
				{
					// Clear any segment infos we had loaded so we
					// have a clean slate on retry:
					Clear();
				}
			}
		}