コード例 #1
0
 public System.Object ClientCommunication(Version serverversion, ICommunicateable communicator, bool full, System.Object obj)
 {
     try
     {
         if (serverversion.Major > 0)
         {
             int c = communicator.ReceiveInt();
             if (c > 0)
             {
                 System.Collections.Generic.Dictionary <string, DepositContent> .ValueCollection.Enumerator e = this.Values.GetEnumerator();
                 for (int i = 0; i < c; i++)
                 {
                     if (e.MoveNext())
                     {
                         e.Current.ClientCommunication(serverversion, communicator, full, obj);
                     }
                 }
             }
         }
         return(this);
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
        }//GetCode128BestCodeSet

        private static int GetCode128CharPos(BarcodeImage barcode, string value, int codeTableIndex)
        {
            System.Collections.Generic.Dictionary <int, string> .Enumerator iMapping = barcode._code128MappingLookup[codeTableIndex].GetEnumerator();
            while (iMapping.MoveNext())
            {
                if (iMapping.Current.Value == value)
                {
                    return(iMapping.Current.Key);
                } //if
            }     //while
            return(-1);
        }         //GetCode128CharPos
コード例 #3
0
ファイル: FileManager.cs プロジェクト: ZdravekSprite/testing
        public SourceFileForm getFirstForm()
        {
            if (_openFiles.Keys.Count > 0)
            {
                System.Collections.Generic.Dictionary <string, OpenFileStruct> .Enumerator al = _openFiles.GetEnumerator();
                if (al.MoveNext())
                {
                    return(al.Current.Value.form);
                }
            }

            return
                (null);
        }
コード例 #4
0
        private string GetFirstNoHeaderNode(System.Collections.Generic.Dictionary <string, NavItem> navItems, string id, out bool isAllCheck, out string nodeKey)
        {
            nodeKey    = string.Empty;
            isAllCheck = true;
            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            stringBuilder.Append("<div class=\"two fl clearfix\">");
            if (navItems.Values.Count > 0)
            {
                System.Collections.Generic.KeyValuePair <string, NavItem> keyValuePair = navItems.First <System.Collections.Generic.KeyValuePair <string, NavItem> >();
                if (string.IsNullOrEmpty(keyValuePair.Value.SpanName))
                {
                    nodeKey = keyValuePair.Key;
                    int num = 0;
                    using (System.Collections.Generic.Dictionary <string, NavPageLink> .Enumerator enumerator = keyValuePair.Value.PageLinks.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            System.Collections.Generic.KeyValuePair <string, NavPageLink> current = enumerator.Current;
                            string permissionId = RolePermissionInfo.GetPermissionId(id, current.Value.ID);
                            bool   flag         = this.oldPermissions.FirstOrDefault((RolePermissionInfo p) => p.PermissionId == permissionId) != null;
                            if (!flag)
                            {
                                isAllCheck = false;
                            }
                            if (num == 0)
                            {
                                stringBuilder.Append(" <div class=\"titlecheck fl\">");
                                stringBuilder.AppendFormat(" <label class=\"setalign\"> <input type=\"checkbox\" name=\"permissions\" value=\"{0}\" {1}>{2}</label>", permissionId, this.GetInputCheck(flag), current.Value.Title);
                                stringBuilder.Append("</div>");
                            }
                            else
                            {
                                stringBuilder.Append("  <div class=\"twoinerlist fl\">");
                                stringBuilder.AppendFormat(" <label class=\"setalign\"> <input type=\"checkbox\" name=\"permissions\" value=\"{0}\" {1}>{2}</label>", permissionId, this.GetInputCheck(flag), current.Value.Title);
                                stringBuilder.Append("</div>");
                            }
                            num++;
                        }
                        goto IL_185;
                    }
                }
                stringBuilder.Append(" <div class=\"titlecheck fl\">");
                stringBuilder.Append("  &nbsp;");
                stringBuilder.Append("</div>");
            }
IL_185:
            stringBuilder.Append("</div>");
            return(stringBuilder.ToString());
        }
 private void SetUnpackedValueOfHistory(MsgPack.Serialization.ComplexTypeWithNonSerialized unpackingContext, System.Collections.Generic.Dictionary<System.DateTime, string> unpackedValue) {
     System.Collections.Generic.Dictionary<System.DateTime, string> existent = default(System.Collections.Generic.Dictionary<System.DateTime, string>);
     existent = unpackingContext.History;
     System.Collections.Generic.Dictionary<System.DateTime, string>.Enumerator enumerator = unpackedValue.GetEnumerator();
     System.Collections.Generic.KeyValuePair<System.DateTime, string> current;
     try {
         for (
         ; enumerator.MoveNext(); 
         ) {
             current = enumerator.Current;
             existent.Add(current.Key, current.Value);
         }
     }
     finally {
         enumerator.Dispose();
     }
 }
        static StackObject *MoveNext_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            System.Collections.Generic.Dictionary <System.Int32, BK.IDisposableClassInheritanceAdaptor.IDisposableAdaptor> .Enumerator instance_of_this_method = (System.Collections.Generic.Dictionary <System.Int32, BK.IDisposableClassInheritanceAdaptor.IDisposableAdaptor> .Enumerator) typeof(System.Collections.Generic.Dictionary <System.Int32, BK.IDisposableClassInheritanceAdaptor.IDisposableAdaptor> .Enumerator).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));

            var result_of_this_method = instance_of_this_method.MoveNext();

            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method ? 1 : 0;
            return(__ret + 1);
        }
 protected internal override void PackToCore(MsgPack.Packer packer, System.Collections.Generic.Dictionary <MsgPack.MessagePackObject, MsgPack.MessagePackObject> objectTree)
 {
     packer.PackMapHeader(objectTree.Count);
     System.Collections.Generic.Dictionary <MsgPack.MessagePackObject, MsgPack.MessagePackObject> .Enumerator enumerator = objectTree.GetEnumerator();
     System.Collections.Generic.KeyValuePair <MsgPack.MessagePackObject, MsgPack.MessagePackObject>           current;
     try {
         for (
             ; enumerator.MoveNext();
             )
         {
             current = enumerator.Current;
             this._serializer0.PackTo(packer, current.Key);
             this._serializer0.PackTo(packer, current.Value);
         }
     }
     finally {
         enumerator.Dispose();
     }
 }
コード例 #8
0
        public int GetGroupBuyOerderNumber()
        {
            int result;

            if (this.GroupBuyId > 0)
            {
                using (System.Collections.Generic.Dictionary <string, LineItemInfo> .ValueCollection.Enumerator enumerator = this.LineItems.Values.GetEnumerator())
                {
                    if (enumerator.MoveNext())
                    {
                        LineItemInfo current = enumerator.Current;
                        result = current.Quantity;
                        return(result);
                    }
                }
            }
            result = 0;
            return(result);
        }
コード例 #9
0
        public virtual void Save()
        {
            lock (this.Locker)
            {
                Stump.ORM.Database database = ServerBase <WorldServer> .Instance.DBAccessor.Database;
                using (System.Collections.Generic.Dictionary <int, T> .Enumerator enumerator = this.Items.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        System.Collections.Generic.KeyValuePair <int, T> current = enumerator.Current;
                        T value = current.Value;
                        if (value.Record.IsNew)
                        {
                            Stump.ORM.Database arg_74_0 = database;
                            value = current.Value;
                            arg_74_0.Insert(value.Record);
                            value = current.Value;
                            value.Record.IsNew = false;
                        }
                        else
                        {
                            value = current.Value;
                            if (value.Record.IsDirty)
                            {
                                Stump.ORM.Database arg_CF_0 = database;
                                value = current.Value;
                                arg_CF_0.Update(value.Record);
                            }
                        }
                    }
                    goto IL_111;
                }
IL_F1:
                T t = this.ItemsToDelete.Dequeue();
                database.Delete(t.Record);
IL_111:
                if (this.ItemsToDelete.Count > 0)
                {
                    goto IL_F1;
                }
            }
        }
コード例 #10
0
        static StackObject *MoveNext_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method);
            System.Collections.Generic.Dictionary <System.String, ET.ListComponent <System.String> > .ValueCollection.Enumerator instance_of_this_method = (System.Collections.Generic.Dictionary <System.String, ET.ListComponent <System.String> > .ValueCollection.Enumerator) typeof(System.Collections.Generic.Dictionary <System.String, ET.ListComponent <System.String> > .ValueCollection.Enumerator).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 16);

            var result_of_this_method = instance_of_this_method.MoveNext();

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method);

            __intp.Free(ptr_of_this_method);
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method ? 1 : 0;
            return(__ret + 1);
        }
