private string FindFileNameInFiles(ExecuteInfo info, bool throwException = true)
        {
            var root = "Views";

            if (Development.IsAttached)
            {
                root = Path.Combine(Development.GetProjectDirectory(), root);
            }

            var    command        = this.GetTypeName(info.Type) + "/";
            var    method         = this.GetMethodName(info.Method);
            string fileNameLevel0 = method;
            string fileNameLevel1 = root + "/" + method;
            string fileNameLevel2 = root + "/" + command + method;

            if (FileHelper.FileExists(fileNameLevel2))
            {
                return(NormalizePath(fileNameLevel2));
            }
            else if (FileHelper.FileExists(fileNameLevel1))
            {
                return(NormalizePath(fileNameLevel1));
            }
            else if (FileHelper.FileExists(fileNameLevel0))
            {
                return(NormalizePath(fileNameLevel0));
            }

            if (throwException)
            {
                this.ThrowFindContentInFiles();
            }

            return(null);
        }
Beispiel #2
0
        void Disconnect()
        {
            Resources?.Dispose();
            Experience?.Dispose();
            Expedition?.Dispose();
            Construction?.Dispose();
            Development?.Dispose();
            Sortie?.Dispose();
            Battle?.Dispose();
            Fate?.Dispose();
            r_RankingPoints?.Dispose();
            r_SortieConsumption?.Dispose();
            QuestProgress?.Dispose();
            BattleDetail?.Dispose();

            if (r_Connection != null)
            {
                r_Connection.Update -= OnDatabaseUpdate;

                r_Connection.Dispose();
            }

            foreach (var rCustomGroup in r_CustomRecordsGroups.Values)
            {
                rCustomGroup.Dispose();
            }

            IsConnected = false;
        }
        public int AddDevelopmentActivity(Development development)
        {
            Development development1 = new Development();
            var         DevelpmentId = development1.DevelopmentId;

            return(DevelpmentId);
        }
        public bool Load(bool logging = true)
        {
            bool succeeded = true;

            ResourceManager.CopyDocumentFromArchive("Record/" + ShipParameter.FileName, MasterPath + "\\" + ShipParameter.FileName);

            succeeded &= EnemyFleet.Load(MasterPath);
            succeeded &= ShipParameter.Load(MasterPath);
            succeeded &= Construction.Load(MasterPath);
            succeeded &= ShipDrop.Load(MasterPath);
            succeeded &= Development.Load(MasterPath);
            succeeded &= Resource.Load(MasterPath);

            if (logging)
            {
                if (succeeded)
                {
                    Utility.Logger.Add(2, "レコードをロードしました。");
                }
                else
                {
                    Utility.Logger.Add(3, "レコードのロードに失敗しました。");
                }
            }

            return(succeeded);
        }
Beispiel #5
0
        public ActionResult AddOrEditDevelopment(int appid, int id, int Level)
        {
            if (dzaccount == null)
            {
                return(Redirect("/dzhome/login"));
            }
            Miniapp listtemp = MiniappBLL.SingleModel.GetModelByRelationId(appid);

            if (listtemp == null)
            {
                return(View("PageError", new Return_Msg()
                {
                    Msg = "没有找到模板!", code = "500"
                }));
            }
            ViewBag.appId      = listtemp.Id;
            ViewBag.rappId     = appid;
            ViewBag.Level      = Level;
            ViewBag.NewmodelId = 0;

            if (id <= 0)
            {
                return(View(new Development()));
            }
            else
            {
                Development model = DevelopmentBLL.SingleModel.GetModel(id);
                return(View(model));
            }
        }
Beispiel #6
0
        public bool Save(bool logging = true)
        {
            //api_start2がロード済みのときのみ
            if (KCDatabase.Instance.MasterShips.Count == 0)
            {
                return(false);
            }

            bool succeeded = true;


            succeeded &= EnemyFleet.Save(MasterPath);
            succeeded &= ShipParameter.Save(MasterPath);
            succeeded &= Construction.Save(MasterPath);
            succeeded &= ShipDrop.Save(MasterPath);
            succeeded &= Development.Save(MasterPath);
            succeeded &= Resource.Save(MasterPath);
            if (logging)
            {
                if (succeeded)
                {
                    Utility.Logger.Add(2, LoggerRes.SavedRecords);
                }
                else
                {
                    Utility.Logger.Add(3, LoggerRes.FailedSavingRecords);
                }
            }

            return(succeeded);
        }
