/** * @brief Generator 객체 생성 */ private void OnEnable() { if (genPlanet == null) { genPlanet = VoxelPlanetGenerator.GetPlanetGenerator(); } if (genTerrainInfo == null) { genTerrainInfo = new TerrainInfo(); } if (genCloudInfo == null) { genCloudInfo = new CloudInfo(); } if (fillArea == null) { fillArea = new FillArea(); } if (noiseArea == null) { noiseArea = new NoiseArea(); } }
public Result <Bitmap> DrawTag(ReaderSettings readerSettings, DrawerSettings drawerSettings, LayouterSettings layouterSettings) { var words = wordsProvider.GetObjectSource(readerSettings); if (!words.IsSuccess) { return(Result.Fail <Bitmap>(words.Error)); } var frequency = frequencyProvider.GetFrequencyDictionary(words.Value); var orderedSource = frequency.OrderByDescending(kv => kv.Value) .Take(readerSettings.MaxObjectsCount).ToList(); var sizableSource = sizableProvider.GetSizableSource(orderedSource, drawerSettings); var drawableWordSource = drawableProvider.GetDrawableSource(sizableSource, layouterSettings); if (!drawableWordSource.IsSuccess) { return(Result.Fail <Bitmap>(drawableWordSource.Error)); } var cloudInfo = new CloudInfo(drawableWordSource.Value); var bitmap = drawer.GetBitmap(cloudInfo, drawerSettings); return(bitmap); }
/** * @function GenerateTerrain(행성 이름, 구름 구성정보, 구형 생성 Flag) * @brief 구름을 생성한다. */ public void GenerateClouds(string planetName, CloudInfo info, bool isSphere) { if (info == null) { return; } //행성 정보 재구성 var voxelPlanet = InitVoxelPlanet(planetName); var planetInfo = voxelPlanet.GetComponent <VoxelPlanetInfo>(); planetInfo.Init(planetName); planetInfo.isSphere = isSphere; //구름 생성 정보 재구성 planetInfo.cloudInfo = info.DeepCopy(); //구름 오브젝트 초기화 GameObject objClouds = InitPlanetObject(voxelPlanet, "Clouds"); var compClouds = objClouds.AddComponent <VoxelClouds>(); compClouds.planetInfo = planetInfo; //청크 생성 EditorCoroutineRunner.StartEditorCoroutine(compClouds.BuildChunk()); SaveCurrentPlanetInfo(voxelPlanet); }
/** * @brief 생성자, Planet의 Terrain, Clouds 생성정보를 기록 * @param info : planet info, tfTerrain : 지형 오브젝트, tfClouds : 구름 오브젝트 */ public SavePlanet(VoxelPlanetInfo info, Transform tfTerrain, Transform tfClouds) { if (info == null) { return; } this.name = info.name; this.isSphere = info.isSphere; if (tfTerrain != null) { this.terrainInfo = info.terrainInfo; } if (tfClouds != null) { this.cloudsInfo = info.cloudInfo; } modifyList = info.modifyList; if (info.modifyAreaObject.Count != 0) { areaObjPath = new List <string>(); foreach (KeyValuePair <string, GameObject> pair in info.modifyAreaObject) { areaObjPath.Add(pair.Key); } } }
public OptionViewModel(MainViewModel parentModel) { this.ParentModel = parentModel; var AppOpt = ParentModel.AppModel.AppSetting; AppVer = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); IsStartUp = AppOpt.IsStartUpApp; IsRightNow = AppOpt.IsInstantSend; IsEnableESC = AppOpt.IsESCClose; DisplayTime = AppOpt.RemainDis; CompanyID = AppOpt.CompanyID; HospitalName = AppOpt.PCName; var info = ParentModel.AppModel.S3Info; CloudInfoModel = new CloudInfo() { StorageName = info.StorageName, StoragePath = info.StoragePath, SecretKey = info.SecretKey, PrivateKey = info.PrivateKey }; CmdSave = new RelayCommand(SaveCommand); CmdConfirm = new RelayCommand(ConfirmCommand); CmdCancel = new RelayCommand(CancelCommand); }
public void AddCloud(AvailableCloud selectedItem) { var name = selectedItem.Name; var letters = VirtualDriveWrapper.GetFreeDriveLettes(); if (letters.Count == 0) { throw new InvalidOperationException("No free letters"); } if (Clouds.Any(c => c.CloudInfo.Name == name)) { int i = 1; while (Clouds.Any(c => c.CloudInfo.Name == name + " " + i)) { i++; } name = name + " " + i; } var info = new CloudInfo { Id = Guid.NewGuid().ToString(), Name = name, ClassName = selectedItem.ClassName, AssemblyFileName = selectedItem.AssemblyFileName, DriveLetter = letters[0] }; var mount = new CloudMount(info, this); Clouds.Add(mount); SaveClouds(); }
public Result <Bitmap> GetBitmap(CloudInfo cloudInfo, DrawerSettings drawerSettings) { var heightCoefficient = (float)cloudInfo.SizeOfCloud.Height / (drawerSettings.Height - Border); var widthCoefficient = (float)cloudInfo.SizeOfCloud.Width / (drawerSettings.Width - Border); var biggestCoefficient = Math.Max(heightCoefficient, widthCoefficient); var bitmap = PrepareBitmap(drawerSettings); if (!bitmap.IsSuccess) { return(bitmap); } var graphics = PrepareGraphics(bitmap.Value, cloudInfo, drawerSettings.BackgroundColor, biggestCoefficient); foreach (var drawable in cloudInfo.DrawableSource) { using var currentFont = new Font(drawerSettings.TextFont.FontFamily, (int)Math.Round(drawable.Place.Height / (biggestCoefficient * 2))); var currentPlace = new PointF(drawable.Place.X / biggestCoefficient, drawable.Place.Y / biggestCoefficient); graphics.DrawString(drawable.Value, currentFont, drawerSettings.TextBrush, currentPlace); } return(bitmap); }
private void UpdateSettingsV1() { var settings = Gui.Properties.Settings.Default; if (settings.Clouds != null && settings.Clouds.Count > 0) { return; } var versionsPath = Environment.ExpandEnvironmentVariables("%LOCALAPPDATA%\\Rambalac\\ACD.DokanNet.Gui.exe_Url_3nx2g2l53nrtm2p32mr11ar350hkhmgy"); var topVersion = Directory.GetDirectories(versionsPath).OrderByDescending(s => Path.GetFileName(s)).FirstOrDefault(); if (topVersion == null) { return; } var config = Path.Combine(topVersion, "user.config"); XmlDocument doc = new XmlDocument(); doc.Load(config); var authinfo = new AmazonCloudDrive.AuthInfo { AuthToken = doc.SelectSingleNode("//setting[@name='AuthToken']/value").InnerText, AuthRenewToken = doc.SelectSingleNode("//setting[@name='AuthRenewToken']/value").InnerText, AuthTokenExpiration = DateTime.Parse(doc.SelectSingleNode("//setting[@name='AuthTokenExpiration']/value").InnerText) }; var readOnly = bool.Parse(doc.SelectSingleNode("//setting[@name='ReadOnly']/value").InnerText); var letter = doc.SelectSingleNode("//setting[@name='LastDriveLetter']/value").InnerText[0]; var cloudinfo = new CloudInfo { Id = Guid.NewGuid().ToString(), Name = "Amazon Cloud Drive", ClassName = "Azi.Cloud.AmazonCloudDrive.AmazonCloud", AssemblyFileName = "Clouds.AmazonCloudDrive.dll", DriveLetter = letter, ReadOnly = readOnly, AuthSave = JsonConvert.SerializeObject(authinfo) }; settings.Clouds = new CloudInfoCollection(new CloudInfo[] { cloudinfo }); var cacheFolder = Environment.ExpandEnvironmentVariables(settings.CacheFolder); var newPath = Path.Combine(cacheFolder, UploadService.UploadFolder, cloudinfo.Id); Directory.CreateDirectory(newPath); var files = Directory.GetFiles(Path.Combine(cacheFolder, UploadService.UploadFolder)); foreach (var file in files) { File.Move(file, Path.Combine(newPath, Path.GetFileName(file))); } }
public void SetAccountInfo(CloudInfo accountInfo) { s3Client = new AmazonS3Client( accountInfo.SecretKey, aes.GetDeCryptString(accountInfo.PrivateKey), RegionEndpoint.APNortheast2); fileTransferUtility = new TransferUtility(s3Client); SetBucketName(accountInfo.StorageName, accountInfo.StoragePath); }
/** * @brief Load된 정보로 Planet정보 구성 * @param loadInfo : Load된 정보 */ public void ReLoadInfo(SavePlanet loadInfo) { if (loadInfo == null) { return; } Init(loadInfo.name); isSphere = loadInfo.isSphere; modifyList = new Dictionary <WorldPos, List <ModifyArea> >(loadInfo.modifyList); //Area Object 정보를 구성하고 생성한다. if (loadInfo.areaObjPath != null) { foreach (var objPath in loadInfo.areaObjPath) { if (modifyAreaObject.ContainsKey(objPath)) { if (modifyAreaObject[objPath] != null) { continue; } } var obj = Instantiate(Resources.Load(objPath), Vector3.zero, Quaternion.Euler(Vector3.zero)) as GameObject; //생성된 Object는 참조 할 때만 활성화 obj.SetActive(false); //렌더 비활성화. var mesh = obj.GetComponent <MeshRenderer>(); if (mesh != null) { mesh.enabled = false; } //인스펙터에서 숨긴다. obj.hideFlags = HideFlags.HideInHierarchy; modifyAreaObject[objPath] = obj; } } if (loadInfo.terrainInfo != null) { terrainInfo = loadInfo.terrainInfo.DeepCopy(); } if (loadInfo.cloudsInfo != null) { cloudInfo = loadInfo.cloudsInfo.DeepCopy(); } }
private Graphics PrepareGraphics(Bitmap bitmap, CloudInfo cloudInfo, Color backgroundColor, float coefficient) { var graphics = Graphics.FromImage(bitmap); graphics.Clear(backgroundColor); graphics.TranslateTransform(Border / 2 - cloudInfo.TranslateTransform.X / coefficient, Border / 2 - cloudInfo.TranslateTransform.Y / coefficient); return(graphics); }
/// <summary> /// Return whatever we currently have. If we don't have anything, /// try to figure it out. /// </summary> /// <returns></returns> public static string GetCloudApiRoot() { // We have a value, use it... if (m_cloudinfoCurrent != null) { return(m_cloudinfoCurrent.szUrl); } // See if the user gave us anything... m_lcloudinfo.Clear(); int ii = 0; string szCloudName; string szCloudUrl; string szCloudManager; string szCloudSignin; string szCloudFolderName; string szCloudUseHttps; string szTwainCloudExpressFolder; for (szCloudUrl = Config.Get("cloudApiRoot[" + ii + "].url", ""); !string.IsNullOrEmpty(szCloudUrl); szCloudUrl = Config.Get("cloudApiRoot[" + ++ii + "].url", "")) { szCloudName = Config.Get("cloudApiRoot[" + ii + "].name", szCloudUrl); szCloudManager = Config.Get("cloudApiRoot[" + ii + "].manager", ""); szCloudSignin = Config.Get("cloudApiRoot[" + ii + "].signin", ""); szCloudFolderName = Config.Get("cloudApiRoot[" + ii + "].folderName", "mycloud"); szCloudUseHttps = Config.Get("cloudApiRoot[" + ii + "].useHttps", Config.Get("useHttps", "yes")); szTwainCloudExpressFolder = Config.Get("cloudApiRoot[" + ii + "].twainCloudExpressFolder", ""); if (!string.IsNullOrEmpty(szTwainCloudExpressFolder) && !Directory.Exists(szTwainCloudExpressFolder)) { Log.Error("Unable to locate twainCloudExpressFolder, so ignoring this setting: " + szTwainCloudExpressFolder); szTwainCloudExpressFolder = ""; } m_lcloudinfo.Add(new CloudInfo(szCloudName, szCloudUrl, szCloudManager, szCloudSignin, szCloudFolderName, szCloudUseHttps, szTwainCloudExpressFolder)); } // Use whatever has been baked into the app... if (m_lcloudinfo.Count == 0) { m_lcloudinfo.Add(new CloudInfo(ConfigurationManager.AppSettings["CloudName"], ConfigurationManager.AppSettings["CloudApiRoot"], ConfigurationManager.AppSettings["CloudManager"], ConfigurationManager.AppSettings["CloudSignin"], ConfigurationManager.AppSettings["CloudFolderName"], ConfigurationManager.AppSettings["CloudUseHttps"], "")); } // Grab the first value, if the user's configured us... if ((m_lcloudinfo.Count > 0) && !string.IsNullOrEmpty(m_lcloudinfo[0].szUrl)) { m_cloudinfoCurrent = new CloudInfo(m_lcloudinfo[0].szName, m_lcloudinfo[0].szUrl, m_lcloudinfo[0].szManager, m_lcloudinfo[0].szSignin, m_lcloudinfo[0].szFolderName, m_lcloudinfo[0].szUseHttps, m_lcloudinfo[0].szTwainCloudExpressFolder); return(m_cloudinfoCurrent.szUrl); } // Ruh-roh... return("we have a problem"); }
public void PutNextRectangle_HasOptimalRectanglesLocations_OnManyRectangles() { const int accuracy = 40; var sizes = GetSizableList(50, 50); var drawableSource = cloudLayouter.GetDrawableSource(sizes, settings); var info = new CloudInfo(drawableSource.Value); var radius = Math.Max(center.LengthTo(info.RightUpperPointOfCloud), center.LengthTo(info.LeftDownPointOfCloud)); var sumOfRectanglesSquares = cloudLayouter.Rectangles.Select(r => r.Width * r.Height).Sum(); var squareOfCircle = Math.PI * radius * radius; var isOptimal = sumOfRectanglesSquares / squareOfCircle * 100 < accuracy; isOptimal.Should().BeTrue(); }
private void InitializeClouds() { _globalCloud = new CloudInfo(Cloud.Global); _linklocalCloud = new CloudInfo(Cloud.AllLinkLocal); _clouds = new ObservableCollection <CloudInfo>(); foreach (Cloud cloud in Cloud.GetAvailableClouds()) { _clouds.Add(new CloudInfo(cloud)); } _readonlyClouds = new ReadOnlyObservableCollection <CloudInfo>(_clouds); _scopedClouds = new ObservableCollection <CloudInfo>(); _readonlyScopedClouds = new ReadOnlyObservableCollection <CloudInfo>(_scopedClouds); }
private static string Get(CloudInfo cloudInfo) { StringBuilder ret = new StringBuilder(); if (cloudInfo.IsNSC) { ret.Append(R.NoSignificantCloud); } else if (cloudInfo.IsSKC) { ret.Append(R.SkyClear); } else if (cloudInfo.IsCLR) { ret.Append(R.SkyClear); } else if (cloudInfo.IsVerticalVisibility) { if (cloudInfo.VVDistance.HasValue) { ret.Append(R.VerticalVisibility + R.Space + cloudInfo.VVDistance.Value); } else { ret.Append(R.VerticalVisibility + R.Space + R.Unknown); } } else { foreach (var fItem in cloudInfo) { ret.Append(Get(fItem) + R.Comma); } } ret.Append(R.Dot); return(ret.ToString()); }
public static void SetCloudApiRoot(string a_szCloudName) { int ii; // Nope... if (string.IsNullOrEmpty(a_szCloudName)) { return; } // See if we have a match... for (ii = 0; ii < m_lcloudinfo.Count; ii++) { if (m_lcloudinfo[ii].szName == a_szCloudName) { m_cloudinfoCurrent = new CloudInfo(m_lcloudinfo[ii].szName, m_lcloudinfo[ii].szUrl, m_lcloudinfo[ii].szManager, m_lcloudinfo[ii].szSignin, m_lcloudinfo[ii].szFolderName, m_lcloudinfo[ii].szUseHttps, m_lcloudinfo[ii].szTwainCloudExpressFolder); return; } } // No joy, so make an entry... m_cloudinfoCurrent = new CloudInfo(a_szCloudName, a_szCloudName, "", "", "mycloud", "yes", ""); }
public void ListComments() { CloudInfo props = RunTest(CloudInfo.GetProperties(Api, Settings.Username + "/Documents", CloudInfo.Properties.FileId)); ShowList(Comment.List(Api, props.FileId)); }
private void InitializeClouds() { _globalCloud = new CloudInfo(Cloud.Global); _linklocalCloud = new CloudInfo(Cloud.AllLinkLocal); _clouds = new ObservableCollection<CloudInfo>(); foreach (Cloud cloud in Cloud.GetAvailableClouds()) _clouds.Add(new CloudInfo(cloud)); _readonlyClouds = new ReadOnlyObservableCollection<CloudInfo>(_clouds); _scopedClouds = new ObservableCollection<CloudInfo>(); _readonlyScopedClouds = new ReadOnlyObservableCollection<CloudInfo>(_scopedClouds); }
static public CloudInfo[] GetClouds() { int retval = 0; ArrayList clouds = new ArrayList(); WsaQuerySet querySet = new WsaQuerySet(); CriticalLookupHandle hLookup; PnrpCloudInfo cloudInfo = new PnrpCloudInfo(); cloudInfo.dwSize = Marshal.SizeOf(typeof(PnrpCloudInfo)); cloudInfo.Cloud.Scope = PnrpScope.Any; cloudInfo.dwCloudState = (PnrpCloudState)0; cloudInfo.Flags = PnrpCloudFlags.None; querySet.NameSpace = NspNamespaces.Cloud; querySet.NSProviderId = NsProviderCloud; querySet.ServiceClassId = SvcIdCloud; querySet.Blob = cloudInfo; WsaQuerySetSafe native = WsaQuerySet.ToWsaQuerySetSafe(querySet); using (native) { CriticalAllocHandle handle = CriticalAllocHandleWsaQuerySetSafe.FromWsaQuerySetSafe(native); retval = WSALookupServiceBegin(handle, WsaNspControlFlags.ReturnAll, out hLookup); } if (retval != 0) { // unable to start the enumeration SocketException exception = new SocketException(WSAGetLastError()); Utility.CloseInvalidOutCriticalHandle(hLookup); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(exception); } // start with a sensible default size int size = Marshal.SizeOf(typeof(WsaQuerySetSafe)) + 200; //wrap in CriticalAllocHandle when PAYLOAD is enabled CriticalAllocHandle nativeQuerySetPtr = CriticalAllocHandle.FromSize(size); using (hLookup) { while (true) { retval = WSALookupServiceNext(hLookup, 0, ref size, (IntPtr)nativeQuerySetPtr); if (retval != 0) { int error = WSAGetLastError(); if (error == (int)WsaError.WSAENOMORE || error == (int)WsaError.WSA_E_NO_MORE) { // no more break; } if (error == (int)WsaError.WSAEFAULT) { // buffer too small, allocate a bigger one of the specified size if (nativeQuerySetPtr != null) { nativeQuerySetPtr.Dispose(); nativeQuerySetPtr = null; } //wrap in CriticalAllocHandle when PAYLOAD is enabled nativeQuerySetPtr = CriticalAllocHandle.FromSize(size); continue; } // unexpected error throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SocketException(error)); } else { if (nativeQuerySetPtr != IntPtr.Zero) { // marshal the results into something usable WsaQuerySet resultQuerySet = PeerNameResolver.MarshalWsaQuerySetNativeToWsaQuerySet(nativeQuerySetPtr, 0); // extract out the friendly cloud attributes CloudInfo resultCloudInfo = new CloudInfo(); PnrpCloudInfo prnpCloudInfo = (PnrpCloudInfo)resultQuerySet.Blob; resultCloudInfo.Name = resultQuerySet.ServiceInstanceName; resultCloudInfo.Scope = prnpCloudInfo.Cloud.Scope; resultCloudInfo.ScopeId = prnpCloudInfo.Cloud.ScopeId; resultCloudInfo.State = prnpCloudInfo.dwCloudState; resultCloudInfo.Flags = prnpCloudInfo.Flags; // add it to the list to return later clouds.Add(resultCloudInfo); } } } } // package up the results into a nice array return (CloudInfo[])clouds.ToArray(typeof(CloudInfo)); }
public CloudMount(CloudInfo info, ViewModel model) { this.model = model; cloudInfo = info; cloudInfo.PropertyChanged += CloudInfoChanged; }
protected CloudInfo(CloudInfo copyThis) : base(copyThis) { this.groundFromDist = copyThis.groundFromDist; this.densityHeight = copyThis.densityHeight; this.densityWidth = copyThis.densityWidth; }