Пример #1
0
        private SaveService CreateSaveService()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new SaveService(userId);

            return(service);
        }
Пример #2
0
        /// <summary>
        /// 当用户点击下载选中按钮后,会调用该方法,把选中的资源下载到用户指定的目录中
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UpDateButton_Click(object sender, EventArgs e)
        {
            //声明一个下载队列,将要下载的图片加入队列里
            List <ImgResource> img = new List <ImgResource>();

            //当用户点击筛选按钮,筛选出图片后,下载选中是基于筛选图片的列表里来的【看count是否为0】
            if (CrawlerProject.ImgResourcesContainer.ProcessedImages.Count > 0)
            {
                for (int f = 0; f < CrawlerProject.ImgResourcesContainer.ProcessedImages.Count; f++)
                {
                    //如果相应图片对应的复选框被选中,则加入下载队列
                    if (checkBoxes[f].Checked)
                    {
                        img.Add(CrawlerProject.ImgResourcesContainer.ProcessedImages[f]);
                    }
                }
            }
            else
            {
                for (int f = 0; f < CrawlerProject.ImgResourcesContainer.RowImages.Count; f++)
                {
                    if (checkBoxes[f].Checked)
                    {
                        img.Add(CrawlerProject.ImgResourcesContainer.RowImages[f]);
                    }
                }
            }
            filePath = SaveService.SaveImages(img);
        }
Пример #3
0
        public void UpdatesSave()
        {
            // Arrange
            var einToTest     = "30-9876543";
            var applicationId = "CE7F5AA5-6832-43FE-BAE1-80D14CD8F666";
            var oldData       = new
            {
                EIN              = einToTest,
                ApplicationId    = "CE7F5AA5-6832-43FE-BAE1-80D14CD8F666",
                ApplicationState = "{ \"name\": \"Joe Biden\", \"email:\" \"[email protected]\" }"
            };
            var newData = new
            {
                EIN              = einToTest,
                ApplicationId    = "CE7F5AA5-6832-43FE-BAE1-80D14CD8F666",
                ApplicationState = "{ \"name\": \"Michelle Obama\", \"email:\" \"[email protected]\" }"
            };

            var service = new SaveService(_saveRepositoryMock);

            service.AddOrUpdate(einToTest, applicationId, null, oldData.ApplicationState);
            var existingRecord = service.GetSave(applicationId);

            // Act
            service.AddOrUpdate(einToTest, applicationId, null, newData.ApplicationState);
            var newRecord = service.GetSave(applicationId);

            // Assert
            Assert.AreEqual(newData.ApplicationState, newRecord.ApplicationState);
            Assert.AreEqual(applicationId, newRecord.ApplicationId);
        }
Пример #4
0
        private void GlassesEditor_FormClosing(object sender, FormClosingEventArgs e)
        {
            SaveService saveService = (SaveService)ToolFramework.Instance.ServiceManagerInstance.GetService(typeof(SaveService));

            if (saveService != null && !saveService.Stop())
            {
                e.Cancel = true;
            }
            else if (!this.allowShutdown)
            {
                if (ToolFramework.Instance.Game != null)
                {
                    ToolFramework.Instance.Game.Exit();
                }
                e.Cancel     = true;
                this.closing = true;
            }
            else
            {
                TickService tickService = (TickService)ToolFramework.Instance.ServiceManagerInstance.GetService(typeof(TickService));
                if (tickService != null)
                {
                    tickService.Stop();
                }
            }
        }
Пример #5
0
        private void MainWindow_OnClosing(object sender, CancelEventArgs e)
        {
            if (_isSaved)
            {
                return;
            }

            var answer = MessageBox.Show(
                "Save changed?",
                "Save",
                MessageBoxButton.YesNoCancel,
                MessageBoxImage.Question
                );

            switch (answer)
            {
            case MessageBoxResult.Yes:
                SaveService.OnSave(ref _fileName, NotepadField.Text);
                break;

            case MessageBoxResult.Cancel:
                e.Cancel = true;
                break;
            }
        }
Пример #6
0
        public void Setup()
        {
            _root = $"{Application.streamingAssetsPath}";

            _service = new SaveService();
            _service.Init(_root);
        }