Beispiel #7
0
        public bool Load(bool logging = true)
        {
            bool succeeded = true;

            ResourceManager.CopyFromArchive("Record/" + ShipParameter.FileName, MasterPath + "\\" + ShipParameter.FileName);

            succeeded &= EnemyFleet.Load(MasterPath);
            succeeded &= ShipParameter.Load(MasterPath);
            succeeded &= Construction.Load(MasterPath);
            succeeded &= ShipDrop.Load(MasterPath);
            succeeded &= Development.Load(MasterPath);
            succeeded &= Resource.Load(MasterPath);
            if (logging)
            {
                if (succeeded)
                {
                    Utility.Logger.Add(2, LoggerRes.LoadedRecords);
                }
                else
                {
                    Utility.Logger.Add(3, LoggerRes.FailedLoadingRecords);
                }
            }
            return(succeeded);
        }
Beispiel #8
0
        public void Draw()
        {
            switch (Status)
            {
            case CardStatus.NoCard:
                Pbx.Image = null;
                Activable = false;
                Selected  = false;
                TtAyuda.SetToolTip(Pbx, "");
                SetHelp(IconChar.None, "");
                break;

            case CardStatus.FaceUp:
                Pbx.Image = Development.GetImage();
                SetHelp(IconChar.None, "");
                TtAyuda.SetToolTip(Pbx, Development.ToStringWithPrice());
                break;

            case CardStatus.FaceDown:
                Pbx.Image = NamedPath.DevelopmentBack(Development.Level).GetImage();
                TtAyuda.SetToolTip(Pbx, "");
                SetHelp(IconChar.None, "");
                break;

            default:
                break;
            }
        }
Beispiel #9
0
        public void Save()
        {
            //api_start2がロード済みのときのみ
            if (KCDatabase.Instance.MasterShips.Count == 0)
            {
                return;
            }

            bool successed = true;


            successed &= EnemyFleet.Save(MasterPath);
            successed &= ShipParameter.Save(MasterPath);
            successed &= Construction.Save(MasterPath);
            successed &= ShipDrop.Save(MasterPath);
            successed &= Development.Save(MasterPath);
            successed &= Resource.Save(MasterPath);

            if (successed)
            {
                Utility.Logger.Add(2, "レコードをセーブしました。");
            }
            else
            {
                Utility.Logger.Add(2, "レコードのセーブに失敗しました。");
            }
        }
 protected override void CallExternalDeveloper(Development d)
 {
     d.StartWatching();
     Hyena.Log.Information(String.Format("Calling generic raw developer {0}", executable));
     System.Diagnostics.Process ufraw = System.Diagnostics.Process.Start(executable);
     ufraw.EnableRaisingEvents = true;
     ufraw.Exited += new EventHandler((sender, e) => d.StopWatching());
 }
Beispiel #11
0
        public static void TrackDevelopment()
        {
            ProductionConsumptionRate pcrate = HUD.HUDProduction.TotalPCRate;

            electricity_development = new Development(pcrate.p_electricity, pcrate.c_electricity, Electricity);
            labour_development      = new Development(pcrate.p_labour, pcrate.c_labour, Labour);
            vehicles_development    = new Development(pcrate.p_vehicles, pcrate.c_vehicles, Vehicles);
            OnDevelopmentUpdate();
        }
Beispiel #12
0
 void DoDevelop(Development d)
 {
     // After user edits...
     // ...actually generate, JPEG using darktable-cli. Make sure sidecar is present!
     string executable = "darktable-cli";
     string args = String.Format ("'{0}' '{1}'",
                                  d.RawUri.LocalPath, d.DevelopedUri.LocalPath);
     System.Diagnostics.Process dt_cli = System.Diagnostics.Process.Start (executable, args);
     dt_cli.Exited += (sender, e) => d.StopWatching();
 }
Beispiel #13
0
 protected override void CallExternalDeveloper(Development d)
 {
     string executable = "darktable";
     string args = String.Format ("-d memory '{0}'", d.RawUri.LocalPath);
     d.StartWatching ();
     Log.Information (String.Format ("Calling Darktable: {0} {1}", executable, args));
     System.Diagnostics.Process dt = System.Diagnostics.Process.Start (executable, args);
     dt.EnableRaisingEvents = true;
     dt.Exited += (sender, o) => DoDevelop(d);
 }
