1 °³¿ä
VisualCpp ÇÁ·ÎÁ§Æ® ÆÄÀÏ ÀÚµ¿ »ý¼ºÀ» À§ÇÑ À¯Æ¿¸®Æ¼. ±âº» ¼³Á¤ ÆÄÀÏ ¾ÈÀÇ ³»¿ëÀ» Àоî¿Í¼ Àû´çÈ÷ ¹®ÀÚ¿ ġȯÇÑ ´ÙÀ½, ÀúÀåÇØÁÖ´Â °Í »ÓÀÌ´Ù. FxRuby¿Í
GuidGenConsole ÇÁ·Î±×·¥À» ÀÌ¿ëÇß´Ù.
óÀ½¿¡´Â VisualCpp Wizard¸¦ ÀÌ¿ëÇØ ¾îÂî¾îÂîÇØº¸·Á Çߴµ¥, C#À̳ª VB¿Í´Â ´Þ¸® VisualCpp Wizard´Â ²Ï º¹ÀâÇØ¼ Æ÷±âÇß´Ù. SxS ¾î¼Àºí¸®µµ ¼·¯¿îµ¥, ÀÌ·± °Í±îÁö Â÷º°ÇÏ´Ù´Ï, Cpp´Â ÀÌÁ¦ »ç¾ç±æÀ̶õ ¸»Àΰ¡...
GUID »ý¼º ºÎºÐÀº À©µµ¿ìÁî ½ºÅ©¸³Æ®¸¦ ÀÌ¿ëÇØ¼ ó¸®ÇÒ ¼öµµ ÀÖ´Ù. ¾Æ·¡¿Í °°Àº ½ºÅ©¸³Æ®¸¦ ÀÌ¿ëÇÏ¸é µÈ´Ù.
Set TypeLib = CreateObject("Scriptlet.TypeLib")
Wscript.Echo TypeLib.Guid
2 ´Ù¿î·Îµå
3 ¼Ò½º
´Ù¿î·Îµåº» ¾È¿¡ ¼Ò½º ÆÄÀÏÀÌ ÀÖ±â´Â ÇÏ´Ù¸¸...
require 'fox16'
require 'fox16/kwargs'
require 'FileUtils'
require 'YAML'
include Fox
include Responder
# ÆÄÀÏ ³»¿¡¼ ¹®ÀÚ¿µéÀ» ġȯÇÑ´Ù.
def replace_text_in_file(source_name, dest_name, patterns)
source_lines = IO.readlines(source_name)
for line in source_lines
for from, to in patterns
line.gsub!(from, to)
end
end
dest = File.open(dest_name, "w")
for line in source_lines
dest.write(line)
end
end
# GUID »ý¼º
def generate_guid()
guid = ""
system("GuidGenConsole.exe > guid.txt")
guid = (IO.readlines("guid.txt"))[0]
File.unlink("guid.txt")
return guid.strip().upcase()
end
class MainWindow < FXMainWindow
ID_GENERATE = FXMainWindow::ID_LAST
ID_CLOSE = ID_GENERATE + 1
TEMPLATE_PATH = "__TEMPLATE__"
OUTPUT_PATH = "__OUTPUT__"
def initialize(app)
super(app, "Visual C++ 2005 Project Maker", :opts => DECOR_ALL)
@config = YAML.load(File.open(File.join(TEMPLATE_PATH, "config.yaml")))
@project_types = []
for name, value in @config
@project_types.push(name)
end
# ÇÁ·ÎÁ§Æ® À̸§
name_group = FXGroupBox.new(
self, "Project Name",
:opts => LAYOUT_SIDE_TOP | FRAME_GROOVE | LAYOUT_FILL_X
)
@project_name = FXTextField.new(name_group, 80)
# ÇÁ·ÎÁ§Æ® ŸÀÔ
@selected_project_type = FXDataTarget.new(0)
type_group = FXGroupBox.new(
self, "Project Type",
:opts => LAYOUT_SIDE_TOP | FRAME_GROOVE | LAYOUT_FILL_X
)
@project_types.each_with_index do |name, index|
button = FXRadioButton.new(
type_group, name, @selected_project_type,
FXDataTarget::ID_OPTION + index,
:opts => ICON_BEFORE_TEXT | LAYOUT_SIDE_TOP
)
end
@selected_project_type.connect(SEL_COMMAND, method(:on_project_type_change))
# ¿É¼Ç ±×·ì UI ÃʱâÈ
option_group = FXGroupBox.new(
self, "Options",
:opts => LAYOUT_SIDE_TOP | FRAME_GROOVE | LAYOUT_FILL_X
)
FXLabel.new(option_group, "&Output Path")
@output_path = FXTextField.new(option_group, 80)
@output_path.text = @config[@project_types[0]]["OutputPath"]
FXLabel.new(option_group, "&Intermediate Path")
@intermediate_path = FXTextField.new(option_group, 80)
@intermediate_path.text = @config[@project_types[0]]["IntermediatePath"]
FXLabel.new(option_group, "I&nclude Path")
@include_path = FXTextField.new(option_group, 80)
@include_path.text = @config[@project_types[0]]["IncludePath"]
FXLabel.new(option_group, "Output &File")
@output_file = FXTextField.new(option_group, 80)
@output_file.text = @config[@project_types[0]]["OutputFile"]
# ¹öư ±×·ì UI ÃʱâÈ
button_group = FXGroupBox.new(
self, "Actions",
:opts => LAYOUT_SIDE_RIGHT | FRAME_GROOVE | LAYOUT_FILL_X | LAYOUT_FILL_Y
)
@generate_button = FXButton.new(button_group, "&Generate", :opts => LAYOUT_SIDE_LEFT)
@generate_button.connect(SEL_COMMAND, method(:on_generate_button_click))
@close_button = FXButton.new(button_group, "&Close", :opts => LAYOUT_SIDE_LEFT)
@close_button.connect(SEL_COMMAND, method(:on_close_button_click))
# ´ÜÃàŰ ÃʱâÈ
FXMAPFUNC(SEL_COMMAND, MainWindow::ID_GENERATE, 'on_generate_button_click')
accelTable.addAccel(fxparseAccel("F5"), self, FXSEL(SEL_COMMAND, MainWindow::ID_GENERATE))
FXMAPFUNC(SEL_COMMAND, MainWindow::ID_CLOSE, 'on_close_button_click')
accelTable.addAccel(fxparseAccel("ESC"), self, FXSEL(SEL_COMMAND, MainWindow::ID_CLOSE))
# Æ÷Ä¿½º À̵¿
@project_name.setFocus()
end
def on_project_type_change(sender, sel, ptr)
index = @selected_project_type.to_s.to_i
@output_path.text = @config[@project_types[index]]["OutputPath"]
@intermediate_path.text = @config[@project_types[index]]["IntermediatePath"]
@include_path.text = @config[@project_types[index]]["IncludePath"]
@output_file.text = @config[@project_types[index]]["OutputFile"]
end
def on_generate_button_click(sender, sel, ptr)
project_name = @project_name.text.strip()
if project_name.length == 0 then
FXMessageBox.error(self, MBOX_OK, "Error", "Project Name Required")
return
end
source_dir = File.join(TEMPLATE_PATH, @project_types[@selected_project_type.to_s.to_i])
dest_dir = File.join(OUTPUT_PATH, project_name)
begin
FileUtils.mkdir(dest_dir)
rescue
end
files =
{
File.join(source_dir, "Project.vcproj") =>
File.join(dest_dir, project_name + ".vcproj"),
File.join(source_dir, "PCH.h") =>
File.join(dest_dir, project_name + "PCH.h"),
File.join(source_dir, "PCH.cpp") =>
File.join(dest_dir, project_name + "PCH.cpp")
}
patterns =
{
"#PROJECTNAME#" => project_name,
"#OUTDIR#" => @output_path.text,
"#INTDIR#" => @intermediate_path.text,
"#INCLUDEDIR#" => @include_path.text,
"#OUTFILE#" => @output_file.text,
"#GUID#" => generate_guid()
}
for from, to in files
begin
FileUtils.cp(from, to)
replace_text_in_file(to, to, patterns)
rescue
end
end
close
end
def on_close_button_click(sender, sel, ptr)
close
end
end
application = FXApp.new
main_window = MainWindow.new(application)
application.create
main_window.show(PLACEMENT_SCREEN)
application.run
SeriousMoin v1 (koMoinMoin 1.0a4 Modified)