コード例 #11
0
 public static string GetEntityValueAndName(Guid entityNodeTypeId, string fieldName, object value)
 {
     foreach (Entity ent in EntityFieldProvider.Entities)
     {
         if (ent.Id.Equals(entityNodeTypeId))
         {
             EntityField field = ent.Fields[fieldName];
             if (field != null)
             {
                 if (field.ListValues != null && field.ListValues.Count > 0)
                 {
                     System.Collections.Generic.Dictionary <string, object[]> .KeyCollection.Enumerator keys = field.ListValues.Keys.GetEnumerator();
                     foreach (object[] obj in field.ListValues.Values)
                     {
                         if (!keys.MoveNext())
                         {
                             break;
                         }
                         if (obj[0].Equals(value))
                         {
                             return(keys.Current);
                         }
                     }
                 }
                 else if (field.DataType.Equals(typeof(Entity)))
                 {
                     if (value is Guid)
                     {
                         ClientDataSet.EntityNodeRow row = EntityNodeProvider.GetEntityNode((Guid)value);
                         if (row != null)
                         {
                             return(row.Name);
                         }
                     }
                 }
             }
         }
     }
     return(Convert.ToString(value, CultureInfo.CurrentCulture));
 }
コード例 #12
0
        /// <summary>
        /// If the current is not ASPX page but ASCX controls, the controls in this ASCX control has id starting with underscore.
        /// To avoid confusion in formula, we also define variable name without underscore.
        /// </summary>
        /// <remarks></remarks>
        private void AddVariableNameWithoutUnderscore()
        {
            System.Collections.Generic.Dictionary <string, object> vars = new System.Collections.Generic.Dictionary <string, object>();
            System.Collections.Generic.IEnumerator <System.Collections.Generic.KeyValuePair <string, object> > enumerator = this.Evaluator.Variables.GetEnumerator();
            while (enumerator.MoveNext())
            {
                if (enumerator.Current.Key.StartsWith("_"))
                {
                    string varNameWitoutUnderscore = enumerator.Current.Key.Substring(1);
                    if (!this.Evaluator.Variables.ContainsKey(varNameWitoutUnderscore))
                    {
                        vars.Add(varNameWitoutUnderscore, enumerator.Current.Value);
                    }
                }
            }

            System.Collections.Generic.Dictionary <string, object> .Enumerator enumerator2 = vars.GetEnumerator();
            while (enumerator2.MoveNext())
            {
                this.Evaluator.Variables.Add(enumerator2.Current.Key, enumerator2.Current.Value);
            }
        }
コード例 #13
0
ファイル: UCGeometryEdit.cs プロジェクト: wwcc19870805/DIFGIS
        private void UpdateDatabase(System.Collections.Generic.Dictionary <DF3DFeatureClass, IRowBufferCollection> rowsMap)
        {
            System.Collections.Generic.Dictionary <DF3DFeatureClass, IRowBufferCollection> .Enumerator enumerator = rowsMap.GetEnumerator();
            if (!enumerator.MoveNext())
            {
                return;
            }
            System.Collections.Generic.KeyValuePair <DF3DFeatureClass, IRowBufferCollection> current = enumerator.Current;
            DF3DFeatureClass key          = current.Key;
            int            count          = SelectCollection.Instance().GetCount(false);
            EditParameters editParameters = new EditParameters(key.GetFeatureClass().GuidString);

            editParameters.connectionInfo = key.GetFeatureClass().DataSource.ConnectionInfo.ToConnectionString();
            editParameters.datasetName    = key.GetFeatureClass().FeatureDataSet.Name;
            editParameters.geometryMap    = rowsMap;
            editParameters.nTotalCount    = count;
            editParameters.TemproalTime   = this._time;
            IBatcheEdit batcheEdit = BatchEditFactory.CreateBatchEdit(count);

            batcheEdit.BeginEdit();
            batcheEdit.DoWork(EditType.ET_UPDATE_GEOMETRY, editParameters);
            batcheEdit.EndEdit();
        }
コード例 #14
0
        public void Save()
        {
            lock (this.m_locker)
            {
                Stump.ORM.Database database = ServerBase <WorldServer> .Instance.DBAccessor.Database;
                foreach (System.Collections.Generic.KeyValuePair <int, ItemShortcut> current in this.m_itemShortcuts)
                {
                    if (current.Value.IsDirty || current.Value.IsNew)
                    {
                        database.Save(current.Value);
                    }
                }
                using (System.Collections.Generic.Dictionary <int, SpellShortcut> .Enumerator enumerator2 = this.m_spellShortcuts.GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        System.Collections.Generic.KeyValuePair <int, SpellShortcut> current2 = enumerator2.Current;
                        if (current2.Value.IsDirty || current2.Value.IsNew)
                        {
                            database.Save(current2.Value);
                        }
                    }
                    goto IL_FD;
                }
IL_E3:
                Stump.Server.WorldServer.Database.Shortcuts.Shortcut shortcut = this.m_shortcutsToDelete.Dequeue();
                if (shortcut != null)
                {
                    database.Delete(shortcut);
                }
IL_FD:
                if (this.m_shortcutsToDelete.Count > 0)
                {
                    goto IL_E3;
                }
            }
        }
コード例 #15
0
ファイル: RobotSphere.cs プロジェクト: TendoSoSoft/FIVE
        public void OnHit()
        {
            health -= 5.0f;
            if (health <= 0)
            {
                if (RobotManager.ID2Robot.Count == 1)
                {
                    // lose
                }
                else
                {
                    RobotManager.RemoveRobot(gameObject);
                    CameraManager.Remove(fpsCamera);
                    CameraManager.Remove(thirdPersonCamera);

                    System.Collections.Generic.Dictionary <int, GameObject> .Enumerator it = RobotManager.ID2Robot.GetEnumerator();
                    it.MoveNext();
                    it.Current.Value.GetComponent <RobotSphere>().SwitchToThis();

                    gameObject.SetActive(false);
                    Destroy(gameObject);
                }
            }
        }
コード例 #16
0
        public void Save()
        {
            lock (this.m_locker)
            {
                Stump.ORM.Database database = ServerBase <WorldServer> .Instance.DBAccessor.Database;
                using (System.Collections.Generic.Dictionary <int, CharacterSpell> .Enumerator enumerator = this.m_spells.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        System.Collections.Generic.KeyValuePair <int, CharacterSpell> current = enumerator.Current;
                        database.Save(current.Value.Record);
                    }
                    goto IL_79;
                }
IL_65:
                CharacterSpellRecord poco = this.m_spellsToDelete.Dequeue();
                database.Delete(poco);
IL_79:
                if (this.m_spellsToDelete.Count > 0)
                {
                    goto IL_65;
                }
            }
        }