Beispiel #14
0
        /// <summary>
        /// 添加或编辑发展历程数据
        /// </summary>
        /// <param name="appid"></param>
        /// <returns></returns>
        public ActionResult AddOrEditDevelopmentData(Development infos)
        {
            if (dzaccount == null)
            {
                return(Redirect("/dzhome/login"));
            }
            ServiceResult result = new ServiceResult();

            try
            {
                if (dzaccount == null)
                {
                    return(Json(result.IsFailed("系统繁忙auth_null !")));
                }

                if (infos == null)
                {
                    return(Json(result.IsFailed("系统繁忙auth_null !")));
                }
                if (infos.Id == 0)
                {
                    infos.Lastdate   = DateTime.Now;
                    infos.Createdate = DateTime.Now;
                    infos.State      = 1;
                    //添加数据
                    object datatemp = DevelopmentBLL.SingleModel.Add(infos);
                    result.Data = new Dictionary <string, object> {
                        { "id", datatemp }
                    };
                    result.IsSucceed("添加成功 !");
                }
                else
                {
                    string updatecolumn = "Content,Year,Month,Lastdate,State";
                    if (infos.State == 0)
                    {
                        updatecolumn = "Lastdate,State";
                    }

                    infos.Lastdate = DateTime.Now;
                    //修改数据
                    DevelopmentBLL.SingleModel.Update(infos, updatecolumn);
                    result.Data = new Dictionary <string, object> {
                        { "id", infos.Id }
                    };
                    result.IsSucceed("修改成功 !");
                }

                return(Json(result));
            }
            catch (Exception)
            {
                return(Json(result.IsFailed("服务器出错 , 请重试 !")));
            }
        }
Beispiel #15
0
 protected override void CallExternalDeveloper(Development d)
 {
     string executable = "rawstudio";
     string args = String.Format ("--output='{1}' '{0}'",
                                  d.RawUri.LocalPath, d.DevelopedUri.LocalPath);
     d.StartWatching ();
     Log.Information (String.Format ("Calling Rawstudio: {0} {1}", executable, args));
     System.Diagnostics.Process rs = System.Diagnostics.Process.Start (executable, args);
     rs.EnableRaisingEvents = true;
     rs.Exited += (sender, e) => d.StopWatching();
 }
        public void Test_for_DeleteDevelopmentActivity()
        {
            Development development = new Development()
            {
                DevelopmentId = 1,
            };

            var Result = _PoliticianServices.DeleteDevelopmentActivity(development.DevelopmentId);


            Assert.True(Result);
        }
 public void Run(object o, EventArgs e, Photo p)
 {
     try
     {
         Development d = new Development(p);
         CallExternalDeveloper(d);
     } catch (InvalidDataException)
     {
         Log.Warning("The original version of this image is not a (supported) RAW file");
         return;
     }
 }
Beispiel #18
0
 public static void Start()
 {
     _electricity_development = new List <Development>();
     _labour_development      = new List <Development>();
     _vehicles_development    = new List <Development>();
     _electricity             = 2;
     _labour   = 2;
     _vehicles = 2;
     electricity_development = new Development(0, 0, Electricity);
     labour_development      = new Development(0, 0, Labour);
     vehicles_development    = new Development(0, 0, Vehicles);
 }
Beispiel #19
0
 protected override void CallExternalDeveloper(Development d)
 {
     string executable = "ufraw";
     string args = String.Format (
         "--overwrite --out-type=jpeg --output='{1}' '{0}'",
         d.RawUri.LocalPath, d.DevelopedUri.LocalPath);
     d.StartWatching ();
     Log.Information (String.Format ("Calling UFRaw: {0} {1}", executable, args));
     System.Diagnostics.Process ufraw = System.Diagnostics.Process.Start (executable, args);
     ufraw.EnableRaisingEvents = true;
     ufraw.Exited += new EventHandler((sender, e) => d.StopWatching());
 }
        public void SameValueDevelopmentsAreEqual(uint level, uint prestige, TokenColor discounts, uint diamondPrice, uint rubyPrice, uint emeraldPrice, uint onyxPrice, uint sapphirePrice)
        {
            //arrange
            Development d1, d2 = null;
            //act
            var price = new TokenCollection(diamondPrice, onyxPrice, sapphirePrice, emeraldPrice, rubyPrice, 0);

            d1 = new Development(level, prestige, discounts, price);
            d2 = new Development(level, prestige, discounts, price);
            //assert
            Assert.AreEqual(d1, d2);
        }