Пример #7
0
        void Start()
        {
            Settings();
            string[] gameSettings = GameService.GetSettings();
            gamesID       = Int32.Parse(gameSettings[0]);
            puzzleID      = Int32.Parse(gameSettings[1]);
            sizeX         = Int32.Parse(gameSettings[3]);
            sizeY         = Int32.Parse(gameSettings[4]);
            this.size     = Int32.Parse(gameSettings[5]);
            this.is_break = Int32.Parse(gameSettings[6]);

            //формируем пазл в сцене
            PuzzlesService.GeneratorPuzzles(sizeX, sizeY, gameSettings[2]);

            //Если загруженый пазл был прерван, то загружаем его сохранение
            if (is_break == 1)
            {
                for (int i = 0; i < PuzzlesService.puzzleArray.Length; i++)
                {
                    SaveService.GetSave(PuzzlesService.puzzleArray[i]);
                }
            }

            StartCoroutine("finished");
        }
Пример #8
0
        private void SetupMetadataItems()
        {
            var guidProvider = new GuidProvider();
            var saveService  = new SaveService(Config);
            var firstMap     = new Dictionary <string, object>()
            {
                { "Bezeichnung", "ok then" },
                { "Typ", "D4C" },
                { "Stichwörter", "kocchi wo miro" }
            };
            var firstItem = new MetadataItem(guidProvider.NextGuid, firstMap);

            saveService.SaveDocument(firstItem);
            var secondMap = new Dictionary <string, object>()
            {
                { "Bezeichnung", "ok then" },
                { "Typ", "Quittung" },
                { "Stichwörter", "some jojo meme" }
            };
            var secondItem = new MetadataItem(guidProvider.NextGuid, secondMap);

            saveService.SaveDocument(secondItem);
            var thirdMap = new Dictionary <string, object>()
            {
                { "Bezeichnung", "My deadly queen has already touched this code" },
                { "Typ", "Crazy Diamond" },
                { "Stichwörter", "ok I guess" }
            };
            var thirdItem = new MetadataItem(guidProvider.NextGuid, thirdMap);

            saveService.SaveDocument(thirdItem);
        }
Пример #9
0
 void Start()
 {
     saveService = FindObjectOfType <SaveService>();
     saveService.Setup(new PlayerPrefsStorage());
     saveService.Register(someService);
     saveService.Load(someService);
 }
Пример #10
0
        // This is the function if the button Sequ backup is triggered
        private void RunSequBackup_Click(object sender, RoutedEventArgs e)
        {
            Nko obj = new Nko();

            foreach (Save saves in BackupListDisplay.SelectedItems)
            {
                string lastCompleteDir = "";
                string name            = saves.name.ToString();
                string sourceDir       = saves.SourceDirectory.ToString();
                string destDir         = saves.DestinationDirectory.ToString();
                string TypeOfSave      = saves.TypeOfSave.ToString();

                if (TypeOfSave == "Full")
                {
                    lastCompleteDir = "";
                }
                else if (TypeOfSave == "Diff")
                {
                    lastCompleteDir = saves.LastCompleteDirectory.ToString();
                }

                SaveService.ServiceSave(name, sourceDir, destDir, TypeOfSave, lastCompleteDir, saves, obj);


                string[]    originalFiles = Directory.GetFiles(sourceDir, "*", SearchOption.AllDirectories);
                ProgressBar pb            = new ProgressBar(originalFiles, name);
                System.Windows.Forms.MessageBox.Show(" Save finished we move on the next one ");
            }
        }
Пример #11
0
 private void MainWindow_OnKeyDown(object sender, KeyEventArgs e)
 {
     if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.S)
     {
         SaveService.OnSave(ref _fileName, NotepadField.Text);
         SaveStatusUpdate(true);
     }
 }
    public ViewModel(LoadService loadService, SaveService saveService)
    {
        _LoadService = loadService;
        _SaveService = saveService;
        // Create command instance for Save
        // Create command instance for Load

        Items = loadService.Load();
    }