コード例 #17
0
 protected internal override MsgPack.Serialization.ComplexType UnpackFromCore(MsgPack.Unpacker unpacker)
 {
     MsgPack.Serialization.ComplexType result = default(MsgPack.Serialization.ComplexType);
     result = new MsgPack.Serialization.ComplexType();
     if (unpacker.IsArrayHeader)
     {
         int unpacked   = default(int);
         int itemsCount = default(int);
         itemsCount = MsgPack.Serialization.UnpackHelpers.GetItemsCount(unpacker);
         System.Uri nullable = default(System.Uri);
         if ((unpacked < itemsCount))
         {
             if ((unpacker.Read() == false))
             {
                 throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(0);
             }
             if (((unpacker.IsArrayHeader == false) &&
                  (unpacker.IsMapHeader == false)))
             {
                 nullable = this._serializer1.UnpackFrom(unpacker);
             }
             else
             {
                 MsgPack.Unpacker disposable = default(MsgPack.Unpacker);
                 disposable = unpacker.ReadSubtree();
                 try {
                     nullable = this._serializer1.UnpackFrom(disposable);
                 }
                 finally {
                     if (((disposable == null)
                          == false))
                     {
                         disposable.Dispose();
                     }
                 }
             }
         }
         if (((nullable == null)
              == false))
         {
             result.Source = nullable;
         }
         unpacked = (unpacked + 1);
         byte[] nullable0 = default(byte[]);
         if ((unpacked < itemsCount))
         {
             nullable0 = MsgPack.Serialization.UnpackHelpers.UnpackBinaryValue(unpacker, typeof(MsgPack.Serialization.ComplexType), "Byte[] Data");
         }
         if (((nullable0 == null)
              == false))
         {
             result.Data = nullable0;
         }
         unpacked = (unpacked + 1);
         System.Nullable <System.DateTime> nullable1 = default(System.Nullable <System.DateTime>);
         if ((unpacked < itemsCount))
         {
             if ((unpacker.Read() == false))
             {
                 throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(2);
             }
             if (((unpacker.IsArrayHeader == false) &&
                  (unpacker.IsMapHeader == false)))
             {
                 nullable1 = this._serializer6.UnpackFrom(unpacker);
             }
             else
             {
                 MsgPack.Unpacker disposable0 = default(MsgPack.Unpacker);
                 disposable0 = unpacker.ReadSubtree();
                 try {
                     nullable1 = this._serializer6.UnpackFrom(disposable0);
                 }
                 finally {
                     if (((disposable0 == null)
                          == false))
                     {
                         disposable0.Dispose();
                     }
                 }
             }
         }
         if (nullable1.HasValue)
         {
             result.TimeStamp = nullable1.Value;
         }
         unpacked = (unpacked + 1);
         System.Collections.Generic.Dictionary <System.DateTime, string> nullable2 = default(System.Collections.Generic.Dictionary <System.DateTime, string>);
         if ((unpacked < itemsCount))
         {
             if ((unpacker.Read() == false))
             {
                 throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(3);
             }
             if (((unpacker.IsArrayHeader == false) &&
                  (unpacker.IsMapHeader == false)))
             {
                 nullable2 = this._serializer4.UnpackFrom(unpacker);
             }
             else
             {
                 MsgPack.Unpacker disposable1 = default(MsgPack.Unpacker);
                 disposable1 = unpacker.ReadSubtree();
                 try {
                     nullable2 = this._serializer4.UnpackFrom(disposable1);
                 }
                 finally {
                     if (((disposable1 == null)
                          == false))
                     {
                         disposable1.Dispose();
                     }
                 }
             }
         }
         if (((nullable2 == null)
              == false))
         {
             System.Collections.Generic.Dictionary <System.DateTime, string> .Enumerator enumerator = nullable2.GetEnumerator();
             System.Collections.Generic.KeyValuePair <System.DateTime, string>           current;
             try {
                 for (
                     ; enumerator.MoveNext();
                     )
                 {
                     current = enumerator.Current;
                     result.History.Add(current.Key, current.Value);
                 }
             }
             finally {
                 enumerator.Dispose();
             }
         }
         unpacked = (unpacked + 1);
         System.Collections.Generic.List <int> nullable3 = default(System.Collections.Generic.List <int>);
         if ((unpacked < itemsCount))
         {
             if ((unpacker.Read() == false))
             {
                 throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(4);
             }
             if (((unpacker.IsArrayHeader == false) &&
                  (unpacker.IsMapHeader == false)))
             {
                 nullable3 = this._serializer5.UnpackFrom(unpacker);
             }
             else
             {
                 MsgPack.Unpacker disposable2 = default(MsgPack.Unpacker);
                 disposable2 = unpacker.ReadSubtree();
                 try {
                     nullable3 = this._serializer5.UnpackFrom(disposable2);
                 }
                 finally {
                     if (((disposable2 == null)
                          == false))
                     {
                         disposable2.Dispose();
                     }
                 }
             }
         }
         if (((nullable3 == null)
              == false))
         {
             if ((result.Points == null))
             {
                 this._methodBaseComplexType_set_Points0.Invoke(result, new object[] {
                     nullable3
                 });
             }
             else
             {
                 System.Collections.Generic.List <int> .Enumerator enumerator0 = nullable3.GetEnumerator();
                 int current0;
                 try {
                     for (
                         ; enumerator0.MoveNext();
                         )
                     {
                         current0 = enumerator0.Current;
                         result.Points.Add(current0);
                     }
                 }
                 finally {
                     enumerator0.Dispose();
                 }
             }
         }
         unpacked = (unpacked + 1);
     }
     else
     {
         int itemsCount0 = default(int);
         itemsCount0 = MsgPack.Serialization.UnpackHelpers.GetItemsCount(unpacker);
         for (int i = 0; (i < itemsCount0); i = (i + 1))
         {
             string key       = default(string);
             string nullable4 = default(string);
             nullable4 = MsgPack.Serialization.UnpackHelpers.UnpackStringValue(unpacker, typeof(MsgPack.Serialization.ComplexType), "MemberName");
             if (((nullable4 == null)
                  == false))
             {
                 key = nullable4;
             }
             else
             {
                 throw MsgPack.Serialization.SerializationExceptions.NewNullIsProhibited("MemberName");
             }
             if ((key == "Points"))
             {
                 System.Collections.Generic.List <int> nullable9 = default(System.Collections.Generic.List <int>);
                 if ((unpacker.Read() == false))
                 {
                     throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(i);
                 }
                 if (((unpacker.IsArrayHeader == false) &&
                      (unpacker.IsMapHeader == false)))
                 {
                     nullable9 = this._serializer5.UnpackFrom(unpacker);
                 }
                 else
                 {
                     MsgPack.Unpacker disposable6 = default(MsgPack.Unpacker);
                     disposable6 = unpacker.ReadSubtree();
                     try {
                         nullable9 = this._serializer5.UnpackFrom(disposable6);
                     }
                     finally {
                         if (((disposable6 == null)
                              == false))
                         {
                             disposable6.Dispose();
                         }
                     }
                 }
                 if (((nullable9 == null)
                      == false))
                 {
                     if ((result.Points == null))
                     {
                         this._methodBaseComplexType_set_Points0.Invoke(result, new object[] {
                             nullable9
                         });
                     }
                     else
                     {
                         System.Collections.Generic.List <int> .Enumerator enumerator2 = nullable9.GetEnumerator();
                         int current2;
                         try {
                             for (
                                 ; enumerator2.MoveNext();
                                 )
                             {
                                 current2 = enumerator2.Current;
                                 result.Points.Add(current2);
                             }
                         }
                         finally {
                             enumerator2.Dispose();
                         }
                     }
                 }
             }
             else
             {
                 if ((key == "History"))
                 {
                     System.Collections.Generic.Dictionary <System.DateTime, string> nullable8 = default(System.Collections.Generic.Dictionary <System.DateTime, string>);
                     if ((unpacker.Read() == false))
                     {
                         throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(i);
                     }
                     if (((unpacker.IsArrayHeader == false) &&
                          (unpacker.IsMapHeader == false)))
                     {
                         nullable8 = this._serializer4.UnpackFrom(unpacker);
                     }
                     else
                     {
                         MsgPack.Unpacker disposable5 = default(MsgPack.Unpacker);
                         disposable5 = unpacker.ReadSubtree();
                         try {
                             nullable8 = this._serializer4.UnpackFrom(disposable5);
                         }
                         finally {
                             if (((disposable5 == null)
                                  == false))
                             {
                                 disposable5.Dispose();
                             }
                         }
                     }
                     if (((nullable8 == null)
                          == false))
                     {
                         System.Collections.Generic.Dictionary <System.DateTime, string> .Enumerator enumerator1 = nullable8.GetEnumerator();
                         System.Collections.Generic.KeyValuePair <System.DateTime, string>           current1;
                         try {
                             for (
                                 ; enumerator1.MoveNext();
                                 )
                             {
                                 current1 = enumerator1.Current;
                                 result.History.Add(current1.Key, current1.Value);
                             }
                         }
                         finally {
                             enumerator1.Dispose();
                         }
                     }
                 }
                 else
                 {
                     if ((key == "TimeStamp"))
                     {
                         System.Nullable <System.DateTime> nullable7 = default(System.Nullable <System.DateTime>);
                         if ((unpacker.Read() == false))
                         {
                             throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(i);
                         }
                         if (((unpacker.IsArrayHeader == false) &&
                              (unpacker.IsMapHeader == false)))
                         {
                             nullable7 = this._serializer6.UnpackFrom(unpacker);
                         }
                         else
                         {
                             MsgPack.Unpacker disposable4 = default(MsgPack.Unpacker);
                             disposable4 = unpacker.ReadSubtree();
                             try {
                                 nullable7 = this._serializer6.UnpackFrom(disposable4);
                             }
                             finally {
                                 if (((disposable4 == null)
                                      == false))
                                 {
                                     disposable4.Dispose();
                                 }
                             }
                         }
                         if (nullable7.HasValue)
                         {
                             result.TimeStamp = nullable7.Value;
                         }
                     }
                     else
                     {
                         if ((key == "Data"))
                         {
                             byte[] nullable6 = default(byte[]);
                             nullable6 = MsgPack.Serialization.UnpackHelpers.UnpackBinaryValue(unpacker, typeof(MsgPack.Serialization.ComplexType), "Byte[] Data");
                             if (((nullable6 == null)
                                  == false))
                             {
                                 result.Data = nullable6;
                             }
                         }
                         else
                         {
                             if ((key == "Source"))
                             {
                                 System.Uri nullable5 = default(System.Uri);
                                 if ((unpacker.Read() == false))
                                 {
                                     throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(i);
                                 }
                                 if (((unpacker.IsArrayHeader == false) &&
                                      (unpacker.IsMapHeader == false)))
                                 {
                                     nullable5 = this._serializer1.UnpackFrom(unpacker);
                                 }
                                 else
                                 {
                                     MsgPack.Unpacker disposable3 = default(MsgPack.Unpacker);
                                     disposable3 = unpacker.ReadSubtree();
                                     try {
                                         nullable5 = this._serializer1.UnpackFrom(disposable3);
                                     }
                                     finally {
                                         if (((disposable3 == null)
                                              == false))
                                         {
                                             disposable3.Dispose();
                                         }
                                     }
                                 }
                                 if (((nullable5 == null)
                                      == false))
                                 {
                                     result.Source = nullable5;
                                 }
                             }
                             else
                             {
                                 unpacker.Skip();
                             }
                         }
                     }
                 }
             }
         }
     }
     return(result);
 }
コード例 #18
0
ファイル: DataGpOPGroup.cs プロジェクト: Jackjet/ECOSingle
        private void butOn_Click(object sender, System.EventArgs e)
        {
            DataTable dataTable = (DataTable)this.dgvInfo.DataSource;

            System.Collections.Generic.List <DevSnmpConfig> list = new System.Collections.Generic.List <DevSnmpConfig>();
            System.Collections.Generic.Dictionary <string, System.Collections.Generic.List <int> > dictionary = new System.Collections.Generic.Dictionary <string, System.Collections.Generic.List <int> >();
            this.m_parent.endTimer();
            DialogResult dialogResult = EcoMessageBox.ShowWarning(EcoLanguage.getMsg(LangRes.OPCrm_on, new string[0]), MessageBoxButtons.OKCancel);

            if (dialogResult == DialogResult.Cancel)
            {
                this.m_parent.starTimer();
                return;
            }
            foreach (DataRow dataRow in dataTable.Rows)
            {
                string text  = dataRow[0].ToString();
                string value = dataRow[3].ToString();
                if (dictionary.ContainsKey(text))
                {
                    System.Collections.Generic.List <int> list2 = dictionary[text];
                    list2.Add(System.Convert.ToInt32(value));
                }
                else
                {
                    dictionary.Add(text, new System.Collections.Generic.List <int>
                    {
                        System.Convert.ToInt32(value)
                    });
                }
            }
            System.Collections.Generic.Dictionary <string, System.Collections.Generic.List <int> > .Enumerator enumerator2 = dictionary.GetEnumerator();
            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            while (enumerator2.MoveNext())
            {
                System.Collections.Generic.KeyValuePair <string, System.Collections.Generic.List <int> > current = enumerator2.Current;
                string text = current.Key;
                stringBuilder.Append(text + ",");
            }
            string text2 = stringBuilder.ToString();

            if (text2.Length > 1)
            {
                text2 = text2.Substring(0, text2.Length - 1);
            }
            System.Collections.Generic.List <DeviceInfo> list3 = (System.Collections.Generic.List <DeviceInfo>)ClientAPI.RemoteCall(7, 1, text2, 10000);
            if (list3 == null)
            {
                list3 = new System.Collections.Generic.List <DeviceInfo>();
            }
            foreach (DeviceInfo current2 in list3)
            {
                string        text     = current2.DeviceID.ToString();
                DevSnmpConfig sNMPpara = commUtil.getSNMPpara(current2);
                sNMPpara.groupOutlets = dictionary[text];
                list.Add(sNMPpara);
            }
            DevPortGroupAPI devPortGroupAPI = new DevPortGroupAPI(list);
            bool            flag            = devPortGroupAPI.TurnOnGroupOutlets();

            if (flag)
            {
                EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
            }
            else
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
            }
            this.m_parent.starTimer();
        }
コード例 #19
0
        private void SetDataGridViewTags(TableInfo tableInfo)
        {
            bool @readonly = tableInfo.Readonly;

            if (tableInfo.ObjectList.SupportCreate)
            {
                this.tableDataGridView.AllowUserToAddRows = true;
                this.newRecordToolStripButton.Enabled     = true;
            }
            else
            {
                this.tableDataGridView.AllowUserToAddRows = false;
                this.newRecordToolStripButton.Enabled     = false;
            }
            if (@readonly)
            {
                this.tableDataGridView.Tag = TableTag.ReadOnlyTable;
            }
            else
            {
                this.tableDataGridView.Tag = (tableInfo.ObjectList.SupportCreate ? TableTag.AllowCreate : TableTag.NotAllowCreate);
                if (this.m_tableInfoSet.CustomTableIds.Contains(tableInfo.TableId))
                {
                    this.tableDataGridView.Tag = TableTag.CustomTable;
                }
            }
            DataTable dataTable = this.m_dataSet.Tables[tableInfo.Name];

            for (int i = 0; i < dataTable.Rows.Count; i++)
            {
                DataGridViewRow dataGridViewRow = this.tableDataGridView.Rows[i];
                if (@readonly)
                {
                    dataGridViewRow.Tag = RowTag.AnOldRowExist;
                }
                else
                {
                    DataRow dataRow     = dataTable.Rows[i];
                    object  revitObject = tableInfo.ObjectList.GetRevitObject(dataRow);
                    Element element     = revitObject as Element;
                    if (revitObject != null)
                    {
                        dataGridViewRow.Tag = RowTag.AnOldRowExist;
                        if (element == null)
                        {
                            goto IL_249;
                        }
                        ParameterMap parametersMap = element.ParametersMap;
                        using (System.Collections.Generic.Dictionary <string, ColumnInfo> .KeyCollection.Enumerator enumerator = tableInfo.Keys.GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {
                                string           current          = enumerator.Current;
                                ColumnInfo       columnInfo       = tableInfo[current];
                                DataGridViewCell dataGridViewCell = dataGridViewRow.Cells[current];
                                Parameter        parameter;
                                if (columnInfo.BuiltInParameter == (BuiltInParameter)(-1))
                                {
                                    parameter = APIObjectList.GetParameterByDefinitionName(parametersMap, columnInfo.Name);
                                }
                                else
                                {
                                    parameter = element.get_Parameter(columnInfo.BuiltInParameter);
                                }
                                if (parameter == null || parameter.IsReadOnly)
                                {
                                    dataGridViewCell.Tag = CellTag.ReadOnly;
                                }
                            }
                            goto IL_249;
                        }
                    }
                    dataGridViewRow.Tag = RowTag.ANewRow;
                    if (tableInfo.ObjectList.SupportCreate)
                    {
                        foreach (string current2 in tableInfo.Keys)
                        {
                            ColumnInfo       columnInfo2       = tableInfo[current2];
                            DataGridViewCell dataGridViewCell2 = dataGridViewRow.Cells[current2];
                            if (tableInfo.PrimaryKeys.Contains(columnInfo2.ColumnId))
                            {
                                dataGridViewCell2.Tag = CellTag.ReadOnly;
                            }
                        }
                    }
                }
                IL_249 :;
            }
        }
