private void MainForm_Load(object sender, EventArgs e)
 {
     Globals.ApplicationDirectory = AppDomain.CurrentDomain.BaseDirectory;
     Globals.Resources            = ResourceOperations.LoadResources(Globals.ApplicationDirectory + Globals.ResourceFileLocation);
     Globals.Universe             = new Universe(0, "Universe1", "Placeholder Description");
     UpdateGalaxyCountLabels();
 }
예제 #2
0
        /// <summary>
        /// 退出
        /// </summary>
        /// <param name="session"></param>
        public void LogOff(SessionInfo session)
        {
            var dbInfo = session.DatabaseInfo;

            if (dbInfo != null)
            {
                dbInfo.RealPassword        = WCF16001EncryptOperation.DecryptWithM004(dbInfo.Password);
                session.DBConnectionString = dbInfo.GetConnectionString();
            }
            List <string> lstSysMsg = new List <string>();
            //更新数据库中的用户在线属性
            OperationReturn optReturn = ResourceOperations.ChangeUserStatus(session, "0");

            if (!optReturn.Result)
            {
                currCallback.SendSysMessage(S1600MessageType.LogOffFailed, lstSysMsg);
                //LogOperation.WriteLog("Update " + lstLoginUsers[session.UserID].UserName + " status failed : " + optReturn.Message);
                return;
            }

            if (lstLoginUsers.Keys.Contains(currentUser.UserID))
            {
                lstLoginUsers.Remove(currentUser.UserID);
                foreach (KeyValuePair <long, LoginUserInfo> user in lstLoginUsers)
                {
                    if (user.Key != currentUser.UserID)
                    {
                        lstSysMsg.Clear();
                        lstSysMsg.Add(currentUser.UserID.ToString());
                        user.Value.CallBack.SendSysMessage(S1600MessageType.FriendOffline, lstSysMsg);
                    }
                }
            }
            //LogOperation.WriteLog("User " + lstLoginUsers[session.UserID].UserName + " logoff");
        }
        public bool doStuff(object state, ILoggingProvider logger)
        {
            var successful = false;

            logger.LogMessage(GetStartLogMessage(), LoggingCategory.Task);
            successful = ResourceOperations.SaveToFileSystem(Descriptor, ExportPath);
            logger.LogMessage(GetEndLogMessage(successful), LoggingCategory.Task);

            return(successful);
        }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ResourceGroupOperations"/> class.
 /// </summary>
 /// <param name="options"> The client parameters to use in these operations. </param>
 /// <param name="id"> The identifier of the resource that is the target of operations. </param>
 protected internal ManagementGroupOperations(ResourceOperations options, ResourceIdentifier id)
     : base(options, id)
 {
     _clientDiagnostics = new ClientDiagnostics(ClientOptions);
     _restClient        = new ManagementGroupsRestOperations(_clientDiagnostics, Pipeline, BaseUri);
 }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Subscription"/> class.
 /// </summary>
 /// <param name="operations"> The operations object to copy the client parameters from. </param>
 /// <param name="subscriptionData"> The data model representing the generic azure resource. </param>
 internal Subscription(ResourceOperations operations, SubscriptionData subscriptionData)
     : base(operations, subscriptionData.Id)
 {
     Data = subscriptionData;
 }