Пример #13
0
        /// <summary>
        /// You must pass the smallest timeframe the software will watch for.
        /// Eg.: If set to TEN_MINUTES, then one mouse movement or keypress in that timeframe
        /// will be considered an active time.
        /// DataPrecision is not implemented fully, only High precision works
        /// </summary>
        /// <param name="appName">If saving is enabled the resulting file will have this as prefix</param>
        /// <param name="resolution">The smallest timeframe the software will watch for</param>
        /// <param name="SavePreference">Dictates how usage data will be saved/stored</param>
        /// <param name="dataPrecision">Sets how fine grained the data will be</param>
        public Watcher(string appName, Resolution chosenResolution,
                       SavePreference preference, DataPrecision dataPrecision)
        {
            ISaveService saveService = new SaveService(appName, preference, dataPrecision);
            IUsageKeeper keeper      = CreateKeeper(ref saveService, dataPrecision, chosenResolution);
            IStorage     store       = new UsageStore(keeper);

            wService = new WatcherService(ref store, ref saveService);
        }
 public MainViewModel()
 {
     this.saveService        = new SaveService(PathUtil.SaveFile);
     this.SaveCommand        = new RelayCommand(this.SaveCommandExecute);
     this.ReloadCommand      = new RelayCommand(this.ReloadCommandExecute);
     this.OpenAboutCommand   = new RelayCommand(this.OpenAboutCommandExecute);
     this.SetAllItemsCommand = new RelayCommand(this.SetAllItemsCommandExecute);
     this.DebugSaveCommand   = new RelayCommand(this.DebugSaveCommandExecute);
     HotKey.Register(Key.D, KeyModifier.Ctrl | KeyModifier.Shift, DebugSaveCommand);
 }
Пример #15
0
        public void RetrievesSave()
        {
            // Arrange
            var service = new SaveService(_saveRepositoryMock);

            // Act
            var save = service.GetSave("CE7F5AA5-6832-47FE-BAE1-80D14CD8F667");

            // Assert
            Assert.AreEqual("{ \"name\": \"Barack Obama\", \"email:\" \"[email protected]\" }", save.ApplicationState);
        }
Пример #16
0
        private static void LoginUserFromData()
        {
            string email    = Settings.Default.Email;
            string password = Settings.Default.Password;

            if (email.Length > 3)
            {
                ConnectionController connection = ConnectionControllerImpl.GetController();
                connection.SingIn(SaveService.GetUser());
            }
        }
    public ViewModel(LoadService loadService, SaveService saveService)
    {
        _LoadService = loadService;
        _SaveService = saveService;
        // Create command instance for Save
        // Create command instance for Load

        var itemsList = _LoadService.Load();

        Items = new ObservableCollection(itemsList);
    }
Пример #18
0
 public PassportMediator(
     AppSetting setting,
     SaveService saveService,
     IAudioService audioService,
     UIControlData viewComponent) : base(TypeName, viewComponent)
 {
     this.audioService = audioService;
     this.saveService  = saveService;
     this.setting      = setting;
     this.passportVo   = new PassportVo();
 }
    public ViewModel(LoadService loadService, SaveService saveService)
    {
        _LoadService = loadService;
        _SaveService = saveService;
        // Create command instance for Save
        // Create command instance for Load

        var itemsList   = _LoadService.Load();
        var facadeItems = itemsList.Select(item => new ConfigurationItemPropertiesFacade(item));

        Items = new ObservableCollection(facadeItems);
    }
Пример #20
0
        public void CreateDirectory_FolderCreated()
        {
            // Arrange
            var folderPath = FolderPath;
            var service    = new SaveService(Config);

            // Act
            service.CreateDirectory(folderPath);

            // Assert
            Assert.IsTrue(Directory.Exists(RepositoryPath + '\\' + folderPath));
        }
Пример #21
0
        /// <summary>
        /// You must pass the smallest timeframe the software will watch for.
        /// Eg.: If set to TEN_MINUTES, then one mouse movement or keypress in that timeframe
        /// will be considered an active time.
        /// DataPrecision is not implemented fully, only High precision works
        /// </summary>
        /// <param name="appName">If saving is enabled the resulting file will have this as prefix</param>
        /// <param name="resolution">The smallest timeframe the software will watch for</param>
        /// <param name="savePreference">Dictates how usage data will be saved/stored</param>
        /// <param name="dataPrecision">Sets how fine grained the data will be</param>
        public Watcher(string appName, Resolution chosenResolution,
                       SavePreference preference, DataPrecision dataPrecision)
        {
            ISaveService saveService = new SaveService(appName, preference, dataPrecision);
            IUsageToday  today       = (IUsageToday)CreateOrLoadKeeper(ref saveService, dataPrecision,
                                                                       chosenResolution, SaveType.Today);
            IUsageArchive archive = (IUsageArchive)CreateOrLoadKeeper(ref saveService, dataPrecision,
                                                                      chosenResolution, SaveType.Archive);
            IStorage store = new UsageStorage(ref today, ref archive, ref saveService);

            wService = new WatcherService(ref store);
        }