コード例 #20
0
 protected internal override MsgPack.Serialization.ComplexTypeWithNonSerialized UnpackFromCore(MsgPack.Unpacker unpacker)
 {
     MsgPack.Serialization.ComplexTypeWithNonSerialized result = default(MsgPack.Serialization.ComplexTypeWithNonSerialized);
     result = new MsgPack.Serialization.ComplexTypeWithNonSerialized();
     if (unpacker.IsArrayHeader)
     {
         int unpacked   = default(int);
         int itemsCount = default(int);
         itemsCount = MsgPack.Serialization.UnpackHelpers.GetItemsCount(unpacker);
         byte[] nullable = default(byte[]);
         if ((unpacked < itemsCount))
         {
             nullable = MsgPack.Serialization.UnpackHelpers.UnpackBinaryValue(unpacker, typeof(MsgPack.Serialization.ComplexTypeWithNonSerialized), "Byte[] Data");
         }
         if (((nullable == null)
              == false))
         {
             result.Data = nullable;
         }
         unpacked = (unpacked + 1);
         System.Collections.Generic.Dictionary <System.DateTime, string> nullable0 = default(System.Collections.Generic.Dictionary <System.DateTime, string>);
         if ((unpacked < itemsCount))
         {
             if ((unpacker.Read() == false))
             {
                 throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(1);
             }
             if (((unpacker.IsArrayHeader == false) &&
                  (unpacker.IsMapHeader == false)))
             {
                 nullable0 = this._serializer2.UnpackFrom(unpacker);
             }
             else
             {
                 MsgPack.Unpacker disposable = default(MsgPack.Unpacker);
                 disposable = unpacker.ReadSubtree();
                 try {
                     nullable0 = this._serializer2.UnpackFrom(disposable);
                 }
                 finally {
                     if (((disposable == null)
                          == false))
                     {
                         disposable.Dispose();
                     }
                 }
             }
         }
         if (((nullable0 == null)
              == false))
         {
             System.Collections.Generic.Dictionary <System.DateTime, string> .Enumerator enumerator = nullable0.GetEnumerator();
             System.Collections.Generic.KeyValuePair <System.DateTime, string>           current;
             try {
                 for (
                     ; enumerator.MoveNext();
                     )
                 {
                     current = enumerator.Current;
                     ((System.Collections.Generic.Dictionary <System.DateTime, string>)(this._methodBaseComplexTypeWithNonSerialized_get_History38.Invoke(result, null))).Add(current.Key, current.Value);
                 }
             }
             finally {
                 enumerator.Dispose();
             }
         }
         unpacked = (unpacked + 1);
         System.Uri nullable1 = default(System.Uri);
         if ((unpacked < itemsCount))
         {
             if ((unpacker.Read() == false))
             {
                 throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(2);
             }
             if (((unpacker.IsArrayHeader == false) &&
                  (unpacker.IsMapHeader == false)))
             {
                 nullable1 = this._serializer3.UnpackFrom(unpacker);
             }
             else
             {
                 MsgPack.Unpacker disposable0 = default(MsgPack.Unpacker);
                 disposable0 = unpacker.ReadSubtree();
                 try {
                     nullable1 = this._serializer3.UnpackFrom(disposable0);
                 }
                 finally {
                     if (((disposable0 == null)
                          == false))
                     {
                         disposable0.Dispose();
                     }
                 }
             }
         }
         if (((nullable1 == null)
              == false))
         {
             result.Source = nullable1;
         }
         unpacked = (unpacked + 1);
         System.Nullable <System.DateTime> nullable2 = default(System.Nullable <System.DateTime>);
         if ((unpacked < itemsCount))
         {
             if ((unpacker.Read() == false))
             {
                 throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(3);
             }
             if (((unpacker.IsArrayHeader == false) &&
                  (unpacker.IsMapHeader == false)))
             {
                 nullable2 = this._serializer5.UnpackFrom(unpacker);
             }
             else
             {
                 MsgPack.Unpacker disposable1 = default(MsgPack.Unpacker);
                 disposable1 = unpacker.ReadSubtree();
                 try {
                     nullable2 = this._serializer5.UnpackFrom(disposable1);
                 }
                 finally {
                     if (((disposable1 == null)
                          == false))
                     {
                         disposable1.Dispose();
                     }
                 }
             }
         }
         if (nullable2.HasValue)
         {
             result.TimeStamp = nullable2.Value;
         }
         unpacked = (unpacked + 1);
     }
     else
     {
         int itemsCount0 = default(int);
         itemsCount0 = MsgPack.Serialization.UnpackHelpers.GetItemsCount(unpacker);
         for (int i = 0; (i < itemsCount0); i = (i + 1))
         {
             string key       = default(string);
             string nullable3 = default(string);
             nullable3 = MsgPack.Serialization.UnpackHelpers.UnpackStringValue(unpacker, typeof(MsgPack.Serialization.ComplexTypeWithNonSerialized), "MemberName");
             if (((nullable3 == null)
                  == false))
             {
                 key = nullable3;
             }
             else
             {
                 throw MsgPack.Serialization.SerializationExceptions.NewNullIsProhibited("MemberName");
             }
             if ((key == "TimeStamp"))
             {
                 System.Nullable <System.DateTime> nullable7 = default(System.Nullable <System.DateTime>);
                 if ((unpacker.Read() == false))
                 {
                     throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(i);
                 }
                 if (((unpacker.IsArrayHeader == false) &&
                      (unpacker.IsMapHeader == false)))
                 {
                     nullable7 = this._serializer5.UnpackFrom(unpacker);
                 }
                 else
                 {
                     MsgPack.Unpacker disposable4 = default(MsgPack.Unpacker);
                     disposable4 = unpacker.ReadSubtree();
                     try {
                         nullable7 = this._serializer5.UnpackFrom(disposable4);
                     }
                     finally {
                         if (((disposable4 == null)
                              == false))
                         {
                             disposable4.Dispose();
                         }
                     }
                 }
                 if (nullable7.HasValue)
                 {
                     result.TimeStamp = nullable7.Value;
                 }
             }
             else
             {
                 if ((key == "Source"))
                 {
                     System.Uri nullable6 = default(System.Uri);
                     if ((unpacker.Read() == false))
                     {
                         throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(i);
                     }
                     if (((unpacker.IsArrayHeader == false) &&
                          (unpacker.IsMapHeader == false)))
                     {
                         nullable6 = this._serializer3.UnpackFrom(unpacker);
                     }
                     else
                     {
                         MsgPack.Unpacker disposable3 = default(MsgPack.Unpacker);
                         disposable3 = unpacker.ReadSubtree();
                         try {
                             nullable6 = this._serializer3.UnpackFrom(disposable3);
                         }
                         finally {
                             if (((disposable3 == null)
                                  == false))
                             {
                                 disposable3.Dispose();
                             }
                         }
                     }
                     if (((nullable6 == null)
                          == false))
                     {
                         result.Source = nullable6;
                     }
                 }
                 else
                 {
                     if ((key == "History"))
                     {
                         System.Collections.Generic.Dictionary <System.DateTime, string> nullable5 = default(System.Collections.Generic.Dictionary <System.DateTime, string>);
                         if ((unpacker.Read() == false))
                         {
                             throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(i);
                         }
                         if (((unpacker.IsArrayHeader == false) &&
                              (unpacker.IsMapHeader == false)))
                         {
                             nullable5 = this._serializer2.UnpackFrom(unpacker);
                         }
                         else
                         {
                             MsgPack.Unpacker disposable2 = default(MsgPack.Unpacker);
                             disposable2 = unpacker.ReadSubtree();
                             try {
                                 nullable5 = this._serializer2.UnpackFrom(disposable2);
                             }
                             finally {
                                 if (((disposable2 == null)
                                      == false))
                                 {
                                     disposable2.Dispose();
                                 }
                             }
                         }
                         if (((nullable5 == null)
                              == false))
                         {
                             System.Collections.Generic.Dictionary <System.DateTime, string> .Enumerator enumerator0 = nullable5.GetEnumerator();
                             System.Collections.Generic.KeyValuePair <System.DateTime, string>           current0;
                             try {
                                 for (
                                     ; enumerator0.MoveNext();
                                     )
                                 {
                                     current0 = enumerator0.Current;
                                     ((System.Collections.Generic.Dictionary <System.DateTime, string>)(this._methodBaseComplexTypeWithNonSerialized_get_History38.Invoke(result, null))).Add(current0.Key, current0.Value);
                                 }
                             }
                             finally {
                                 enumerator0.Dispose();
                             }
                         }
                     }
                     else
                     {
                         if ((key == "Data"))
                         {
                             byte[] nullable4 = default(byte[]);
                             nullable4 = MsgPack.Serialization.UnpackHelpers.UnpackBinaryValue(unpacker, typeof(MsgPack.Serialization.ComplexTypeWithNonSerialized), "Byte[] Data");
                             if (((nullable4 == null)
                                  == false))
                             {
                                 result.Data = nullable4;
                             }
                         }
                     }
                 }
             }
         }
     }
     return(result);
 }
コード例 #21
0
 public void AnalysePossibilities()
 {
     this.Possibilities = new System.Collections.Generic.List <SpellCastInformations>();
     foreach (Spell current in this.Fighter.Spells.Values)
     {
         SpellCategory         spellCategories       = SpellIdentifier.GetSpellCategories(current);
         SpellLevelTemplate    currentSpellLevel     = current.CurrentSpellLevel;
         SpellCastInformations spellCastInformations = new SpellCastInformations(current);
         if ((long)this.Fighter.AP >= (long)((ulong)currentSpellLevel.ApCost) && !currentSpellLevel.StatesForbidden.Any(new Func <int, bool>(this.Fighter.HasState)))
         {
             if (!currentSpellLevel.StatesRequired.Any((int state) => !this.Fighter.HasState(state)) && this.Fighter.SpellHistory.CanCastSpell(current.CurrentSpellLevel))
             {
                 if ((spellCategories & SpellCategory.Summoning) != SpellCategory.None && this.Fighter.CanSummon())
                 {
                     Cell freeAdjacentCell = this.m_environment.GetFreeAdjacentCell();
                     if (freeAdjacentCell == null)
                     {
                         continue;
                     }
                     spellCastInformations.IsSummoningSpell = true;
                     spellCastInformations.SummonCell       = freeAdjacentCell;
                 }
                 else
                 {
                     foreach (FightActor current2 in
                              from fighter in this.Fighter.Fight.Fighters
                              where fighter.IsAlive() && fighter.IsVisibleFor(this.Fighter)
                              select fighter)
                     {
                         int mPToUse;
                         if (this.CanReach(current2, current, out mPToUse) && this.Fighter.SpellHistory.CanCastSpell(current.CurrentSpellLevel, current2.Cell))
                         {
                             spellCastInformations.MPToUse = mPToUse;
                             SpellTarget spellTarget = this.ComputeSpellImpact(current, current2);
                             if (spellTarget != null)
                             {
                                 spellTarget.Target = current2;
                                 if (spellTarget.Damage >= 0.0)
                                 {
                                     spellCastInformations.Impacts.Add(spellTarget);
                                 }
                             }
                         }
                     }
                 }
                 this.Possibilities.Add(spellCastInformations);
             }
         }
     }
     if (Brain.Brain.DebugMode)
     {
         Debug.WriteLine(this.Fighter.Name);
         using (System.Collections.Generic.Dictionary <int, Spell> .ValueCollection.Enumerator enumerator = this.Fighter.Spells.Values.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 Spell spell = enumerator.Current;
                 Debug.WriteLine("Spell {0} ({1}) :: {2}", new object[]
                 {
                     spell.Template.Name,
                     spell.Id,
                     SpellIdentifier.GetSpellCategories(spell)
                 });
                 System.Collections.Generic.IEnumerable <SpellCastInformations> arg_2C4_0 = this.Possibilities;
                 Func <SpellCastInformations, bool> predicate = (SpellCastInformations x) => x.Spell == spell;
                 SpellCastInformations spellCastInformations2 = arg_2C4_0.FirstOrDefault(predicate);
                 if (spellCastInformations2 != null)
                 {
                     if (spellCastInformations2.IsSummoningSpell)
                     {
                         Debug.WriteLine("\tSummon Spell");
                     }
                     else
                     {
                         ObjectDumper objectDumper = new ObjectDumper(8);
                         objectDumper.MemberPredicate = ((System.Reflection.MemberInfo member) => !member.Name.Contains("Target"));
                         ObjectDumper objectDumper2 = objectDumper;
                         Debug.WriteLine("\t{0} Targets", new object[]
                         {
                             spellCastInformations2.Impacts.Count
                         });
                         foreach (SpellTarget spellTarget in spellCastInformations2.Impacts)
                         {
                             Debug.Write(objectDumper2.DumpElement(spellTarget));
                             if (spellTarget.Target != null)
                             {
                                 Debug.WriteLine("\t\tTarget = " + spellTarget.Target + spellTarget.Target.Id.ToString());
                             }
                         }
                     }
                 }
             }
         }
         Debug.WriteLine("");
     }
 }
