private void BtnGetStore_Click(object sender, System.EventArgs e) { try { LstStoreCats.Items.Clear(); TxtName.Text = ""; TxtSubscription.Text = ""; TxtDescription.Text = ""; GetStoreCall apicall = new GetStoreCall(Context); StoreType store = apicall.GetStore(); TxtName.Text = store.Name; TxtSubscription.Text = store.SubscriptionLevel.ToString(); TxtDescription.Text = store.Description; foreach (StoreCustomCategoryType cat in store.CustomCategories) { string[] listparams = new string[2]; listparams[0] = cat.CategoryID.ToString(); listparams[1] = cat.Name; ListViewItem vi = new ListViewItem(listparams); LstStoreCats.Items.Add(vi); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void StoreOpened_StoreTypeTest( [Values(StoreType.Premium, StoreType.Soft)] StoreType storeType ) { Assert.DoesNotThrow(() => m_Result = AnalyticsEvent.StoreOpened(storeType)); EvaluateAnalyticsResult(m_Result); }
public void Tip( [Argument("STORE-TYPE")] StoreType storeType, [Argument("STORE-PATH")] string storePath) { if (!Directory.Exists(storePath)) { throw new CommandExitedException($"The given STORE-PATH, {storePath} seems not existed.", -1); } const int minimumDifficulty = 5000000, maximumTransactions = 100; IStagePolicy <NCAction> stagePolicy = new VolatileStagePolicy <PolymorphicAction <ActionBase> >(); IBlockPolicy <NCAction> blockPolicy = new BlockPolicySource(Logger.None).GetPolicy(minimumDifficulty, maximumTransactions); IStore store = storeType.CreateStore(storePath); Block <NCAction> genesisBlock = store.GetGenesisBlock <NCAction>(); BlockChain <NCAction> chain = new BlockChain <NCAction>( blockPolicy, stagePolicy, store, new NoOpStateStore(), genesisBlock); _console.Out.WriteLine(JsonSerializer.Serialize(chain.Tip.Header)); }
/// <summary> /// Initializes a new instance of the StoreLocation class. /// </summary> /// <param name="latitude">Latitude.</param> /// <param name="longitude">Longitude.</param> /// <param name="storeName">Store name.</param> /// <param name="storeType">Store type.</param> public StoreLocation(double latitude, double longitude, string storeName, StoreType storeType) { this.Latitude = latitude; this.Longitude = longitude; this.StoreName = storeName; this.StoreType = storeType; }
public static AnalyticsResult StoreOpened(StoreType storeType, IDictionary <string, object> eventData = null) { m_EventData.Clear(); m_EventData.Add("type", EnumToString(storeType)); AddCustomEventData(eventData); return(Custom("store_opened", m_EventData)); }
public void SaveBonesValue(StoreType id, KneadType type) { switch (type) { case KneadType.PosX: mPosition[(int)id].x = transform.localPosition.x; break; case KneadType.PosY: mPosition[(int)id].y = transform.localPosition.y; break; case KneadType.PosZ: mPosition[(int)id].z = transform.localPosition.z; break; case KneadType.Rotation: mRotation[(int)id] = transform.localRotation; break; case KneadType.ScaleX: mScale[(int)id].x = transform.localScale.x; break; case KneadType.ScaleY: mScale[(int)id].y = transform.localScale.y; break; case KneadType.ScaleZ: mScale[(int)id].z = transform.localScale.z; break; } }
public float GetBonesValue(StoreType id, KneadType type) { switch (type) { case KneadType.PosX: return(mPosition[(int)id].x); case KneadType.PosY: return(mPosition[(int)id].y); case KneadType.PosZ: return(mPosition[(int)id].z); case KneadType.ScaleX: return(mScale[(int)id].x); case KneadType.ScaleY: return(mScale[(int)id].y); case KneadType.ScaleZ: return(mScale[(int)id].z); default: return(0.0f); } }
public static List <T> ReadListFromStore <T>(string fileName, StoreType store, out string strError) { List <T> entities = null; try { fileName += FileExtension; var fullPath = Path.Combine(GetFolderPath(store), fileName); if (File.Exists(fullPath)) { var data = FileIoHelper.ReadFromTextFile(fullPath, out strError); entities = SerializationHelper.DeserializeFromJsonString <List <T> >(data); } else { strError = "Le fichier spécifié n'existe pas"; } } catch (Exception e) { strError = ExceptionHelper.GetMessageFromException(e); //ElLogger.LogError(strError); } return(entities ?? new List <T>()); }
public static string GetFolderPath(StoreType store) { var path = ""; switch (store) { case StoreType.Config: path = ConfigPath; break; case StoreType.Log: path = LogPath; break; case StoreType.Operation: path = OperationPath; break; case StoreType.Derogation: path = DerogationPath; break; case StoreType.Other: break; default: path = OtherPath; break; } return(path); }
protected virtual void StartBuildMode(GameObject pPrefab, int pCost, StoreType type = StoreType.PLATFORM) { if (_placement.BuildModeActivated) { return; } if (type == StoreType.SUPPLYSTORE && !BM.CanBuildMoreStores()) { print("cannot build more stores"); return; } else if (type == StoreType.PLATFORM && !BM.CanBuildMoreTracks()) { print("cannot build more tracks"); return; } //check if building can be paid for, but do not pay yet if (FC.PayBuildingCost(pCost)) { _placement.ActivateBuildmode(pPrefab, pCost); OnBuildModeActivated(); } else { print("not enough moneyz"); } }
public UpdateStoreCommand(string name, string description, string address, StoreType type) { Name = name; Description = description; Address = address; Type = type; }
public StoreEditableInfo(string name, string description, string address, StoreType type) { Name = name; Description = description; Address = address; Type = type; }
/// <summary> /// Sets the configuration of the eBay store owned by the caller. /// </summary> /// /// <param name="Store"> /// Specifies the Store configuration that is being set for the user. /// </param> /// public void SetStore(StoreType Store) { this.Store = Store; Execute(); }
public async Task <OperationDetails> DeleteStoreTypeAsync(StoreTypeDto storeTypeDto) { if (storeTypeDto == null) { Logger.Error("Something went wrong"); return(new OperationDetails(false, "Something went wrong", "StoreType")); } StoreType storeType = await unitOfWork.StoreTypeRepository.GetByIdAsync(storeTypeDto.Id); if (storeType == null) { Logger.Error("Store type not found"); return(new OperationDetails(false, "Store type not found", "StoreType")); } try { await unitOfWork.StoreTypeRepository.DeleteAsync(storeType); await unitOfWork.SaveAsync(); Logger.Info("Successfully deleted"); return(new OperationDetails(true)); } catch (Exception ex) { Logger.Error(ex.Message); return(new OperationDetails(false, ex.Message)); } }
public async Task <bool> Delete(StoreType StoreType) { if (await ValidateId(StoreType)) { } return(StoreType.IsValidated); }
public void TestOneToMany() { string storeTypeName = "ST1"; StoreType st1 = new StoreType(); st1.Name = storeTypeName; Store s1 = new Store(); s1.Code = "S01"; s1.StoreType = st1; Store s2 = new Store(); s2.Code = "S02"; s2.StoreType = st1; UnitOfWork uow = new UnitOfWork(); uow.Save(st1); uow.Save(s1); uow.Save(s2); uow.Commit(); st1.Refresh(); Assert.IsNotNull(st1.Stores); Assert.AreEqual(2, st1.Stores.Count); }
public async Task GetStoreTypeByIdAsync_When_Correct_Should_return_StoreDto() { //arrange StoreTypeDto storeTypeDto = new StoreTypeDto { Id = 0, Name = "Test store" }; StoreType storeType = new StoreType { Id = 0, Name = "Test store" }; storeTypeRepository.Setup(x => x.GetByIdAsync(0)).ReturnsAsync(storeType); mapper.Setup(x => x.Map <StoreType, StoreTypeDto>(storeType)).Returns(storeTypeDto); //act var actualResult = await storeTypeService.GetStoreTypeByIdAsync(storeTypeDto.Id); //assert actualResult.Should().BeEquivalentTo(storeTypeDto); storeTypeRepository.Verify(x => x.GetByIdAsync(storeTypeDto.Id), Times.Once); }
public void ProcessJob(TaskScheduling task) { ServicesAdministrationServiceClient adminClient = new ServicesAdministrationServiceClient(true); List <StoreType> storeTypes = adminClient.LoadAllStoreTypes(); adminClient.LoadAllIdentityStores().ForEach((IdentityStore store) => { if (store.get_StoreType() == null) { StoreType storeType = storeTypes.Find((StoreType st) => st.get_StoreTypeId() == store.get_StoreTypeId()); if (storeType != null) { store.set_StoreType(storeType); } } this.ReplicateStore(store); }); try { ActionResult result = (new ServicesAdministrationServiceClient(true)).EnsureSchemaLinkAttributeIsUptoDate(); Helper.LogDebugResults(SchemaReplicationProcessor.logger, result, "Schema link attribute update "); } catch (Exception exception1) { Exception exception = exception1; string message = string.Concat("Error occurred while updating the schema link attribute. Reason: ", exception.Message); LogExtension.LogException(SchemaReplicationProcessor.logger, message, exception); } SchemaReplicationProcessor.logger.InfoFormat("Job processed successfully.", Array.Empty <object>()); }
public async Task <OperationDetails> AddStoreTypeAsync(StoreTypeDto storeTypeDto) { if (storeTypeDto == null) { Logger.Error("Something went wrong"); return(new OperationDetails(false, "Something went wrong", "StoreType")); } StoreType storeType = mapper.Map <StoreTypeDto, StoreType>(storeTypeDto); try { if (unitOfWork.StoreTypeRepository.GetByName(storeType.Name) != null) { Logger.Error("A Store type with this name already exists"); return(new OperationDetails(false, "A Store type with this name already exists", "StoreType")); } await unitOfWork.StoreTypeRepository.CreateAsync(storeType); await unitOfWork.SaveAsync(); Logger.Info("Successfully added"); return(new OperationDetails(true)); } catch (Exception ex) { Logger.Error(ex.Message); return(new OperationDetails(false, "Unfortunately, something went wrong....", "StoreType")); } }
private void RemoveFromStore(Dictionary <string, HashSet <byte[]> > hashes, StoreType storeType, CancellationToken ct, bool emptyAfterCommit, OperationProgress progress) { try { ParallelOptions o = new ParallelOptions(); o.CancellationToken = ct; o.MaxDegreeOfParallelism = Debugger.IsAttached ? 1 : -1; progress.FlushStoreInProgress = true; progress.FlushStoreTotal = hashes.Count; progress.FlushStorePosition = 0; progress.FlushStoreStartTime = DateTime.Now; Parallel.ForEach(hashes, o, group => { this.RemoveFromStore(group.Value, group.Key, storeType, progress); progress.IncrementFlushStorePosition(); if (emptyAfterCommit) { group.Value.Clear(); } }); } finally { progress.FlushStoreInProgress = false; } }
public void AddToStore(byte[] hash, StoreType storeType) { HashSet <byte[]> hashset = new HashSet <byte[]>(ByteArrayComparer.Comparer); hashset.Add(hash); this.AddToStore(hashset, storeType, new CancellationToken(), new OperationProgress()); }
public void ToStoreConstructor(StoreType storeType, Type expectedType) { IStore store = storeType.CreateStore(_storePath); Assert.IsType(expectedType, store); (store as IDisposable)?.Dispose(); }
public async Task UpdateStoreTypeAsync_When_Update_StoreType_Should_Return_Exception() { //arrange var expectedResult = new OperationDetails(false, "Exception message"); StoreTypeDto storeTypeDto = new StoreTypeDto { Id = 0, Name = "Test store" }; StoreType storeType = new StoreType { Id = 0, Name = "Test store" }; mapper.Setup(x => x.Map <StoreTypeDto, StoreType>(storeTypeDto)).Returns(storeType); storeTypeRepository.Setup(x => x.UpdateAsync(storeType)).Throws(new Exception("Exception message")); //act var actualResult = await storeTypeService.UpdateStoreTypeAsync(storeTypeDto); //assert actualResult.Should().BeEquivalentTo(expectedResult); }
public AD7Property(string name, AD7ProgramNode node, RoutineScope rs, bool readOnly) { Debug.WriteLine("AD7Property ctor (string,AD7ProgramNode,RoutineScope,bool)"); Name = name; _node = node; _rs = rs; _readOnly = readOnly; TypeName = null; StoreType st; if (_node.Debugger.Debugger.ScopeVariables.TryGetValue(name, out st)) { TypeName = _node.Debugger.Debugger.ScopeVariables[name].Type; if (numberTypeMax.ContainsKey(TypeName) && st.Unsigned) { TypeName += " unsigned"; } } Value = GetValue(name); if (TypeName == null) { // an heuristic to find out an expression type. TypeName = StoreType.InferTypeExpression(Value); } }
public async Task AddStoreTypeAsync_When_Duplication_Name_Store_Should_Return_StoreType_Already_Exists() { //arrange var expectedResult = new OperationDetails(false, "A Store type with this name already exists", "StoreType"); StoreTypeDto storeTypeDto = new StoreTypeDto { Id = 0, Name = "Test store" }; StoreType storeType = new StoreType { Id = 0, Name = "Test store" }; mapper.Setup(x => x.Map <StoreTypeDto, StoreType>(storeTypeDto)).Returns(storeType); storeTypeRepository.Setup(x => x.GetByName(storeType.Name)).Returns(storeType); //act var actualResult = await storeTypeService.AddStoreTypeAsync(storeTypeDto); //assert actualResult.Should().BeEquivalentTo(expectedResult); }
static void Main(string[] args) { var context = NewApiContext(Settings.Default.eBayURI, Settings.Default.eBayToken); //var apiCall = new GeteBayOfficialTimeCall(context); var apiCall = new SetStoreCall(context); //var time = apiCall.GeteBayOfficialTime(); //var options = apiCall.GetStoreOptions(); var store = new StoreType() { Description = "Test Store", Name = "Test Store", SubscriptionLevel = StoreSubscriptionLevelCodeType.Basic, Theme = new StoreThemeType() { ThemeID = 1 } }; apiCall.SetStore(store); var addCall = new AddFixedPriceItemCall(context); addCall.AddFixedPriceItem(item); //Console.WriteLine(time); //Console.WriteLine(options); Console.ReadKey(); }
public async Task <ActionResult> Post([FromBody] StoreType storeType) { context.StoreTypes.Add(storeType); await context.SaveChangesAsync(); return(new CreatedAtRouteResult("GetStoreType", new { id = storeType.StoreTypeId }, storeType)); }
public async Task <OperationDetails> UpdateStoreTypeAsync(StoreTypeDto storeTypeDto) { if (storeTypeDto == null) { Logger.Error("Something went wrong"); return(new OperationDetails(false, "Something went wrong", "StoreType")); } StoreType storeType = mapper.Map <StoreTypeDto, StoreType>(storeTypeDto); try { await unitOfWork.StoreTypeRepository.UpdateAsync(storeType); await unitOfWork.SaveAsync(); Logger.Info("Successfully updated"); return(new OperationDetails(true)); } catch (Exception ex) { Logger.Error(ex.Message); return(new OperationDetails(false, ex.Message)); } }
public void Tip( [Argument("STORE-TYPE")] StoreType storeType, [Argument("STORE-PATH")] string storePath) { if (!Directory.Exists(storePath)) { throw new CommandExitedException($"The given STORE-PATH, {storePath} seems not existed.", -1); } IStagePolicy <NCAction> stagePolicy = new VolatileStagePolicy <PolymorphicAction <ActionBase> >(); IBlockPolicy <NCAction> blockPolicy = new BlockPolicySource(Logger.None).GetPolicy(); IStore store = storeType.CreateStore(storePath); var stateStore = new TrieStateStore(new DefaultKeyValueStore(null)); Block <NCAction> genesisBlock = store.GetGenesisBlock <NCAction>(blockPolicy.GetHashAlgorithm); BlockChain <NCAction> chain = new BlockChain <NCAction>( blockPolicy, stagePolicy, store, stateStore, genesisBlock); _console.Out.WriteLine(Utils.SerializeHumanReadable(chain.Tip.Header)); (store as IDisposable)?.Dispose(); }
public void Simple_operations(StoreType storeType) { _store = StoreFactory.CreateStore(storeType, _storagePath, 2000, 1); var data1 = Enumerable.Repeat((byte)13, 1500).ToArray(); var p1 = _store.StoreNewDocument(data1); var data2 = Enumerable.Repeat((byte)17, 100).ToArray(); var p2 = _store.StoreNewDocument(data2); var d1 = _store.LoadDocument(p1); Assert.AreEqual(1500, d1.Length); Assert.IsTrue(d1.All(d => d == 13)); var d2 = _store.LoadDocument(p2); Assert.AreEqual(100, d2.Length); Assert.IsTrue(d2.All(d => d == 17)); _store.Dispose(); _store = StoreFactory.CreateStore(StoreType.PlainFile, _storagePath); d1 = _store.LoadDocument(p1); Assert.AreEqual(1500, d1.Length); Assert.IsTrue(d1.All(d => d == 13)); d2 = _store.LoadDocument(p2); Assert.AreEqual(100, d2.Length); Assert.IsTrue(d2.All(d => d == 17)); }
public void SetStoreCategories() { // Skip if the user is not store enabled. if (TestData.Store == null) return; SetStoreCategoriesCall api = new SetStoreCategoriesCall(this.apiContext); // Build the StoreType object. StoreType st = new StoreType(); st.Description = TestData.Store.Description; st.Logo = TestData.Store.Logo; st.MerchDisplay = TestData.Store.MerchDisplay; st.Name = TestData.Store.Name; api.Action = StoreCategoryUpdateActionCodeType.Add; api.DestinationParentCategoryID = 1234; api.ItemDestinationCategoryID = 4321; StoreCustomCategoryTypeCollection catArray = new StoreCustomCategoryTypeCollection(); api.StoreCategoryList = catArray; StoreCustomCategoryType cat = new StoreCustomCategoryType(); catArray.Add(cat); cat.CategoryID = 102; cat.Name = "TestStoreCategory"; // Make API call. ApiException gotException = null; // Negative test. try { api.Execute(); } catch (ApiException ex) { gotException = ex; } Assert.IsNotNull(gotException); }
public async Task DeleteStoreTypeAsync_When_StoreType_Null_Should_Return_StoreType_Not_Found() { //arrange var expectedResult = new OperationDetails(false, "Store type not found", "StoreType"); StoreTypeDto storeTypeDto = new StoreTypeDto { Id = 0, Name = "Test store" }; StoreType storeType = new StoreType { Id = 0, Name = "Test store" }; mapper.Setup(x => x.Map <StoreTypeDto, StoreType>(storeTypeDto)).Returns(storeType); //act var actualResult = await storeTypeService.DeleteStoreTypeAsync(storeTypeDto); //arrange actualResult.Should().BeEquivalentTo(expectedResult); }
internal PurchasedProduct(StoreType storeType, string cotcProductId, string internalProductId, float paidPrice, string paidCurrency, string receipt, string token) { StoreType = storeType; CotcProductId = cotcProductId; InternalProductId = internalProductId; PaidPrice = paidPrice; PaidCurrency = paidCurrency; Receipt = receipt; Token = token; }
public Store(ProjectSIA.Store dbStore) { Id = dbStore.id; Name = dbStore.name; BeginDate = dbStore.beginDate; EndDate = dbStore.endDate; Type = dbStore.type.ParseEnum<StoreType>(); Rule = dbStore.rule.ParseEnum<StoreRule>(); Value = dbStore.value; }
protected override AdminService CreateAdminService(StoreType storeType) { IServiceFactory serviceFactory = null; if (storeType == StoreType.Memory) { serviceFactory = new MemoryServiceFactory(); } else if (storeType == StoreType.FileSystem) { serviceFactory = new FileSystemServiceFactory(TestPath); } return new TcpAdminService(serviceFactory, Local, NetworkPassword); }
/// <summary> /// Last step in the purchase. Validates the receipt received by a native purchase. You may have to do additional /// steps to close your purchase process. /// </summary> /// <returns>Promise indicating whether the recceipt was validated properly. In case of exception, you can inspect why /// the receipt failed to verify.</returns> /// <param name="storeType">Type of Store, should be provided by the store plugin. Valid are appstore, macstore, googleplay.</param> /// <param name="cotcProductId">ID of the product purchased (as configured on the backoffice).</param> /// <param name="paidPrice">Paid price in units.</param> /// <param name="paidCurrency">Currency of paid price (ISO code).</param> /// <param name="receipt">Receipt string, dependent on the store type.</param> public Promise<ValidateReceiptResult> ValidateReceipt(StoreType storeType, string cotcProductId, float paidPrice, string paidCurrency, string receipt) { HttpRequest req = Gamer.MakeHttpRequest("/v1/gamer/store/validateReceipt"); Bundle data = Bundle.CreateObject(); data["store"] = storeType.ToString().ToLower(); data["productId"] = cotcProductId; data["price"] = paidPrice; data["currency"] = paidCurrency; data["receipt"] = receipt; req.BodyJson = data; return Common.RunInTask<ValidateReceiptResult>(req, (response, task) => { task.PostResult(new ValidateReceiptResult(response.BodyJson)); }); }
public IsolatedStorageFileAdapter(StoreType storeType) { switch (storeType) { case StoreType.Application: wrappedSubject = IsolatedStorageFile.GetUserStoreForApplication(); break; case StoreType.Assembly: wrappedSubject = IsolatedStorageFile.GetMachineStoreForAssembly(); break; default: throw new ArgumentOutOfRangeException("storeType"); } }
public void SetStore() { // Skip if the user is not store enabled. if( TestData.Store == null ) return; SetStoreCall api = new SetStoreCall(this.apiContext); // Build the StoreType object. StoreType st = new StoreType(); st.Description = TestData.Store.Description; st.Logo = TestData.Store.Logo; st.MerchDisplay = TestData.Store.MerchDisplay; st.Name = TestData.Store.Name; // Make API call. api.SetStore(st); }
/// <summary> 행사장, 거래처 만들기 </summary> public static Contents.Store CreateStore(string name, DateTime beginDate, DateTime endDate, StoreType storeType) { try { Contents.Store store = null; using (var db = DB.Context) { using (var transaction = new TransactionScope()) { store = StoreManager.CreateStore(db, name, beginDate, endDate, storeType, StoreRule.None, 0); transaction.Complete(); } } return store; } catch (AutistarException ex) { ex.Message.WriteLog(); return null; } }
public IBeverage GetCoffee(StoreType storeType, BeverageType beverageType) { IBeverage coffee = null; switch(storeType) { case StoreType.RegularStore : switch (beverageType) { case BeverageType.HouseBlend: coffee = new HouseBlend(); break; case BeverageType.Roast: coffee = new DarkRoast(); break; } break; case StoreType.ExoticStore: switch (beverageType) { case BeverageType.HouseBlend: coffee = new SpecialHouseBlend(); break; case BeverageType.Roast: coffee = new AmazonRoast(); break; } break; } return coffee; }
public BinaryCollectionTest(StoreType storeType) : base(storeType) { }
private void BtnSetStore_Click(object sender, System.EventArgs e) { try { TxtStatus.Text = ""; SetStoreCall apicall = new SetStoreCall(Context); StoreType store = new StoreType(); if (TxtName.Text != String.Empty) store.Name = TxtName.Text; if (TxtDescription.Text != String.Empty) store.Description = TxtDescription.Text; if (TxtHeader.Text != String.Empty) store.CustomHeader = TxtHeader.Text; if (CboLayout.SelectedIndex > 0) { store.ItemListLayout = (StoreItemListLayoutCodeType) Enum.Parse(typeof(StoreItemListLayoutCodeType), CboLayout.SelectedItem.ToString()); } if (CboSort.SelectedIndex > 0) { store.ItemListSortOrder = (StoreItemListSortOrderCodeType) Enum.Parse(typeof(StoreItemListSortOrderCodeType), CboSort.SelectedItem.ToString()); } apicall.SetStore(store); TxtStatus.Text = apicall.ApiResponse.Ack.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
protected ShardedDataTestBase(StoreType storeType) { this.storeType = storeType; }
protected static void RunBuild(BuildTarget target, BuildOptions options, StoreType store) { ClearLog(); AppInfo.CheckForDefaults(); string buildLocation = GetBuildDirectory(target, store); string buildFile = GetBuildFile(target); Debug.Log(string.Format("[BUILD] [{0} : {1}] Started @ {2:MM/dd/yy hh:mm:ss}", store.ToString(), target.ToString(), DateTime.Now)); BuildCreateFolder(buildLocation, buildFile, target); BuildUnityProject(target, options, store, buildLocation, buildFile); BuildCopyIncludes(target, store); BuildZip(buildLocation, buildFile, target, store); Debug.Log(string.Format("[BUILD] [{0} : {1}] Completed @ {2:MM/dd/yy hh:mm:ss}.", store.ToString(), target.ToString(), DateTime.Now)); }
private void downloadTitle(string titleId, string titleVersion, string outputDir, StoreType[] storeTypes) { fireDebug("Downloading Title {0} v{1}...", titleId, (string.IsNullOrEmpty(titleVersion)) ? "[Latest]" : titleVersion); if (storeTypes.Length < 1) { fireDebug(" No store types were defined..."); throw new Exception("You must at least define one store type!"); } string titleUrl = string.Format("{0}{1}/", nusUrl, titleId); bool storeEncrypted = false; bool storeDecrypted = false; bool storeWad = false; fireProgress(0); foreach (StoreType st in storeTypes) { switch (st) { case StoreType.DecryptedContent: fireDebug(" -> Storing Decrypted Content..."); storeDecrypted = true; break; case StoreType.EncryptedContent: fireDebug(" -> Storing Encrypted Content..."); storeEncrypted = true; break; case StoreType.WAD: fireDebug(" -> Storing WAD..."); storeWad = true; break; case StoreType.All: fireDebug(" -> Storing Decrypted Content..."); fireDebug(" -> Storing Encrypted Content..."); fireDebug(" -> Storing WAD..."); storeDecrypted = true; storeEncrypted = true; storeWad = true; break; } } fireDebug(" Checking for Internet connection..."); if (!CheckInet()) { fireDebug(" Connection not found..."); throw new Exception("You're not connected to the internet!"); } if (outputDir[outputDir.Length - 1] != Path.DirectorySeparatorChar) outputDir += Path.DirectorySeparatorChar; if (!Directory.Exists(outputDir)) Directory.CreateDirectory(outputDir); string tmdFile = "tmd" + (string.IsNullOrEmpty(titleVersion) ? string.Empty : string.Format(".{0}", titleVersion)); //Download TMD fireDebug(" Downloading TMD..."); try { wcNus.DownloadFile(titleUrl + tmdFile, outputDir + tmdFile); } catch (Exception ex) { fireDebug(" Downloading TMD Failed..."); throw new Exception("Downloading TMD Failed:\n" + ex.Message); } fireProgress(5); //Download cetk fireDebug(" Downloading Ticket..."); try { wcNus.DownloadFile(titleUrl + "cetk", outputDir + "cetk"); } catch (Exception ex) { if (!continueWithoutTicket || !storeEncrypted) { fireDebug(" Downloading Ticket Failed..."); throw new Exception("Downloading Ticket Failed:\n" + ex.Message); } storeDecrypted = false; storeWad = false; } fireProgress(10); //Parse TMD and Ticket fireDebug(" Parsing TMD..."); TMD tmd = TMD.Load(outputDir + tmdFile); if (string.IsNullOrEmpty(titleVersion)) { fireDebug(" -> Title Version: {0}", tmd.TitleVersion); } fireDebug(" -> {0} Contents", tmd.NumOfContents); fireDebug(" Parsing Ticket..."); Ticket tik = Ticket.Load(outputDir + "cetk"); string[] encryptedContents = new string[tmd.NumOfContents]; //Download Content for (int i = 0; i < tmd.NumOfContents; i++) { fireDebug(" Downloading Content #{0} of {1}... ({2} bytes)", i + 1, tmd.NumOfContents, tmd.Contents[i].Size); fireProgress(((i + 1) * 60 / tmd.NumOfContents) + 10); if (useLocalFiles && File.Exists(outputDir + tmd.Contents[i].ContentID.ToString("x8"))) { fireDebug(" Using Local File, Skipping..."); continue; } try { wcNus.DownloadFile(titleUrl + tmd.Contents[i].ContentID.ToString("x8"), outputDir + tmd.Contents[i].ContentID.ToString("x8")); encryptedContents[i] = tmd.Contents[i].ContentID.ToString("x8"); } catch (Exception ex) { fireDebug(" Downloading Content #{0} of {1} failed...", i + 1, tmd.NumOfContents); throw new Exception("Downloading Content Failed:\n" + ex.Message); } } //Decrypt Content if (storeDecrypted || storeWad) { SHA1 s = SHA1.Create(); for (int i = 0; i < tmd.NumOfContents; i++) { fireDebug(" Decrypting Content #{0} of {1}...", i + 1, tmd.NumOfContents); fireProgress(((i + 1) * 20 / tmd.NumOfContents) + 75); //Decrypt Content byte[] decryptedContent = decryptContent(File.ReadAllBytes(outputDir + tmd.Contents[i].ContentID.ToString("x8")), i, tik, tmd); Array.Resize(ref decryptedContent, (int)tmd.Contents[i].Size); //Check SHA1 byte[] newSha = s.ComputeHash(decryptedContent); if (!Shared.CompareByteArrays(newSha, tmd.Contents[i].Hash)) { fireDebug(@"/!\ /!\ /!\ Hashes do not match /!\ /!\ /!\"); throw new Exception(string.Format("Content #{0}: Hashes do not match!", i)); } //Write Decrypted Content File.WriteAllBytes(outputDir + tmd.Contents[i].ContentID.ToString("x8") + ".app", decryptedContent); } s.Clear(); } //Pack Wad if (storeWad) { fireDebug(" Building Certificate Chain..."); CertificateChain cert = CertificateChain.FromTikTmd(outputDir + "cetk", outputDir + tmdFile); byte[][] contents = new byte[tmd.NumOfContents][]; for (int i = 0; i < tmd.NumOfContents; i++) contents[i] = File.ReadAllBytes(outputDir + tmd.Contents[i].ContentID.ToString("x8") + ".app"); fireDebug(" Creating WAD..."); WAD wad = WAD.Create(cert, tik, tmd, contents); wad.Save(outputDir + tmd.TitleID.ToString("x16") + "v" + tmd.TitleVersion.ToString() + ".wad"); } //Delete not wanted files if (!storeEncrypted) { fireDebug(" Deleting Encrypted Contents..."); for (int i = 0; i < encryptedContents.Length; i++) if (File.Exists(outputDir + encryptedContents[i])) File.Delete(outputDir + encryptedContents[i]); } if (storeWad && !storeDecrypted) { fireDebug(" Deleting Decrypted Contents..."); for (int i = 0; i < encryptedContents.Length; i++) if (File.Exists(outputDir + encryptedContents[i] + ".app")) File.Delete(outputDir + encryptedContents[i] + ".app"); } if (!storeDecrypted && !storeEncrypted) { fireDebug(" Deleting TMD and Ticket..."); File.Delete(outputDir + tmdFile); File.Delete(outputDir + "cetk"); } fireDebug("Downloading Title {0} v{1} Finished...", titleId, (string.IsNullOrEmpty(titleVersion)) ? "[Latest]" : titleVersion); fireProgress(100); }
private static string GetBuildStoreDirectory(StoreType store) { string buildLocation = Path.GetFullPath(Application.dataPath + "/../../Builds/"); //if (store != StoreType.None) //{ // buildLocation += string.Format("{0}/", store.ToString()); //} //else //{ // buildLocation += "NoStore/"; //} return Path.GetFullPath(buildLocation); }
private static void BuildUnityProject(BuildTarget target, BuildOptions options, StoreType store, string buildLocation, string buildFile) { PlayerSettings.companyName = AppInfo.companyName; PlayerSettings.productName = AppInfo.longName; PlayerSettings.bundleIdentifier = AppInfo.appleBundleId; PlayerSettings.bundleVersion = AppInfo.fullVersion; List<string> buildScenes = new List<string>(scenes); // if you need to define multiple symbols, separate them with a semicolon (;) string defineSymbols = "STORE_" + store.ToString().ToUpper(); // generally want player logs enabled in case something weird happens and we can get some // info from it. just don't be stupid with logging debug stuff on release. PlayerSettings.usePlayerLog = true; // platform specific options if (target == BuildTarget.Android) { PlayerSettings.defaultInterfaceOrientation = UIOrientation.LandscapeRight; PlayerSettings.Android.minSdkVersion = AndroidSdkVersions.AndroidApiLevel9; //PlayerSettings.Android.keystorePass = ""; //PlayerSettings.Android.keyaliasName = ""; //PlayerSettings.Android.keyaliasPass = ""; // ensure the versioncode increases by 1, for Google Play, this is important if you're building // multiple APKs per release. PlayerSettings.Android.bundleVersionCode += 1; PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, defineSymbols); } else if (target.ToString().Contains("Standalone")) { PlayerSettings.useMacAppStoreValidation = false; PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, defineSymbols); } else if (target == BuildTarget.iOS) { PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS, defineSymbols); } // store-specific options if (store == StoreType.MacAppStore) { // Mac App Store is very picky about where applications can write to, and I've been told that people // have failed certification when they left usePlayerLog on. Since dealing with all of the permissions // and whatnot on MAS is enough of a pain, I'm going to trust them and disable it. PlayerSettings.useMacAppStoreValidation = true; PlayerSettings.usePlayerLog = false; } string buildResult = BuildPipeline.BuildPlayer(buildScenes.ToArray(), buildLocation + buildFile, target, options); // error logs if (!string.IsNullOrEmpty(buildResult)) { Debug.LogError(buildResult); } else { Debug.Log("[BUILD] Unity Build Successful."); } }
protected PathTestBase(StoreType storeType) : base(storeType) { }
protected NetworkServiceTestBase(StoreType storeType) : base(storeType) { }
private static void BuildZip(string buildLocation, string buildFile, BuildTarget target, StoreType store) { string zipBuildDestination = GetBuildStoreDirectory(store); // we don't zip up APKs, because simply posting them to the web allows devices to install them from a link. // so for android, we simply copy the file to a versioned name. if (target == BuildTarget.Android) { string versionedName = string.Format("{0}.{1}_{2}.apk", buildFile.Substring(0, buildFile.Length - 4), AppInfo.buildDate, AppInfo.buildCount); FileTools.CopyTo(buildLocation + buildFile, zipBuildDestination + versionedName); } else { //string zipFile = string.Format("{0}.{1}_{2}.zip", target.ToString().Replace("Standalone", ""), AppInfo.buildDate, AppInfo.buildCount); string zipFile = "card-war.zip"; FileTools.ZipDirectory(buildLocation, zipBuildDestination, zipFile); } using (FileStream fs = File.Create(Path.Combine(zipBuildDestination, "version.json"))) { StreamWriter sw = new StreamWriter(fs); //sw.WriteLine("Hello world!"); sw.Write(Newtonsoft.Json.JsonConvert.SerializeObject(new { version = AppInfo.fullVersion, date = DateTime.Now })); sw.Close(); } }
private static string GetBuildDirectory(BuildTarget target, StoreType store) { string buildLocation = GetBuildStoreDirectory(store); if (target == BuildTarget.StandaloneWindows) { buildLocation += "Windows/"; } else if (target == BuildTarget.StandaloneOSXIntel) { buildLocation += "Mac/"; } else if (target == BuildTarget.StandaloneLinux) { buildLocation += "Linux/"; } else if (target == BuildTarget.iOS) { buildLocation += "iOS/"; } else if (target == BuildTarget.Android) { buildLocation += "Android/"; } return Path.GetFullPath(buildLocation); }
public static Store CreateStore(ProjectSIAEntities db, string name, DateTime beginDate, DateTime endDate, StoreType type, StoreRule rule, double value) { using (var wl = new WriteLock()) { if (endDate <= beginDate) throw new AutistarException("종료일이 시작일보다 빠릅니다."); var newStore = db.Store.Add(new ProjectSIA.Store { name = name, beginDate = beginDate, endDate = endDate, type = type.ToString(), rule = rule.ToString(), value = value }); var rows = db.SaveChanges(); if (rows != 1) throw new AutistarException("행사장(거래처) 추가 중 DB 작업이 실패했습니다."); var store = new Store(newStore); _storeList.Add(store); return store; } }
private static string GetBuildIncludesDirectory(BuildTarget target, StoreType store) { string buildLocation = Path.GetFullPath(Application.dataPath + "/../../BuildIncludes/"); if (store != StoreType.None) { buildLocation += string.Format("{0}/", store.ToString()); } else { buildLocation += "NoStore/"; } if (target == BuildTarget.StandaloneWindows) { buildLocation += "Windows/"; } else if (target == BuildTarget.StandaloneOSXIntel) { buildLocation += "Mac/"; } else if (target == BuildTarget.StandaloneLinux) { buildLocation += "Linux/"; } else if (target == BuildTarget.iOS) { buildLocation += "iOS/"; } else if (target == BuildTarget.Android) { buildLocation += "Android/"; } return buildLocation; }
internal List<StoreLocation> GetStores( double upperLeftLat, double upperLeftLong, double lowerRightLat, double lowerRightLong, StoreType storeType) { List<StoreLocation> locations = new List<StoreLocation>(); StreamResourceInfo streamInfo = Application.GetResourceStream( new Uri("/Map;component/DynamicLayer/StoresLocation.xml", UriKind.Relative)); XmlDocument document = new XmlDocument(); document.Load(streamInfo.Stream); string latLonCondition = "[number(@Latitude) < " + upperLeftLat.ToString(CultureInfo.InvariantCulture) + " and number(@Latitude) > " + lowerRightLat.ToString(CultureInfo.InvariantCulture) + " and number(@Longitude) > " + upperLeftLong.ToString(CultureInfo.InvariantCulture) + " and number(@Longitude) < " + lowerRightLong.ToString(CultureInfo.InvariantCulture) + "]"; switch (storeType) { case StoreType.Area: { XmlNodeList nodeList = document.SelectNodes("/StoresLocation/Area" + latLonCondition); foreach (XmlNode node in nodeList) { XmlElement element = (XmlElement)node; locations.Add(new StoreLocation( Convert.ToDouble(element.GetAttribute("Latitude"), CultureInfo.InvariantCulture), Convert.ToDouble(element.GetAttribute("Longitude"), CultureInfo.InvariantCulture), element.GetAttribute("Name"), StoreType.Area)); } } break; case StoreType.Store: { XmlNodeList nodeList = document.SelectNodes("/StoresLocation/Area/*" + latLonCondition); foreach (XmlNode node in nodeList) { XmlElement element = (XmlElement)node; locations.Add(new StoreLocation( Convert.ToDouble(element.GetAttribute("Latitude"), CultureInfo.InvariantCulture), Convert.ToDouble(element.GetAttribute("Longitude"), CultureInfo.InvariantCulture), element.GetAttribute("Name"), element.LocalName == "Market" ? StoreType.Market : StoreType.Store)); } } break; } return locations; }
protected override AdminService CreateAdminService(StoreType storeType) { return new FakeAdminService(storeType); }
public StringDataTest(StoreType storeType) : base(storeType) { }
// copy everything in the BuildIncludes directory over into the proper directories, overwriting files if they already exist. private static void BuildCopyIncludes(BuildTarget target, StoreType store) { string buildLocation = GetBuildDirectory(target, store); string buildIncludeLocation = GetBuildIncludesDirectory(target, store); if (Directory.Exists(buildIncludeLocation)) FileTools.CopyAll(buildIncludeLocation, buildLocation); }
protected static void PushToDropbox(StoreType store) { //Debug.Log("Hello world!"); string storePath = GetBuildStoreDirectory(store); string dbBasePath = FileTools.GetDropboxPath(); //string dbStoreFolder = store == StoreType.None ? "NoStore" : store.ToString(); string dbPath = string.Format("{0}/GameBuilds/{1}/", dbBasePath, AppInfo.shortName); //string dbArchivePath = dbPath + "Archive/"; if (!Directory.Exists(dbBasePath)) { Debug.LogError("[ERROR] Dropbox path doesn't exist."); return; } int archiveCount = 0; int buildFileCount = 0; if (!Directory.Exists(dbPath)) Directory.CreateDirectory(dbPath); //if (!Directory.Exists(dbArchivePath)) // Directory.CreateDirectory(dbArchivePath); // move zip and version to build string[] extensions = new string[] { "*.zip", "*.json"}; foreach (string ext in extensions) { // move all current build zips to our build folder string[] buildFiles = Directory.GetFiles(storePath, ext, SearchOption.TopDirectoryOnly); buildFileCount += buildFiles.Length; foreach (string file in buildFiles) { string filename = Path.GetFileName(file); string extension = Path.GetExtension(filename); //int endIndex = filename.LastIndexOf(".", filename.Length - extension.Length - 1); //string prefix = filename.Substring(0, endIndex); // remove .YYMMDD_V.XXX // move all current build files to our archive folder. //string[] dbFiles = Directory.GetFiles(dbPath, "*", SearchOption.TopDirectoryOnly); //foreach (string dbFile in dbFiles) //{ // //string destFile = dbArchivePath + Path.GetFileName(dbFile); // //if (File.Exists(destFile)) // // File.Delete(destFile); // //File.Move(dbFile, destFile); // ++archiveCount; //} File.Copy(file, dbPath + Path.GetFileName(file), true); } } Debug.Log(string.Format("[BUILD] {0} file(s) copied to Dropbox. ({1} file(s) archived.)", buildFileCount, archiveCount)); }
/// <summary> /// <para>Performs the membership method: /// Retrieve a member’s profile data /// using the "query" string provided - should be the "Member/{member_id}/Profile.xml" part of the url. /// It shouldn't include "http://api.trademe.co.nz/v1/". /// </para> /// DOES NOT REQUIRE AUTHENTICATION. /// </summary> /// <param name="searchString">The string to search for.</param> /// <param name="page">The page number you would like to retrieve.</param> /// <param name="category">The category the search is in.</param> /// <param name="storeType">The type of store.</param> /// <returns>Stores</returns> public Stores SearchStores(string searchString = "", int page = 1, string category = "", StoreType storeType = StoreType.Normal) { if (_search == null) { _search = new SearchMethods(_connection); } return _search.SearchStores(searchString, page, category, storeType); }