예제 #6
0
 internal ResourcesUpdateByIdOperation(ResourceOperations parentOperation, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response)
 {
     _operation       = new OperationOrResponseInternals <GenericResource>(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ResourcesUpdateByIdOperation");
     _parentOperation = parentOperation;
 }
예제 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SingletonOperations"/> class.
 /// </summary>
 /// <param name="parent"></param>
 protected SingletonOperations(ResourceOperations parent)
     : base(new ClientContext(parent.ClientOptions, parent.Credential, parent.BaseUri, parent.Pipeline), ResourceIdentifier.RootResourceIdentifier)
 {
     Parent = parent;
 }
예제 #8
0
 internal PredefinedTagCreateOrUpdateOperation(ResourceOperations parentOperation, Response <PredefinedTagData> response)
 {
     _operation = new OperationOrResponseInternals <PredefinedTag>(Response.FromValue(new PredefinedTag(parentOperation, response.Value), response.GetRawResponse()));
 }
예제 #9
0
 /// <summary> Initializes a new instance of the <see cref = "TagResource"/> class. </summary>
 /// <param name="options"> The client parameters to use in these operations. </param>
 /// <param name="resource"> The resource that is the target of operations. </param>
 internal TagResource(ResourceOperations options, TagResourceData resource)
     : base(options, resource.Id)
 {
     Data = resource;
 }
예제 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GenericResourceOperations"/> class.
 /// </summary>
 /// <param name="operations"> The operation to get the client properties from. </param>
 /// <param name="id"> The id of the resource. </param>
 internal GenericResourceOperations(ResourceOperations operations, ResourceIdentifier id)
     : base(operations, id)
 {
 }
예제 #11
0
 internal TagCreateOrUpdateOperation(ResourceOperations parentOperation, Response <TagResourceData> response)
 {
     _operation = new OperationOrResponseInternals <TagResource>(Response.FromValue(new TagResource(parentOperation, response.Value), response.GetRawResponse()));
 }
예제 #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ManagementGroup"/> class.
 /// </summary>
 /// <param name="operations"> The operations to copy the client options from. </param>
 /// <param name="resource"> The ManagementGroupData to use in these operations. </param>
 internal ManagementGroupInfo(ResourceOperations operations, ManagementGroupInfoData resource)
     : base(operations, resource.Id)
 {
     Data = resource;
 }
예제 #13
0
 internal ManagementGroupsCreateOrUpdateOperation(ResourceOperations operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response)
 {
     _operation     = new OperationOrResponseInternals <ManagementGroup>(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.AzureAsyncOperation, "ManagementGroupsCreateOrUpdateOperation");
     _operationBase = operationsBase;
 }
예제 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SubscriptionOperations"/> class.
 /// </summary>
 /// <param name="operations"> The resource operations to copy the options from. </param>
 /// <param name="id"> The identifier of the resource that is the target of operations. </param>
 protected SubscriptionOperations(ResourceOperations operations, ResourceIdentifier id)
     : base(operations, id)
 {
 }
예제 #15
0
 internal TagResourceContainer(ResourceOperations operationsBase) : base(operationsBase)
 {
     _clientDiagnostics = new ClientDiagnostics(ClientOptions);
 }
예제 #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ResourceGroupOperations"/> class.
 /// </summary>
 /// <param name="options"> The client parameters to use in these operations. </param>
 /// <param name="id"> The identifier of the resource that is the target of operations. </param>
 protected ResourceGroupOperations(ResourceOperations options, ResourceIdentifier id)
     : base(options, id)
 {
 }
예제 #17
0
 internal TagResourceOperations(ResourceOperations options, ResourceIdentifier id) : base(options, id)
 {
     _clientDiagnostics = new ClientDiagnostics(ClientOptions);
 }
예제 #18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ResourceGroup"/> class.
 /// </summary>
 /// <param name="operations"> The operations to copy the client options from. </param>
 /// <param name="resource"> The ResourceGroupData to use in these operations. </param>
 internal ResourceGroup(ResourceOperations operations, ResourceGroupData resource)
     : base(operations, resource.Id)
 {
     Data = resource;
 }
예제 #19
0
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="session"></param>
        /// <param name="lstParams">
        /// </param>
        public void LoginSystem(SessionInfo session)
        {
            List <string> lstSysMsg = new List <string>();

            try
            {
                //判断传过来的参数不为空
                if (session == null)
                {
                    currCallback.SendSysMessage(S1600MessageType.LoginFailed, lstSysMsg);
                    return;
                }
                var dbInfo = session.DatabaseInfo;
                if (dbInfo != null)
                {
                    dbInfo.RealPassword        = WCF16001EncryptOperation.DecryptWithM004(dbInfo.Password);
                    session.DBConnectionString = dbInfo.GetConnectionString();
                }

                string s = string.Empty;
                foreach (KeyValuePair <long, LoginUserInfo> pair in lstLoginUsers)
                {
                    s = WCF16001EncryptOperation.DecryptWithM004(pair.Value.UserName) + " | ";
                }
                //LogOperation.WriteLog(s);

                currentUser             = new LoginUserInfo();
                currentUser.UserID      = session.UserID;
                currentUser.UserSession = session;

                currentUser.UserName = session.UserInfo.Account;
                currentUser.CallBack = currCallback;

                //如果不包含这个用户 则加入该对象
                //lstLoginUsers.Remove(currentUser.UserID);
                if (!lstLoginUsers.Keys.Contains(currentUser.UserID))
                {
                    lstLoginUsers.Add(currentUser.UserID, currentUser);
                    s = "User Login : "******"User Logined : " + WCF16001EncryptOperation.DecryptWithM004(currentUser.UserName);
                        // LogOperation.WriteLog(s);
                    }
                    catch (Exception ex)
                    {
                        //此处无需做任何操作 因为无论消息发送是否成功 该通道都要被删掉
                        s = "User Login send OffLine msg failed : " + WCF16001EncryptOperation.DecryptWithM004(currentUser.UserName) + ",\t" + ex.Message;
                        //LogOperation.WriteLog(s);
                    }

                    lstLoginUsers.Remove(currentUser.UserID);       //此处不可缺 删掉原来的callback 添加进现在的callback 用来更新callback通道
                    lstLoginUsers.Add(currentUser.UserID, currentUser);
                    //LogOperation.WriteLog("Delete old and add new ");
                }
                currCallback.SendSysMessage(S1600MessageType.LoginSuceess, lstSysMsg);
                //更新数据库中的用户在线属性
                OperationReturn optReturn = ResourceOperations.ChangeUserStatus(session, "1");
                if (!optReturn.Result)
                {
                    lstSysMsg.Clear();
                    lstSysMsg.Add("code = " + optReturn.Code + " ; message = " + optReturn.Message);
                    currCallback.SendSysMessage(S1600MessageType.LoginFailed, lstSysMsg);
                    return;
                }

                // currCallback.SendSysMessage(MessageType.TestMsg, "Message = " + optReturn.Message);
                //获得联系人
                optReturn = PermissionFuncs.GetContacters(session);
                if (!optReturn.Result)
                {
                    lstSysMsg.Clear();
                    lstSysMsg.Add("code = " + optReturn.Code + " ; message = " + optReturn.Message);
                    currCallback.SendSysMessage(S1600MessageType.GetFriendFailed, lstSysMsg);
                    return;
                }
                currCallback.InitFriendList(optReturn.Data as List <string>);

                //给在线的用户发送上线通知
                foreach (KeyValuePair <long, LoginUserInfo> user in lstLoginUsers)
                {
                    //通知每个用户 我上线啦 我本人就不用发了
                    if (user.Key != currentUser.UserID)
                    {
                        lstSysMsg.Clear();
                        lstSysMsg.Add(currentUser.UserID.ToString());
                        user.Value.CallBack.SendSysMessage(S1600MessageType.FriendOnline, lstSysMsg);
                    }
                }

                //开始接收离线消息
                List <string> lstParam = new List <string>();
                lstParam.Add(currentUser.UserID.ToString());
                optReturn = ChatMessageOperation.GetAllOffLineMsg(session, lstParam);
                if (optReturn.Result)
                {
                    //LogOperation.WriteLog("Send offline message to " + currentUser.UserName);
                    SendOfflineMsg(optReturn.Data as Dictionary <long, ChatMessage>);
                }
            }
            catch (Exception ex)
            {
                //LogOperation.WriteLog("Login error: " + ex.Message);
            }
        }