コード例 #22
0
        /// <summary>
        /// Loads the elements collection.
        /// </summary>
        protected void Load()
        {
            if (Invalid)
            {
                IsInitialized = false;
            }

            if (!IsInitialized)
            {
                Collection = new System.Collections.Generic.List <OlapElement>(0);
                System.Collections.Specialized.StringCollection elementNames = null;
                if (_subset != null)
                {
                    OlapSubsetDefinition subsetDef = new OlapSubsetDefinition();
                    subsetDef.LongName = _subset.LongName;
                    subsetDef.RefName  = _subset.ReferenceName;
                    elementNames       = NativeOlapApi.DimensionSubsetElements(_dimension.Server.Store.ClientSlot, _dimension.Server.ServerHandle, _dimension.Name, subsetDef, _dimension.Server.LastErrorInternal);
                }
                else if (_element != null)
                {
                    switch (_elementsLevel)
                    {
                    case OlapElementsLevel.OlapElementsLevelParents:
                        elementNames = NativeOlapApi.DimensionElementParents(_dimension.Server.Store.ClientSlot, _dimension.Server.ServerHandle, _dimension.Name, _element.Name, _dimension.Server.LastErrorInternal);
                        break;

                    case OlapElementsLevel.OlapElementsLevelChildren:
                        if (!_ignorePermissionsForChildren)
                        {
                            elementNames = NativeOlapApi.DimensionElementChildren(_dimension.Server.Store.ClientSlot, _dimension.Server.ServerHandle, _dimension.Name, _element.Name, _dimension.Server.LastErrorInternal);
                        }
                        else
                        {
                            System.Collections.Generic.Dictionary <string, bool> allElementNames = NativeOlapApi.DimensionElementAllChildren(_dimension.Server.Store.ClientSlot, _dimension.Server.ServerHandle, _dimension.Name, _element.Name, _dimension.Server.LastErrorInternal);
                            if (allElementNames != null)
                            {
                                System.Collections.Generic.Dictionary <string, bool> .Enumerator enumNames = allElementNames.GetEnumerator();

                                while (enumNames.MoveNext())
                                {
                                    System.Collections.Generic.KeyValuePair <string, bool> de = enumNames.Current;
                                    OlapElement newElement = new OlapElement(_dimension, de.Key);
                                    if (de.Value)
                                    {
                                        newElement.CanAccess = true;
                                    }
                                    else
                                    {
                                        newElement.CanAccess = false;
                                    }
                                    Collection.Add(newElement);
                                }
                            }
                            else
                            {
                                if (_dimension.Server.LastErrorInternal.Value != 0)
                                {
                                    throw new OlapException("Receiving the element collection failed!", _dimension.Server.LastErrorInternal.Value);
                                }
                            }
                            Invalid       = false;
                            IsInitialized = true;
                            return;
                        }
                        break;

                    case OlapElementsLevel.OlapElementsLevelTopLevel:
                        elementNames = NativeOlapApi.DimensionTopLevelElements(_dimension.Server.Store.ClientSlot, _dimension.Server.ServerHandle, _dimension.Name, _dimension.Server.LastErrorInternal);
                        break;
                    }
                }
                else
                {
                    switch (_elementsLevel)
                    {
                    case OlapElementsLevel.OlapElementsLevelTopLevel:
                        elementNames = NativeOlapApi.DimensionTopLevelElements(_dimension.Server.Store.ClientSlot, _dimension.Server.ServerHandle, _dimension.Name, _dimension.Server.LastErrorInternal);
                        break;

                    case OlapElementsLevel.OlapElementsLevelAll:
                        elementNames = NativeOlapApi.DimensionElements(_dimension.Server.Store.ClientSlot, _dimension.Server.ServerHandle, _dimension.Name, _dimension.Server.LastErrorInternal);
                        break;
                    }
                }

                if (elementNames != null)
                {
                    for (int i = 0; i < elementNames.Count; i++)
                    {
                        OlapElement newElement = new OlapElement(_dimension, elementNames[i]);
                        newElement.CanAccess = true;
                        Collection.Add(newElement);
                    }
                }
                else
                {
                    if (_dimension.Server.LastErrorInternal.Value != 0)
                    {
                        throw new OlapException("Receiving the element collection failed!", _dimension.Server.LastErrorInternal.Value);
                    }
                }
                Invalid       = false;
                IsInitialized = true;
            }
        }