Beispiel #21
0
                /// <summary>
                ///
                /// </summary>
                /// <returns></returns>
                public static string GetConnectionStringDBUserLogServer()
                {
                    if (Development.GetIsEnabledDeveloperMode())
                    {
                        return(ConfigurationManager.ConnectionStrings["Development.MsSqlServer.UserLogServer"].ConnectionString);
                    }

                    if (GetUseLocalDB())
                    {
                        return(ConfigurationManager.ConnectionStrings["LocalDB.MsSqlServer.UserLogServer"].ConnectionString);
                    }

                    return(ConfigurationManager.ConnectionStrings["MsSqlServer.UserLogServer"].ConnectionString);
                }
            static void Main(String[] args)
            {
                President   mediator    = new President();
                Market      market      = new Market(mediator);
                Development development = new Development(mediator);
                Financial   financial   = new Financial(mediator);

                mediator.SetFinancial(financial);
                mediator.SetDevelopment(development);
                mediator.SetMarket(market);

                market.Process();
                market.Apply();

                Console.Read();
            }
Beispiel #23
0
        public void MediatorModelTest()
        {
            President   mediator    = new President();
            Market      market      = new Market(mediator);
            Development development = new Development(mediator);
            Financial   financial   = new Financial(mediator);

            mediator.SetFinancial(financial);
            mediator.SetDevelopment(development);
            mediator.SetMarket(market);

            market.Process();
            market.Apply();

            Console.Read();
        }
        public ActionResult <IEnumerable <SearchResult> > Get(string word)
        {
            var retorno   = new Development();
            var lista     = retorno.DadosYoutTube(word);
            var novaLista = new List <SearchResult>();

            foreach (var item in lista)
            {
                var novoObjeto = new Dados {
                    Description = item.Snippet.Description, Name = item.Snippet.ChannelTitle, URL = item.Snippet.ChannelId
                };
                _dataService.Create(novoObjeto);
                novaLista.Add(item);
            }
            //return retorno.DadosYoutTube(word);
            return(novaLista);
        }
