Exemplo n.º 1
0
    private void Awake()
    {
        BuildDirectories();

        if (!Instance)
        {
            Instance = this;
            DontDestroyOnLoad(this);

            // Check if save folder directory exists
            if (!Directory.Exists(SAVE_FOLDER_CUSTOM_CHARACTERS))
            {
                Debug.Log("Custom characters save folder does not exist, creating...");
                // it doesnt, create save folder
                //SAVE_FOLDER_CUSTOM_CHARACTERS = Application.dataPath + "/Save Folders/Custom Characters";
                Directory.CreateDirectory(SAVE_FOLDER_CUSTOM_CHARACTERS);
            }
            else
            {
                Debug.Log("Custom characters save folder already exists at: " + SAVE_FOLDER_CUSTOM_CHARACTERS);
            }
        }
        else
        {
            Destroy(gameObject);
        }
    }
Exemplo n.º 2
0
        public CarPassModel GetTheLastCarPassed(string entranceID, int value)
        {
            CarPassModel car = new CarPassModel();

            try
            {
                PersistencyManager db = m_Persistency_Manager;

                Guid     entranceGuid = new Guid(entranceID.ToString());
                ENTRANCE testEntrance = db.ENTRANCE.Where(br => br.entranceID == entranceGuid).FirstOrDefault();

                if (testEntrance != null)
                {
                    if (db != null)
                    {
                        Guid branchGuid = new Guid(testEntrance.branchID.ToString());

                        car = getCar(db, branchGuid, value);
                    }
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception)
            {
                car = null;
            }

            return(car);
        }
Exemplo n.º 3
0
        // http://localhost:1182/api/car?branchName=Cankaya
        public IEnumerable <CarPassModel> GetCars(string branchName)
        {
            List <CarPassModel> cars = new List <CarPassModel>();

            try
            {
                PersistencyManager db = m_Persistency_Manager;

                BRANCH testBranch = db.BRANCH.Where(br => br.branchName == branchName).FirstOrDefault();

                if (testBranch != null)
                {
                    if (db != null)
                    {
                        cars = getCars(db, testBranch.branchID);
                    }
                }
            }
            catch (Exception)
            {
                cars = null;
            }

            return(cars);
        }
Exemplo n.º 4
0
 public InputViewModel(ICurrencyManager currencyManager, PersistencyManager persistencyManager, IMessenger messanger)
 {
     _currencyManager = currencyManager;
     Currencies       = new ObservableCollection <Currency>(
         currencyManager.Currencies);
     _messanger   = messanger;
     BaseCurrency = persistencyManager.BaseCurrency;
 }
Exemplo n.º 5
0
 public void SavePermanent()
 {
     PersistencyManager.UseLongTermPersist(Path.Combine(Path.Combine(Application.dataPath, "Saves"), "SaveFile" + DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss.bin")).Replace('/', Path.DirectorySeparatorChar));
     persistManager = PersistencyManager.GetCurrentPersistor();
     Save();
     PersistencyManager.UseShortTermPersist();
     persistManager = PersistencyManager.GetCurrentPersistor();
 }
Exemplo n.º 6
0
        public string PrintSerialNumber(string TransactionID, string SerialNumber)
        {
            string printerName = MES.Processor.ModuleConfiguration.Default_PrinterName; //System.Configuration.ConfigurationManager.AppSettings.Get("SNPrinter");

            if (String.IsNullOrEmpty(printerName))
            {
                System.Drawing.Printing.PrinterSettings printerSetting = new System.Drawing.Printing.PrinterSettings();

                foreach (var printer in System.Drawing.Printing.PrinterSettings.InstalledPrinters)
                {
                    printerSetting.PrinterName = printer.ToString();

                    if (printerSetting.IsDefaultPrinter)
                    {
                        printerName = printerSetting.PrinterName;
                        break;
                    }
                }
            }

            Processor processor = new Processor();

            DataPair pair = new DataPair()
            {
                Identifier = new DataIdentifier()
                {
                    DataUniqueID = TransactionID, DataType = MES.Core.DataType.PrintingRecord, RawData = Encoding.UTF8.GetBytes(String.Format("{0}:{1}", TransactionID, SerialNumber))
                },
                Items = new List <DataItem>
                        (
                    new DataItem[]
                {
                    new DataItem()
                    {
                        CreationTime   = DateTime.Now,
                        DeviceID       = printerName,
                        DataParameters = new List <DataParameter>
                                         (
                            new DataParameter[] { new DataParameter()
                                                  {
                                                      Name  = "SerialNumber",
                                                      Value = SerialNumber
                                                  } }
                                         )
                    }
                }
                        )
            };

            pair = processor.Print(pair, TransactionID, "SerialNumber");

            PersistencyManager manager = new PersistencyManager();

            List <string> dataItemIDList = manager.Persist(pair, 1, null) as List <string>;

            return((dataItemIDList != null) ? dataItemIDList[0] : null);
        }
Exemplo n.º 7
0
    public void LoadOnClick()
    {
        var text = GetComponentInChildren <UnityEngine.UI.Text>();
        var path = Path.Combine(Path.Combine(Application.dataPath, "Saves").Replace('/', Path.DirectorySeparatorChar), text.text);

        Debug.Log("Loadin " + path);
        PersistencyManager.stateNumber = 1;
        PersistencyManager.UseLongTermPersist(path);
        SceneManager.LoadScene(2);
    }
Exemplo n.º 8
0
        public string[] AddTestResult(DataPair DataPair)
        {
            PersistencyManager manager = new PersistencyManager();

            DataPair.Identifier.DataType = DataType.TestResult;

            List <string> dataItemIDList = manager.Persist(DataPair, 1, null) as List <string>;

            return((dataItemIDList != null) ? dataItemIDList.ToArray() : null);
        }
Exemplo n.º 9
0
        private void startSerialPortDetector()
        {
            this.serailPortSignalDetector = new SerialPortSignalDetector();

            this.serailPortSignalDetector.SerialPortSignalCallBack += (object sender, SerialPortSignalDetectorEventArgs e) =>
            {
                this.Invoke(new Action(() =>
                {
                    if (this.persistencyManager == null)
                    {
                        this.persistencyManager = new PersistencyManager();
                    }

                    this.persistencyManager.Record
                    (
                        e.DataIdentifier.DataUniqueID,
                        ((object[])(e.DataIdentifier.RawData))[0].ToString().Trim(),
                        ((int)(this.parameters.GetPersistencyParameter().PersistencyType)),
                        new Dictionary <string, object>()
                    {
                        { "DataStore", this.parameters.GetPersistencyParameter().DataStore },
                        { "SeriesID", this.parameters.GetBusinessParameter().SeriesID },
                        { "SeriesName", this.parameters.GetBusinessParameter().SeriesName },
                        { "ModelID", this.parameters.GetBusinessParameter().ModelID },
                        { "ModelName", this.parameters.GetBusinessParameter().ModelName },
                        { "DeviceID", this.parameters.GetBusinessParameter().DeviceID },
                        { "DeviceName", this.parameters.GetBusinessParameter().DeviceName },
                        { "OperatorID", this.parameters.GetBusinessParameter().OperatorID },
                        { "OperatorName", this.parameters.GetBusinessParameter().OperatorName },
                        { "StationID", this.parameters.GetBusinessParameter().StationID },
                        { "StationName", this.parameters.GetBusinessParameter().StationName },
                        { "LineID", this.parameters.GetBusinessParameter().LineID },
                        { "LineName", this.parameters.GetBusinessParameter().LineName },
                        { "BusinessID", this.parameters.GetBusinessParameter().BusinessID },
                        { "BusinessName", this.parameters.GetBusinessParameter().BusinessName },
                        { "OrderID", this.parameters.GetBusinessParameter().OrderID }
                    }
                    );

                    this.textBoxSignalMessage.Text += e.DataIdentifier.DataUniqueID;
                    this.textBoxSignalMessage.Text += " : ";
                    this.textBoxSignalMessage.Text += ((object[])(e.DataIdentifier.RawData))[0].ToString().Trim();
                    this.textBoxSignalMessage.Text += " : ";
                    this.textBoxSignalMessage.Text += CommonUtility.GetMillisecondsByDateTime((DateTime)(((object[])(e.DataIdentifier.RawData))[1]), null);
                    this.textBoxSignalMessage.Text += "\r\n";

                    this.textBoxSignalMessage.SelectionStart = this.textBoxSignalMessage.Text.Length;
                    this.textBoxSignalMessage.ScrollToCaret();
                    this.textBoxSignalMessage.Refresh();
                }));
            };

            this.serailPortSignalDetector.Detect();
        }
Exemplo n.º 10
0
        private void saveDataPair(DataPair pair)
        {
            if (this.persistencyManager == null)
            {
                this.persistencyManager = new PersistencyManager();
            }

            List <string> result = this.persistencyManager.Persist
                                   (
                pair,
                ((int)(this.parameters.GetPersistencyParameter().PersistencyType)),
                new Dictionary <string, object>()
            {
                { "DataStore", this.parameters.GetPersistencyParameter().DataStore },
                { "FileExtension", this.parameters.GetCameraParameter().ImageOutputFormat.ToString() }
            }
                                   ) as List <string>;

            if (this.parameters.GetPersistencyParameter().PersistencyType == PersistencyType.FileSystem)
            {
                this.currentImageFile = result[1];

                this.imageUrlMappings.Add(this.currentImageFile, this.currentImageFile + ".info.xml");
            }
            else
            {
                string servicePoint    = ConfigurationManager.AppSettings.Get("ServicePoint");
                string imageServiceUrl = ConfigurationManager.AppSettings.Get("ImageServiceUrl");
                string imageInfoUrl    = ConfigurationManager.AppSettings.Get("ImageInfoUrl");

                imageServiceUrl = String.Format(imageServiceUrl, result[1]);
                imageInfoUrl    = String.Format(imageInfoUrl, result[1]);

                if (!servicePoint.EndsWith("/"))
                {
                    servicePoint = servicePoint + "/";
                }

                if (imageServiceUrl.StartsWith("/"))
                {
                    imageServiceUrl = imageServiceUrl.Remove(0, 1);
                }

                if (imageInfoUrl.StartsWith("/"))
                {
                    imageInfoUrl = imageInfoUrl.Remove(0, 1);
                }

                this.currentImageFile = servicePoint + imageServiceUrl;

                this.imageUrlMappings.Add(this.currentImageFile, servicePoint + imageInfoUrl);
            }
        }
Exemplo n.º 11
0
        public async Task TestConnection()
        {
            //Arrange
            //Der er intet Arrange
            //Unittest havde brug for en connection fra et andet sted.
            //Derfor måtte jeg lave en notesblock hvor jeg lagde connectionString ind i.

            //Act
            bool ok = await PersistencyManager.TryOpenConn();

            //Assert
            Assert.IsTrue(ok);
        }
Exemplo n.º 12
0
        [HttpPost]  //http://localhost:1182/api/car?branchName=Cankaya...
        public bool Post(String entranceID, [FromBody] CarPassModel model)
        {
            try
            {
                PersistencyManager db = m_Persistency_Manager;

                Guid     entranceGuid = new Guid(entranceID.ToString());
                ENTRANCE testEntrance = db.ENTRANCE.Where(br => br.entranceName == model.entranceName && br.entranceID == entranceGuid).FirstOrDefault();

                if (testEntrance != null && testEntrance.entranceName == model.entranceName)
                {
                    var list = db.CARPASS.Where(br => br.entranceID == entranceGuid);

                    foreach (var item in list.ToList())
                    {
                        CARPASS delete = db.CARPASS.Where(br => br.entranceID == item.entranceID).FirstOrDefault();
                        db.CARPASS.DeleteObject(delete);
                        db.SaveChanges();
                    }

                    CARPASS carPass = new CARPASS();
                    carPass.carPassID  = Guid.NewGuid();
                    carPass.entranceID = testEntrance.entranceID;

                    carPass.plateNo        = model.plateNo;
                    carPass.state          = model.state;
                    carPass.image          = model.image;
                    carPass.time           = model.time;
                    carPass.dbCreationTime = DateTime.Now;

                    db.CARPASS.AddObject(carPass);
                    db.SaveChanges();

                    PushNotification(testEntrance.BRANCH.branchName, model.entranceName, "Yeni Araç Geçişi!", carPass.carPassID);
                }

                else
                {
                    return(false);
                }
            }
            catch (Exception exc)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 13
0
    void Awake()
    {
        if (gameHandler == null)
        {
            gameHandler        = this;
            inventory          = GetComponent <Inventory>();
            persistencyManager = GetComponent <PersistencyManager>();
            sceneLoader        = GetComponent <SceneLoader>();
            musicHandler       = GetComponentInChildren <MusicHandler>();
            soundHandler       = GetComponentInChildren <SoundHandler>();

            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }
    }
Exemplo n.º 14
0
        public AccountModel GetAccount(PersistencyManager db, String entranceID, String username, String password, String deviceKey, int bos)
        {
            AccountModel testAccount = new AccountModel();

            testAccount = (from lg in db.LOGIN
                           where lg.deviceKey == deviceKey
                           select new AccountModel
            {
                entranceID = lg.entranceID,
                username = lg.username,
                password = lg.password,
                entranceName = lg.ENTRANCE.entranceName,
                deviceKey = lg.deviceKey,
                branchName = lg.ENTRANCE.BRANCH.branchName,
                branchGuid = lg.ENTRANCE.branchID
            }).FirstOrDefault();

            if (testAccount.username == username && testAccount.password == password && testAccount.deviceKey == deviceKey)
            {
                TOKEN aToken = new TOKEN();
                aToken.entranceID          = testAccount.entranceID;
                aToken.tokenGenerationTime = DateTime.Now;
                aToken.tokenID             = Guid.NewGuid();

                db.TOKEN.AddObject(aToken);
                db.SaveChanges();

                testAccount.tokenID = aToken.tokenID.ToString();

                testAccount.branchID   = testAccount.branchGuid.ToString();
                testAccount.username   = "";
                testAccount.password   = "";
                testAccount.deviceKey  = "";
                testAccount.branchGuid = null;
                return(testAccount);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 15
0
        public AccountModel Login(string entranceID, string username, string password, string deviceKey)
        {
            AccountResultModel result = new AccountResultModel();

            result.Status = AccountResultStatus.UNKNOWN_ERROR;

            try
            {
                username   = username.Trim();
                entranceID = entranceID.Trim();
                deviceKey  = deviceKey.Trim();

                PersistencyManager db = m_Persistency_Manager;

                if (db != null)
                {
                    result.Account = GetAccount(db, entranceID, username, password, deviceKey, 1);
                    if (result.Account != null)
                    {
                        result.Status = AccountResultStatus.VALID_LOGIN;
                    }

                    else
                    {
                        result.Status = AccountResultStatus.INVALID_USERNAME_PASSWORD;
                    }
                }
                else
                {
                    result.Status = AccountResultStatus.INVALID_SERVER;
                }
            }
            catch (Exception exc)
            {
                result.Status = AccountResultStatus.UNKNOWN_ERROR;
            }

            return(result.Account);
        }
Exemplo n.º 16
0
    void Start()
    {
        persistManager = PersistencyManager.GetCurrentPersistor();
        Debug.Log("gamecontroller start");
        if (PersistencyManager.stateNumber == 1)
        {
            Debug.Log("Loading");
            Load();
            Debug.Log(turncount + " " + mutationState);
        }

        ChangeTileMaterial(tileMats[mutationState]);
        CreateSelector();
        var mainCamera = GameObject.FindGameObjectWithTag("MainCamera");


        mainCameraAnimator = mainCamera.GetComponent <Animator>();

        if (turncount % 2 == 1)
        {
            mainCameraAnimator.SetTrigger("next"); Debug.Log("fut");
        }
    }
Exemplo n.º 17
0
        public List <CarPassModel> getCars(PersistencyManager db, Guid branchGuid)
        {
            List <CarPassModel> carList = new List <CarPassModel>();

            try
            {
                var tempList = (from cp in db.CARPASS
                                where cp.branchID == branchGuid
                                select new
                {
                    carPassID = cp.carPassID,
                    branchID = cp.branchID,
                    plateNo = cp.plateNo,
                    state = cp.state,
                    image = cp.image
                }).ToList();

                foreach (var item in tempList)
                {
                    CarPassModel carModel = new CarPassModel();

                    carModel.carPassID = item.carPassID;
                    carModel.branchID  = item.branchID.ToString();
                    carModel.plateNo   = item.plateNo;
                    carModel.state     = item.state;
                    carModel.image     = item.image;

                    carList.Add(carModel);
                }
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.StackTrace);
            }

            return(carList);
        }
Exemplo n.º 18
0
        private void testToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.setControls(true);

            this.applyParameters();

            this.updateCammeraParameters();

            Action action = new Action(() =>
            {
                this.xiAcquirer = new XIAcquirer();

                object[] testOutput = null;

                byte[] result = this.xiAcquirer.Test(out testOutput);

                DataPair pair = testOutput[0] as DataPair;

                pair = this.doCorrelation(pair.Identifier, pair.Items[0]);

                pair = this.doComputation(pair);

                pair = this.doCorrelation(pair.Identifier, pair.Items[0]);

                using (MemoryStream stream = new MemoryStream(pair.Items[1].DataBytes))
                {
                    this.bitmap = Bitmap.FromStream(stream) as Bitmap;
                }

                if (this.persistencyManager == null)
                {
                    this.persistencyManager = new PersistencyManager();
                }

                List <string> persistencyResult = this.persistencyManager.Persist
                                                  (
                    pair,
                    ((int)(this.parameters.GetPersistencyParameter().PersistencyType)),
                    new Dictionary <string, object>()
                {
                    { "DataStore", this.parameters.GetPersistencyParameter().DataStore },
                    { "FileExtension", this.parameters.GetCameraParameter().ImageOutputFormat.ToString() }
                }
                                                  ) as List <string>;

                if (this.parameters.GetPersistencyParameter().PersistencyType == PersistencyType.FileSystem)
                {
                    this.currentImageFile = persistencyResult[1];

                    this.imageUrlMappings.Add(this.currentImageFile, this.currentImageFile + ".info.xml");
                }
                else
                {
                    string servicePoint    = ConfigurationManager.AppSettings.Get("ServicePoint");
                    string imageServiceUrl = ConfigurationManager.AppSettings.Get("ImageServiceUrl");
                    string imageInfoUrl    = ConfigurationManager.AppSettings.Get("ImageInfoUrl");

                    imageServiceUrl = String.Format(imageServiceUrl, persistencyResult[1]);
                    imageInfoUrl    = String.Format(imageInfoUrl, persistencyResult[1]);

                    if (!servicePoint.EndsWith("/"))
                    {
                        servicePoint = servicePoint + "/";
                    }

                    if (imageServiceUrl.StartsWith("/"))
                    {
                        imageServiceUrl = imageServiceUrl.Remove(0, 1);
                    }

                    if (imageInfoUrl.StartsWith("/"))
                    {
                        imageInfoUrl = imageInfoUrl.Remove(0, 1);
                    }

                    this.currentImageFile = servicePoint + imageServiceUrl;

                    this.imageUrlMappings.Add(this.currentImageFile, servicePoint + imageInfoUrl);
                }

                this.Invoke(new Action(() =>
                {
                    this.pictureBoxAcquiredImage.Image = this.bitmap;
                    this.listBoxBarcodes.DataSource    = pair.Items[1].GetParameterValue("BarCodes").Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); //barcodes;

                    this.pictureBoxAcquiredImage.Refresh();
                    this.listBoxBarcodes.Refresh();

                    this.tabControlMain.SelectedTab = this.tabPageBarcodes;

                    this.toolStripStatusLabelCurrentStatus.Text = this.currentImageFile;

                    if (this.bindingSource.Count == 20)
                    {
                        string imageUrlMappingKey = this.bindingSource[0].ToString();

                        if (this.imageUrlMappings.ContainsKey(imageUrlMappingKey))
                        {
                            this.imageUrlMappings.Remove(imageUrlMappingKey);
                        }

                        this.bindingSource.RemoveAt(0);
                    }

                    this.bindingSource.Add(new DataParameter()
                    {
                        Name = this.currentImageFile, Value = this.currentImageFile
                    });

                    this.dataGridViewRecentImages.Refresh();

                    this.setControls(false);
                }));
            });

            Task.Run(action);
        }
Exemplo n.º 19
0
        public CarPassModel getCar(PersistencyManager db, Guid branchGuid, int value)
        {
            CarPassModel carModel = new CarPassModel();

            try
            {
                if (value == 1)
                {
                    var tempList = (from cp in db.CARPASS
                                    where cp.ENTRANCE.branchID == branchGuid
                                    orderby cp.dbCreationTime descending
                                    select new
                    {
                        carPassID = cp.carPassID,
                        entranceID = cp.entranceID,
                        plateNo = cp.plateNo,
                        state = cp.state,
                        image = cp.image,
                        time = cp.time,
                        entranceName = cp.ENTRANCE.entranceName
                    }).ToList();

                    carModel.carPassID    = tempList[0].carPassID;
                    carModel.entranceID   = tempList[0].entranceID.ToString();
                    carModel.plateNo      = tempList[0].plateNo;
                    carModel.state        = tempList[0].state;
                    carModel.image        = tempList[0].image;
                    carModel.time         = tempList[0].time;
                    carModel.entranceName = tempList[0].entranceName;
                }
                else
                {
                    var tempList = (from cp in db.CARPASS
                                    where cp.ENTRANCE.branchID == branchGuid
                                    orderby cp.dbCreationTime ascending
                                    select new
                    {
                        carPassID = cp.carPassID,
                        entranceID = cp.entranceID,
                        plateNo = cp.plateNo,
                        state = cp.state,
                        image = cp.image,
                        time = cp.time,
                        entranceName = cp.ENTRANCE.entranceName
                    }).ToList();


                    carModel.carPassID    = tempList[0].carPassID;
                    carModel.entranceID   = tempList[0].entranceID.ToString();
                    carModel.plateNo      = tempList[0].plateNo;
                    carModel.state        = tempList[0].state;
                    carModel.image        = tempList[0].image;
                    carModel.time         = tempList[0].time;
                    carModel.entranceName = tempList[0].entranceName;
                }
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.StackTrace);
            }

            return(carModel);
        }