private void CreateNextRoom(int x, int y, Side side) { Creator.Create(x + side.X(), y + side.Y(), side); RoomData nextRoomData = DungeonManager.Dungeon.GetRoom(x + side.X(), y + side.Y()); if (nextRoomData == null) { CreateNextRoom(x, y, side); } else { if (!nextRoomData.Created && !nextRoomData.IsCreatingNextRooms) { nextRoomData.Create(x + side.X(), y + side.Y()); } } }
public void Validate(uint Price, string SKU, string Token, Action <bool, string> Callback) { try { string data = Requests.Get(string.Format(VALIDATE_URL, packageName, SKU, Token, accessToken)); ISerializeObject obj = Creator.Create <ISerializeObject>(data); bool isOK = (Convert.ToInt32(obj["consumptionState"]) == 0 && Convert.ToInt32(obj["purchaseState"]) == 0); Callback(isOK, ""); } catch (Exception ex) { Callback(false, ex.ToString()); } }
public static void Main(String[] args) { Validator validator = new Validator(new ArgumetsValid()); Creator creator = new Creator(new CreatorFileTXT()); try { validator.isValid(args); creator.Create(args, Resource.outputPath); } catch (arf_Exception exception) { Console.WriteLine($"my ex: {exception.Message}"); } catch (Exception exception) { Console.WriteLine(exception.Message); } }
/// <summary> /// エントリポイント /// </summary> /// <param name="args">$1:csvDirPath, $2:excelDirPath, $3:excelFileNameBase</param> public static void Main(string[] args) { // HACK: 引数この形でいいのか考える // 引数の取得とチェック #if DEBUG var csvDirPath = @"./Sample"; var excepDirPath = @"./Sample"; var excelBaseName = @"Excel"; #else if (args.Length != 3) { throw new Exception("引数が不正です($1:csvDirPath, $2:excelFilePath, $3:excelFileNameBase)。"); } var csvDirPath = args[0]; var excepDirPath = args[1]; var excelBaseName = args[2]; #endif if (!Directory.Exists(csvDirPath)) { throw new Exception("ディレクトリが見つかりません。" + csvDirPath); } if (!Directory.Exists(excepDirPath)) { throw new Exception("ディレクトリが見つかりません。" + excepDirPath); } var timestamp = DateTime.Now.ToString("yyyyMMddHHmmss"); var extension = ".xlsx"; var excelFilePath = Path.Combine(excepDirPath, excelBaseName + timestamp + extension); // 定義の読み込み var csvDef = CsvDef.ReadCsvDef(); var excelDef = ExcelDef.ReadExcelDef(); // csvの読み込み var csvList = Csv.ReadAllCsv(csvDirPath, csvDef); // excel出力 var creator = new Creator(excelFilePath, excelDef, csvList); creator.Create(); }
private ISerializeObject BuildMessage(string Title, string Message) { ISerializeObject messageObj = Creator.Create <ISerializeObject>(); ISerializeArray applications = messageObj.AddArray("applications"); applications.Add(packageName); ISerializeObject notification = messageObj.AddObject("notification"); notification["content"] = Message; if (!string.IsNullOrEmpty(Title)) { notification["title"] = Title; } return(messageObj); }
public void Validate(uint Price, string SKU, string Token, Action <bool, string> Callback) { try { Requests.HeaderMap headers = new Requests.HeaderMap(); headers["X-Access-Token"] = accessToken; string data = Requests.Get(string.Format(VALIDATE_URL, packageName, SKU, Token), headers); ISerializeObject obj = Creator.Create <ISerializeObject>(data); bool isOK = (Convert.ToInt32(obj["purchaseState"]) == 0); Callback(isOK, ""); } catch (Exception ex) { Callback(false, ex.ToString()); } }
public static string GetRefreshToken(string Code, string ClientID, string ClientSecret, string RedirectURI) { Requests.ParameterMap parameters = new Requests.ParameterMap(); parameters["grant_type"] = "authorization_code"; parameters["code"] = Code; parameters["client_id"] = ClientID; parameters["client_secret"] = ClientSecret; parameters["redirect_uri"] = RedirectURI; string data = Requests.Post(TOKEN_URL, null, parameters); ISerializeObject obj = Creator.Create <ISerializeObject>(data); if (obj.Contains("refresh_token")) { return(obj.Get <string>("refresh_token")); } return(""); }
private void GetAccessToken() { try { Requests.ParameterMap parameters = new Requests.ParameterMap(); parameters["grant_type"] = "refresh_token"; parameters["client_id"] = clientID; parameters["client_secret"] = clientSecret; parameters["refresh_token"] = refreshToken; string data = Requests.Post(TOKEN_URL, null, parameters); ISerializeObject obj = Creator.Create <ISerializeObject>(data); accessToken = obj["access_token"].ToString(); } catch { } }
private void newLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { ProjectCreateDialog pcd1 = new ProjectCreateDialog(); var dlg2 = pcd1.ShowDialog(); switch (dlg2) { case DialogResult.OK: welcomePanel.Visible = false; editorPanel.Visible = true; UnlockAll(); progress.Visible = true; _isProject = true; Creator.Create(ProjectCreationData.ProjCreationType, ProjectCreationData.ProjectDir, ProjectCreationData.ProjectName); break; case DialogResult.Cancel: break; } }
private void insertVehicle() { string licensePlate = m_UI.GetVehicleLicensePlate(); if (m_Data.Contains(licensePlate)) { m_UI.PrintMsg("The Vehicle Are Already Exists In The System"); handleAlreadyExistSituation(licensePlate); } else { Vehicle v = Creator.Create(m_UI.GetVehicleType()); v.LicensePlate = licensePlate; VehicleInfo vInfo = new VehicleInfo(v); insertVehicleDetails(vInfo); insertSpecificVehicleDetails(vInfo); insertEngineDetails(vInfo); m_Data.Insert(vInfo); m_UI.PrintMsg("\nThe Vehicle Insert Successfully \n"); } }
public static BasicObject CreateInstanceOf(string Type, Level level) { BasicObject NewObject = null; foreach (BasicObjectCreator Creator in BasicObjectCreator.BasicObjectTypes) { if (Type == Creator.MyObjectName) { if (!Creator.HasLoaded) { Creator.Create(); } NewObject = Creator.ReturnObject(); if (NewObject != null) { NewObject.CreatorString = Creator.MyObjectName; if (NewObject.GetType().Equals(typeof(TimeBasic))) { level.TimeEvents.Add((TimeBasic)NewObject); SetAsTime((TimeBasic)NewObject, Creator); } else { level.AddObject(NewObject); } } } } Console.Write(Type); return(NewObject); }
/// <summary> /// metodo que crea el mundo en Unity. /// </summary> /// <param name="providedAdapter"> recibe un IMainViewAdapter para crear el mundo. </param> public void Build(IMainViewAdapter providedAdapter) { this.adapter = providedAdapter ?? throw new ArgumentNullException(nameof(providedAdapter)); OneAdapter.Adapter = this.adapter; this.adapter.AfterBuild += this.AfterBuildShowFirstPage; Creator creator = new Creator(); try { creator.Create(); } catch (NotFoundOnXMLException e) { this.adapter.Debug(e.Message); } World world = Singleton <World> .Instance; foreach (Level level in world.ListLevel) { Creator.UnityPages.Add(level.Name, new List <string>()); foreach (Screen screen in level.ScreenList) { this.nextPageName = this.adapter.AddPage(); Creator.UnityPages[level.Name].Add(this.nextPageName); this.adapter.ChangeLayout(Layout.ContentSizeFitter); foreach (Element element in screen.ElementList) { IRenderer renderer = new Renderer(); element.Render(renderer); } } } }
static void Main(string[] args) { Database db = new MySQLDatabase("localhost", "root", "!QAZ2wsx", "bourse_analyzer"); MigrationManager.Migrate(db, null, null); long num = 1000; object obj = Activator.CreateInstance(typeof(Number), num); test t = new test(); ISerializeObject d = Creator.Serialize <ISerializeObject>(t); test f = Creator.Bind <test>(Creator.Create <ISerializeObject>(d.Content)); BufferStream buff = new BufferStream(new byte[10000]); Serializer.Serialize(f, buff); buff.ResetRead(); f = Serializer.Deserialize <test>(buff); }
public static void Load() { foreach (CreatorBasic Creator in AllCreators) { Creator.Create(); if (Creator.Catagory != null && !Creator.Catagory.Equals("")) { bool CatagoryTaken = false; foreach (string Cat in Catagories) { if (Cat.Equals(Creator.Catagory)) { CatagoryTaken = true; } } if (!CatagoryTaken) { Catagories.Add(Creator.Catagory); } } } }
// Create a WebRequest. // // This is the main creation routine. We take a Uri object, look // up the Uri in the prefix match table, and invoke the appropriate // handler to create the object. We also have a parameter that // tells us whether or not to use the whole Uri or just the // scheme portion of it. // // Input: // requestUri - Uri object for request. // useUriBase - True if we're only to look at the scheme portion of the Uri. // // Returns: // Newly created WebRequest. private static WebRequest Create(Uri requestUri, bool useUriBase) { string LookupUri; WebRequestPrefixElement?Current = null; bool Found = false; if (!useUriBase) { LookupUri = requestUri.AbsoluteUri; } else { // schemes are registered as <schemeName>":", so add the separator // to the string returned from the Uri object LookupUri = requestUri.Scheme + ':'; } int LookupLength = LookupUri.Length; // Copy the prefix list so that if it is updated it will // not affect us on this thread. List <WebRequestPrefixElement> prefixList = PrefixList; // Look for the longest matching prefix. // Walk down the list of prefixes. The prefixes are kept longest // first. When we find a prefix that is shorter or the same size // as this Uri, we'll do a compare to see if they match. If they // do we'll break out of the loop and call the creator. for (int i = 0; i < prefixList.Count; i++) { Current = prefixList[i]; // See if this prefix is short enough. if (LookupLength >= Current.Prefix.Length) { // It is. See if these match. if (string.Compare(Current.Prefix, 0, LookupUri, 0, Current.Prefix.Length, StringComparison.OrdinalIgnoreCase) == 0) { // These match. Remember that we found it and break // out. Found = true; break; } } } if (Found) { // We found a match, so just call the creator and return what it does. WebRequest webRequest = Current !.Creator.Create(requestUri); return(webRequest); } // Otherwise no match, throw an exception. throw new NotSupportedException(SR.net_unknown_prefix); }
private void Backup() { string BackupTypeError = "IPS"; original = label3.Text; modified = label1.Text; output = label2.Text; string Time = string.Format("{0:yyyy-MM-dd_hh.mm.ss.tt}", DateTime.Now); try { if (radioButton1.Checked == true) { //IPS BackupTypeError = "IPS"; Creator creator = new Creator(); creator.Create(original, modified, output + @"/" + Path.GetFileNameWithoutExtension(label1.Text) + "_" + Time + "_" + ".ips"); } else if (radioButton2.Checked == true) { //UPS byte[] original2 = null, modified2 = null; try { BinaryReader br = new BinaryReader(File.OpenRead(original)); original2 = br.ReadBytes((int)br.BaseStream.Length); br.Close(); } catch (Exception) { MessageBox.Show("Error opening file\n" + original); return; } try { BinaryReader br = new BinaryReader(File.Open(modified, FileMode.Open)); modified2 = br.ReadBytes((int)br.BaseStream.Length); br.Close(); } catch (Exception) { MessageBox.Show("Error opening file\n" + modified); return; } BackupTypeError = "UPS"; UPSfile upsFile = new UPSfile(original2, modified2); upsFile.writeToFile(output + "//" + Path.GetFileNameWithoutExtension(label1.Text) + "_" + Time + "_" + ".ups"); } else if (radioButton3.Checked == true) { //BAK BackupTypeError = "BAK"; string fileName = Path.GetFileNameWithoutExtension(label1.Text); File.Copy(label1.Text, label2.Text + "//" + fileName + "_" + Time + "_" + ".bak"); } } catch { ErrorNotification(original, modified, output, BackupTypeError); } }
public IButton CreateButton() { return(_button.Create()); }
public ICheckBox CreateCheckBox() { return(_checkBox.Create()); }
private void Awake() { spawnCounter = Random.Range(minSpawnTime, maxSpawnTime); Enemy newEnemy = Creator.Create(enemyPrefab.gameObject).GetComponent <Enemy>(); }
//Создать файл private void CreateButtonClick(Object Sender, RoutedEventArgs Args) { Worker.Create(); }
public void Create(Uri uri, IEnumerable <byte> data) { Creator.Create(uri, data); }
public LocalDalContext() { Pictures = Creator <LocalDbSet <PictureModel> > .Create(); }
ISerializeObject ISerializeObject.Clone() { return(Creator.Create <ISerializeObject>(((ISerializeData)this).Content)); }
ISerializeArray ISerializeArray.Clone() { return(Creator.Create <ISerializeArray>(((ISerializeData)this).Content)); }
private bool MustCompile() { if (!File.Exists(EnvironmentHelper.FinalOutputDirectory + SelectedRule.TargetName + GetExtension(this))) { return(true); } string hashesFilePath = intermediateModulePath + HashesFileName; ISerializeObject hashesData = null; if (File.Exists(hashesFilePath)) { hashesData = Creator.Create <ISerializeObject>(File.ReadAllText(hashesFilePath)); } if (hashesData == null) { hashesData = Creator.Create <ISerializeObject>(); } bool result = false; string configurationTypeName = typeof(ProjectBase.ProfileBase.BuildConfigurations).Name; if (!hashesData.Contains(configurationTypeName) || hashesData.Get <int>(configurationTypeName) != (int)BuildSystem.BuildConfiguration) { result = true; } hashesData.Set(configurationTypeName, (int)BuildSystem.BuildConfiguration); string platformTypeName = typeof(ProjectBase.ProfileBase.PlatformTypes).Name; if (!hashesData.Contains(platformTypeName) || hashesData.Get <int>(platformTypeName) != (int)BuildSystem.PlatformType) { result = true; } hashesData.Set(platformTypeName, (int)BuildSystem.PlatformType); if (!result) { List <string> extensions = new List <string>(); extensions.AddRange(EnvironmentHelper.HeaderFileExtensions); extensions.AddRange(EnvironmentHelper.CompileFileExtensions); extensions.AddRange(EnvironmentHelper.CSharpFileExtensions); string[] files = FileSystemUtilites.GetAllFiles(sourcePathRoot, extensions.ToArray()); foreach (string file in files) { string filePathHash = GetHash(file).ToString(); int contentHash = GetHash(File.ReadAllText(file)); if (hashesData.Contains(filePathHash) && hashesData.Get <int>(filePathHash) == contentHash) { continue; } hashesData.Set(filePathHash, contentHash); result = true; } } File.WriteAllText(hashesFilePath, hashesData.Content); return(result); }