Beispiel #25
0
    public static void Stop()
    {
        Development.Log("Stopping Server");

        if (TcpReady)
        {
            Development.Log("Shutting Down TCP Listener");
            tcpListener.Stop();
            tcpListener = null;
        }

        if (UdpReady)
        {
            Development.Log("Shutting Down UDP Listener");
            udpListener.Close();
            udpListener = null;
        }


        if (PacketsReady)
        {
            Development.Log("Clearing Packet Receivers");
            packetReceivers.Clear();
            packetReceivers = null;
        }

        if (ClientsReady)
        {
            // Setup Max Clients
            Development.Log("Clearing Client Connections");
            clients.Clear();
        }

        if (DatabaseReady)
        {
            Game.Save();
            Development.Log("Disconnected from MySQL");
            database.Disconnect();
            database = null;
        }

        Development.Log("Server Shutdown");
        IsReady = false;
        Development.Divider();
    }
        public async Task <ActionResult> ChangeDevelopment(Development selec, long id)
        {
            var Email = User.Identity.Name;
            // Name of current Login
            var Name = adamUnit.AppUserRepository.SingleOrDefault(x => x.Email == Email).FirstName;
            // UserId of CurrentLogin
            var UserCurrentId = adamUnit.AppUserRepository.SingleOrDefault(x => x.Email == Email).Id;
            //id of Employee
            var EmployeeId = adamUnit.EmployeeRepository.SingleOrDefault(x => x.UserId == UserCurrentId).Id;
            //attachmet of UserCurrentLogin
            var attachment = adamUnit.AttachmentRepository.FirstOrDefault(x => x.OwnerId == EmployeeId.ToString()).FileName;

            // Id of current Login
            var IdOfCur = adamUnit.AppUserRepository.SingleOrDefault(x => x.Email == Email).Id;
            var task    = adamUnit.TaskRepository.SingleOrDefault(x => x.Id == id);

            task.Development = selec;
            await adamUnit.TaskRepository.UpdateAsync(task);

            //retrive UserId of role
            var UserId = adamUnit.RoleRepository.GetUserIdOfRole();
            // retriv UserName of role
            var userName = adamUnit.AppUserRepository.SingleOrDefault(x => x.Id == UserId).UserName;
            var notify   = new Notfication();

            notify.ToUserId    = UserId;
            notify.OwnerUserId = IdOfCur;
            notify.TableName   = TableName.task;
            notify.TablePkId   = id;
            notify.IsRead      = false;
            notify.Context     = "Change status";
            await adamUnit.NotificationRepository.InserAsync(notify);

            var Url = "/Admin/task/Details?id=" + id;

            if (adamUnit.TokenFireBaseRepository.Exists(x => x.UserId == UserId))
            {
                var tokens = adamUnit.TokenFireBaseRepository.GetAll(x => x.UserId == UserId).Select(x => x.token);
                foreach (var token in tokens)
                {
                    NotificationController.SendPushNotification(token, notify.Context, Name, Url, attachment);
                }
            }
            return(Json("ok"));
        }
        public void ExceptionTestFor_FieldsCannotblankforAddDevelopment()
        {
            Development development = new Development()
            {
                DevelopmentId = 1,
                Activity      = "ss",
                State         = "ss",
                Budget        = 11,
                CandidateId   = 1,
                Month         = "april",
                Title         = "dd",
                Year          = "2019",
            };
            //Assert
            var ex = Assert.Throws <FieldscannotEmptyException>(() => _PoliticianServices.AddDevelopmentActivity(development));

            Assert.Equal("Fields can not be blank ", ex.Messages);
        }
        public void Test_for_EditDevelopmentActivity()
        {
            Development development = new Development()
            {
                DevelopmentId = 1,
                Activity      = "ss",
                State         = "ss",
                Budget        = 11,
                CandidateId   = 1,
                Month         = "april",
                Title         = "dd",
                Year          = "2019",
            };

            var Result         = _PoliticianServices.EditDevelopmentActivity(development);
            var GetDevelopment = _PoliticianServices.GetDevelopmentActivity(development);

            Assert.Equal(GetDevelopment, Result);
        }
Beispiel #29
0
    private static void InitializeServerData()
    {
        // Connect to MySQL
        Development.Log("Connecting to MySQL");
        if (!database.Connect())
        {
            Debug.LogError("No Database Connection... Shutting Down");
            return;
        }

        // Setup Max Clients
        Development.Log("Initializing Client Connections");
        for (int i = 1; i <= MaxPlayers; i++)
        {
            clients.Add(i, new Client(i));
        }

        // Init Packet Receivers.
        Development.Log("Initializing Packet Receivers");
        InitPacketReceiver(Client.Packets.Welcome, Receive.Welcome);
        InitPacketReceiver(Client.Packets.PlayerMovement, Receive.PlayerMovement);
        InitPacketReceiver(Client.Packets.PlayerShoot, Receive.PlayerShoot);
        InitPacketReceiver(Client.Packets.PlayerThrowItem, Receive.PlayerThrowItem);
        InitPacketReceiver(Client.Packets.PlayerInspect, Receive.PlayerThrowItem);
        InitPacketReceiver(Client.Packets.Registration, Receive.Registration);

        // Startup TCP Listener
        Development.Log("Starting TCP Listener");
        tcpListener = new TcpListener(IPAddress.Any, Port);
        tcpListener.Start();
        tcpListener.BeginAcceptTcpClient(TCPConnectCallback, null);

        // Startup UDP Listener
        Development.Log("Starting UDP Listener");
        udpListener = new UdpClient(Port);
        udpListener.BeginReceive(UDPReceiveCallback, null);

        Development.Log($"Server Started ( {Port} )");
        IsReady = true;

        // Delegate to a new Game()
        Game.Load();
    }
        public void Test_for_AddDevelopmentActivity()
        {
            Development development = new Development()
            {
                DevelopmentId = 1,
                Activity      = "ss",
                State         = "ss",
                Budget        = 11,
                CandidateId   = 1,
                Month         = "april",
                Title         = "dd",
                Year          = "2019",
            };

            var Result         = _PoliticianServices.AddDevelopmentActivity(development);
            var AddDevelopment = Result.ToString();

            Assert.NotNull(AddDevelopment);
        }
        private string FindFileNameInFiles(string viewName, bool throwException = true)
        {
            if (Development.IsAttached)
            {
                viewName = Path.Combine(Development.GetProjectDirectory(), viewName);
            }

            if (FileHelper.FileExists(viewName))
            {
                return(NormalizePath(viewName));
            }

            if (throwException)
            {
                this.ThrowFindContentInFiles();
            }

            return(null);
        }