コード例 #23
0
        public void Play(MarketState marketstate, System.Random random)
        {
            try
            {
                if (IsComputer)
                {
                    if (Deposit.Count > 0)
                    {
                        StockIndex lastindex        = null;
                        double     lastpriceaverage = 0D;
                        double     savecapital      = 0D;
                        foreach (DepositContent content in Deposit.Values)
                        {
                            if (content.Stock.StockIndexes.Count > 0)
                            {
                                System.Collections.Generic.Dictionary <string, StockIndex> .Enumerator e = content.Stock.StockIndexes.GetEnumerator();
                                if (e.MoveNext())
                                {
                                    if (lastindex == null)
                                    {
                                        lastindex        = e.Current.Value;
                                        lastpriceaverage = lastindex.PriceAverage;
                                        savecapital      = (lastindex.PriceAverage * 15);
                                    }
                                    else if (e.Current.Value.Id != lastindex.Id)
                                    {
                                        lastindex        = e.Current.Value;
                                        lastpriceaverage = lastindex.PriceAverage;
                                        savecapital      = (lastindex.PriceAverage * 15);
                                    }
                                    // Handle computer players deposit.
                                    int buyprocentlow = 0, buyprocentmiddle = 0, buyprocenthigh = 0, maxbuyprepoch = MAX_BUY_PR_EPOCH, stockstobuy = 0;
                                    int sellprocentlow = 0, sellprocentmiddle = 0, sellprocenthigh = 0, maxsellprepoch = MAX_SELL_PR_EPOCH, stockstosell = 0;
                                    switch (marketstate.State)
                                    {
                                    case MarketStateType.Normal:
                                        buyprocentlow     = 75;
                                        buyprocentmiddle  = 85;
                                        buyprocenthigh    = 95;
                                        sellprocentlow    = 50;
                                        sellprocentmiddle = 70;
                                        sellprocenthigh   = 90;
                                        break;

                                    case MarketStateType.Depression:
                                        buyprocentlow     = 60;
                                        buyprocentmiddle  = 70;
                                        buyprocenthigh    = 80;
                                        sellprocentlow    = 30;
                                        sellprocentmiddle = 50;
                                        sellprocenthigh   = 70;
                                        break;

                                    case MarketStateType.Boom:
                                        buyprocentlow     = 70;
                                        buyprocentmiddle  = 80;
                                        buyprocenthigh    = 90;
                                        sellprocentlow    = 70;
                                        sellprocentmiddle = 80;
                                        sellprocenthigh   = 90;
                                        break;

                                    default:
                                        buyprocentlow     = 100;
                                        buyprocentmiddle  = 100;
                                        buyprocenthigh    = 100;
                                        sellprocentlow    = 100;
                                        sellprocentmiddle = 100;
                                        sellprocenthigh   = 100;
                                        break;
                                    }
                                    // Try to buy stocks.
                                    if (content.Stock.Price < content.Stock.MinPrice * 4 && content.Stock.Available > 0)
                                    {
                                        if (random.Next(100) > buyprocentlow / 1.75 && maxbuyprepoch > 0)
                                        {
                                            stockstobuy = MAX_STOCKS_TO_BUY;
                                            if (stockstobuy > content.Stock.Available)
                                            {
                                                stockstobuy = content.Stock.Available;
                                            }
                                            while (stockstobuy > 0 && content.Stock.CalculatePrice(stockstobuy) + content.Stock.CalculateBrokerage(marketstate, stockstobuy) > Capital - savecapital)
                                            {
                                                stockstobuy = (int)System.Math.Floor((double)(stockstobuy / 10));
                                            }
                                            if (stockstobuy > 5)
                                            {
                                                content.Buy(marketstate, random.Next(stockstobuy));
                                                maxbuyprepoch -= 1;
                                            }
                                            else if (stockstobuy > 0)
                                            {
                                                content.Buy(marketstate, stockstobuy);
                                                maxbuyprepoch -= 1;
                                            }
                                        }
                                    }
                                    else if (content.Stock.Price < lastpriceaverage / 8 && (content.LastSellPrice == 0 || content.Stock.Price < content.LastSellPrice || content.Stock.Price > content.LastSellPrice * 1.5) && content.Stock.Available > 0)
                                    {
                                        // Try to buy stocks.
                                        if (random.Next(100) > buyprocentlow && maxbuyprepoch > 0)
                                        {
                                            stockstobuy = MAX_STOCKS_TO_BUY;
                                            if (stockstobuy > content.Stock.Available)
                                            {
                                                stockstobuy = content.Stock.Available;
                                            }
                                            while (stockstobuy > 0 && content.Stock.CalculatePrice(stockstobuy) + content.Stock.CalculateBrokerage(marketstate, stockstobuy) > Capital - savecapital)
                                            {
                                                stockstobuy = (int)System.Math.Floor((double)(stockstobuy / 10));
                                            }
                                            if (stockstobuy > 5)
                                            {
                                                content.Buy(marketstate, random.Next(stockstobuy));
                                                maxbuyprepoch -= 1;
                                            }
                                            else if (stockstobuy > 0)
                                            {
                                                content.Buy(marketstate, stockstobuy);
                                                maxbuyprepoch -= 1;
                                            }
                                        }
                                    }
                                    else if (content.Stock.Price < lastpriceaverage / 4 && (content.LastSellPrice == 0 || content.Stock.Price < content.LastSellPrice || content.Stock.Price > content.LastSellPrice * 1.5) && content.Stock.Available > 0)
                                    {
                                        // Try to buy stocks.
                                        if (random.Next(100) > buyprocentmiddle && maxbuyprepoch > 0)
                                        {
                                            stockstobuy = MAX_STOCKS_TO_BUY;
                                            if (stockstobuy > content.Stock.Available)
                                            {
                                                stockstobuy = content.Stock.Available;
                                            }
                                            while (stockstobuy > 0 && content.Stock.CalculatePrice(stockstobuy) + content.Stock.CalculateBrokerage(marketstate, stockstobuy) > Capital - savecapital)
                                            {
                                                stockstobuy = (int)System.Math.Floor((double)(stockstobuy / 10));
                                            }
                                            if (stockstobuy >= 10)
                                            {
                                                stockstobuy = stockstobuy / 2;
                                                if (stockstobuy > 5)
                                                {
                                                    content.Buy(marketstate, random.Next(stockstobuy));
                                                    maxbuyprepoch -= 1;
                                                }
                                                else if (stockstobuy > 0)
                                                {
                                                    content.Buy(marketstate, stockstobuy);
                                                    maxbuyprepoch -= 1;
                                                }
                                            }
                                        }
                                    }
                                    else if (content.Stock.Price < lastpriceaverage && (content.LastSellPrice == 0 || content.Stock.Price < content.LastSellPrice || content.Stock.Price > content.LastSellPrice * 1.5) && content.Stock.Available > 0)
                                    {
                                        // Try to buy stocks.
                                        if (random.Next(100) > buyprocenthigh && maxbuyprepoch > 0)
                                        {
                                            stockstobuy = MAX_STOCKS_TO_BUY;
                                            if (stockstobuy > content.Stock.Available)
                                            {
                                                stockstobuy = content.Stock.Available;
                                            }
                                            while (stockstobuy > 0 && content.Stock.CalculatePrice(stockstobuy) + content.Stock.CalculateBrokerage(marketstate, stockstobuy) > Capital - savecapital)
                                            {
                                                stockstobuy = (int)System.Math.Floor((double)(stockstobuy / 10));
                                            }
                                            if (stockstobuy >= 20)
                                            {
                                                stockstobuy = stockstobuy / 4;
                                                if (stockstobuy > 5)
                                                {
                                                    content.Buy(marketstate, random.Next(stockstobuy));
                                                    maxbuyprepoch -= 1;
                                                }
                                                else if (stockstobuy > 0)
                                                {
                                                    content.Buy(marketstate, stockstobuy);
                                                    maxbuyprepoch -= 1;
                                                }
                                            }
                                        }
                                    }
                                    // Try to sell stocks.
                                    if (marketstate.State == MarketStateType.Depression && content.Stock.Price < content.LastBuyPrice / 4 && content.LastBuyPrice > content.Stock.MinPrice * 50)
                                    {
                                        // No profit expected.
                                        stockstosell = content.Count;
                                        if (stockstosell > 5)
                                        {
                                            content.Sell(marketstate, random.Next(stockstosell));
                                            maxsellprepoch -= 1;
                                        }
                                        else
                                        {
                                            content.Sell(marketstate, stockstosell);
                                            maxsellprepoch -= 1;
                                        }
                                    }
                                    else if (content.Count > 0 && content.Stock.Price > content.LastBuyPrice * 2 && content.Stock.Price > content.Stock.MinPrice * 5)
                                    {
                                        // Try to sell stocks.
                                        if (random.Next(100) > sellprocentlow && maxsellprepoch > 0)
                                        {
                                            stockstosell = content.Count;
                                            if (stockstosell > 5)
                                            {
                                                content.Sell(marketstate, random.Next(stockstosell));
                                                maxsellprepoch -= 1;
                                            }
                                            else
                                            {
                                                content.Sell(marketstate, stockstosell);
                                                maxsellprepoch -= 1;
                                            }
                                        }
                                    }
                                    else if (content.Count > 0 && content.Stock.Price > content.LastBuyPrice * 1.5 && content.Stock.Price > content.Stock.MinPrice * 5)
                                    {
                                        // Try to sell stocks.
                                        if (random.Next(100) > sellprocentmiddle && maxsellprepoch > 0)
                                        {
                                            stockstosell = content.Count;
                                            if (stockstosell >= 10)
                                            {
                                                stockstosell = stockstosell / 2;
                                                if (stockstosell > 5)
                                                {
                                                    content.Sell(marketstate, random.Next(stockstosell));
                                                    maxsellprepoch -= 1;
                                                }
                                                else
                                                {
                                                    content.Sell(marketstate, stockstosell);
                                                    maxsellprepoch -= 1;
                                                }
                                            }
                                            else
                                            {
                                                content.Sell(marketstate, stockstosell);
                                                maxsellprepoch -= 1;
                                            }
                                        }
                                    }
                                    else if (content.Count > 0 && content.Stock.Price > content.LastBuyPrice * 1.25 && content.Stock.Price > content.Stock.MinPrice * 5)
                                    {
                                        // Try to sell stocks.
                                        if (random.Next(100) > sellprocenthigh && maxsellprepoch > 0)
                                        {
                                            stockstosell = content.Count;
                                            if (stockstosell >= 20)
                                            {
                                                stockstosell = stockstosell / 4;
                                                if (stockstosell > 5)
                                                {
                                                    content.Sell(marketstate, random.Next(stockstosell));
                                                    maxsellprepoch -= 1;
                                                }
                                                else
                                                {
                                                    content.Sell(marketstate, stockstosell);
                                                    maxsellprepoch -= 1;
                                                }
                                            }
                                            else
                                            {
                                                content.Sell(marketstate, stockstosell);
                                                maxsellprepoch -= 1;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                ValueHistory.AddHistory(Value);
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }
コード例 #24
0
 private static System.Collections.Generic.List<System.Collections.Generic.Dictionary<string, string>> GetUserLatestPostsFromResult(System.Collections.ArrayList result)
 {
     System.Collections.Generic.List<System.Collections.Generic.Dictionary<string, string>> list = new System.Collections.Generic.List<System.Collections.Generic.Dictionary<string, string>>();
     try
     {
         try
         {
             System.Collections.IEnumerator enumerator = result.GetEnumerator();
             while (enumerator.MoveNext())
             {
                 object objectValue = System.Runtime.CompilerServices.RuntimeHelpers.GetObjectValue(enumerator.Current);
                 System.Collections.Generic.Dictionary<string, string> dictionary = new System.Collections.Generic.Dictionary<string, string>();
                 dictionary.Add("id", "");
                 dictionary.Add("link", "");
                 dictionary.Add("thumbnail-image", "");
                 dictionary.Add("lowres-image", "");
                 dictionary.Add("highres-image", "");
                 dictionary.Add("lowres-video", "");
                 dictionary.Add("highres-video", "");
                 dictionary.Add("description", "");
                 dictionary.Add("description-notags", "");
                 dictionary.Add("tags", "");
                 dictionary.Add("latitude", "");
                 dictionary.Add("longitude", "");
                 dictionary.Add("location", "");
                 if (Conversions.ToBoolean(NewLateBinding.LateGet(objectValue, null, "containskey", new object[]
                 {
                         "id"
                 }, null, null, null)))
                 {
                     dictionary["id"] = Conversions.ToString(NewLateBinding.LateIndexGet(objectValue, new object[]
                     {
                             "id"
                     }, null));
                 }
                 if (Conversions.ToBoolean(NewLateBinding.LateGet(objectValue, null, "containskey", new object[]
                 {
                         "link"
                 }, null, null, null)))
                 {
                     dictionary["link"] = Conversions.ToString(NewLateBinding.LateIndexGet(objectValue, new object[]
                     {
                             "link"
                     }, null));
                 }
                 if (Conversions.ToBoolean(NewLateBinding.LateGet(objectValue, null, "containskey", new object[]
                 {
                         "videos"
                 }, null, null, null)))
                 {
                     dictionary.Add("video", "");
                     System.Collections.Generic.Dictionary<string, object> dictionary2 = (System.Collections.Generic.Dictionary<string, object>)NewLateBinding.LateIndexGet(objectValue, new object[]
                     {
                             "videos"
                     }, null);
                     try
                     {
                         System.Collections.Generic.Dictionary<string, object>.Enumerator enumerator2 = dictionary2.GetEnumerator();
                         while (enumerator2.MoveNext())
                         {
                             System.Collections.Generic.KeyValuePair<string, object> current = enumerator2.Current;
                             string key = current.Key;
                             if (Operators.CompareString(key, "low_bandwidth", false) == 0)
                             {
                                 System.Collections.Generic.Dictionary<string, object> dictionary3 = (System.Collections.Generic.Dictionary<string, object>)current.Value;
                                 dictionary["lowres-video"] = Conversions.ToString(dictionary3["url"]);
                             }
                             else if (Operators.CompareString(key, "standard_resolution", false) == 0)
                             {
                                 System.Collections.Generic.Dictionary<string, object> dictionary4 = (System.Collections.Generic.Dictionary<string, object>)current.Value;
                                 dictionary["highres-video"] = Conversions.ToString(dictionary4["url"]);
                             }
                         }
                     }
                     finally
                     {
                         System.Collections.Generic.Dictionary<string, object>.Enumerator enumerator2;
                         ((System.IDisposable)enumerator2).Dispose();
                     }
                 }
                 if (Conversions.ToBoolean((!Conversions.ToBoolean(NewLateBinding.LateGet(objectValue, null, "containskey", new object[]
                 {
                         "location"
                 }, null, null, null)) || !Conversions.ToBoolean(NewLateBinding.LateIndexGet(objectValue, new object[]
                 {
                         "location"
                 }, null) != null)) ? false : true))
                 {
                     System.Collections.Generic.Dictionary<string, object> dictionary5 = (System.Collections.Generic.Dictionary<string, object>)NewLateBinding.LateIndexGet(objectValue, new object[]
                     {
                             "location"
                     }, null);
                     try
                     {
                         System.Collections.Generic.Dictionary<string, object>.Enumerator enumerator3 = dictionary5.GetEnumerator();
                         while (enumerator3.MoveNext())
                         {
                             System.Collections.Generic.KeyValuePair<string, object> current2 = enumerator3.Current;
                             string key2 = current2.Key;
                             if (Operators.CompareString(key2, "latitude", false) == 0)
                             {
                                 dictionary["latitude"] = Conversions.ToString(current2.Value);
                             }
                             else if (Operators.CompareString(key2, "longitude", false) == 0)
                             {
                                 dictionary["longitude"] = Conversions.ToString(current2.Value);
                             }
                             else if (Operators.CompareString(key2, "name", false) == 0)
                             {
                                 dictionary["location"] = Conversions.ToString(current2.Value);
                             }
                         }
                     }
                     finally
                     {
                         System.Collections.Generic.Dictionary<string, object>.Enumerator enumerator3;
                         ((System.IDisposable)enumerator3).Dispose();
                     }
                 }
                 if (NewLateBinding.LateGet(objectValue, null, "containskey", new object[]
                 {
                         "images"
                 }, null, null, null) != null)
                 {
                     System.Collections.Generic.Dictionary<string, object> dictionary6 = (System.Collections.Generic.Dictionary<string, object>)NewLateBinding.LateIndexGet(objectValue, new object[]
                     {
                             "images"
                     }, null);
                     try
                     {
                         System.Collections.Generic.Dictionary<string, object>.Enumerator enumerator4 = dictionary6.GetEnumerator();
                         while (enumerator4.MoveNext())
                         {
                             System.Collections.Generic.KeyValuePair<string, object> current3 = enumerator4.Current;
                             string key3 = current3.Key;
                             if (Operators.CompareString(key3, "thumbnail", false) == 0)
                             {
                                 System.Collections.Generic.Dictionary<string, object> dictionary7 = (System.Collections.Generic.Dictionary<string, object>)current3.Value;
                                 dictionary["thumbnail-image"] = Conversions.ToString(dictionary7["url"]);
                             }
                             else if (Operators.CompareString(key3, "low_resolution", false) == 0)
                             {
                                 System.Collections.Generic.Dictionary<string, object> dictionary8 = (System.Collections.Generic.Dictionary<string, object>)current3.Value;
                                 dictionary["lowres-image"] = Conversions.ToString(dictionary8["url"]);
                             }
                             else if (Operators.CompareString(key3, "standard_resolution", false) == 0)
                             {
                                 System.Collections.Generic.Dictionary<string, object> dictionary9 = (System.Collections.Generic.Dictionary<string, object>)current3.Value;
                                 dictionary["highres-image"] = Conversions.ToString(dictionary9["url"]);
                             }
                         }
                     }
                     finally
                     {
                         System.Collections.Generic.Dictionary<string, object>.Enumerator enumerator4;
                         ((System.IDisposable)enumerator4).Dispose();
                     }
                 }
                 if (NewLateBinding.LateGet(objectValue, null, "containskey", new object[]
                 {
                         "caption"
                 }, null, null, null) != null)
                 {
                     System.Collections.Generic.Dictionary<string, object> dictionary10 = (System.Collections.Generic.Dictionary<string, object>)NewLateBinding.LateIndexGet(objectValue, new object[]
                     {
                             "caption"
                     }, null);
                     try
                     {
                         System.Collections.Generic.Dictionary<string, object>.Enumerator enumerator5 = dictionary10.GetEnumerator();
                         while (enumerator5.MoveNext())
                         {
                             System.Collections.Generic.KeyValuePair<string, object> current4 = enumerator5.Current;
                             string key4 = current4.Key;
                             if (Operators.CompareString(key4, "text", false) == 0)
                             {
                                 dictionary["description"] = Conversions.ToString(current4.Value);
                                 dictionary["description-notags"] = Conversions.ToString(current4.Value);
                             }
                         }
                     }
                     finally
                     {
                         System.Collections.Generic.Dictionary<string, object>.Enumerator enumerator5;
                         ((System.IDisposable)enumerator5).Dispose();
                     }
                 }
                 if (NewLateBinding.LateGet(objectValue, null, "containskey", new object[]
                 {
                         "tags"
                 }, null, null, null) != null)
                 {
                     System.Collections.ArrayList arrayList = (System.Collections.ArrayList)NewLateBinding.LateIndexGet(objectValue, new object[]
                     {
                             "tags"
                     }, null);
                     bool flag = false;
                     try
                     {
                         System.Collections.Generic.IEnumerator<object> enumerator6 = (from f in arrayList.ToArray().ToList<object>()
                                                                                       orderby f.ToString().Length descending
                                                                                       select f).GetEnumerator();
                         while (enumerator6.MoveNext())
                         {
                             object objectValue2 = System.Runtime.CompilerServices.RuntimeHelpers.GetObjectValue(enumerator6.Current);
                             dictionary["tags"] = Conversions.ToString(Operators.AddObject(Operators.AddObject(dictionary["tags"] + "#", objectValue2), ","));
                             dictionary["description-notags"] = dictionary["description-notags"].Replace(Conversions.ToString(Operators.AddObject(" #", objectValue2)), "", System.StringComparison.OrdinalIgnoreCase);
                             flag = true;
                         }
                     }
                     finally
                     {
                         System.Collections.Generic.IEnumerator<object> enumerator6;
                         if (enumerator6 != null)
                         {
                             enumerator6.Dispose();
                         }
                     }
                     if (flag)
                     {
                         dictionary["tags"] = dictionary["tags"].Substring(0, checked(dictionary["tags"].Length - 1));
                     }
                 }
                 list.Add(dictionary);
             }
         }
         finally
         {
             System.Collections.IEnumerator enumerator;
             if (enumerator is System.IDisposable)
             {
                 (enumerator as System.IDisposable).Dispose();
             }
         }
     }
     catch (System.Exception expr_743)
     {
         ProjectData.SetProjectError(expr_743);
         ProjectData.ClearProjectError();
     }
     return list;
 }