Esempio n. 1
1
        public static void LocalizeControl(Control control, ResourceManager resourceManager)
        {
            if ((resourceManager == null) || (control == null))
                return;

            string text = null;
            //Text of Control proper
            try
            {
                text = resourceManager.GetString(control.GetType().Namespace.Replace(".", "_") + "_" + control.GetType().Name + "_Text");
                if (!string.IsNullOrEmpty(text))
                    control.Text = text;
            }
            catch (System.Resources.MissingManifestResourceException)
            {
                //just ignore
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Error when localizing: " + control.Name + ":\r\n" + ex.ToString());
            }

            //the Controls owned by this control
            FieldInfo[] fis = control.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
            foreach (FieldInfo fi in fis)
            {
                LocalizeField(control, resourceManager, fi, "Text");
                LocalizeField(control, resourceManager, fi, "Caption");
            }
        }
        public ActionResult GetResourcesJavaScript(string resxFileName)
        {
            ResourceManager resourceManager = null;
            switch (resxFileName.ToLower())
            {
                case "globalsresource":
                    {
                        resourceManager = new ResourceManager("ControleFinanceiro.CORE.Resources.GlobalsResource", typeof(GlobalsResource).Assembly);
                        break;
                    }
                case "labelsresource":
                    {
                        resourceManager = new ResourceManager("ControleFinanceiro.CORE.Resources.LabelsResource", typeof(LabelsResource).Assembly);
                        break;
                    }
                case "messagesresource":
                    {
                        resourceManager = new ResourceManager("ControleFinanceiro.CORE.Resources.MessagesResource", typeof(MessagesResource).Assembly);
                        break;
                    }
            }

            if(resourceManager != null)
            {
                var resourceSet = resourceManager.GetResourceSet(CultureInfo.CurrentUICulture, true, true);

                var resourceDictionary = resourceSet.Cast<DictionaryEntry>()
                                    .ToDictionary(entry => entry.Key.ToString(), entry => entry.Value.ToString());

                var json = Serializer.Serialize(resourceDictionary);
                var javaScript = string.Format("window.Resources = window.Resources || {{}}; window.Resources.{0} = {1};", resxFileName, json);
                return JavaScript(javaScript);
            }
            return JavaScript("");
        }
Esempio n. 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="resourceType"></param>
 /// <returns></returns>
 public static ResourceManager GetManager(Type resourceType)
 {
     if (cache.ContainsKey(resourceType)) return cache[resourceType];
     var maget = new ResourceManager(resourceType);
     cache.Add(resourceType, maget);
     return maget;
 }
    public Texture2DHolder(string path, ResourceManager.LoadingType type)
    {
        loaded = true;
        this.type = type;
        switch (type) {
        case ResourceManager.LoadingType.RESOURCES_LOAD:
            this.path = path;
            tex = LoadTexture ();
            break;
        case ResourceManager.LoadingType.SYSTEM_IO:
            this.path = path;
            this.fileData = LoadBytes (this.path);

            if (this.fileData == null) {
                Regex pattern = new Regex ("[óñ]");
                this.path = pattern.Replace (this.path, "+¦");

                this.fileData = LoadBytes (this.path);

                if (this.fileData == null) {
                    loaded = false;
                    Debug.Log ("No se pudo cargar: " + this.path);
                }
            }
            break;
        }
    }
    private string BuildHistoryTypeMap()
    {
        var rm = new ResourceManager("Sage.Entity.Interfaces.EntityResources", typeof (HistoryType).Assembly);
        var buf = new StringBuilder();

        foreach (FieldInfo fi in typeof(HistoryType).GetFields(BindingFlags.Public | BindingFlags.Static))
        {
            if (buf.Length != 0)
            {
                buf.Append(",");
            }
            buf.Append(fi.Name).Append(":");
            object[] attrs = fi.GetCustomAttributes(typeof(DisplayNameAttribute), false);

            if (attrs.Length == 1)
            {
                String v = rm.GetString(((DisplayNameAttribute)attrs[0]).DisplayName) ??
                           ((DisplayNameAttribute)attrs[0]).DisplayName;
                buf.Append(v);
            }
            else
            {
                buf.Append(fi.Name);
            }
        }
        return buf.ToString();
    }
Esempio n. 6
0
 public static void GetString_FromResourceType(string key, string expectedValue)
 {
     Type resourceType = typeof(Resources.TestResx);
     ResourceManager resourceManager = new ResourceManager(resourceType);
     string actual = resourceManager.GetString(key);
     Assert.Equal(expectedValue, actual);
 }
Esempio n. 7
0
        protected VisualEffect(IServiceProvider services, string effectAsset,
            int effectLayerCount, IEnumerable<RenderTargetLayerType> requiredRenderTargets)
        {
            if (services == null)
                throw new ArgumentNullException("services");
            if (effectAsset == null)
                throw new ArgumentNullException("effectAsset");
            if (requiredRenderTargets == null)
                throw new ArgumentNullException("requiredRenderTargets");
            if (effectLayerCount < 0)
                throw new ArgumentOutOfRangeException("affectedLayers", "Parameter should have non-negative value.");

            renderer = (Renderer)services.GetService(typeof(Renderer));
            resourceManager = (ResourceManager)services.GetService(typeof(ResourceManager));

            this.requiredRenderTargets = requiredRenderTargets;
            this.effectLayerCount = effectLayerCount > 0 ? effectLayerCount : renderer.KBufferManager.Configuration.LayerCount;

            effect = resourceManager.Load<Effect>(effectAsset);
            effectTechnique = effect.GetTechniqueByName(VisualEffectTechniqueName);
            if (!effectTechnique.IsValid)
                throw new ArgumentException(
                    string.Format("Given effect asset '{0}' does not contain technique {1}.", effectAsset, VisualEffectTechniqueName),
                    "effectAsset");
        }
        public void load_images()
        {
            List<string> resource_paths = new List<string>();
            var assembly = Assembly.GetExecutingAssembly();
            var buffer = new ResourceManager(assembly.GetName().Name + ".g", assembly);
            try
            {
                var list = buffer.GetResourceSet(CultureInfo.CurrentCulture, true, true);
                foreach (DictionaryEntry item in list)
                {
                    resource_paths.Add((string)item.Key);
                }
            }
            finally
            {
                buffer.ReleaseAllResources();
            }

            all_images = new List<photo>();
            foreach (string current_path in resource_paths)
            {
                if (current_path.Contains(".jpg"))
                {
                    BitmapImage another_image = new BitmapImage(new Uri(@"/" + current_path, UriKind.Relative));
                    all_images.Add(new photo(another_image));
                }
            }

            faces_combo_box.ItemsSource = all_images;
            faces_combo_box.SelectedItem = faces_combo_box.Items[0];
        }
Esempio n. 9
0
        public ICypherClient Create()
        {
            if (Transaction.Current != null)
            {
                lock (Lock)
                {
                    var key = Transaction.Current.TransactionInformation.LocalIdentifier;
                    ICypherClient client;
                    if (ActiveClients.ContainsKey(key))
                    {
                        client = ActiveClients[key];
                    }
                    else
                    {
                        client = new TransactionalCypherClient(_baseUri, _webClient, _serializer, this._entityCache);
                        var notifier = new ResourceManager((ICypherUnitOfWork) client);

                        notifier.Complete += (o, e) =>
                                                 {
                                                     lock (Lock)
                                                     {
                                                         ActiveClients.Remove(key);
                                                     }
                                                 };

                        ActiveClients.Add(key, client);
                        Transaction.Current.EnlistVolatile(notifier, EnlistmentOptions.EnlistDuringPrepareRequired);
                    }
                    return client;
                }
            }

            return new NonTransactionalCypherClient(_baseUri, _webClient, _serializer);
        }
Esempio n. 10
0
 // Use this for initialization
 void Start()
 {
     resourceManager = GameObject.FindGameObjectWithTag("Player").GetComponent<ResourceManager>();
     choiceManager = GameObject.Find("Choices").GetComponent<ChoicesManager>();
     conManager = defaultConversation.GetComponent<ConversationManager>();
     eventHandler = GameObject.FindGameObjectWithTag("EventController").GetComponent<EventManagement>();
 }
Esempio n. 11
0
            public override void Process()
            {
                ResourceManager resourceManager = new ResourceManager(context.Server);

                // NOTE: This (re)initializes a static data structure used for
                // resolving names into sector locations, so needs to be run
                // before any other objects (e.g. Worlds) are loaded.
                SectorMap map = SectorMap.GetInstance(resourceManager);

                // Filter parameters
                string milieu = GetStringOption("milieu") ?? GetStringOption("era");
                bool requireData = GetBoolOption("requireData", defaultValue: false);
                string[] tags = GetStringsOption("tag");

                UniverseResult data = new UniverseResult();
                foreach (Sector sector in map.Sectors)
                {
                    if (requireData && sector.DataFile == null)
                        continue;

                    if (milieu != null && sector.DataFile?.Era != milieu)
                        continue;

                    if (tags != null && !tags.Any(tag => sector.Tags.Contains(tag)))
                        continue;

                    data.Sectors.Add(new UniverseResult.SectorResult(sector));
                }

                SendResult(context, data);
            }
Esempio n. 12
0
File: test.cs Progetto: mono/gert
	static void Main ()
	{
		AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler (CurrentDomain_AssemblyResolve);

		try {
			Assembly a = Assembly.GetExecutingAssembly ();
			a.GetSatelliteAssembly (new CultureInfo ("ja-JP"), new Version ("3.0"));
			Assert.Fail ("#A1");
		} catch (FileNotFoundException) {
			Assert.AreEqual (1, _AssemblyResolves.Count, "#A2");
			Assert.AreEqual ("test.resources, Version=3.0, Culture=ja-JP, PublicKeyToken=null", _AssemblyResolves [0], "#A3");
		}

		_AssemblyResolves.Clear ();

		try {
			ResourceManager rm = new ResourceManager ("foo", Assembly.GetExecutingAssembly ());
			rm.GetObject ("bar", new CultureInfo ("fr-FR"));
			Assert.Fail ("#B1");
		} catch (MissingManifestResourceException) {
			Assert.AreEqual (2, _AssemblyResolves.Count, "#B2");
			Assert.AreEqual ("test.resources, Version=0.0.0.0, Culture=fr-FR, PublicKeyToken=null", _AssemblyResolves [0], "#B3");
			Assert.AreEqual ("test.resources, Version=0.0.0.0, Culture=fr, PublicKeyToken=null", _AssemblyResolves [1], "#B4");
		}
	}
Esempio n. 13
0
 /// <summary>
 /// Initializes a new instance of the WorldContext class.
 /// </summary>
 /// <param name="entityManager">The entity manager.</param>
 /// <param name="physics">The physics world.</param>
 /// <param name="resources">The game resources.</param>
 /// <param name="currentTime">The current game time.</param>
 public WorldContext(EntityManager entityManager, World physics, ResourceManager resources, TimeSpan currentTime)
 {
     this.EntityManager = entityManager;
     this.Physics = physics;
     this.Resources = resources;
     this.CurrentTime = currentTime;
 }
Esempio n. 14
0
 internal static ResourceManager eval_b()
 {
     int num = 0;
     while (true)
     {
         switch (num)
         {
         case 1:
         {
             ResourceManager resourceManager = new ResourceManager("eval_bt", typeof(eval_bt).Assembly);
             eval_bt.eval_a = resourceManager;
             num = 2;
             continue;
         }
         case 2:
             goto IL_63;
         }
         if (true)
         {
         }
         if (!object.ReferenceEquals(eval_bt.eval_a, null))
         {
             break;
         }
         num = 1;
     }
     IL_63:
     return eval_bt.eval_a;
 }
Esempio n. 15
0
    public eAnim(string path, ResourceManager.LoadingType type)
    {
        frames = new List<eFrame> ();

        Regex pattern = new Regex("[óñ]");
        this.path = pattern.Replace(path, "+¦");

        string[] splitted = path.Split ('.');
        if (splitted [splitted.Length - 1] == "eaa") {
            string eaaText = "";

            switch (ResourceManager.Instance.getLoadingType ()) {
            case ResourceManager.LoadingType.SYSTEM_IO:
                eaaText = System.IO.File.ReadAllText (path);
                break;
            case ResourceManager.LoadingType.RESOURCES_LOAD:
                TextAsset ta = Resources.Load (path) as TextAsset;
                if(ta!=null)
                    eaaText = ta.text;
                break;
            }
            parseEea (eaaText);
        } else
            createOldMethod ();
    }
 public static void GetResourceSet_Strings(string key, string expectedValue)
 {
     var manager = new ResourceManager("System.Resources.Tests.Resources.TestResx", typeof(ResourceManagerTests).GetTypeInfo().Assembly);
     var culture = new CultureInfo("en-US");
     ResourceSet set = manager.GetResourceSet(culture, true, true);
     Assert.Equal(expectedValue, set.GetString(key));
 }
Esempio n. 17
0
    public override void OnInspectorGUI()
    {
        rm = (ResourceManager)target;

        GUI.changed = false;

        EditorGUILayout.Space();
        num=EditorGUILayout.IntField("Total ResourceType: ", num);
        if(num<=0) num=1;
        EditorGUILayout.Space();

        if(num!=rm.resources.Length) UpdateResourceSize(num);
        if(foldList.Count!=rm.resources.Length) UpdateFoldListSize();

        for(int i=0; i<rm.resources.Length; i++){

            if(rm.resources[i]!=null){
                foldList[i]=EditorGUILayout.Foldout(foldList[i], rm.resources[i].name);

                if(foldList[i]){
                    rm.resources[i].icon=(Texture)EditorGUILayout.ObjectField("Icon: ", rm.resources[i].icon, typeof(Texture), false);

                    rm.resources[i].name=EditorGUILayout.TextField("Name:", rm.resources[i].name);

                    rm.resources[i].value=EditorGUILayout.IntField("Value: ", rm.resources[i].value);
                }
            }
        }

        if(GUI.changed) EditorUtility.SetDirty(rm);
    }
Esempio n. 18
0
        private void Reindex()
        {
            Write("Initializing resource manager...");
            ResourceManager resourceManager = new ResourceManager(Server, Cache);

            SearchEngine.PopulateDatabase(resourceManager, Write);

            Write("&nbsp;");
            Write("Summary:");
            using (var connection = DBUtil.MakeConnection())
            {
                foreach (string table in new string[] { "sectors", "subsectors", "worlds" })
                {
                    string sql = String.Format("SELECT COUNT(*) FROM {0}", table);
                    using (var command = new SqlCommand(sql, connection))
                    {
                        using (var reader = command.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                Write(String.Format("{0}: {1}", table, reader.GetInt32(0)));
                            }
                        }
                    }
                }
            }

            Write("<b>&Omega;</b>");
        }
Esempio n. 19
0
    static void GetSpawnManager()
    {
        spawnManager=(SpawnManager)FindObjectOfType(typeof(SpawnManager));

        if(spawnManager!=null){
            if(spawnManager.spawnMode==_SpawnMode.Continuous) spawnType=0;
            else if(spawnManager.spawnMode==_SpawnMode.WaveCleared) spawnType=1;
            else if(spawnManager.spawnMode==_SpawnMode.RoundBased) spawnType=2;
            else if(spawnManager.spawnMode==_SpawnMode.SkippableContinuous) spawnType=3;
            else if(spawnManager.spawnMode==_SpawnMode.SkippableWaveCleared) spawnType=4;

            waveLength=spawnManager.waves.Length;
            //UpdateWaveLength();

            waveFoldList=new bool[waveLength];
            for(int i=0; i<waveFoldList.Length; i++){
                waveFoldList[i]=true;
            }

            subWaveLength=new int[waveLength];
            for(int i=0; i<waveLength; i++){
                Wave wave=spawnManager.waves[i];
                //Debug.Log(wave.subWaves);
                subWaveLength[i]=wave.subWaves.Length;
            }
        }

        rscManager=(ResourceManager)FindObjectOfType(typeof(ResourceManager));
    }
Esempio n. 20
0
        private void ClearAllNote_Click(object sender, RoutedEventArgs e)
        {
            ResourceManager rm = new ResourceManager(typeof(My_Note.Lang.AppResources));
            if (MessageBox.Show(rm.GetString("SettingPageClearAllNoteMessage"), rm.GetString("SettingPageClearButtonMessageTitle"), MessageBoxButton.OKCancel) != MessageBoxResult.OK)
            {
                //ommit
            }
            else
            {
                using (var appStorage = IsolatedStorageFile.GetUserStoreForApplication())
                {
                    string[] filelist = appStorage.GetFileNames("*.txt");

                    foreach (string file in filelist)
                    {
                        appStorage.DeleteFile(file);
                    }

                    string[] jpglist = appStorage.GetFileNames("*.jpg");

                    foreach (string file in jpglist)
                    {
                        appStorage.DeleteFile(file);
                    }
                }
            }
        }
 public static ResourceManager getInstance()
 {
     if (_instance == null) {
         _instance = new ResourceManager();
     }
     return _instance;
 }
Esempio n. 22
0
            /// <summary>
            /// reads a string from the resource associated with this assembly and then returns it
            /// </summary>
            /// <param name="ResourceStringName">the name of the string to read</param>
            /// <returns>returns the string</returns>
            public static string GetString(string ResourceStringName)
            {
                ResourceManager ResourceMngr = new ResourceManager(BaseResourceName, Assembly.GetExecutingAssembly());

                // get the string from the resource and return it
                return ResourceMngr.GetString(ResourceStringName);
            }
Esempio n. 23
0
        public override void Process(HttpContext context)
        {
            ResourceManager resourceManager = new ResourceManager(context.Server, context.Cache);

            // NOTE: This (re)initializes a static data structure used for
            // resolving names into sector locations, so needs to be run
            // before any other objects (e.g. Worlds) are loaded.
            SectorMap map = SectorMap.FromName(SectorMap.DefaultSetting, resourceManager);

            // Filter parameters
            string era = GetStringOption(context, "era");
            bool requireData = GetBoolOption(context, "requireData", defaultValue: false);

            Result data = new Result();
            foreach (Sector sector in map.Sectors)
            {
                if (requireData && sector.DataFile == null)
                    continue;

                if (era != null && (sector.DataFile == null || sector.DataFile.Era != era))
                    continue;

                data.Sectors.Add(new SectorResult(sector));
            }

            SendResult(context, data);
        }
Esempio n. 24
0
        public GameServer()
        {
            /* Load Resources */
            Console.WriteLine("Loading Resources...");
            Resources = new ResourceManager();
            Resources.Load();

            /* Setting Up Server */
            Console.WriteLine("Starting Up Server...");
            //Package.RecompilePackages();
            //CodeManager StartUp = Package.GetPackage(Game.ServerInfo.StartupPackage).CodeManager;
            //StartUp.RunMain();
            //Game.World.Chunks.ClearWorldGen();
            //Game.World.Chunks.AddWorldGens(StartUp.GetWorldGens());
            Game.World.ClearWorldGen();
            List<WorldGenerator> temp = new List<WorldGenerator>();
            temp.Add(new WorldGenerator());
            Game.World.AddWorldGen(temp);

            /* Listen for Clients */
            NetPeerConfiguration Configuration = new NetPeerConfiguration("FantasyScape");
            Configuration.Port = 54987;
            Configuration.MaximumConnections = 20;
            Server = new NetServer(Configuration);
            Server.Start();
            Message.RegisterServer(Server);

            UpdateTimer = new Stopwatch();
            UpdateTimer.Start();

            Console.WriteLine("Ready!");
        }
Esempio n. 25
0
 public ServerConnection(string url)
 {
     using(Log.Scope("ServerConnection constructor"))
     {
         Log.Debug("connecting to {0}", url);
         try
         {
             if(_instance != null)
             {
                 _instance.Dispose();
                 _instance = null;
             }
         }
         catch { }
         if(url == null)
             throw new ArgumentNullException("url");
         _url = url;
         this.Server = new LPSClientShared.LPSServer.Server(url);
         this.Server.CookieContainer = CookieContainer;
         this.cached_datasets = new Dictionary<string, DataSet>();
         _instance = this;
         resource_manager = new ResourceManager(this);
         configuration_store = new ConfigurationStore();
     }
 }
		public TerrainCollection( ResourceManager rm, IEngine engine, IScene scene ) {
			_engine = engine;
			_scene = scene;
			_resource_manager = rm;

			// now create chunks at the empty points
			int i, j, k, cs;
			for ( k=0; k<zoomorder; k++ ) {
				cs = (int)(ts*Math.Pow(hpc,k+1));
				CX[k] = 0;
				CZ[k] = 0;
				for ( i=0; i<xorder; i++ ) {
					for ( j=0; j<zorder; j++ ) {
						TC[i,j,k] = _engine.CreateTerrainChunk(i*cs, j*cs, cs/hpc, hpc);

						ITexture texture = engine.CreateTexture( "land", Constants.terrainPieceTextureWidth*hpc, Constants.terrainPieceTextureWidth*hpc );
						TC[i,j,k].SetTexture( texture );

						// TODO: how to know which detail texture to use?
						//TC[i,j,k].SetDetailTexture( _resource_manager.GetTexture( 9 ) );

						// TODO: fix this don't hardcode it... and don't set it per terrain chunk
						//if ( k == zoomorder-1 ){
							// TODO:
						//	TC[i,j,k].SetClouds(_resource_manager.GetTexture(8));
						//}
					}
				}
			}
		}
Esempio n. 27
0
 // Use this for initialization
 void Start()
 {
     sm = StateMachine<States>.Initialize(this);
     sm.ChangeState(States.Lobby);
     resourceManager = this.GetComponent<ResourceManager>();
     currentPlayer = playerManager.currentPlayer;
 }
Esempio n. 28
0
        /// <summary>
        /// Construct the renderer.
        /// </summary>
        /// <param name="texmode">
        /// A <see cref="TextureMode"/>. Choose "TextureMode.NORMAL_MODE" if your graphics card supports non-power of 2 texture sizes, TextureMode.TEXTURE_RECTANGLE_EXT otherwise.
        /// </param>
        public Renderer(TextureMode texmode, Display display, ResourceManager resourceManager)
        {
            this.resourceManager = resourceManager;
            textureMode = texmode;

            try
            {
                CheckRendererStatus();
            }
            catch (Exception e)
            {
                Log.Write("Could not initialize renderer: " + e.Message);
                throw e;
            }

            //Set some OpenGL attributes
            Gl.glDisable(Gl.GL_DEPTH_TEST);
            Gl.glEnable(GlTextureMode);
            Gl.glShadeModel(Gl.GL_SMOOTH);
            Gl.glHint(Gl.GL_PERSPECTIVE_CORRECTION_HINT, Gl.GL_NICEST);

            //Enable alpha blending
            Gl.glBlendFunc(Gl.GL_SRC_ALPHA, Gl.GL_ONE_MINUS_SRC_ALPHA);
            Gl.glEnable(Gl.GL_BLEND);

            Ready = true;

            Gl.glColor4d(1, 1, 1, 1);
            /*Gl.glDrawBuffer(Gl.GL_BACK);
            Gl.glClearAccum(0.0f, 0.0f, 0.0f, 0.0f);
            Gl.glClear(Gl.GL_ACCUM_BUFFER_BIT);*/
        }
Esempio n. 29
0
 private static void LocalizeField(Control control, ResourceManager resourceManager, FieldInfo fi, string propertyName)
 {
     MemberInfo[] mia = fi.FieldType.GetMember(propertyName);
     if (mia.GetLength(0) > 0)
     {
         try
         {
             string resourceName = control.GetType().Namespace.Replace(".", "_") + "_" + control.GetType().Name + "_" + fi.Name + "_" + propertyName;
             string localizedText = resourceManager.GetString(resourceName);
             if (localizedText == null)
             {
             }
             else if (!string.IsNullOrEmpty(localizedText))
             {
                 Object o = fi.GetValue(control);
                 if (o != null)
                 {
                     PropertyInfo pi = o.GetType().GetProperty(propertyName);
                     if (pi != null)
                     {
                         pi.SetValue(o, localizedText, null);
                     }
                 }
             }
         }
         catch (System.Resources.MissingManifestResourceException)
         {
             //just ignore
         }
         catch (Exception ex)
         {
             System.Diagnostics.Debug.WriteLine("Error when localizing: " + fi.Name + ":\r\n" + ex.ToString());
         }
     }
 }
Esempio n. 30
0
            public override void Process()
            {
                ResourceManager resourceManager = new ResourceManager(context.Server);

                MapOptions options = MapOptions.SectorGrid | MapOptions.BordersMajor | MapOptions.NamesMajor | MapOptions.NamesMinor;
                Stylesheet.Style style = Stylesheet.Style.Poster;
                ParseOptions(ref options, ref style);

                double x = GetDoubleOption("x", 0);
                double y = GetDoubleOption("y", 0);
                double scale = Util.Clamp(GetDoubleOption("scale", 0), MinScale, MaxScale);
                int width = Util.Clamp(GetIntOption("w", NormalTileWidth), MinDimension, MaxDimension);
                int height = Util.Clamp(GetIntOption("h", NormalTileHeight), MinDimension, MaxDimension);

                Size tileSize = new Size(width, height);

                RectangleF tileRect = new RectangleF();
                tileRect.X = (float)(x * tileSize.Width / (scale * Astrometrics.ParsecScaleX));
                tileRect.Y = (float)(y * tileSize.Height / (scale * Astrometrics.ParsecScaleY));
                tileRect.Width = (float)(tileSize.Width / (scale * Astrometrics.ParsecScaleX));
                tileRect.Height = (float)(tileSize.Height / (scale * Astrometrics.ParsecScaleY));

                DateTime dt = DateTime.Now;
                bool silly = (Math.Abs((int)x % 2) == Math.Abs((int)y % 2)) && (dt.Month == 4 && dt.Day == 1);
                silly = GetBoolOption("silly", silly);

                Selector selector = new RectSelector(SectorMap.ForMilieu(resourceManager, GetStringOption("milieu")), resourceManager, tileRect);
                Stylesheet styles = new Stylesheet(scale, options, style);
                RenderContext ctx = new RenderContext(resourceManager, selector, tileRect, scale, options, styles, tileSize);
                ctx.Silly = silly;
                ctx.ClipOutsectorBorders = true;
                ProduceResponse(context, "Tile", ctx, tileSize);
            }
Esempio n. 31
0
        public static string GetResources(string ResourceName, string Key)
        {
            ResourceManager Resources = new ResourceManager("Resources." + ResourceName, System.Reflection.Assembly.Load("App_GlobalResources"));

            return(Resources.GetString(Key));
        }
 /// <summary>
 /// Instantiates a new <see cref="PropertyCollection" />.
 /// </summary>
 /// <param name="type"></param>
 /// <param name="resourceManager"></param>
 public PropertyCollection(Type type, ResourceManager resourceManager) : this(type)
 {
     LoadProperties(resourceManager);
 }
 private void Awake()
 {
     _sender = GetComponent <PubSubSender>();
     _rm     = FindObjectOfType <ResourceManager>();
 }
Esempio n. 34
0
 public LocalizedDescriptionAttribute(string resourceKey, Type resourceType)
 {
     _resource    = new ResourceManager(resourceType);
     _resourceKey = resourceKey;
 }
        public override void LoadData(XmlNode configNode, ResourceManager resourceManager)
        {
            base.LoadData(configNode, resourceManager);

            if (!resourceManager.DataAgendaPartAFile.ExistsLocal())
            {
                return;
            }

            var document = new XmlDocument();

            document.Load(resourceManager.DataAgendaPartAFile.LocalPath);

            var node = document.SelectSingleNode(@"/SHIFT03A");

            if (node == null)
            {
                return;
            }
            foreach (XmlNode childNode in node.ChildNodes)
            {
                var item = ListDataItem.FromXml(childNode);
                switch (childNode.Name)
                {
                case "SHIFT03AHeader":
                    if (!String.IsNullOrEmpty(item.Value))
                    {
                        HeadersItems.Add(item);
                    }
                    break;

                case "SHIFT03ACombo1":
                    if (!String.IsNullOrEmpty(item.Value))
                    {
                        Combo1Items.Add(item);
                    }
                    break;

                case "SHIFT03ACombo2":
                    if (!String.IsNullOrEmpty(item.Value))
                    {
                        Combo2Items.Add(item);
                    }
                    break;

                case "SHIFT03ACombo3":
                    if (!String.IsNullOrEmpty(item.Value))
                    {
                        Combo3Items.Add(item);
                    }
                    break;

                case "SHIFT03ACombo4":
                    if (!String.IsNullOrEmpty(item.Value))
                    {
                        Combo4Items.Add(item);
                    }
                    break;

                case "SHIFT03ACombo5":
                    if (!String.IsNullOrEmpty(item.Value))
                    {
                        Combo5Items.Add(item);
                    }
                    break;

                case "SHIFT03ACombo6":
                    if (!String.IsNullOrEmpty(item.Value))
                    {
                        Combo6Items.Add(item);
                    }
                    break;

                case "SHIFT03ACombo7":
                    if (!String.IsNullOrEmpty(item.Value))
                    {
                        Combo7Items.Add(item);
                    }
                    break;

                case "SHIFT03ACombo8":
                    if (!String.IsNullOrEmpty(item.Value))
                    {
                        Combo8Items.Add(item);
                    }
                    break;
                }
            }

            Clipart1Configuration = ClipartConfiguration.FromXml(node, "SHIFT03AClipart1");

            CommonEditorConfiguration  = TextEditorConfiguration.FromXml(node);
            HeadersEditorConfiguration = TextEditorConfiguration.FromXml(node, "SHIFT03AHeader");
            Combo1Configuration        = TextEditorConfiguration.FromXml(node, "SHIFT03ACombo1");
            Combo2Configuration        = TextEditorConfiguration.FromXml(node, "SHIFT03ACombo2");
            Combo3Configuration        = TextEditorConfiguration.FromXml(node, "SHIFT03ACombo3");
            Combo4Configuration        = TextEditorConfiguration.FromXml(node, "SHIFT03ACombo4");
            Combo5Configuration        = TextEditorConfiguration.FromXml(node, "SHIFT03ACombo5");
            Combo6Configuration        = TextEditorConfiguration.FromXml(node, "SHIFT03ACombo6");
            Combo7Configuration        = TextEditorConfiguration.FromXml(node, "SHIFT03ACombo7");
            Combo8Configuration        = TextEditorConfiguration.FromXml(node, "SHIFT03ACombo8");
        }
        protected internal override void NodeGUI()
        {
            NodeEditor.BuildShaderPosX = rect.x;
            NodeEditor.BuildShaderPosY = rect.y;
            if (NodeEditor.ShaderToNull)
            {
                Buildshader             = null;
                NodeEditor.ShaderToNull = false;
            }
            NodeEditor.NoBuildShader = true;
            // Save
            if (NodeEditor.ForceWriteFlag)
            {
                UpdateSave();
                NodeEditor.ForceWriteFlag = false;
            }

            if (Inputs[0].GetNodeAcrossConnection() == null)
            {
                NodeEditor.RGBAonBuildShader = false;
            }
            else
            {
                NodeEditor.RGBAonBuildShader = true;
            }

            if (Inputs[0].GetNodeAcrossConnection() == null)
            {
                Inputs[0].knobTexture = ResourceManager.GetTintedTexture("Textures/In_Knob.png", new Color(0.50f, 0.50f, 0.50f, 0.75f));
            }
            else
            {
                Inputs[0].knobTexture = ResourceManager.GetTintedTexture("Textures/In_Knob.png", Color.white);
            }

            Inputs[0].DisplayLayout(new GUIContent("RGBA", "RGBA colors"));

            GUILayout.Space(6);
            GUIStyle g  = new GUIStyle();
            int      ms = g.fontSize;

            g.fontSize         = 11;
            g.alignment        = TextAnchor.LowerLeft;
            g.normal.textColor = Color.white;
            GUILayout.Label("Used Shader*", g);
            g.fontSize = ms;

            GUILayout.Space(32);

            if (GUILayout.Button(new GUIContent("Load current shader from Material", "Load current Shader from the material")))
            {
                Buildshader = NodeEditor._Shadero_Material.shader;
            }

            if (Buildshader == null)
            {
                Texture2D preview = ResourceManager.LoadTexture("Textures/arrow.png");
                GUI.DrawTexture(new Rect(-30, 35, 350, 50), preview);
                NumberVariable = 0;
            }

            Buildshader = (Shader)EditorGUI.ObjectField(new Rect(5, 50, 250, 18), Buildshader, typeof(Shader), true);
            if (MBuildshader != AssetDatabase.GetAssetPath(Buildshader))
            {
                if (Buildshader != null)
                {
                    NodeEditor.ForceWriteFlag  = true;
                    NodeEditor.RecalculateFlag = true;
                    NodeEditor.UpdatePreview   = 1;
                    SceneView.RepaintAll();
                    AssetDatabase.Refresh();
                }
            }
            MBuildshader = AssetDatabase.GetAssetPath(Buildshader);

            if (NodeEditor.FlagIsLoadedMaterial)
            {
                Buildshader = NodeEditor.curEditorState.ShaderInMemory;
                NodeEditor.FlagIsLoadedMaterial = false;
            }
            else
            {
                NodeEditor.curEditorState.ShaderInMemory = Buildshader;
            }


            g                  = new GUIStyle();
            g.fontSize         = 12;
            g.normal.textColor = Color.white;
            GUILayout.Label("Shader Name*", g);
            int msize = GUI.skin.textField.fontSize;

            GUI.skin.textField.fontSize = 20;
            GUILayout.Label(ShaderNameX, g);
            ShaderNameX = Path.GetFileNameWithoutExtension(AssetDatabase.GetAssetPath(Buildshader));
            GUI.skin.textField.fontSize = msize;
            if (Buildshader != null)
            {
                NodeEditor.curEditorState.LivePreviewShaderPath = AssetDatabase.GetAssetPath(Buildshader);
            }
            if (Buildshader == null)
            {
                NodeEditor.curEditorState.LivePreviewShaderPath = "";
            }
            NodeEditor.curEditorState.ShaderName = ShaderNameX;
            if (NodeEditor.FlagIsMaterialChanged)
            {
                NodeEditor.FlagIsMaterialChanged = false;
            }

            if (NodeEditor.curEditorState.LivePreviewShaderPath == "")
            {
                NodeEditor.FlagIsSaved = false;
            }
            else
            {
                NodeEditor.FlagIsSaved = true;
            }


            if (NodeEditor._Shadero_Material == null)
            {
                if (MemoShaderMaterial)
                {
                    NodeEditor._Shadero_Material = MemoShaderMaterial;
                }
            }

            if (NodeEditor._Shadero_Material)
            {
                MemoShaderMaterial = NodeEditor._Shadero_Material;
            }

            if (NodeEditor.curEditorState.LivePreviewShaderPath != "")
            {
                NodeEditor.AutoUpdateFlag = true;
            }
            else
            {
                NodeEditor.AutoUpdateFlag = false;
            }

            if (NodeEditor.curEditorState.LivePreviewShaderPath != "")
            {
                if (GUILayout.Button(new GUIContent("Update Shader", "Saves the Shader to a file in the Assets Folder")))
                {
                    if (NodeEditor.curEditorState.LivePreviewShaderPath != "")
                    {
                        string path = NodeEditor.curEditorState.LivePreviewShaderPath;
                        if (!string.IsNullOrEmpty(path))
                        {
                            if (BuildErrorFlag)
                            {
                                EditorUtility.DisplayDialog("Shadero - Build Error", "You must connect a RGBA source", "OK");
                                BuildErrorFlag = false;
                            }
                            else
                            {
                                NodeEditor.RecalculateFlag = true;
                                File.WriteAllText(path, result);
                                NodeEditor.UpdatePreview = 1;
                                SceneView.RepaintAll();
                                AssetDatabase.Refresh();
                            }
                        }
                    }
                }

                NodeEditor.AutoUpdate = GUILayout.Toggle(NodeEditor.AutoUpdate, "Auto Update");
            }
            GUILayout.Space(6);

            GUILayout.BeginHorizontal();
            ForceNoHdr = GUILayout.Toggle(ForceNoHdr, "Force No Hdr");
            ForceFog   = GUILayout.Toggle(ForceFog, "Force Fog");
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            SupportPixelSnap = GUILayout.Toggle(SupportPixelSnap, "Pixel Snap Support");
            FixHdr           = GUILayout.Toggle(FixHdr, "Fix Blend Hdr");
            GUILayout.EndHorizontal();

            AddTimerParameter = GUILayout.Toggle(AddTimerParameter, "Add Timer _SetTimer Variable");
            GUILayout.Label("*Remplace the default timer to a parametrable variable");
            AddUIRectMaskSupport = GUILayout.Toggle(AddUIRectMaskSupport, "Add AddUIRectMaskSupport");

            GUILayout.Label("Blend Mode");
            string[] test = new string[6];
            test[0] = "Normal";
            test[1] = "Add";
            test[2] = "Soft\nAdd";
            test[3] = "Mul";
            test[4] = "2x Mul";
            test[5] = "Pre-\nMul";


            ShaderUse = GUILayout.Toolbar(ShaderUse, test, GUILayout.Height(30));
            if (ShaderUse == 0)
            {
                ShaderBlend = "Blend SrcAlpha OneMinusSrcAlpha";
            }
            if (ShaderUse == 1)
            {
                ShaderBlend = "Blend SrcAlpha One";
            }
            if (ShaderUse == 2)
            {
                ShaderBlend = "Blend OneMinusDstColor One";
            }
            if (ShaderUse == 3)
            {
                ShaderBlend = "Blend DstColor Zero";
            }
            if (ShaderUse == 4)
            {
                ShaderBlend = "Blend DstColor SrcColor";
            }
            if (ShaderUse == 5)
            {
                ShaderBlend = "Blend One OneMinusSrcAlpha";
            }


            GUILayout.Label("Cull Mode");
            string[] test2 = new string[3];
            test2[0] = "Off";
            test2[1] = "Back";
            test2[2] = "Front";


            CullUse = GUILayout.Toolbar(CullUse, test2, GUILayout.Height(30));
            if (CullUse == 0)
            {
                CullMode = "Cull Off";
            }
            if (CullUse == 1)
            {
                CullMode = "Cull Back";
            }
            if (CullUse == 2)
            {
                CullMode = "Cull Front";
            }
            //    private static string CullMode = "Cull Off";

            if (Buildshader != null)
            {
                GUILayout.Space(18);
                ChangeVariableName = GUILayout.Toggle(ChangeVariableName, "Force Change Variable Name");
                GUILayout.Label("(Experimental, use it only if you \n have finished the shader)");


                if (ChangeVariableName)
                {
                    rect.height = 550 + (NumberVariable * 22);
                    rect.width  = 520;
                    for (int c = 0; c < NumberVariable; c++)
                    {
                        GUILayout.BeginHorizontal();
                        if (OrigineVariableName[c] != VariableName[c])
                        {
                            NewVariableName[c]     = VariableName[c];
                            OrigineVariableName[c] = VariableName[c];
                        }
                        if (NewVariableName[c] == null)
                        {
                            NewVariableName[c] = VariableName[c];
                        }
                        NewVariableName[c] = GUILayout.TextField(NewVariableName[c]);
                        GUILayout.Label(VariableName[c]);
                        GUILayout.EndHorizontal();
                    }
                }
                else
                {
                    rect.height = 520;
                    rect.width  = 400;
                }
            }
        }
Esempio n. 37
0
            public override void Process()
            {
                // NOTE: This (re)initializes a static data structure used for
                // resolving names into sector locations, so needs to be run
                // before any other objects (e.g. Worlds) are loaded.
                ResourceManager resourceManager = new ResourceManager(context.Server);

                Selector   selector;
                RectangleF tileRect = new RectangleF();
                MapOptions options  = MapOptions.SectorGrid | MapOptions.SubsectorGrid | MapOptions.BordersMajor | MapOptions.BordersMinor | MapOptions.NamesMajor | MapOptions.NamesMinor | MapOptions.WorldsCapitals | MapOptions.WorldsHomeworlds;

                Stylesheet.Style style = Stylesheet.Style.Poster;
                ParseOptions(ref options, ref style);
                string title;
                bool   clipOutsectorBorders;

                if (HasOption("x1") && HasOption("x2") &&
                    HasOption("y1") && HasOption("y2"))
                {
                    // Arbitrary rectangle

                    int x1 = GetIntOption("x1", 0);
                    int x2 = GetIntOption("x2", 0);
                    int y1 = GetIntOption("y1", 0);
                    int y2 = GetIntOption("y2", 0);

                    tileRect.X      = Math.Min(x1, x2);
                    tileRect.Y      = Math.Min(y1, y2);
                    tileRect.Width  = Math.Max(x1, x2) - tileRect.X;
                    tileRect.Height = Math.Max(y1, y2) - tileRect.Y;

                    SectorMap.Milieu map = SectorMap.ForMilieu(resourceManager, GetStringOption("milieu"));
                    selector = new RectSelector(map, resourceManager, tileRect, slop: false);

                    tileRect.Offset(-1, -1);
                    tileRect.Width  += 1;
                    tileRect.Height += 1;

                    title = string.Format("Poster ({0},{1}) - ({2},{3})", x1, y1, x2, y2);
                    clipOutsectorBorders = true;
                }
                else if (HasOption("domain"))
                {
                    string domain = GetStringOption("domain");
                    double x, y, w = 2, h = 2;
                    switch (domain.ToLowerInvariant())
                    {
                    case "deneb": x = -4; y = -1; title = "Domain of Deneb"; break;

                    case "vland": x = -2; y = -1; title = "Domain of Vland"; break;

                    case "ilelish": x = -2; y = 1; title = "Domain of Ilelish"; break;

                    case "antares": x = 0; y = -2; title = "Domain of Antares"; break;

                    case "sylea": x = 0; y = 0; title = "Domain of Sylea"; break;

                    case "sol": x = 0; y = 2; title = "Domain of Sol"; break;

                    case "gateway": x = 2; y = 0; title = "Domain of Gateway"; break;

                    // And these aren't domains, but...
                    case "foreven": x = -6; y = -1; title = "Land Grant / Foreven"; break;

                    case "imperium": x = -4; y = -1; w = 7; h = 5; title = "Third Imperium"; break;

                    case "solomani": x = -1.5; y = 2.75; w = 4; h = 2.25; title = "Solomani Confederacy"; break;

                    case "zhodani": x = -8; y = -3; w = 5; h = 3; title = "Zhodani Consulate"; break;

                    case "hive":
                    case "hiver": x = 2; y = 1; w = 6; h = 4; title = "Hiver Federation"; break;

                    case "aslan": x = -8; y = 1; w = 7; h = 4; title = "Aslan Hierate"; break;

                    case "vargr": x = -4; y = -4; w = 8; h = 3; title = "Vargr Extents"; break;

                    case "kkree": x = 4; y = -2; w = 4; h = 4; title = "Two Thousand Worlds"; break;

                    case "jp": x = 0; y = -3; w = 4; h = 3; title = "Julian Protectorate"; break;
                    // TODO: Zhodani provinces

                    case "chartedspace": x = -8; y = -3; w = 16; h = 8; title = "Charted Space"; break;

                    case "jg": x = 160; y = 0; w = 2; h = 2; title = "Judges Guild"; break;

                    default:
                        throw new HttpError(404, "Not Found", string.Format("Unknown domain: {0}", domain));
                    }

                    int x1 = (int)Math.Round(x * Astrometrics.SectorWidth - Astrometrics.ReferenceHex.X + 1);
                    int y1 = (int)Math.Round(y * Astrometrics.SectorHeight - Astrometrics.ReferenceHex.Y + 1);
                    int x2 = (int)Math.Round(x1 + w * Astrometrics.SectorWidth - 1);
                    int y2 = (int)Math.Round(y1 + h * Astrometrics.SectorHeight - 1);

                    tileRect.X      = Math.Min(x1, x2);
                    tileRect.Y      = Math.Min(y1, y2);
                    tileRect.Width  = Math.Max(x1, x2) - tileRect.X;
                    tileRect.Height = Math.Max(y1, y2) - tileRect.Y;

                    SectorMap.Milieu map = SectorMap.ForMilieu(resourceManager, GetStringOption("milieu"));
                    selector = new RectSelector(map, resourceManager, tileRect, slop: false);

                    tileRect.Offset(-1, -1);
                    tileRect.Width  += 1;
                    tileRect.Height += 1;

                    // Account for jagged hexes
                    tileRect.Height += 0.5f;
                    tileRect.Inflate(0.25f, 0.10f);
                    if (style == Stylesheet.Style.Candy)
                    {
                        tileRect.Width += 0.75f;
                    }

                    clipOutsectorBorders = true;
                }
                else
                {
                    // Sector - either POSTed or specified by name
                    Sector sector = null;
                    options = options & ~MapOptions.SectorGrid;

                    if (context.Request.HttpMethod == "POST")
                    {
                        bool        lint   = GetBoolOption("lint", defaultValue: false);
                        ErrorLogger errors = new ErrorLogger();
                        sector = GetPostedSector(context.Request, errors);
                        if (lint && !errors.Empty)
                        {
                            throw new HttpError(400, "Bad Request", errors.ToString());
                        }

                        if (sector == null)
                        {
                            throw new HttpError(400, "Bad Request", "Either file or data must be supplied in the POST data.");
                        }

                        title = "User Data";

                        // TODO: Suppress all OTU rendering.
                        options = options & ~MapOptions.WorldsHomeworlds & ~MapOptions.WorldsCapitals;
                    }
                    else
                    {
                        string sectorName = GetStringOption("sector");
                        if (sectorName == null)
                        {
                            throw new HttpError(400, "Bad Request", "No sector specified.");
                        }

                        SectorMap.Milieu map = SectorMap.ForMilieu(resourceManager, GetStringOption("milieu"));

                        sector = map.FromName(sectorName);
                        if (sector == null)
                        {
                            throw new HttpError(404, "Not Found", string.Format("The specified sector '{0}' was not found.", sectorName));
                        }

                        title = sector.Names[0].Text;
                    }

                    if (sector != null && HasOption("subsector") && GetStringOption("subsector").Length > 0)
                    {
                        options = options & ~MapOptions.SubsectorGrid;
                        string subsector = GetStringOption("subsector");
                        int    index     = sector.SubsectorIndexFor(subsector);
                        if (index == -1)
                        {
                            throw new HttpError(404, "Not Found", string.Format("The specified subsector '{0}' was not found.", subsector));
                        }

                        selector = new SubsectorSelector(resourceManager, sector, index);

                        tileRect = sector.SubsectorBounds(index);

                        options &= ~(MapOptions.SectorGrid | MapOptions.SubsectorGrid);

                        title = string.Format("{0} - Subsector {1}", title, 'A' + index);
                    }
                    else if (sector != null && HasOption("quadrant") && GetStringOption("quadrant").Length > 0)
                    {
                        string quadrant = GetStringOption("quadrant");
                        int    index;
                        switch (quadrant.ToLowerInvariant())
                        {
                        case "alpha": index = 0; quadrant = "Alpha"; break;

                        case "beta": index = 1; quadrant = "Beta"; break;

                        case "gamma": index = 2; quadrant = "Gamma"; break;

                        case "delta": index = 3; quadrant = "Delta"; break;

                        default:
                            throw new HttpError(400, "Bad Request", string.Format("The specified quadrant '{0}' is invalid.", quadrant));
                        }

                        selector = new QuadrantSelector(resourceManager, sector, index);
                        tileRect = sector.QuadrantBounds(index);

                        options &= ~(MapOptions.SectorGrid | MapOptions.SubsectorGrid | MapOptions.SectorsMask);

                        title = string.Format("{0} - {1} Quadrant", title, quadrant);
                    }
                    else
                    {
                        selector = new SectorSelector(resourceManager, sector);
                        tileRect = sector.Bounds;

                        options &= ~(MapOptions.SectorGrid);
                    }

                    // Account for jagged hexes
                    tileRect.Height += 0.5f;
                    tileRect.Inflate(0.25f, 0.10f);
                    if (style == Stylesheet.Style.Candy)
                    {
                        tileRect.Width += 0.75f;
                    }
                    clipOutsectorBorders = false;
                }

                const double NormalScale = 64; // pixels/parsec - standard subsector-rendering scale
                double       scale       = Util.Clamp(GetDoubleOption("scale", NormalScale), MinScale, MaxScale);

                int  rot   = GetIntOption("rotation", 0) % 4;
                bool thumb = GetBoolOption("thumb", false);

                Stylesheet stylesheet = new Stylesheet(scale, options, style);

                Size tileSize = new Size((int)Math.Floor(tileRect.Width * scale * Astrometrics.ParsecScaleX), (int)Math.Floor(tileRect.Height * scale * Astrometrics.ParsecScaleY));

                if (thumb)
                {
                    tileSize.Width  = (int)Math.Floor(16 * tileSize.Width / scale);
                    tileSize.Height = (int)Math.Floor(16 * tileSize.Height / scale);
                    scale           = 16;
                }

                int   bitmapWidth = tileSize.Width, bitmapHeight = tileSize.Height;
                float translateX = 0, translateY = 0;

                switch (rot)
                {
                case 1:     // 90 degrees clockwise
                    Util.Swap(ref bitmapWidth, ref bitmapHeight);
                    translateX = bitmapWidth;
                    break;

                case 2:     // 180 degrees
                    translateX = bitmapWidth; translateY = bitmapHeight;
                    break;

                case 3:     // 270 degrees clockwise
                    Util.Swap(ref bitmapWidth, ref bitmapHeight);
                    translateY = bitmapHeight;
                    break;
                }

                RenderContext ctx = new RenderContext(resourceManager, selector, tileRect, scale, options, stylesheet, tileSize);

                ctx.ClipOutsectorBorders = clipOutsectorBorders;
                ProduceResponse(context, title, ctx, new Size(bitmapWidth, bitmapHeight), rot, translateX, translateY);
            }
Esempio n. 38
0
        /// <summary>
        /// Required method for Designer support - do not modify
        ///   the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            ResourceManager resources = new ResourceManager(typeof(frmAbout));

            this.lblVersion     = new Label();
            this.pictureBox1    = new PictureBox();
            this.lblProductName = new Label();
            this.label2         = new Label();
            this.btnOK          = new Button();
            this.label3         = new Label();
            this.label4         = new Label();
            this.lblWebSite     = new LinkLabel();
            this.label1         = new Label();
            this.label5         = new Label();
            this.SuspendLayout();

            // lblVersion
            this.lblVersion.Location  = new Point(88, 96);
            this.lblVersion.Name      = "lblVersion";
            this.lblVersion.Size      = new Size(88, 23);
            this.lblVersion.TabIndex  = 0;
            this.lblVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;

            // pictureBox1
            this.pictureBox1.Image    = (System.Drawing.Image)resources.GetObject("pictureBox1.Image");
            this.pictureBox1.Location = new Point(0, 0);
            this.pictureBox1.Name     = "pictureBox1";
            this.pictureBox1.Size     = new Size(48, 48);
            this.pictureBox1.TabIndex = 1;
            this.pictureBox1.TabStop  = false;

            // lblProductName
            this.lblProductName.Font = new Font(
                "Microsoft Sans Serif",
                12F,
                System.Drawing.FontStyle.Bold,
                System.Drawing.GraphicsUnit.Point,
                0);
            this.lblProductName.Location  = new Point(56, 16);
            this.lblProductName.Name      = "lblProductName";
            this.lblProductName.Size      = new Size(120, 23);
            this.lblProductName.TabIndex  = 2;
            this.lblProductName.Text      = "SharpChess";
            this.lblProductName.TextAlign = System.Drawing.ContentAlignment.TopCenter;

            // label2
            this.label2.Location  = new Point(8, 96);
            this.label2.Name      = "label2";
            this.label2.Size      = new Size(72, 23);
            this.label2.TabIndex  = 3;
            this.label2.Text      = "Version:";
            this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;

            // btnOK
            this.btnOK.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.btnOK.Location     = new Point(55, 160);
            this.btnOK.Name         = "btnOK";
            this.btnOK.TabIndex     = 4;
            this.btnOK.Text         = "OK";
            this.btnOK.Click       += new EventHandler(this.btnOK_Click);

            // label3
            this.label3.Location  = new Point(8, 48);
            this.label3.Name      = "label3";
            this.label3.Size      = new Size(64, 23);
            this.label3.TabIndex  = 5;
            this.label3.Text      = "Created By:";
            this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;

            // label4
            this.label4.Location  = new Point(88, 48);
            this.label4.Name      = "label4";
            this.label4.Size      = new Size(88, 23);
            this.label4.TabIndex  = 6;
            this.label4.Text      = "Peter Hughes";
            this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;

            // lblWebSite
            this.lblWebSite.Location     = new Point(0, 128);
            this.lblWebSite.Name         = "lblWebSite";
            this.lblWebSite.Size         = new Size(184, 23);
            this.lblWebSite.TabIndex     = 7;
            this.lblWebSite.TabStop      = true;
            this.lblWebSite.Text         = "www.SharpChess.com";
            this.lblWebSite.TextAlign    = System.Drawing.ContentAlignment.MiddleCenter;
            this.lblWebSite.LinkClicked += new LinkLabelLinkClickedEventHandler(this.llbWebSite_LinkClicked);

            // label1
            this.label1.Location  = new Point(8, 72);
            this.label1.Name      = "label1";
            this.label1.Size      = new Size(72, 23);
            this.label1.TabIndex  = 8;
            this.label1.Text      = "Contributors:";
            this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;

            // label5
            this.label5.Location  = new Point(88, 72);
            this.label5.Name      = "label5";
            this.label5.Size      = new Size(88, 23);
            this.label5.TabIndex  = 9;
            this.label5.Text      = "Nimzo";
            this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;

            // frmAbout
            this.AcceptButton      = this.btnOK;
            this.AutoScaleBaseSize = new Size(5, 13);
            this.CancelButton      = this.btnOK;
            this.ClientSize        = new Size(184, 190);
            this.Controls.Add(this.label5);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.lblWebSite);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.btnOK);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.lblProductName);
            this.Controls.Add(this.pictureBox1);
            this.Controls.Add(this.lblVersion);
            this.Icon          = (System.Drawing.Icon)resources.GetObject("$this.Icon");
            this.MaximizeBox   = false;
            this.MinimizeBox   = false;
            this.Name          = "frmAbout";
            this.ShowInTaskbar = false;
            this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text          = "About SharpChess";
            this.Load         += new EventHandler(this.frmAbout_Load);
            this.ResumeLayout(false);
        }
Esempio n. 39
0
        private void StationAdd_Etc_Page_Paint(object sender, PaintEventArgs e)
        {
            try
            {
                Draw(e);

                g = e.Graphics;

                g.DrawString(TextManager.Get().Text("stationrank"), new Font(RTCore.Environment.Font, 40), new SolidBrush(ResourceManager.Get("stationadd.title")), RTCore.Environment.CalcRectangle(new Point(Width / 2, (Height / 2) - 90), RTCore.Environment.CalcStringSize(TextManager.Get().Text("stationrank"), new Font(RTCore.Environment.Font, 40))));
                g.DrawString(TextManager.Get().Text("stationtype"), new Font(RTCore.Environment.Font, 40), new SolidBrush(ResourceManager.Get("stationadd.title")), RTCore.Environment.CalcRectangle(new Point(Width / 2, (Height / 2) + 40), RTCore.Environment.CalcStringSize(TextManager.Get().Text("stationtype"), new Font(RTCore.Environment.Font, 40))));
            }
            catch (Exception ex)
            {
                RTCore.Environment.ReportError(ex, AccessManager.AccessKey);
            }
        }
Esempio n. 40
0
 private void Start()
 {
     _ressourceManager = ResourceManager.Instance;
     UpdateInfos();
 }
Esempio n. 41
0
        protected void DisplayErrorMessage(Exception ex, ResourceManager resourceManager)
        {
            var service = (IManagementUIService)GetService(typeof(IManagementUIService));

            service.ShowError(ex, resourceManager.GetString("General"), string.Empty, false);
        }
Esempio n. 42
0
 internal DynamicProjectSR()
 {
     _resources = new ResourceManager("Microsoft.PythonTools.Project.LocalizableDisplayNameAttribute", this.GetType().Assembly);
 }
Esempio n. 43
0
 static UILibrary()
 {
     rm = new ResourceManager("MyCompany.Employees.LibResources", typeof(UILibrary).Assembly);
 }
Esempio n. 44
0
 /// <remarks>Don't call this during a parse--it loads resources</remarks>
 public static string GetMessage(XmlParseErrorCode id, CultureInfo culture)
 {
     return(ResourceManager.GetString(id.ToString(), culture));
 }
Esempio n. 45
0
        private List <CardColor> GetBestCard(Obj_AI_Hero target, string mode)
        {
            var cards = new List <CardColor>();

            if (target == null || !target.IsValid || target.IsDead)
            {
                return(cards);
            }
            try
            {
                if (IsWKillable(target, 2))
                {
                    cards.Add(CardColor.Gold);
                }
                if (IsWKillable(target))
                {
                    cards.Add(CardColor.Blue);
                }
                if (IsWKillable(target, 1))
                {
                    cards.Add(CardColor.Red);
                }
                if (cards.Any())
                {
                    return(cards);
                }
                var selectedCard =
                    GetSelectedCardColor(Menu.Item(Menu.Name + ".harass.w-card").GetValue <StringList>().SelectedIndex);
                var burst = Menu.Item(Menu.Name + ".miscellaneous.mode").GetValue <StringList>().SelectedIndex == 0;
                var red   = 0;
                var blue  = 0;
                var gold  = 0;

                var shouldBlue = Player.Mana <W.ManaCost + Q.ManaCost &&
                                              Player.Mana + (25 + 25 * W.Level)> Q.ManaCost + W.ManaCost;

                if (!burst && (mode == "combo" || mode == "harass" && selectedCard == CardColor.None))
                {
                    if (Q.Level == 0)
                    {
                        return(new List <CardColor> {
                            CardColor.Blue
                        });
                    }
                    gold++;
                    if (target.Distance(Player) > W.Range * 0.8f)
                    {
                        gold++;
                    }
                    if (mode == "combo" && (Player.ManaPercent < 10 || shouldBlue) ||
                        mode == "harass" && !ResourceManager.Check("harass-blue"))
                    {
                        return(new List <CardColor> {
                            CardColor.Blue
                        });
                    }
                    var minRed  = Menu.Item(Menu.Name + ".combo.red-min").GetValue <Slider>().Value;
                    var redHits = GetWHits(target, GameObjects.EnemyHeroes.Cast <Obj_AI_Base>().ToList(), CardColor.Red);
                    red += redHits;
                    if (red > blue && red > gold && redHits >= minRed)
                    {
                        cards.Add(CardColor.Red);
                        if (red == blue)
                        {
                            cards.Add(CardColor.Blue);
                        }
                        if (red == gold)
                        {
                            cards.Add(CardColor.Gold);
                        }
                    }
                    else if (gold > blue && gold > red)
                    {
                        cards.Add(CardColor.Gold);
                        if (gold == blue)
                        {
                            cards.Add(CardColor.Blue);
                        }
                        if (gold == red && redHits >= minRed)
                        {
                            cards.Add(CardColor.Red);
                        }
                    }
                    else if (blue > red && blue > gold)
                    {
                        cards.Add(CardColor.Blue);
                        if (blue == red && redHits >= minRed)
                        {
                            cards.Add(CardColor.Red);
                        }
                        if (blue == gold)
                        {
                            cards.Add(CardColor.Gold);
                        }
                    }
                }
                if (mode == "combo" && !cards.Any())
                {
                    if (Q.Level == 0)
                    {
                        return(new List <CardColor> {
                            CardColor.Blue
                        });
                    }
                    var distance = target.Distance(Player);
                    var damage   = ItemManager.CalculateComboDamage(target) - target.HPRegenRate * 2f - 10;
                    if (HasEBuff())
                    {
                        damage += E.GetDamage(target);
                    }
                    if (Q.IsReady() && (Utils.GetImmobileTime(target) > 0.5f || distance < Q.Range / 4f))
                    {
                        damage += Q.GetDamage(target);
                    }
                    if (W.GetDamage(target, 2) + damage > target.Health)
                    {
                        cards.Add(CardColor.Gold);
                    }
                    if (distance < Orbwalking.GetRealAutoAttackRange(target) * 0.85f)
                    {
                        if (W.GetDamage(target) + damage > target.Health)
                        {
                            cards.Add(CardColor.Blue);
                        }
                        if (W.GetDamage(target, 1) + damage > target.Health)
                        {
                            cards.Add(CardColor.Red);
                        }
                    }

                    if (!cards.Any())
                    {
                        if (ObjectManager.Player.HealthPercent <=
                            Menu.Item(Menu.Name + ".combo.gold-percent").GetValue <Slider>().Value)
                        {
                            cards.Add(CardColor.Gold);
                        }
                        else if (Player.ManaPercent < 10 || shouldBlue)
                        {
                            cards.Add(CardColor.Blue);
                        }
                        else
                        {
                            var redHits = GetWHits(
                                target, GameObjects.EnemyHeroes.Cast <Obj_AI_Base>().ToList(), CardColor.Red);
                            if (redHits >= Menu.Item(Menu.Name + ".combo.red-min").GetValue <Slider>().Value)
                            {
                                cards.Add(CardColor.Red);
                            }
                        }
                    }
                    if (!cards.Any())
                    {
                        cards.Add(CardColor.Gold);
                    }
                }
                else if (mode == "harass" && !cards.Any())
                {
                    if (selectedCard == CardColor.None && burst)
                    {
                        cards.Add(target.Distance(Player) > W.Range * 0.8f ? CardColor.Gold : CardColor.Blue);
                    }
                    else
                    {
                        var card = !ResourceManager.Check("harass-blue") ? CardColor.Blue : selectedCard;
                        if (card != CardColor.None)
                        {
                            cards.Add(card);
                        }
                    }
                }
                else if (mode == "flee")
                {
                    cards.Add(
                        GetWHits(target, GameObjects.EnemyHeroes.Cast <Obj_AI_Base>().ToList(), CardColor.Red) >= 2
                            ? CardColor.Red
                            : CardColor.Gold);
                }
                if (!cards.Any())
                {
                    cards.Add(CardColor.Gold);
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
            return(cards);
        }
Esempio n. 46
0
        protected override void AddToMenu()
        {
            var comboMenu = Menu.AddSubMenu(new Menu("Combo", Menu.Name + ".combo"));

            HitchanceManager.AddToMenu(
                comboMenu.AddSubMenu(new Menu("Hitchance", comboMenu.Name + ".hitchance")), "combo",
                new Dictionary <string, HitChance> {
                { "Q", HitChance.High }
            });
            comboMenu.AddItem(
                new MenuItem(comboMenu.Name + ".gold-percent", "Pick Gold Health <= %").SetValue(new Slider(20, 5, 75)));
            comboMenu.AddItem(
                new MenuItem(comboMenu.Name + ".red-min", "Pick Red Targets >=").SetValue(new Slider(3, 1, 5)));
            comboMenu.AddItem(new MenuItem(comboMenu.Name + ".q", "Use Q").SetValue(true));
            comboMenu.AddItem(new MenuItem(comboMenu.Name + ".w", "Use W").SetValue(true));

            var harassMenu = Menu.AddSubMenu(new Menu("Harass", Menu.Name + ".harass"));

            HitchanceManager.AddToMenu(
                harassMenu.AddSubMenu(new Menu("Hitchance", harassMenu.Name + ".hitchance")), "harass",
                new Dictionary <string, HitChance> {
                { "Q", HitChance.High }
            });
            ResourceManager.AddToMenu(
                harassMenu,
                new ResourceManagerArgs(
                    "harass", ResourceType.Mana, ResourceValueType.Percent, ResourceCheckType.Minimum)
            {
                DefaultValue = 30
            });
            ResourceManager.AddToMenu(
                harassMenu,
                new ResourceManagerArgs(
                    "harass-blue", ResourceType.Mana, ResourceValueType.Percent, ResourceCheckType.Minimum)
            {
                Prefix       = "W Blue",
                DefaultValue = 50
            });
            harassMenu.AddItem(
                new MenuItem(harassMenu.Name + ".w-card", "Pick Card").SetValue(
                    new StringList(new[] { "Auto", "Gold", "Red", "Blue" }, 3)));
            harassMenu.AddItem(new MenuItem(harassMenu.Name + ".q", "Use Q").SetValue(true));
            harassMenu.AddItem(new MenuItem(harassMenu.Name + ".w", "Use W").SetValue(true));

            var laneclearMenu = Menu.AddSubMenu(new Menu("Lane Clear", Menu.Name + ".lane-clear"));

            ResourceManager.AddToMenu(
                laneclearMenu,
                new ResourceManagerArgs(
                    "lane-clear", ResourceType.Mana, ResourceValueType.Percent, ResourceCheckType.Minimum)
            {
                Advanced    = true,
                LevelRanges = new SortedList <int, int> {
                    { 1, 6 }, { 6, 12 }, { 12, 18 }
                },
                DefaultValues = new List <int> {
                    50, 50, 50
                },
                IgnoreJungleOption = true
            });
            ResourceManager.AddToMenu(
                laneclearMenu,
                new ResourceManagerArgs(
                    "lane-clear-blue", ResourceType.Mana, ResourceValueType.Percent, ResourceCheckType.Minimum)
            {
                Prefix      = "Blue",
                Advanced    = true,
                LevelRanges = new SortedList <int, int> {
                    { 1, 6 }, { 6, 12 }, { 12, 18 }
                },
                DefaultValues = new List <int> {
                    60, 60, 60
                },
                IgnoreJungleOption = true
            });
            laneclearMenu.AddItem(new MenuItem(laneclearMenu.Name + ".q-min", "Q Min.").SetValue(new Slider(4, 1, 5)));
            laneclearMenu.AddItem(new MenuItem(laneclearMenu.Name + ".q", "Use Q").SetValue(true));
            laneclearMenu.AddItem(new MenuItem(laneclearMenu.Name + ".w", "Use W").SetValue(true));

            var fleeMenu = Menu.AddSubMenu(new Menu("Flee", Menu.Name + ".flee"));

            fleeMenu.AddItem(new MenuItem(fleeMenu.Name + ".w", "Use Gold Card").SetValue(true));

            var miscMenu = Menu.AddSubMenu(new Menu("Misc", Menu.Name + ".miscellaneous"));

            var qImmobileMenu = miscMenu.AddSubMenu(new Menu("Q Immobile", miscMenu.Name + "q-immobile"));

            BuffManager.AddToMenu(
                qImmobileMenu, BuffManager.ImmobileBuffs,
                new HeroListManagerArgs("q-immobile")
            {
                IsWhitelist  = false,
                Allies       = false,
                Enemies      = true,
                DefaultValue = false
            }, false);
            BestTargetOnlyManager.AddToMenu(qImmobileMenu, "q-immobile");

            miscMenu.AddItem(
                new MenuItem(miscMenu.Name + ".q-range", "Q Range").SetValue(
                    new Slider((int)Q.Range, 500, (int)Q.Range))).ValueChanged +=
                delegate(object sender, OnValueChangeEventArgs args) { Q.Range = args.GetNewValue <Slider>().Value; };
            miscMenu.AddItem(
                new MenuItem(miscMenu.Name + ".w-range", "Card Pick Distance").SetValue(
                    new Slider((int)W.Range, 500, 800))).ValueChanged +=
                delegate(object sender, OnValueChangeEventArgs args) { W.Range = args.GetNewValue <Slider>().Value; };
            miscMenu.AddItem(
                new MenuItem(miscMenu.Name + ".w-delay", "Card Pick Delay").SetValue(new Slider(150, 0, 400)))
            .ValueChanged +=
                delegate(object sender, OnValueChangeEventArgs args) { Cards.Delay = args.GetNewValue <Slider>().Value; };
            miscMenu.AddItem(
                new MenuItem(miscMenu.Name + ".mode", "W Mode").SetValue(new StringList(new[] { "Burst", "Team" })));
            miscMenu.AddItem(new MenuItem(miscMenu.Name + ".r-card", "Pick Card on R").SetValue(true));

            var manualMenu = Menu.AddSubMenu(new Menu("Manual", Menu.Name + ".manual"));

            manualMenu.AddItem(
                new MenuItem(manualMenu.Name + ".blue", "Hotkey Blue").SetValue(new KeyBind('T', KeyBindType.Press)));
            manualMenu.AddItem(
                new MenuItem(manualMenu.Name + ".red", "Hotkey Red").SetValue(new KeyBind('Y', KeyBindType.Press)));
            manualMenu.AddItem(
                new MenuItem(manualMenu.Name + ".gold", "Hotkey Gold").SetValue(new KeyBind('U', KeyBindType.Press)));

            Q.Range     = Menu.Item(Menu.Name + ".miscellaneous.q-range").GetValue <Slider>().Value;
            W.Range     = Menu.Item(Menu.Name + ".miscellaneous.w-range").GetValue <Slider>().Value;
            Cards.Delay = Menu.Item(Menu.Name + ".miscellaneous.w-delay").GetValue <Slider>().Value;

            IndicatorManager.AddToMenu(DrawingManager.Menu, true);
            IndicatorManager.Add(Q);
            IndicatorManager.Add(
                "W",
                hero =>
                (W.IsReady() || Cards.Status == SelectStatus.Selecting || Cards.Status == SelectStatus.Ready) &&
                Cards.Status != SelectStatus.Selected
                        ? W.GetDamage(hero)
                        : (Cards.Status == SelectStatus.Selected
                            ? (Cards.Has(CardColor.Blue)
                                ? W.GetDamage(hero)
                                : (Cards.Has(CardColor.Red) ? W.GetDamage(hero, 1) : W.GetDamage(hero, 2)))
                            : 0));
            IndicatorManager.Add("E", hero => E.Level > 0 && GetEStacks() >= 2 ? E.GetDamage(hero) : 0);
            IndicatorManager.Finale();

            _eStacks  = DrawingManager.Add("E Stacks", true);
            _rMinimap = DrawingManager.Add("R Minimap", true);
        }
Esempio n. 47
0
 public override IDisposable Foot()
 {
     return(new CaptureScope(_viewPage, s => ResourceManager.RegisterFootScript(s.ToString())));
 }
Esempio n. 48
0
 public virtual void RegisterLink(LinkEntry link)
 {
     ResourceManager.RegisterLink(link);
 }
Esempio n. 49
0
 public virtual void SetMeta(MetaEntry meta)
 {
     ResourceManager.SetMeta(meta);
 }
Esempio n. 50
0
 public virtual void AppendMeta(MetaEntry meta, string contentSeparator)
 {
     ResourceManager.AppendMeta(meta, contentSeparator);
 }
Esempio n. 51
0
        public Int16 GetRedundancyMode()
        {
            Redundancy _redundancy = ResourceManager.GetRedundancy();

            return(Convert.ToInt16(_redundancy.Mode));
        }
Esempio n. 52
0
        public void ToggleRedundancyMode()
        {
            Redundancy _redundancy = ResourceManager.GetRedundancy();

            _redundancy.TogglePartnerMode();
        }
Esempio n. 53
0
        private void ApplyLocalization()
        {
            ResourceManager LocRM = new ResourceManager("Mediachase.UI.Web.App_GlobalResources.Directory.Resources.strPageTitles", typeof(ChangeZone).Assembly);

            pT.Title = LocRM.GetString("tChangeZone");
        }
 public ISymUnmanagedWriter2(Debugger.Interop.CorSym.ISymUnmanagedWriter2 wrappedObject)
 {
     this.wrappedObject = wrappedObject;
     ResourceManager.TrackCOMObject(wrappedObject, typeof(ISymUnmanagedWriter2));
 }
Esempio n. 55
0
 public Player(string name)
 {
     reasourceManager = new ResourceManager();
     color            = new Color(Random.Range(0, 264), Random.Range(0, 264), Random.Range(0, 264));
     this.name        = name;
 }
Esempio n. 56
0
        private void InitializeComponent()
        {
            this.components = new Container();
            ResourceManager manager = new ResourceManager(typeof(sp_ip_detaljiUserControl));

            this.layoutManagerformsp_ip_detalji = new TableLayoutPanel();
            this.layoutManagerformsp_ip_detalji.SuspendLayout();
            this.layoutManagerformsp_ip_detalji.AutoSize     = true;
            this.layoutManagerformsp_ip_detalji.Dock         = DockStyle.Fill;
            this.layoutManagerformsp_ip_detalji.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            this.layoutManagerformsp_ip_detalji.AutoScroll   = false;
            System.Drawing.Point point = new System.Drawing.Point(0, 0);
            this.layoutManagerformsp_ip_detalji.Location = point;
            Size size = new System.Drawing.Size(0, 0);

            this.layoutManagerformsp_ip_detalji.Size        = size;
            this.layoutManagerformsp_ip_detalji.ColumnCount = 2;
            this.layoutManagerformsp_ip_detalji.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
            this.layoutManagerformsp_ip_detalji.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
            this.layoutManagerformsp_ip_detalji.RowCount = 2;
            this.layoutManagerformsp_ip_detalji.RowStyles.Add(new RowStyle());
            this.layoutManagerformsp_ip_detalji.RowStyles.Add(new RowStyle());
            this.label1godina = new UltraLabel();
            this.textgodina   = new UltraTextEditor();
            this.userControlDataGridsp_ip_detalji = new sp_ip_detaljiUserDataGrid();
            this.ultraGridPrintDocument1          = new UltraGridPrintDocument(this.components);
            this.ultraPrintPreviewDialog1         = new UltraPrintPreviewDialog(this.components);
            ((ISupportInitialize)this.textgodina).BeginInit();
            this.SuspendLayout();
            this.label1godina.Name                  = "label1godina";
            this.label1godina.TabIndex              = 1;
            this.label1godina.Tag                   = "labelgodina";
            this.label1godina.AutoSize              = true;
            this.label1godina.StyleSetName          = "FieldUltraLabel";
            this.label1godina.Text                  = "godina         :";
            this.label1godina.Appearance.TextVAlign = VAlign.Middle;
            this.label1godina.Anchor                = AnchorStyles.Left | AnchorStyles.Top;
            this.label1godina.Appearance.ForeColor  = Color.Black;
            this.layoutManagerformsp_ip_detalji.Controls.Add(this.label1godina, 0, 0);
            this.layoutManagerformsp_ip_detalji.SetColumnSpan(this.label1godina, 1);
            this.layoutManagerformsp_ip_detalji.SetRowSpan(this.label1godina, 1);
            Padding padding = new Padding(3, 1, 5, 2);

            this.label1godina.Margin = padding;
            size = new System.Drawing.Size(0, 0);
            this.label1godina.MinimumSize = size;
            point = new System.Drawing.Point(0, 0);
            this.textgodina.Location = point;
            this.textgodina.Name     = "textgodina";
            this.textgodina.Tag      = "godina";
            this.textgodina.TabIndex = 0;
            size = new System.Drawing.Size(0x2c, 0x16);
            this.textgodina.Size      = size;
            this.textgodina.MaxLength = 4;
            this.layoutManagerformsp_ip_detalji.Controls.Add(this.textgodina, 1, 0);
            this.layoutManagerformsp_ip_detalji.SetColumnSpan(this.textgodina, 1);
            this.layoutManagerformsp_ip_detalji.SetRowSpan(this.textgodina, 1);
            padding = new Padding(0, 1, 3, 2);
            this.textgodina.Margin = padding;
            size = new System.Drawing.Size(0x2c, 0x16);
            this.textgodina.MinimumSize = size;
            this.layoutManagerformsp_ip_detalji.Controls.Add(this.userControlDataGridsp_ip_detalji, 0, 1);
            this.layoutManagerformsp_ip_detalji.SetColumnSpan(this.userControlDataGridsp_ip_detalji, 2);
            this.layoutManagerformsp_ip_detalji.SetRowSpan(this.userControlDataGridsp_ip_detalji, 1);
            padding = new Padding(5, 10, 5, 10);
            this.userControlDataGridsp_ip_detalji.Margin = padding;
            size = new System.Drawing.Size(100, 100);
            this.userControlDataGridsp_ip_detalji.MinimumSize = size;
            this.userControlDataGridsp_ip_detalji.Dock        = DockStyle.Fill;
            this.Controls.Add(this.layoutManagerformsp_ip_detalji);
            this.userControlDataGridsp_ip_detalji.Name            = "userControlDataGridsp_ip_detalji";
            this.userControlDataGridsp_ip_detalji.Dock            = DockStyle.Fill;
            this.userControlDataGridsp_ip_detalji.DockPadding.All = 5;
            this.userControlDataGridsp_ip_detalji.FillAtStartup   = false;
            this.userControlDataGridsp_ip_detalji.TabIndex        = 6;
            point = new System.Drawing.Point(0, 0);
            this.userControlDataGridsp_ip_detalji.Location = point;
            size = new System.Drawing.Size(0x285, 350);
            this.userControlDataGridsp_ip_detalji.Size = size;
            this.ultraGridPrintDocument1.Grid          = this.userControlDataGridsp_ip_detalji.DataGrid;
            SizeF ef = new System.Drawing.SizeF(6f, 13f);

            this.AutoScaleDimensions = ef;
            this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
            this.DockPadding.All     = 5;
            this.Name  = "sp_ip_detaljiWorkWith";
            this.Text  = "Work With sp_ip_detalji";
            this.Load += new EventHandler(this.sp_ip_detaljiUserControl_Load);
            this.layoutManagerformsp_ip_detalji.ResumeLayout(false);
            this.layoutManagerformsp_ip_detalji.PerformLayout();
            ((ISupportInitialize)this.textgodina).EndInit();
            this.ResumeLayout(false);
        }
        /// <summary>
        /// Creates dictionary with key value pairs from resources in resourceManager.
        /// </summary>
        /// <param name="culture">The culture.</param>
        /// <param name="resourceManager">The resource manager.</param>
        /// <returns>Dictionary with all resource keys and values</returns>
        private static Dictionary <string, string> CreateDictionaryFromResourceSet(CultureInfo culture, ResourceManager resourceManager)
        {
            var result    = new Dictionary <string, string>();
            var resources = resourceManager.GetResourceSet(culture, true, true).GetEnumerator();

            while (resources.MoveNext())
            {
                if (resources.Key is string && resources.Value is string)
                {
                    result.Add((string)resources.Key, (string)resources.Value);
                }
            }
            return(result);
        }
Esempio n. 58
0
        private static string InternalGetResourceString(string key)
        {
            if (key.Length == 0)
            {
                Debug.Fail("SR::GetResourceString with empty resourceKey.  Bug in caller, or weird recursive loading problem?");
                return key;
            }

            // We have a somewhat common potential for infinite
            // loops with mscorlib's ResourceManager.  If "potentially dangerous"
            // code throws an exception, we will get into an infinite loop
            // inside the ResourceManager and this "potentially dangerous" code.
            // Potentially dangerous code includes the IO package, CultureInfo,
            // parts of the loader, some parts of Reflection, Security (including
            // custom user-written permissions that may parse an XML file at
            // class load time), assembly load event handlers, etc.  Essentially,
            // this is not a bounded set of code, and we need to fix the problem.
            // Fortunately, this is limited to mscorlib's error lookups and is NOT
            // a general problem for all user code using the ResourceManager.

            // The solution is to make sure only one thread at a time can call
            // GetResourceString.  Also, since resource lookups can be
            // reentrant, if the same thread comes into GetResourceString
            // twice looking for the exact same resource name before
            // returning, we're going into an infinite loop and we should
            // return a bogus string.

            bool lockTaken = false;
            try
            {
                Monitor.Enter(_lock, ref lockTaken);

                // Are we recursively looking up the same resource?  Note - our backout code will set
                // the ResourceHelper's currentlyLoading stack to null if an exception occurs.
                if (_currentlyLoading != null && _currentlyLoading.Count > 0 && _currentlyLoading.LastIndexOf(key) != -1)
                {
                    // We can start infinitely recursing for one resource lookup,
                    // then during our failure reporting, start infinitely recursing again.
                    // avoid that.
                    if (_infinitelyRecursingCount > 0)
                    {
                        return key;
                    }
                    _infinitelyRecursingCount++;

                    // Note: our infrastructure for reporting this exception will again cause resource lookup.
                    // This is the most direct way of dealing with that problem.
                    string message = $"Infinite recursion during resource lookup within {System.CoreLib.Name}.  This may be a bug in {System.CoreLib.Name}, or potentially in certain extensibility points such as assembly resolve events or CultureInfo names.  Resource name: {key}";
                    Environment.FailFast(message);
                }

                _currentlyLoading ??= new List<string>();

                // Call class constructors preemptively, so that we cannot get into an infinite
                // loop constructing a TypeInitializationException.  If this were omitted,
                // we could get the Infinite recursion assert above by failing type initialization
                // between the Push and Pop calls below.
                if (!_resourceManagerInited)
                {
                    RuntimeHelpers.RunClassConstructor(typeof(ResourceManager).TypeHandle);
                    RuntimeHelpers.RunClassConstructor(typeof(ResourceReader).TypeHandle);
                    RuntimeHelpers.RunClassConstructor(typeof(RuntimeResourceSet).TypeHandle);
                    RuntimeHelpers.RunClassConstructor(typeof(BinaryReader).TypeHandle);
                    _resourceManagerInited = true;
                }

                _currentlyLoading.Add(key); // Push

                string? s = ResourceManager.GetString(key, null);
                _currentlyLoading.RemoveAt(_currentlyLoading.Count - 1); // Pop

                Debug.Assert(s != null, "Managed resource string lookup failed.  Was your resource name misspelled?  Did you rebuild mscorlib after adding a resource to resources.txt?  Debug this w/ cordbg and bug whoever owns the code that called SR.GetResourceString.  Resource name was: \"" + key + "\"");
                return s ?? key;
            }
            catch
            {
                if (lockTaken)
                {
                    // Backout code - throw away potentially corrupt state
                    s_resourceManager = null;
                    _currentlyLoading = null;
                }
                throw;
            }
            finally
            {
                if (lockTaken)
                {
                    Monitor.Exit(_lock);
                }
            }
        }
Esempio n. 59
0
 internal SR()
 {
     resources = new System.Resources.ResourceManager("LogicBuilder.Workflow.Activities.StringResources", Assembly.GetExecutingAssembly());
 }
Esempio n. 60
0
 /// <summary>
 /// public constructor
 /// </summary>
 public TaskLoggingHelperExtension(ITask taskInstance, ResourceManager primaryResources, ResourceManager sharedResources, string helpKeywordPrefix) :
     base(taskInstance)
 {
     this.TaskResources       = primaryResources;
     this.TaskSharedResources = sharedResources;
     this.HelpKeywordPrefix   = helpKeywordPrefix;
 }