Beispiel #32
0
        public void ShouldFailOnInvalidDevelopment()
        {
            var invalidDevelopment = new Development(11, 11, TokenColor.Black, new TokenCollection());
            var sut = new BuyDevelopmentAction(invalidDevelopment);

            var buyer = new Player("Goku");

            var players = new List <Player>()
            {
                buyer,
                new Player("Vegeta"),
                new Player("Trunks")
            };

            var board = new GameBoard((PlayerCount)players.Count, _nobles, _developments);

            Assert.IsFalse(sut.TryExecuteAction(buyer, board, out var result));

            Assert.AreEqual(ExecutionResult.InvalidDevelopmentToBuy, result);
        }
Beispiel #33
0
                /// <summary>
                /// retorna la cadena de conexion principal
                /// </summary>
                /// <returns></returns>
                public static string GetConnectionStringDBMain()
                {
                    if (Development.GetIsEnabledDeveloperMode())
                    {
                        return(ConfigurationManager.ConnectionStrings["MsSqlServer.Main.Development"].ConnectionString);
                    }

                    if (GetUseLocalDB())
                    {
                        return(ConfigurationManager.ConnectionStrings["LocalDB.MsSqlServer.Main"].ConnectionString);
                    }

                    if (Application.GetIsEnabledDemoMode())
                    {
                        return(ConfigurationManager.ConnectionStrings["Demo.LocalDB.MsSqlServer.Main"].ConnectionString);
                    }


                    return(ConfigurationManager.ConnectionStrings["MsSqlServer.Main"].ConnectionString);
                }
Beispiel #34
0
    public static void Start(int _maxPlayers, int _port)
    {
        Util.IniFile MyIni   = new Util.IniFile("Settings.ini");
        string       section = "MySQL";
        string       host    = MyIni.Read("Host", section);
        string       user    = MyIni.Read("Username", section);
        string       pass    = MyIni.Read("Password", section);
        string       db      = MyIni.Read("Database", section);

        database = new Database.Connection(host, db, user, pass, true);
        Development.Log("Starting Server");

        MaxPlayers = _maxPlayers;
        Port       = _port;

        // Setup Server Packets
        InitializeServerData();

        Development.Divider();
    }
        public void Load()
        {
            bool successed = true;

            successed &= EnemyFleet.Load(MasterPath);
            successed &= ShipParameter.Load(MasterPath);
            successed &= Construction.Load(MasterPath);
            successed &= ShipDrop.Load(MasterPath);
            successed &= Development.Load(MasterPath);
            successed &= Resource.Load(MasterPath);

            if (successed)
            {
                Utility.Logger.Add(2, "レコードをロードしました。");
            }
            else
            {
                Utility.Logger.Add(3, "レコードのロードに失敗しました。");
            }
        }
Beispiel #36
0
        public void ShouldNotReserveIfNotInPublicSpace()
        {
            var reservee        = new Player("Goku");
            var fakeDevelopment = new Development(1, 1, TokenColor.Red, new TokenCollection());

            var players = new List <Player>()
            {
                reservee,
                new Player("Vegeta"),
                new Player("Trunks")
            };

            var board = new GameBoard((PlayerCount)players.Count, new List <Noble>(), _developments);

            var sut = new ReserveDevelopmentAction(Location.Public, fakeDevelopment);

            Assert.IsFalse(sut.TryExecuteAction(reservee, board, out var result));

            Assert.AreEqual(ExecutionResult.InvalidDevelopmentToReserve, result);
        }
 /// <summary>
 /// Derived classes should reimplement this for program-specific functionality.
 /// Remember to call d.StartWatching & d.StopWatching on program start and end, resp.
 /// </summary>
 protected abstract void CallExternalDeveloper(Development d);