예제 #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Provider"/> class.
 /// </summary>
 /// <param name="operations"> The operations object to copy the client parameters from. </param>
 /// <param name="providerData"></param>
 /// <exception cref="ArgumentNullException"> If <see cref="ArmClientOptions"/> or <see cref="TokenCredential"/> is null. </exception>
 internal Provider(ResourceOperations operations, ProviderData providerData)
     : base(operations, providerData.Id)
 {
     Data = providerData;
 }
예제 #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Tenant"/> class.
 /// </summary>
 /// <param name="operations"> The operations object to copy the client parameters from. </param>
 /// <param name="tenantData"> The data model representing the generic azure resource. </param>
 internal Tenant(ResourceOperations operations, TenantData tenantData)
     : base(operations.ClientOptions, operations.Credential, operations.BaseUri, operations.Pipeline)
 {
     Data = tenantData;
 }
예제 #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FeatureOperations"/> class.
 /// </summary>
 /// <param name="options"> The client parameters to use in these operations. </param>
 /// <param name="id"> The id of the feature to use. </param>
 protected FeatureOperations(ResourceOperations options, ResourceIdentifier id)
     : base(options, id)
 {
     _clientDiagnostics = new ClientDiagnostics(ClientOptions);
     _restClient        = new FeaturesRestOperations(_clientDiagnostics, Pipeline, Id.SubscriptionId, BaseUri);
 }
예제 #23
0
 protected ProviderOperations(ResourceOperations operations, ResourceIdentifier id)
     : base(operations, id)
 {
 }
예제 #24
0
 internal ResourceGroupCreateOrUpdateOperation(ResourceOperations parentOperation, Response <ResourceGroupData> response)
 {
     _operation = new OperationOrResponseInternals <ResourceGroup>(Response.FromValue(new ResourceGroup(parentOperation, response.Value), response.GetRawResponse()));
 }
예제 #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Feature"/> class.
 /// </summary>
 /// <param name="operations"> The operations to copy the client options from. </param>
 /// <param name="resource"> The FeatureData to use in these operations. </param>
 internal Feature(ResourceOperations operations, FeatureData resource)
     : base(operations, resource.Id)
 {
     Data = resource;
 }
예제 #26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GenericResource"/> class.
 /// </summary>
 /// <param name="operations"> The operations object to copy the client parameters from. </param>
 /// <param name="resource"> The data model representing the generic azure resource. </param>
 /// <exception cref="ArgumentNullException"> If <see cref="ArmClientOptions"/> or <see cref="TokenCredential"/> is null. </exception>
 internal GenericResource(ResourceOperations operations, GenericResourceData resource)
     : base(operations, resource.Id)
 {
     Data = resource;
 }
예제 #27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PredefinedTag"/> class.
 /// </summary>
 /// <param name="operations"> The operations object to copy the client parameters from. </param>
 /// <param name="data"> The data model representing the generic azure resource. </param>
 internal PredefinedTag(ResourceOperations operations, PredefinedTagData data)
     : base(new ClientContext(operations.ClientOptions, operations.Credential, operations.BaseUri, operations.Pipeline), operations.Id)
 {
     Data = data;
 }