Пример #22
0
 private void Start()
 {
     if (Instance != null && Instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         Instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
Пример #23
0
        /// <summary>
        ///		Create a service, and save it using the provided BusinessEntity, name, and
        ///		description.
        /// </summary>
        /// <param name="entity">The BusinessEntity that will own this BusinessService.</param>
        /// <param name="name">The name for the new BusinessService.</param>
        /// <param name="desc">The description for the new BusinessService.</param>
        /// <returns>The resulting BusinessService after the save.</returns>
        private static BusinessService AddService(BusinessEntity entity, string name, string desc)
        {
            BusinessService service = new BusinessService();

            service.BusinessKey = entity.BusinessKey;
            service.Names.Add(name);
            service.Descriptions.Add(desc);

            SaveService   ss     = new SaveService(service);
            ServiceDetail detail = ss.Send(_connection);

            return(detail.BusinessServices[0]);
        }
Пример #24
0
        //events
        private void OpenFile_OnClick(object sender, RoutedEventArgs e)
        {
            (_fileName, Title) = SaveService.OnOpenFile();

            if (!File.Exists(_fileName))
            {
                MessageBox.Show("Unable to open file", "Error", MessageBoxButton.OK);
                return;
            }

            NotepadField.Text = File.ReadAllText(_fileName);
            SaveStatusUpdate(true);
        }
Пример #25
0
        private void save_progress()
        {
            SaveService.DeleteSave();             // clear table before save new data

            for (int i = 0; i < PuzzlesService.puzzleArray.Length; i++)
            {
                SaveService.SetSave(PuzzlesService.puzzleArray[i]);
            }

            GamesModel gm = new GamesModel();

            gm.SaveBreakGame(StartPuzzle.gamesID);
        }
Пример #26
0
        /// @param localDirector
        ///     The local director owner of the Controller
        /// @param view
        ///     The view of the scene
        /// @param cameraController
        ///     The camera controller
        ///
        public StartupController(LocalDirector localDirector, StartupView view)
            : base(localDirector, view)
        {
            m_view = view;

            m_saveService = GlobalDirector.Service <SaveService>();

            m_audioService.PlayMusic(AudioIdentifiers.k_musicMain);

            m_fsm.RegisterStateCallback(k_stateLoad, EnterStateLoad, null, null);
            m_fsm.RegisterStateCallback(k_stateOutro, EnterStateOutro, null, null);
            m_fsm.ExecuteAction(k_actionNext);
        }
Пример #27
0
        public void SaveDocument_Saveable_ItemSaves()
        {
            // Arrange
            var saveable    = new SaveableItemStub();
            var saveService = new SaveService(Config);
            var fullPath    = RepositoryPath + '\\' + saveable.FileName;

            // Act
            saveService.SaveDocument(saveable);

            // Assert
            Assert.IsTrue(File.Exists(fullPath));
            Assert.AreEqual(saveable.FileContent, File.ReadAllText(fullPath));
        }
Пример #28
0
    /*
     * public static float voiceVolume = 0.5f;
     * public static float musicVolume = 0.5f;
     * public static float soundVolume = 0.5f;
     *
     * public static int actionPoints = 5;
     * public static bool running = false;
     *
     * public static int[] health = { 3, 3, 3 };
     * public static int[] focus = { 3, 3, 3 };
     *
     * private static int numGauze = 3;
     * private static int numSalts = 3;
     * public static int numFrag = 0;
     * public static int numSmoke = 0;*/

    // Start is called before the first frame update
    void Awake()
    {
        #if UNITY_EDITOR
        Screen.SetResolution(1920, 1080, false);
        QualitySettings.vSyncCount  = 0;     // VSync must be disabled
        Application.targetFrameRate = 45;
        #endif

        Screen.orientation = ScreenOrientation.LandscapeLeft;
        if (SaveService.loadedSave == null)
        {
            SaveService.loadedSave = SaveService.LoadData();
        }
    }
Пример #29
0
        public static bool SingIn(AuthData user)
        {
            var content = ContentCreator.CreateContent(user);
            HttpResponseMessage response = AdressList.GetHttpClient().PostAsync(AdressList.SingIn, content).Result;

            if (response.StatusCode == HttpStatusCode.OK)
            {
                MainUserCreator.PutUserToSystem(response);
                SaveService.SaveUser(user);
                return(true);
            }
            DialogMessage.ShowInfo("Logowanie nieudane!");
            return(false);
        }
Пример #30
0
        public ServiceDetail Send(SaveService saveService, AuthToken authToken)
        {
            SetAuthToken(saveService, authToken);

            try
            {
                return(soapClient.SaveService(saveService));
            }
            catch (UddiException uddiException)
            {
                AttemptRefreshAuthInfo(uddiException, authToken);

                return(soapClient.SaveService(saveService));
            }
        }
Пример #31
0
        /// <summary>
        ///   Publica serviciul cu informatiile specificate in campurile corespunzatoare (daca nu exista deja).
        /// </summary>
        public void performPublish()
        {
            String businessName = txbBusinessName.Text.Trim();
            String serviceName  = txbServiceName.Text.Trim();
            String accessPoint  = txbAccessPoint.Text.Trim();

            if (businessName == String.Empty || serviceName == String.Empty || accessPoint == String.Empty) {

                MessageBox.Show("All values must be set", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try {

                FindBusiness findBusiness = new FindBusiness(businessName);

                findBusiness.FindQualifiers.Add(FindQualifier.ExactNameMatch);

                BusinessList businessList = findBusiness.Send(uddiConnection);

                if (0 == businessList.BusinessInfos.Count) {

                    BusinessEntity newBusinessEntity   = new BusinessEntity(businessName);

                    BusinessService newBusinessService = new BusinessService(serviceName);

                    newBusinessEntity.BusinessServices.Add(newBusinessService);

                    BindingTemplate newBindingTemplate = new BindingTemplate();

                    newBindingTemplate.AccessPoint.Text    = accessPoint;
                    newBindingTemplate.AccessPoint.UrlType = UrlType.Http;

                    selectOntologyForNewBindingTemplate(newBindingTemplate);

                    newBusinessService.BindingTemplates.Add(newBindingTemplate);

                    SaveBusiness saveNewBusiness = new SaveBusiness(newBusinessEntity);

                    saveNewBusiness.Send(uddiConnection);
                }
                else {

                    MessageBox.Show("Business already exists");

                    GetBusinessDetail getBusinessDetail = new GetBusinessDetail(businessList.BusinessInfos[0].BusinessKey);

                    BusinessDetail businessDetail    = getBusinessDetail.Send(uddiConnection);

                    BusinessEntity oldBusinessEntity = businessDetail.BusinessEntities[0];

                    FindService findService = new FindService(serviceName);

                    findService.FindQualifiers.Add(FindQualifier.ExactNameMatch);

                    findService.BusinessKey = businessDetail.BusinessEntities[0].BusinessKey;

                    ServiceList serviceList = findService.Send(uddiConnection);

                    if (0 == serviceList.ServiceInfos.Count) {

                        BusinessService newBusinessService     = new BusinessService(serviceName);

                        oldBusinessEntity.BusinessServices.Add(newBusinessService);

                        BindingTemplate newBindingTemplate     = new BindingTemplate();

                        newBindingTemplate.AccessPoint.Text    = accessPoint;
                        newBindingTemplate.AccessPoint.UrlType = UrlType.Http;

                        selectOntologyForNewBindingTemplate(newBindingTemplate);

                        newBusinessService.BindingTemplates.Add(newBindingTemplate);

                        SaveBusiness saveOldBusiness = new SaveBusiness(oldBusinessEntity);

                        saveOldBusiness.Send(uddiConnection);
                    }
                    else {

                        MessageBox.Show("Service already exists");

                        GetServiceDetail getServiceDetail  = new GetServiceDetail(serviceList.ServiceInfos[0].ServiceKey);

                        ServiceDetail serviceDetail        = getServiceDetail.Send(uddiConnection);

                        BusinessService oldBusinessService = serviceDetail.BusinessServices[0];

                        foreach (BindingTemplate bindingTemplate in oldBusinessService.BindingTemplates) {

                            if (bindingTemplate.AccessPoint.Text == accessPoint) {

                                MessageBox.Show("Binding already exists");
                                return;
                            }
                        }

                        BindingTemplate newBindingTemplate     = new BindingTemplate();

                        newBindingTemplate.AccessPoint.Text    = accessPoint;
                        newBindingTemplate.AccessPoint.UrlType = UrlType.Http;

                        selectOntologyForNewBindingTemplate(newBindingTemplate);

                        oldBusinessService.BindingTemplates.Add(newBindingTemplate);

                        SaveService saveOldService = new SaveService(oldBusinessService);

                        saveOldService.Send(uddiConnection);
                    }
                }

                MessageBox.Show("Publish successful", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (UddiException e) {

                MessageBox.Show("Uddi error: "+ e.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception e){

                MessageBox.Show("General exception: " + e.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }