This class contains methods that generate text files containing string resources so the user can manually perform the operations of running the ResGen tool to build a .resources file and then running the assembly linker to build the .resource files into satellite assemblies.
예제 #1
0
        public static String GetTextByName(CacheType type, string name, GenerateText callback)
        {
            if (String.IsNullOrEmpty(name))
            {
                return(callback());
            }
            if (HttpRuntime.Cache == null)
            {
                return(callback());
            }

            var cacheKey      = type + "-" + name;
            var cachedVersion = HttpRuntime.Cache[cacheKey] as String;

            if (cachedVersion == null)
            {
                if (!Cachelock.ContainsKey(cacheKey))
                {
                    Cachelock.Add(cacheKey, new Object());
                }

                lock (Cachelock[cacheKey])
                {
                    cachedVersion = callback();
                    CacheObject(type, cacheKey, cachedVersion);
                }
            }

            return(cachedVersion);
        }
    /// <summary>
    /// Entry point for sample application.
    /// The Main method gets the current command-line options by calling GetArgs().
    /// It then uses the current options to determine which method to call.
    /// </summary>
    /// <param name="args"></param>
    public static void Main(string [] args)
    {
        //Get arguments.
        Options currentOptions = GetArgs(args);

        //Execute relevant portion of program depending on arguments.
        switch (currentOptions)
        {
        case Options.GenerateResourceFiles:
            GenerateResources gr = new GenerateResources();
            gr.ResourceFileUsage();
            gr.GenerateResourceFiles();
            gr.BuildSatelliteAssemblies();
            return;

        case Options.GenerateTextFiles:
            GenerateText g = new GenerateText();
            g.TextFileUsage();
            g.GenerateTextFiles();
            return;

        case Options.UseResources:
            UseResources u = new UseResources();
            u.Run();
            return;

        case Options.Help:
            Usage();
            return;

        case Options.None:
            goto case Options.Help;

        case Options.Invalid: //Prompt for
            Console.WriteLine("Invalid option, please try again.");
            Usage();
            break;

        default:
            //Should not get here.
            Console.WriteLine("Invalid option in Main()");
            return;
        } //switch
    }     //Main()
예제 #3
0
  /// <summary>
  /// Entry point for sample application.
  /// The Main method gets the current command-line options by calling GetArgs().
  /// It then uses the current options to determine which method to call.
  /// </summary>
  /// <param name="args"></param>
  public static void Main(string [] args) 
  {
    //Get arguments.
    Options currentOptions = GetArgs(args);
    //Execute relevant portion of program depending on arguments.
    switch (currentOptions)
    {
      case Options.GenerateResourceFiles:
        GenerateResources gr = new GenerateResources();
        gr.ResourceFileUsage();
        gr.GenerateResourceFiles();
        gr.BuildSatelliteAssemblies();
        return;

      case Options.GenerateTextFiles:
        GenerateText g = new GenerateText();
        g.TextFileUsage();
        g.GenerateTextFiles();
        return;

      case Options.UseResources:
        UseResources u = new UseResources();
        u.Run();
        return;

      case Options.Help:
        Usage();
        return;

      case Options.None:
        goto case Options.Help;

      case Options.Invalid:  //Prompt for 
        Console.WriteLine("Invalid option, please try again.");
        Usage();
        break;

      default:
        //Should not get here.
        Console.WriteLine("Invalid option in Main()");
        return;
    }//switch
  }//Main()
예제 #4
0
 public static String GetText(CacheType type, int cacheKey, GenerateText callback)
 {
     return(GetTextByName(type, cacheKey.ToString(CultureInfo.InvariantCulture), callback));
 }